From a8805a65aab9109b915364fccf36c8328f636e48 Mon Sep 17 00:00:00 2001 From: Caoruihong Date: Tue, 13 Jul 2021 23:57:39 +0800 Subject: [PATCH] feat: add support for gn build system add BUILD.gn for all kernel modules Signed-off-by: Caoruihong Change-Id: I018446427bf64615f2596d47862b219659b58b34 --- BUILD.gn | 321 ++++++++++++++++-- Kconfig | 13 +- Makefile | 18 +- apps/BUILD.gn | 50 +++ apps/init/BUILD.gn | 53 +++ apps/mksh/BUILD.gn | 40 +++ apps/shell/BUILD.gn | 58 ++++ apps/tftp/BUILD.gn | 55 +++ apps/toybox/BUILD.gn | 40 +++ arch/BUILD.gn | 44 +++ arch/arm/BUILD.gn | 47 +++ arch/arm/arm/BUILD.gn | 82 +++++ arch/arm/gic/BUILD.gn | 41 +++ bsd/BUILD.gn | 86 +++++ bsd/Kconfig | 8 + bsd/compat/linuxkpi/BUILD.gn | 57 ++++ bsd/dev/usb/BUILD.gn | 154 +++++++++ compat/BUILD.gn | 38 +++ compat/posix/BUILD.gn | 55 +++ drivers/BUILD.gn | 70 ++++ drivers/block/disk/BUILD.gn | 45 +++ drivers/char/bch/BUILD.gn | 52 +++ drivers/char/mem/BUILD.gn | 42 +++ drivers/char/quickstart/BUILD.gn | 42 +++ drivers/char/random/BUILD.gn | 46 +++ drivers/char/video/BUILD.gn | 42 +++ drivers/mtd/multi_partition/BUILD.gn | 54 +++ fs/BUILD.gn | 56 +++ fs/fat/BUILD.gn | 55 +++ fs/fat/virpart/BUILD.gn | 47 +++ fs/jffs2/BUILD.gn | 75 ++++ fs/nfs/BUILD.gn | 40 +++ fs/proc/BUILD.gn | 32 +- fs/ramfs/BUILD.gn | 36 ++ fs/romfs/BUILD.gn | 39 +++ fs/vfs/BUILD.gn | 116 +++++++ fs/vfs/bcache/BUILD.gn | 42 +++ fs/zpfs/BUILD.gn | 13 +- kernel/BUILD.gn | 38 +-- kernel/base/BUILD.gn | 54 +-- kernel/base/misc/panic_shellcmd.c | 2 +- kernel/common/BUILD.gn | 48 +++ kernel/common/blackbox/BUILD.gn | 47 +++ kernel/common/hidumper/BUILD.gn | 41 +++ kernel/common/patchfs/BUILD.gn | 44 +++ kernel/common/rootfs/BUILD.gn | 44 +++ kernel/common/{ => rootfs}/Kconfig | 0 kernel/common/{ => rootfs}/Makefile | 0 kernel/common/{ => rootfs}/los_bootargs.c | 0 kernel/common/{ => rootfs}/los_bootargs.h | 0 kernel/common/{ => rootfs}/los_rootfs.c | 0 kernel/common/{ => rootfs}/los_rootfs.h | 0 kernel/extended/BUILD.gn | 56 +++ kernel/extended/cppsupport/BUILD.gn | 36 ++ kernel/extended/cpup/BUILD.gn | 45 +++ .../extended/{include => cpup}/los_cpup_pri.h | 0 kernel/extended/dynload/BUILD.gn | 45 +++ kernel/extended/hilog/BUILD.gn | 45 +++ kernel/extended/liteipc/BUILD.gn | 41 +++ kernel/extended/power/BUILD.gn | 36 ++ kernel/extended/trace/BUILD.gn | 45 +++ .../{include => trace}/los_trace_pri.h | 0 kernel/extended/vdso/BUILD.gn | 53 +++ kernel/extended/vdso/src/Makefile | 2 +- kernel/extended/vdso/src/los_vdso_text.S | 2 +- kernel/extended/vdso/usr/BUILD.gn | 54 +++ kernel/extended/vdso/usr/Makefile | 2 +- kernel/user/BUILD.gn | 57 ++++ lib/BUILD.gn | 50 +++ lib/libc/BUILD.gn | 92 +++++ lib/libmbedtls/BUILD.gn | 122 +++++++ lib/libscrew/BUILD.gn | 46 +++ lib/libsec/BUILD.gn | 83 +++++ lib/zlib/BUILD.gn | 62 ++++ liteos.gni | 63 ++++ net/BUILD.gn | 44 +++ net/lwip-2.1/BUILD.gn | 63 ++++ net/lwip-2.1/lwip_porting.gni | 40 +++ net/telnet/BUILD.gn | 45 +++ platform/BUILD.gn | 101 ++++++ platform/Makefile | 7 +- platform/bsp.mk | 3 +- {kernel/common => platform}/console.c | 0 {kernel/common => platform}/console.h | 0 {kernel/common => platform}/hwi_shell.c | 0 {kernel/common => platform}/los_builddef.h | 0 {kernel/common => platform}/los_cir_buf.c | 0 {kernel/common => platform}/los_cir_buf_pri.h | 0 {kernel/common => platform}/los_config.c | 0 {kernel/common => platform}/los_config.h | 2 +- {kernel/common => platform}/los_excinfo.c | 0 {kernel/common => platform}/los_excinfo_pri.h | 0 {kernel/common => platform}/los_hilog.c | 0 {kernel/common => platform}/los_hilog.h | 0 {kernel/common => platform}/los_init.c | 0 {kernel/common => platform}/los_init.h | 0 {kernel/common => platform}/los_init_info.h | 0 {kernel/common => platform}/los_init_pri.h | 0 {kernel/common => platform}/los_magickey.c | 0 {kernel/common => platform}/los_magickey.h | 0 {kernel/common => platform}/los_printf.c | 0 {kernel/common => platform}/los_seq_buf.c | 0 {kernel/common => platform}/los_seq_buf.h | 0 {kernel/common => platform}/los_timer_pri.h | 0 {kernel/common => platform}/sys_config.h | 0 {kernel/common => platform}/virtual_serial.c | 0 {kernel/common => platform}/virtual_serial.h | 0 security/BUILD.gn | 44 +++ security/cap/BUILD.gn | 41 +++ security/vid/BUILD.gn | 41 +++ shell/BUILD.gn | 31 +- syscall/BUILD.gn | 46 +++ testsuites/BUILD.gn | 37 ++ tools/build/mk/los_config.mk | 12 +- 114 files changed, 3992 insertions(+), 124 deletions(-) create mode 100644 apps/BUILD.gn create mode 100644 apps/init/BUILD.gn create mode 100644 apps/mksh/BUILD.gn create mode 100644 apps/shell/BUILD.gn create mode 100644 apps/tftp/BUILD.gn create mode 100644 apps/toybox/BUILD.gn create mode 100644 arch/BUILD.gn create mode 100644 arch/arm/BUILD.gn create mode 100644 arch/arm/arm/BUILD.gn create mode 100644 arch/arm/gic/BUILD.gn create mode 100644 bsd/BUILD.gn create mode 100644 bsd/compat/linuxkpi/BUILD.gn create mode 100644 bsd/dev/usb/BUILD.gn create mode 100644 compat/BUILD.gn create mode 100644 compat/posix/BUILD.gn create mode 100644 drivers/BUILD.gn create mode 100644 drivers/block/disk/BUILD.gn create mode 100644 drivers/char/bch/BUILD.gn create mode 100644 drivers/char/mem/BUILD.gn create mode 100644 drivers/char/quickstart/BUILD.gn create mode 100644 drivers/char/random/BUILD.gn create mode 100644 drivers/char/video/BUILD.gn create mode 100644 drivers/mtd/multi_partition/BUILD.gn create mode 100644 fs/BUILD.gn create mode 100644 fs/fat/BUILD.gn create mode 100644 fs/fat/virpart/BUILD.gn create mode 100644 fs/jffs2/BUILD.gn create mode 100644 fs/nfs/BUILD.gn create mode 100644 fs/ramfs/BUILD.gn create mode 100644 fs/romfs/BUILD.gn create mode 100644 fs/vfs/BUILD.gn create mode 100644 fs/vfs/bcache/BUILD.gn create mode 100644 kernel/common/BUILD.gn create mode 100644 kernel/common/blackbox/BUILD.gn create mode 100644 kernel/common/hidumper/BUILD.gn create mode 100644 kernel/common/patchfs/BUILD.gn create mode 100644 kernel/common/rootfs/BUILD.gn rename kernel/common/{ => rootfs}/Kconfig (100%) rename kernel/common/{ => rootfs}/Makefile (100%) rename kernel/common/{ => rootfs}/los_bootargs.c (100%) rename kernel/common/{ => rootfs}/los_bootargs.h (100%) rename kernel/common/{ => rootfs}/los_rootfs.c (100%) rename kernel/common/{ => rootfs}/los_rootfs.h (100%) create mode 100644 kernel/extended/BUILD.gn create mode 100644 kernel/extended/cppsupport/BUILD.gn create mode 100644 kernel/extended/cpup/BUILD.gn rename kernel/extended/{include => cpup}/los_cpup_pri.h (100%) create mode 100644 kernel/extended/dynload/BUILD.gn create mode 100644 kernel/extended/hilog/BUILD.gn create mode 100644 kernel/extended/liteipc/BUILD.gn create mode 100644 kernel/extended/power/BUILD.gn create mode 100644 kernel/extended/trace/BUILD.gn rename kernel/extended/{include => trace}/los_trace_pri.h (100%) create mode 100644 kernel/extended/vdso/BUILD.gn create mode 100644 kernel/extended/vdso/usr/BUILD.gn create mode 100644 kernel/user/BUILD.gn create mode 100644 lib/BUILD.gn create mode 100644 lib/libc/BUILD.gn create mode 100644 lib/libmbedtls/BUILD.gn create mode 100644 lib/libscrew/BUILD.gn create mode 100644 lib/libsec/BUILD.gn create mode 100644 lib/zlib/BUILD.gn create mode 100644 liteos.gni create mode 100644 net/BUILD.gn create mode 100644 net/lwip-2.1/BUILD.gn create mode 100644 net/lwip-2.1/lwip_porting.gni create mode 100644 net/telnet/BUILD.gn create mode 100644 platform/BUILD.gn rename {kernel/common => platform}/console.c (100%) rename {kernel/common => platform}/console.h (100%) rename {kernel/common => platform}/hwi_shell.c (100%) rename {kernel/common => platform}/los_builddef.h (100%) rename {kernel/common => platform}/los_cir_buf.c (100%) rename {kernel/common => platform}/los_cir_buf_pri.h (100%) rename {kernel/common => platform}/los_config.c (100%) rename {kernel/common => platform}/los_config.h (99%) rename {kernel/common => platform}/los_excinfo.c (100%) rename {kernel/common => platform}/los_excinfo_pri.h (100%) rename {kernel/common => platform}/los_hilog.c (100%) rename {kernel/common => platform}/los_hilog.h (100%) rename {kernel/common => platform}/los_init.c (100%) rename {kernel/common => platform}/los_init.h (100%) rename {kernel/common => platform}/los_init_info.h (100%) rename {kernel/common => platform}/los_init_pri.h (100%) rename {kernel/common => platform}/los_magickey.c (100%) rename {kernel/common => platform}/los_magickey.h (100%) rename {kernel/common => platform}/los_printf.c (100%) rename {kernel/common => platform}/los_seq_buf.c (100%) rename {kernel/common => platform}/los_seq_buf.h (100%) rename {kernel/common => platform}/los_timer_pri.h (100%) rename {kernel/common => platform}/sys_config.h (100%) rename {kernel/common => platform}/virtual_serial.c (100%) rename {kernel/common => platform}/virtual_serial.h (100%) create mode 100644 security/BUILD.gn create mode 100644 security/cap/BUILD.gn create mode 100644 security/vid/BUILD.gn create mode 100644 syscall/BUILD.gn create mode 100644 testsuites/BUILD.gn diff --git a/BUILD.gn b/BUILD.gn index df7704a6..93965953 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -28,47 +28,308 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import("//build/lite/config/component/lite_component.gni") -import("//build/lite/config/subsystem/lite_subsystem.gni") + +declare_args() { + tee_enable = false +} + +LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h") + +tee = "" +if (tee_enable) { + tee = "_tee" +} + +productName = get_path_info(product_path, "file") +config_file = "${productName}_release.config" +if (ohos_build_compiler == "clang") { + if (ohos_build_type == "debug") { + config_file = "debug/${productName}_${ohos_build_compiler}${tee}.config" + } else { + config_file = "${productName}_${ohos_build_compiler}_release${tee}.config" + } +} else if (ohos_build_compiler == "gcc") { + if (ohos_build_type == "debug") { + config_file = "${productName}_debug_shell${tee}.config" + } else { + config_file = "${productName}_release${tee}.config" + } +} + +liteos_config_file = rebase_path("tools/build/config/$config_file") + +# we prefer use product specified config file +f = "$product_path/config/${ohos_build_type}${tee}.config" +if (exec_script("//build/lite/run_shell_cmd.py", [ "if [ -f $f ]; then echo true; else echo false; fi" ], "value")) { + liteos_config_file = f +} + +print("liteos_config_file:", liteos_config_file) + +exec_script("//build/lite/run_shell_cmd.py", [ "which genconfig || pip install --user kconfiglib" ]) + +exec_script("//build/lite/run_shell_cmd.py", + [ + "env" + + " CONFIG_=LOSCFG_" + + " KCONFIG_CONFIG_HEADER='y=true'" + + " KCONFIG_CONFIG=$liteos_config_file" + + " DEVICE_PATH=$device_path" + + " srctree=" + rebase_path(".") + + " genconfig" + + " --header-path $LITEOS_MENUCONFIG_H" + + " --file-list kconfig_files.txt" + + " --env-list kconfig_env.txt" + + " --config-out config.gni", + ]) + +import("liteos.gni") generate_notice_file("kernel_notice_file") { module_name = "kernel" module_source_dir_list = [ - "//third_party/FreeBSD", - "//third_party/musl", - "//third_party/zlib", - "//third_party/FatFs", - "//third_party/Linux_Kernel", - "//third_party/lwip", - "//third_party/NuttX", - "//third_party/mtd-utils", + "$LITEOSTHIRDPARTY/FreeBSD", + "$LITEOSTHIRDPARTY/musl", + "$LITEOSTHIRDPARTY/zlib", + "$LITEOSTHIRDPARTY/FatFs", + "$LITEOSTHIRDPARTY/Linux_Kernel", + "$LITEOSTHIRDPARTY/lwip", + "$LITEOSTHIRDPARTY/NuttX", + "$LITEOSTHIRDPARTY/mtd-utils", ] } -declare_args() { - enable_ohos_kernel_liteos_a_ext_build = true - LOSCFG_TEST_APPS = false - tee_enable = "" -} - -lite_subsystem("kernel") { - subsystem_components = [] - - if (enable_ohos_kernel_liteos_a_ext_build == false) { - subsystem_components += [ - "//kernel/liteos_a/kernel", - "//kernel/liteos_a/net", - "//kernel/liteos_a/lib", - "//kernel/liteos_a/compat", - "//kernel/liteos_a/fs", - "//kernel/liteos_a/arch:platform_cpu", +liteos_arch_cflags = [] +if (defined(LOSCFG_ARCH_ARM)) { + mcpu = LOSCFG_ARCH_CPU + if (defined(LOSCFG_ARCH_ARM_AARCH64) && defined(LOSCFG_ARCH_FPU_DISABLE)) { + mcpu += "+nofp" + } + liteos_arch_cflags += [ "-mcpu=$mcpu" ] + if (defined(LOSCFG_ARCH_ARM_AARCH32)) { + liteos_arch_cflags += [ + "-mfloat-abi=softfp", + "-mfpu=$LOSCFG_ARCH_FPU", + ] + } +} + +cc = "$ohos_current_cc_command " + string_join(" ", liteos_arch_cflags) +if (ohos_build_compiler == "clang") { + cc += " --target=$target_triple" +} + +config("arch_config") { + cflags = liteos_arch_cflags + asmflags = cflags + ldflags = cflags +} + +config("as_objs_libc_flags") { + defines = [ "__ASSEMBLY__" ] + + # linux style macros + if (defined(LOSCFG_ARCH_ARM_V7A) || defined(LOSCFG_ARCH_ARM_V7R) || + defined(LOSCFG_ARCH_ARM_V7M)) { + defines += [ "__LINUX_ARM_ARCH__=7" ] + } else if (defined(LOSCFG_ARCH_ARM_V8A) || defined(LOSCFG_ARCH_ARM_V8R) || + defined(LOSCFG_ARCH_ARM_V8M)) { + defines += [ "__LINUX_ARM_ARCH__=8" ] + } +} + +config("std_include") { + std_include = exec_script("//build/lite/run_shell_cmd.py", [ "$cc -print-file-name=include" ], "trim string") + include_dirs = [ std_include ] +} + +config("public") { + configs = [ + "arch:public", + "platform:public", + "kernel:public", + "compat:public", + "bsd:public", + "fs:public", + "drivers:public", + "security:public", + "net:public", + "shell:public", + "lib:public", + ":std_include", + ] +} + +config("los_config") { + cflags = [ + "-imacros", + "$LITEOS_MENUCONFIG_H", + ] + + defines = [ "__LITEOS__" ] + + configs = [ ":arch_config" ] + + ldflags = [ "-nostdlib" ] + + cflags_c = [ "-std=c99" ] + + cflags += [ + "-fno-pic", + "-fno-builtin", + "-nostdinc", + "-Wall", + "-Werror", + "-fms-extensions", + "-Wno-address-of-packed-member", + "-fno-strict-aliasing", + "-fno-common", + "-fsigned-char", + "-Wpointer-arith", + "-Wstrict-prototypes", + "-Winvalid-pch", + "-ffunction-sections", + "-fdata-sections", + "-fno-exceptions", + "-fno-omit-frame-pointer", + "-fno-short-enums", + ] + + if (defined(LOSCFG_QUICK_START)) { + cflags -= [ "-Werror" ] + } + + if (defined(LOSCFG_COMPILE_DEBUG)) { + cflags += [ + "-O0", + "-g", + "-gdwarf-2", ] - if (LOSCFG_SHELL) { - subsystem_components += [ "//kernel/liteos_a/shell" ] + } else { + if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { + cflags += [ + "-Oz", + "-flto", + ] + } else { + cflags += [ "-O2" ] } + } + + if (defined(LOSCFG_CC_STACKPROTECTOR_ALL)) { + cflags += [ "-fstack-protector-all" ] + } else if (defined(LOSCFG_CC_STACKPROTECTOR_STRONG)) { + cflags += [ "-fstack-protector-strong" ] + } else if (defined(LOSCFG_CC_STACKPROTECTOR)) { + cflags += [ + "-fstack-protector", + "--param", + "ssp-buffer-size=4", + ] } else { - deps = [ ":make" ] - deps += [ "//kernel/liteos_a/testsuites/unittest:unittest" ] + cflags += [ "-fno-stack-protector" ] + } + + if (!defined(LOSCFG_COMPILER_CLANG_LLVM)) { + cflags += [ "-fno-aggressive-loop-optimizations" ] + if (!defined(LOSCFG_ARCH_ARM_AARCH64)) { + cflags += [ + "-mno-unaligned-access", + "-mthumb-interwork", + ] + } + } + + if (defined(LOSCFG_THUMB)) { + cflags += [ + "-mthumb", + "-Wa,-mimplicit-it=thumb", + ] } + + asmflags = cflags +} + +liteos_name = "liteos2" +liteos_out = rebase_path("$target_out_dir/$liteos_name") +executable(liteos_name) { + configs = [] # clear default configs + configs += [ ":los_config" ] + + ldflags = [ + "-static", + "-Wl,--gc-sections", + "-Wl,-Map=" + rebase_path("$liteos_out.map"), + "-Wl,--no-eh-frame-hdr", + "-Wl,--whole-archive", + ] + + libgcc = exec_script("//build/lite/run_shell_cmd.py", [ "$cc -print-libgcc-file-name" ], "trim string") + libs = [ libgcc ] + if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { + libs += [ "tools/build/liteos_llvm.ld" ] + } else { + libs += [ "tools/build/liteos.ld" ] + ldflags += [ "-nostartfiles" ] + } + + deps = [ + ":modules", + ] +} + +build_ext_component("build_liteos_bin") { + deps = [ ":$liteos_name" ] + exec_path = rebase_path(target_out_dir) + + objcopy = "${compile_prefix}objcopy$toolchain_cmd_suffix" + objdump = "${compile_prefix}objdump$toolchain_cmd_suffix" + + liteos = rebase_path("$root_out_dir/unstripped/bin/$liteos_name") + + command = "$objcopy -O binary $liteos $liteos_out.bin" + command += " && sh -c '$objdump -t $liteos | sort >$liteos_out.sym.sorted'" + command += " && sh -c '$objdump -d $liteos >$liteos_out.asm'" +} + +group("modules") { + deps = [ + "arch", + "bsd", + "compat", + "drivers", + "fs", + "kernel", + "lib", + "net", + "platform", + "security", + "shell", + "syscall", + ] +} + +group("apps") { + deps = [ "apps" ] +} + +group("tests") { + deps = [ "testsuites" ] +} + +group("kernel") { + deps = [ + ":make", + ":tests", + ] +} + +group("liteos_a") { + deps = [ + ":apps", + ":kernel", + ":tests", + ] } build_ext_component("make") { diff --git a/Kconfig b/Kconfig index 1b3a174e..8b8704e8 100644 --- a/Kconfig +++ b/Kconfig @@ -58,7 +58,7 @@ source "platform/Kconfig" source "arch/Kconfig" ######################### config options of rootfs ##################### -source "kernel/common/Kconfig" +source "kernel/common/rootfs/Kconfig" ######################### config options of patchfs ##################### source "kernel/common/patchfs/Kconfig" ######################### config options of blackbox ##################### @@ -93,6 +93,7 @@ source "fs/romfs/Kconfig" source "fs/nfs/Kconfig" source "fs/proc/Kconfig" source "fs/jffs2/Kconfig" +source "fs/zpfs/Kconfig" config ENABLE_READ_BUFFER bool "Enable read buffer Option" default n @@ -163,9 +164,16 @@ config ENABLE_MAGICKEY config THUMB bool "Enable Thumb" default n + select INTERWORK_THUMB help Answer Y to build thumb version. This will make LiteOS smaller. +config INTERWORK_THUMB + bool "Enable interwork Thumb" if THUMB + default n + help + Answer Y to enable interwork thumb. + config PLATFORM_DVFS bool "Enable Dvfs" default n @@ -295,8 +303,7 @@ source "bsd/dev/usb/Kconfig" source "../../drivers/adapter/khdf/liteos/Kconfig" # Device driver Kconfig import -osource "$(DEVICE_PATH)/Kconfig" -osource "$(DEVICE_PATH)/config/Kconfig" +osource "$(DEVICE_PATH)/drivers/Kconfig" source "drivers/char/mem/Kconfig" source "drivers/char/quickstart/Kconfig" diff --git a/Makefile b/Makefile index ff3bf7c9..72d7994b 100644 --- a/Makefile +++ b/Makefile @@ -51,13 +51,25 @@ LITEOS_PLATFORM_BASE = $(LITEOSTOPDIR)/platform export CONFIG_=LOSCFG_ ifeq ($(PRODUCT_PATH),) -export PRODUCT_PATH=$(LITEOSTOPDIR)/../../device/hisilicon/drivers +export PRODUCT_PATH=$(shell hb env|grep "product path:"|sed 's/.*: //g') +endif +ifeq ($(DEVICE_PATH),) +export DEVICE_PATH=$(shell hb env|grep "device path:"|sed 's/.*: //g') +endif + +ifeq ($(TEE:1=y),y) +tee = _tee +endif +ifeq ($(RELEASE:1=y),y) +CONFIG ?= $(PRODUCT_PATH)/config/release$(tee).config +else +CONFIG ?= $(PRODUCT_PATH)/config/debug$(tee).config endif ifeq ($(shell which menuconfig),) $(shell pip install --user kconfiglib >/dev/null) endif -$(shell env CONFIG_=$(CONFIG_) PRODUCT_PATH=$(PRODUCT_PATH) olddefconfig >/dev/null) +$(shell env CONFIG_=$(CONFIG_) DEVICE_PATH=$(DEVICE_PATH) olddefconfig >/dev/null) -include $(LITEOSTOPDIR)/tools/build/config.mk @@ -217,7 +229,7 @@ update_all_config: done update_config: - $(HIDE)test -f "$(CONFIG)" && cp "$(CONFIG)" .config && menuconfig && savedefconfig --out "$(CONFIG)" + $(HIDE)test -f "$(CONFIG)" && cp -v "$(CONFIG)" .config && menuconfig && savedefconfig --out "$(CONFIG)" .PHONY: all lib clean cleanall $(LITEOS_TARGET) debug release help update_all_config update_config .PHONY: prepare sysroot cleanrootfs $(ROOTFS) $(ROOTFSDIR) $(APPS) menuconfig $(LITEOS_LIBS_TARGET) $(__LIBS) $(OUT) diff --git a/apps/BUILD.gn b/apps/BUILD.gn new file mode 100644 index 00000000..3e197007 --- /dev/null +++ b/apps/BUILD.gn @@ -0,0 +1,50 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +group("apps") { + deps = [] + + if (defined(LOSCFG_SHELL)) { + deps += [ + "shell", + #"mksh", + #"toybox", + ] + } + + if (defined(LOSCFG_USER_INIT_DEBUG)) { + #deps += [ "init" ] + } + + if (defined(LOSCFG_NET_LWIP_SACK_TFTP)) { + deps += [ "tftp" ] + } +} diff --git a/apps/init/BUILD.gn b/apps/init/BUILD.gn new file mode 100644 index 00000000..3b8b4f5a --- /dev/null +++ b/apps/init/BUILD.gn @@ -0,0 +1,53 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +executable("init") { + sources = [ "src/init.c" ] + + cflags = [ "-fPIE" ] + + if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { + cflags += [ + "-Wno-shift-op-parentheses", + "-Wno-bitwise-op-parentheses", + "-Wnonnull", + ] + } + + ldflags = [ + "-pie", + "-s", + ] + + if (defined(LOSCFG_QUICK_START)) { + ldflags += [ "--static" ] + } +} diff --git a/apps/mksh/BUILD.gn b/apps/mksh/BUILD.gn new file mode 100644 index 00000000..a09888e5 --- /dev/null +++ b/apps/mksh/BUILD.gn @@ -0,0 +1,40 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//build/lite/config/component/lite_component.gni") +import("//kernel/liteos_a/liteos.gni") + +group("mksh") { + deps = [ ":build_mksh" ] +} + +build_ext_component("build_mksh") { + exec_path = rebase_path(target_out_dir) + command = "make -C $LITEOSTHIRDPARTY/mksh" +} diff --git a/apps/shell/BUILD.gn b/apps/shell/BUILD.gn new file mode 100644 index 00000000..7afbbf6f --- /dev/null +++ b/apps/shell/BUILD.gn @@ -0,0 +1,58 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +executable("shell") { + sources = [ + "builtin/cd.c", + "src/main.c", + "src/shcmd.c", + "src/shcmdparse.c", + "src/shmsg.c", + ] + + deps = [ "$LITEOSTHIRDPARTY/bounds_checking_function:libsec_static" ] + + include_dirs = [ "include" ] + + cflags = [ "-fPIE" ] + + if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { + cflags += [ + "-Wno-shift-op-parentheses", + "-Wno-bitwise-op-parentheses", + ] + } + + ldflags = [ + "-pie", + "-s", + ] +} diff --git a/apps/tftp/BUILD.gn b/apps/tftp/BUILD.gn new file mode 100644 index 00000000..eef0d82a --- /dev/null +++ b/apps/tftp/BUILD.gn @@ -0,0 +1,55 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +executable("tftp") { + sources = [ + "src/main.c", + "src/tftpc.c", + ] + + deps = [ "$LITEOSTHIRDPARTY/bounds_checking_function:libsec_static" ] + + include_dirs = [ "include" ] + + cflags = [ "-fPIE" ] + + if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { + cflags += [ + "-Wno-shift-op-parentheses", + "-Wno-bitwise-op-parentheses", + ] + } + + ldflags = [ + "-pie", + "-s", + ] +} diff --git a/apps/toybox/BUILD.gn b/apps/toybox/BUILD.gn new file mode 100644 index 00000000..8438e89e --- /dev/null +++ b/apps/toybox/BUILD.gn @@ -0,0 +1,40 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//build/lite/config/component/lite_component.gni") +import("//kernel/liteos_a/liteos.gni") + +group("toybox") { + deps = [ ":build_toybox" ] +} + +build_ext_component("build_toybox") { + exec_path = rebase_path(target_out_dir) + command = "make -C $LITEOSTHIRDPARTY/toybox" +} diff --git a/arch/BUILD.gn b/arch/BUILD.gn new file mode 100644 index 00000000..75517815 --- /dev/null +++ b/arch/BUILD.gn @@ -0,0 +1,44 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +group("arch") { + deps = [] + if (defined(LOSCFG_ARCH_ARM)) { + deps += [ "arm" ] + } +} + +config("public") { + configs = [] + if (defined(LOSCFG_ARCH_ARM)) { + configs += [ "arm:public" ] + } +} diff --git a/arch/arm/BUILD.gn b/arch/arm/BUILD.gn new file mode 100644 index 00000000..6a797c10 --- /dev/null +++ b/arch/arm/BUILD.gn @@ -0,0 +1,47 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +group("arm") { + deps = [ "gic" ] + if (defined(LOSCFG_ARCH_ARM_AARCH32)) { + deps += [ "arm" ] + } +} + +config("public") { + include_dirs = [ "include" ] + configs = [] + if (defined(LOSCFG_ARCH_ARM_AARCH32)) { + configs += [ "arm:public" ] + } else if (defined(LOSCFG_ARCH_ARM_AARCH64)) { + configs += [ "aarch64:public" ] + } +} diff --git a/arch/arm/arm/BUILD.gn b/arch/arm/arm/BUILD.gn new file mode 100644 index 00000000..f2ef7610 --- /dev/null +++ b/arch/arm/arm/BUILD.gn @@ -0,0 +1,82 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_name = LOSCFG_ARCH_CPU +kernel_module(module_name) { + sources = [ + "src/arm_generic_timer.c", + "src/clear_user.S", + "src/hw_user_get.S", + "src/hw_user_put.S", + "src/jmp.S", + "src/los_arch_mmu.c", + "src/los_asid.c", + "src/los_dispatch.S", + "src/los_exc.c", + "src/los_hw.c", + "src/los_hw_exc.S", + "src/los_hw_runstop.S", + "src/los_hw_tick.c", + "src/los_hwi.c", + "src/strncpy_from_user.c", + "src/strnlen_user.c", + "src/user_copy.c", + ] + + if (LOSCFG_ARCH_ARM_VER == "armv7-a") { + sources += [ "src/armv7a/cache.S" ] + } + + if (defined(LOSCFG_KERNEL_SMP)) { + sources += [ "src/startup/reset_vector_mp.S" ] + } else { + sources += [ "src/startup/reset_vector_up.S" ] + } + + include_dirs = [ "src/include" ] + + if (defined(LOSCFG_GDB)) { + configs += [ "$LITEOSTOPDIR:as_objs_libc_flags" ] + } + + public_configs = [ ":public" ] +} + +group("arm") { + public_deps = [ ":$module_name" ] +} + +config("public") { + include_dirs = [ + "include", + "src/include", + ] +} diff --git a/arch/arm/gic/BUILD.gn b/arch/arm/gic/BUILD.gn new file mode 100644 index 00000000..127100f5 --- /dev/null +++ b/arch/arm/gic/BUILD.gn @@ -0,0 +1,41 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [] + + if (defined(LOSCFG_ARCH_GIC_V2)) { + sources += [ "gic_v2.c" ] + } else if (defined(LOSCFG_ARCH_GIC_V3)) { + sources += [ "gic_v3.c" ] + } +} diff --git a/bsd/BUILD.gn b/bsd/BUILD.gn new file mode 100644 index 00000000..fac70d00 --- /dev/null +++ b/bsd/BUILD.gn @@ -0,0 +1,86 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_COMPAT_BSD) +module_name = "libbsd" +kernel_module(module_name) { + sources = [ + "kern/bus_if.c", + "kern/device_if.c", + "kern/kern_condvar.c", + "kern/kern_timeout.c", + "kern/subr_bus.c", + "kern/subr_kobj.c", + ] + + if (defined(LOSCFG_ARCH_ARM_AARCH32)) { + sources += [ + "arm/autoconf.c", + "arm/hw_user_copy.S", + "arm/in_cksum.c", + "arm/in_cksum_arm.S", + "arm/nexus.c", + ] + } + + if (defined(LOSCFG_DRIVERS_RANDOM)) { + sources += [ + "crypto/rijndael/rijndael-alg-fst.c", + "crypto/rijndael/rijndael-api-fst.c", + "crypto/sha2/sha256c.c", + "dev/random/hash.c", + "dev/random/yarrow.c", + "libkern/explicit_bzero.c", + ] + } + + public_configs = [ ":public" ] +} + +group("bsd") { + public_deps = [ ":$module_name" ] + + deps = [ + "compat/linuxkpi", + "dev/usb", + ] +} + +config("public") { + include_dirs = [ + ".", + "kern", + ] + configs = [ + "compat/linuxkpi:public", + "dev/usb:public", + ] +} diff --git a/bsd/Kconfig b/bsd/Kconfig index 53c2816a..c19d8cd8 100644 --- a/bsd/Kconfig +++ b/bsd/Kconfig @@ -1,6 +1,14 @@ config COMPAT_BSD bool "Enable FreeBSD" default y + select COMPAT_LINUXKPI help Answer Y to enable LiteOS support FreeBSD. + +config COMPAT_LINUXKPI + bool "Enable linuxkpi" if COMPAT_BSD + default y + + help + Answer Y to enable LiteOS support compatible layer for linuxkpi. diff --git a/bsd/compat/linuxkpi/BUILD.gn b/bsd/compat/linuxkpi/BUILD.gn new file mode 100644 index 00000000..01c73efb --- /dev/null +++ b/bsd/compat/linuxkpi/BUILD.gn @@ -0,0 +1,57 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_COMPAT_BSD) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/adp.c", + "src/linux_completion.c", + "src/linux_interrupt.c", + "src/linux_sched.c", + "src/linux_semaphore.c", + "src/linux_timer.c", + "src/linux_wakelock.c", + "src/linux_workqueue.c", + "src/prctl.c", + "src/tzdst.c", + ] + + if (defined(LOSCFG_HRTIMER_ENABLE)) { + sources += [ "src/linux_hrtimer.c" ] + } + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/bsd/dev/usb/BUILD.gn b/bsd/dev/usb/BUILD.gn new file mode 100644 index 00000000..c2cb6c1d --- /dev/null +++ b/bsd/dev/usb/BUILD.gn @@ -0,0 +1,154 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_DRIVERS_USB) +module_name = "usb_base" +kernel_module(module_name) { + sources = [ + "implementation/bsd_busspace.c", + "implementation/bsd_kernel.c", + "implementation/usb_btree.c", + "implementation/usb_busdma_loader.c", + "implementation/usb_init.c", + "implementation/usb_version.c", + "usb_debug.c", + ] + + if (defined(LOSCFG_DRIVERS_USB)) { + sources += [ + "controller/usb_controller.c", + "quirk/usb_quirk.c", + "usb_dev.c", + "usb_device.c", + "usb_dynamic.c", + "usb_error.c", + "usb_generic.c", + "usb_handle_request.c", + "usb_hub.c", + "usb_if.c", + "usb_lookup.c", + "usb_mbuf.c", + "usb_parse.c", + "usb_process.c", + "usb_request.c", + "usb_transfer.c", + "usb_util.c", + ] + } + + if (defined(LOSCFG_DRIVERS_USB_4G_MODEM)) { + sources += [ "net/if_cdce.c" ] + } + + if (defined(LOSCFG_DRIVERS_USB_ETHERNET)) { + sources += [ + "net/if_axe.c", + "net/if_axge.c", + ] + } + + if (defined(LOSCFG_DRIVERS_USB_RNDIS_HOST)) { + sources += [ "net/if_urndis.c" ] + } + + if (defined(LOSCFG_DRIVERS_USB_4G_MODEM) || + defined(LOSCFG_DRIVERS_USB_ETHERNET) || + defined(LOSCFG_DRIVERS_USB_RNDIS_HOST)) { + sources += [ + "net/usb_eth_drv.c", + "net/usb_ethernet.c", + ] + } + + if (defined(LOSCFG_DRIVERS_USB_4G_MODEM) || + defined(LOSCFG_DRIVERS_USB_SERIAL)) { + sources += [ + "serial/u3g.c", + "serial/usb_serial.c", + ] + } + + if (defined(LOSCFG_DRIVERS_USB_HOST_EHCI)) { + sources += [ + "controller/ehci.c", + "controller/ehci_pci.c", + ] + } + + if (defined(LOSCFG_DRIVERS_USB_HOST_XHCI) || + defined(LOSCFG_DRIVERS_USB_HOST_XHCI_FOR_PORT2)) { + sources += [ + "controller/xhci.c", + "controller/xhci_pci.c", + ] + } + + if (defined(LOSCFG_DRIVERS_USB_WIRELESS)) { + sources += [ "linux_usb.c" ] + } + + if (defined(LOSCFG_DRIVERS_USB_MASS_STORAGE)) { + sources += [ "storage/umass.c" ] + } + + if (defined(LOSCFG_DRIVERS_USB_HID_CLASS) && + defined(LOSCFG_DRIVERS_HDF_INPUT)) { + sources += [ + "input/uhid.c", + "usb_hid.c", + ] + + include_dirs = [ + "//drivers/framework/model/input/driver", + "//drivers/framework/include/core", + "//drivers/framework/core/common/include/host", + "//drivers/framework/utils", + "//drivers/framework/osal", + "//drivers/framework/ability/sbuf/include", + "//drivers/framework/include/osal", + ] + } + + configs += [ + "$HDFTOPDIR:hdf_config" + ] + + public_configs = [ ":public" ] +} + +group("usb") { + public_deps = [ ":$module_name" ] +} + +config("public") { + include_dirs = [ "." ] + include_dirs += [ "$LITEOSTHIRDPARTY/FreeBSD/sys/dev/evdev" ] +} diff --git a/compat/BUILD.gn b/compat/BUILD.gn new file mode 100644 index 00000000..300dcf3e --- /dev/null +++ b/compat/BUILD.gn @@ -0,0 +1,38 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +group("compat") { + deps = [ "posix" ] +} + +config("public") { + configs = [ "posix:public" ] +} diff --git a/compat/posix/BUILD.gn b/compat/posix/BUILD.gn new file mode 100644 index 00000000..d145e64f --- /dev/null +++ b/compat/posix/BUILD.gn @@ -0,0 +1,55 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_COMPAT_POSIX) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/map_error.c", + "src/misc.c", + "src/mqueue.c", + "src/posix_memalign.c", + "src/pthread.c", + "src/pthread_attr.c", + "src/pthread_cond.c", + "src/pthread_mutex.c", + "src/sched.c", + "src/semaphore.c", + "src/socket.c", + "src/time.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/drivers/BUILD.gn b/drivers/BUILD.gn new file mode 100644 index 00000000..4926f959 --- /dev/null +++ b/drivers/BUILD.gn @@ -0,0 +1,70 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +cmd = "if [ -f $device_path/drivers/BUILD.gn ]; then echo true; else echo false; fi" +HAVE_DEVICE_DRIVERS = exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value") + +module_switch = defined(LOSCFG_DRIVERS) +group("drivers") { + if (module_switch) { + deps = [ + "block/disk", + "char/bch", + "char/mem", + "char/quickstart", + "char/random", + "char/video", + "mtd/multi_partition", + "//drivers/adapter/khdf/liteos", + "//drivers/liteos", + ] + if (HAVE_DEVICE_DRIVERS) { + deps += [ "$device_path/drivers" ] + } + } +} + +config("public") { + configs = [ + "block/disk:public", + "char/bch:public", + "char/mem:public", + "char/quickstart:public", + "char/random:public", + "char/video:public", + "mtd/multi_partition:public", + "//drivers/adapter/khdf/liteos:public", + "//drivers/liteos:public", + ] + if (HAVE_DEVICE_DRIVERS) { + configs += [ "$device_path/drivers:public" ] + } +} diff --git a/drivers/block/disk/BUILD.gn b/drivers/block/disk/BUILD.gn new file mode 100644 index 00000000..48e42b06 --- /dev/null +++ b/drivers/block/disk/BUILD.gn @@ -0,0 +1,45 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_FAT_DISK) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/disk.c", + "src/disk_shellcmd.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/drivers/char/bch/BUILD.gn b/drivers/char/bch/BUILD.gn new file mode 100644 index 00000000..cc684575 --- /dev/null +++ b/drivers/char/bch/BUILD.gn @@ -0,0 +1,52 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_VFS_BLOCK_DEVICE) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchdev_driver.c", + "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchdev_register.c", + "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchdev_unregister.c", + "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchlib_cache.c", + "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchlib_read.c", + "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchlib_sem.c", + "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchlib_setup.c", + "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchlib_teardown.c", + "$LITEOSTHIRDPARTY/NuttX/drivers/bch/bchlib_write.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/drivers/char/mem/BUILD.gn b/drivers/char/mem/BUILD.gn new file mode 100644 index 00000000..aad2d717 --- /dev/null +++ b/drivers/char/mem/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_DRIVERS_MEM) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "src/mem.c" ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/drivers/char/quickstart/BUILD.gn b/drivers/char/quickstart/BUILD.gn new file mode 100644 index 00000000..9f2cb98d --- /dev/null +++ b/drivers/char/quickstart/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_DRIVERS_QUICKSTART) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "src/quickstart.c" ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/drivers/char/random/BUILD.gn b/drivers/char/random/BUILD.gn new file mode 100644 index 00000000..0410df5b --- /dev/null +++ b/drivers/char/random/BUILD.gn @@ -0,0 +1,46 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_DRIVERS_RANDOM) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "src/random.c" ] + + if (defined(LOSCFG_HW_RANDOM_ENABLE)) { + sources += [ "src/random_hw.c" ] + } + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/drivers/char/video/BUILD.gn b/drivers/char/video/BUILD.gn new file mode 100644 index 00000000..1470983e --- /dev/null +++ b/drivers/char/video/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_DRIVERS_VIDEO) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "$LITEOSTHIRDPARTY/NuttX/drivers/video/fb.c" ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "$LITEOSTHIRDPARTY/NuttX/include/nuttx/video" ] +} diff --git a/drivers/mtd/multi_partition/BUILD.gn b/drivers/mtd/multi_partition/BUILD.gn new file mode 100644 index 00000000..625a89d5 --- /dev/null +++ b/drivers/mtd/multi_partition/BUILD.gn @@ -0,0 +1,54 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_VFS) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/mtd_partition.c", + "src/mtd_shellcmd.c", + ] + + include_dirs = [ + "$LITEOSTOPDIR/fs/jffs2/include", + "//device/hisilicon/drivers/include/mtd/common/include", + ] + + if (defined(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7)) { + include_dirs += [ "//device/qemu/drivers/cfiflash" ] + } + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/fs/BUILD.gn b/fs/BUILD.gn new file mode 100644 index 00000000..f148c269 --- /dev/null +++ b/fs/BUILD.gn @@ -0,0 +1,56 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +group("fs") { + deps = [ + "fat", + "fat/virpart", + "jffs2", + "nfs", + "proc", + "ramfs", + "romfs", + "vfs", + "vfs/bcache", + "zpfs", + ] +} + +config("public") { + include_dirs = [ "include" ] + configs = [ + "vfs:public", + "vfs/bcache:public", + "fat:public", + "fat/virpart:public", + "proc:public", + ] +} diff --git a/fs/fat/BUILD.gn b/fs/fat/BUILD.gn new file mode 100644 index 00000000..34abc034 --- /dev/null +++ b/fs/fat/BUILD.gn @@ -0,0 +1,55 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_FAT) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "os_adapt/fat_shellcmd.c", + "os_adapt/fatfs.c", + "os_adapt/format.c", + ] + + sources += [ + "$LITEOSTHIRDPARTY/FatFs/source/diskio.c", + "$LITEOSTHIRDPARTY/FatFs/source/ff.c", + "$LITEOSTHIRDPARTY/FatFs/source/ffsystem.c", + "$LITEOSTHIRDPARTY/FatFs/source/ffunicode.c", + ] + + include_dirs = [ "os_adapt" ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "$LITEOSTHIRDPARTY/FatFs/source" ] +} diff --git a/fs/fat/virpart/BUILD.gn b/fs/fat/virpart/BUILD.gn new file mode 100644 index 00000000..08178e2d --- /dev/null +++ b/fs/fat/virpart/BUILD.gn @@ -0,0 +1,47 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_FAT_VIRTUAL_PARTITION) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/virpart.c", + "src/virpartff.c", + ] + + include_dirs = [ "../os_adapt" ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/fs/jffs2/BUILD.gn b/fs/jffs2/BUILD.gn new file mode 100644 index 00000000..bf5eecc1 --- /dev/null +++ b/fs/jffs2/BUILD.gn @@ -0,0 +1,75 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_JFFS) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/jffs2_hash.c", + "src/vfs_jffs2.c", + ] + + sources += [ + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/background.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/build.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/compr.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/compr_rtime.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/compr_rubin.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/compr_zlib.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/debug.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/dir.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/erase.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/file.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/fs.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/gc.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/malloc.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/nodelist.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/nodemgmt.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/read.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/readinode.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/scan.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/summary.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/super.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/write.c", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2/writev.c", + ] + + include_dirs = [ + "$LITEOSTHIRDPARTY/Linux_Kernel/fs/jffs2", + "$LITEOSTHIRDPARTY/Linux_Kernel/fs", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/fs/nfs/BUILD.gn b/fs/nfs/BUILD.gn new file mode 100644 index 00000000..8f987f9d --- /dev/null +++ b/fs/nfs/BUILD.gn @@ -0,0 +1,40 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_NFS) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "$LITEOSTHIRDPARTY/NuttX/fs/nfs/nfs_adapter.c", + "$LITEOSTHIRDPARTY/NuttX/fs/nfs/nfs_util.c", + "$LITEOSTHIRDPARTY/NuttX/fs/nfs/rpc_clnt.c", + ] +} diff --git a/fs/proc/BUILD.gn b/fs/proc/BUILD.gn index 122e956e..2c133512 100644 --- a/fs/proc/BUILD.gn +++ b/fs/proc/BUILD.gn @@ -25,23 +25,31 @@ # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -static_library("fs_proc") { +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_PROC) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { sources = [ + "os_adapt/fd_proc.c", + "os_adapt/fs_cache_proc.c", + "os_adapt/kernel_trace_proc.c", + "os_adapt/mounts_proc.c", + "os_adapt/power_proc.c", "os_adapt/proc_init.c", - "os_adapt/vfs_proc.c", + "os_adapt/proc_vfs.c", + "os_adapt/process_proc.c", + "os_adapt/uptime_proc.c", + "os_adapt/vmm_proc.c", + "src/proc_file.c", "src/proc_shellcmd.c", - "src/pseudofs.c", - "src/seq_file.c", ] - include_dirs = [ "include" ] + public_configs = [ ":public" ] +} - if (LOSCFG_LLTREPORT) { - cflags += [ - "-fprofile-arcs", - "-ftest-coverage", - ] - } +config("public") { + include_dirs = [ "include" ] } diff --git a/fs/ramfs/BUILD.gn b/fs/ramfs/BUILD.gn new file mode 100644 index 00000000..5b593f83 --- /dev/null +++ b/fs/ramfs/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_RAMFS) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "$LITEOSTHIRDPARTY/NuttX/fs/tmpfs/fs_tmpfs.c" ] +} diff --git a/fs/romfs/BUILD.gn b/fs/romfs/BUILD.gn new file mode 100644 index 00000000..eef06c08 --- /dev/null +++ b/fs/romfs/BUILD.gn @@ -0,0 +1,39 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_ROMFS) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "$LITEOSTHIRDPARTY/NuttX/fs/romfs/fs_romfs.c", + "$LITEOSTHIRDPARTY/NuttX/fs/romfs/fs_romfsutil.c", + ] +} diff --git a/fs/vfs/BUILD.gn b/fs/vfs/BUILD.gn new file mode 100644 index 00000000..1cd4859e --- /dev/null +++ b/fs/vfs/BUILD.gn @@ -0,0 +1,116 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_VFS) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "operation/fs_chattr.c", + "operation/fs_check.c", + "operation/fs_fallocate.c", + "operation/fs_fallocate64.c", + "operation/fs_file.c", + "operation/fs_file_mapping.c", + "operation/fs_init.c", + "operation/fs_other.c", + "operation/fs_preadv.c", + "operation/fs_pwritev.c", + "operation/fs_readv.c", + "operation/fs_utime.c", + "operation/fs_writev.c", + "operation/fullpath.c", + "vfs_cmd/vfs_shellcmd.c", + ] + + sources += [ + "$LITEOSTHIRDPARTY/NuttX/fs/dirent/fs_closedir.c", + "$LITEOSTHIRDPARTY/NuttX/fs/dirent/fs_opendir.c", + "$LITEOSTHIRDPARTY/NuttX/fs/dirent/fs_readdir.c", + "$LITEOSTHIRDPARTY/NuttX/fs/dirent/fs_rewinddir.c", + "$LITEOSTHIRDPARTY/NuttX/fs/dirent/fs_seekdir.c", + "$LITEOSTHIRDPARTY/NuttX/fs/dirent/fs_telldir.c", + "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_blockproxy.c", + "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_closeblockdriver.c", + "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_findblockdriver.c", + "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_openblockdriver.c", + "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_registerblockdriver.c", + "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_registerdriver.c", + "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_unregisterblockdriver.c", + "$LITEOSTHIRDPARTY/NuttX/fs/driver/fs_unregisterdriver.c", + "$LITEOSTHIRDPARTY/NuttX/fs/inode/fs_files.c", + "$LITEOSTHIRDPARTY/NuttX/fs/mount/fs_foreachmountpoint.c", + "$LITEOSTHIRDPARTY/NuttX/fs/mount/fs_mount.c", + "$LITEOSTHIRDPARTY/NuttX/fs/mount/fs_umount.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_close.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_dup.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_dup2.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_dupfd.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_dupfd2.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_fcntl.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_fsync.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_getfilep.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_ioctl.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_link.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_lseek.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_lseek64.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_mkdir.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_open.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_poll.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_pread.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_pread64.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_pwrite.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_pwrite64.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_read.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_readlink.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_rename.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_rmdir.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_select.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_sendfile.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_stat.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_statfs.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_symlink.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_truncate.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_truncate64.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_unlink.c", + "$LITEOSTHIRDPARTY/NuttX/fs/vfs/fs_write.c", + "$LITEOSTOPDIR/fs/vfs/mount.c", + "$LITEOSTOPDIR/fs/vfs/path_cache.c", + "$LITEOSTOPDIR/fs/vfs/vnode.c", + "$LITEOSTOPDIR/fs/vfs/vnode_hash.c", + ] + + include_dirs = [ "$LITEOSTOPDIR/syscall" ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/fs/vfs/bcache/BUILD.gn b/fs/vfs/bcache/BUILD.gn new file mode 100644 index 00000000..6f52a9bc --- /dev/null +++ b/fs/vfs/bcache/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_FAT_CACHE) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "src/bcache.c" ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "../include/bcache" ] +} diff --git a/fs/zpfs/BUILD.gn b/fs/zpfs/BUILD.gn index e8094f4f..e0cc31e2 100644 --- a/fs/zpfs/BUILD.gn +++ b/fs/zpfs/BUILD.gn @@ -27,16 +27,13 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -static_library("fs_zpfs") { +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_FS_ZPFS) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { sources = [ "vfs_zpfs.c", "zpfs.c", ] - - if (LOSCFG_LLTREPORT) { - cflags += [ - "-fprofile-arcs", - "-ftest-coverage", - ] - } } diff --git a/kernel/BUILD.gn b/kernel/BUILD.gn index 34a26649..504db26b 100644 --- a/kernel/BUILD.gn +++ b/kernel/BUILD.gn @@ -25,32 +25,24 @@ # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -import("//build/lite/config/component/lite_component.gni") +import("//kernel/liteos_a/liteos.gni") -lite_component("kernel") { - features = [ +group("kernel") { + deps = [ "base", - "syscall", + "common", + "extended", "user", ] - if (LOSCFG_KERNEL_CPUP) { - features += [ "extended/cpup" ] - } - if (LOSCFG_KERNEL_MPU) { - features += [ "extended/mpu" ] - } - if (LOSCFG_KERNEL_CPPSUPPORT) { - features += [ "extended/cppsupport" ] - } - if (LOSCFG_KERNEL_DYNLOAD) { - features += [ "extended/dynload" ] - } - if (LOSCFG_KERNEL_TRACE) { - features += [ "extended/trace" ] - } - if (LOSCFG_KERNEL_VDSO) { - features += [ "extended/vdso" ] - } +} + +config("public") { + include_dirs = [ "include" ] + configs = [ + "base:public", + "common:public", + "extended:public", + ] } diff --git a/kernel/base/BUILD.gn b/kernel/base/BUILD.gn index 67cb2543..b231ed27 100644 --- a/kernel/base/BUILD.gn +++ b/kernel/base/BUILD.gn @@ -25,9 +25,12 @@ # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -static_library("base") { +import("//kernel/liteos_a/liteos.gni") + +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { sources = [ "core/los_bitmap.c", "core/los_process.c", @@ -36,22 +39,24 @@ static_library("base") { "core/los_sys.c", "core/los_task.c", "core/los_tick.c", - "core/los_timeslice.c", "ipc/los_event.c", + "ipc/los_futex.c", "ipc/los_ipcdebug.c", "ipc/los_mux.c", - "ipc/los_mux_debug.c", "ipc/los_queue.c", "ipc/los_queue_debug.c", + "ipc/los_rwlock.c", "ipc/los_sem.c", "ipc/los_sem_debug.c", - "mem/bestfit/los_memory.c", - "mem/bestfit/los_multipledlinkhead.c", + "ipc/los_signal.c", "mem/common/los_memstat.c", "mem/membox/los_membox.c", + "mem/tlsf/los_memory.c", + "misc/kill_shellcmd.c", "misc/los_misc.c", "misc/los_stackinfo.c", "misc/mempt_shellcmd.c", + "misc/panic_shellcmd.c", "misc/swtmr_shellcmd.c", "misc/sysinfo_shellcmd.c", "misc/task_shellcmd.c", @@ -59,22 +64,33 @@ static_library("base") { "mp/los_lockdep.c", "mp/los_mp.c", "mp/los_percpu.c", + "mp/los_spinlock.c", "mp/los_stat.c", "om/los_err.c", - "sched/sched_sq/los_priqueue.c", "sched/sched_sq/los_sched.c", - "vm/filemap.c", - "vm/pmm.c", - "vm/vm.c", - "vm/vmm.c", + "vm/los_vm_boot.c", + "vm/los_vm_dump.c", + "vm/los_vm_fault.c", + "vm/los_vm_filemap.c", + "vm/los_vm_iomap.c", + "vm/los_vm_map.c", + "vm/los_vm_page.c", + "vm/los_vm_phys.c", + "vm/los_vm_scan.c", + "vm/los_vm_syscall.c", + "vm/oom.c", + "vm/shm.c", ] - include_dirs = [ - "include", - "../extended/include", - "../extended/vdso/include", - "../extended/dynload/include", - "../include", - "mem", - ] + if (defined(LOSCFG_SHELL_CMD_DEBUG)) { + configs += [ + "$HDFTOPDIR:hdf_config" + ] + } + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] } diff --git a/kernel/base/misc/panic_shellcmd.c b/kernel/base/misc/panic_shellcmd.c index 0829a7e7..1923c625 100644 --- a/kernel/base/misc/panic_shellcmd.c +++ b/kernel/base/misc/panic_shellcmd.c @@ -35,7 +35,6 @@ #include "shell.h" #endif #include "los_swtmr_pri.h" -#include "watchdog_if.h" #ifdef LOSCFG_SHELL_CMD_DEBUG @@ -46,6 +45,7 @@ LITE_OS_SEC_TEXT_MINOR BOOL OsSystemExcIsReset(VOID) return systemExcReset; } #ifdef LOSCFG_DRIVERS_HDF_PLATFORM_WATCHDOG +#include "watchdog_if.h" #define WATCHDOG_TIMER_INTERVAL 5 // 5 seconds #define WATCHDOG_TIMER_INTERVAL_HALF (WATCHDOG_TIMER_INTERVAL / 2) diff --git a/kernel/common/BUILD.gn b/kernel/common/BUILD.gn new file mode 100644 index 00000000..02da36bc --- /dev/null +++ b/kernel/common/BUILD.gn @@ -0,0 +1,48 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +group("common") { + deps = [ + "blackbox", + "hidumper", + "patchfs", + "rootfs", + ] +} + +config("public") { + configs = [ + "blackbox:public", + "hidumper:public", + "patchfs:public", + "rootfs:public", + ] +} diff --git a/kernel/common/blackbox/BUILD.gn b/kernel/common/blackbox/BUILD.gn new file mode 100644 index 00000000..b1327cf3 --- /dev/null +++ b/kernel/common/blackbox/BUILD.gn @@ -0,0 +1,47 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_BLACKBOX) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "los_blackbox_common.c", + "los_blackbox_core.c", + "los_blackbox_detector.c", + "los_blackbox_system_adapter.c", + ] + include_dirs = [ "$LITEOSTOPDIR/syscall" ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "." ] +} diff --git a/kernel/common/hidumper/BUILD.gn b/kernel/common/hidumper/BUILD.gn new file mode 100644 index 00000000..93f74119 --- /dev/null +++ b/kernel/common/hidumper/BUILD.gn @@ -0,0 +1,41 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_HIDUMPER) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "los_hidumper.c" ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "." ] +} diff --git a/kernel/common/patchfs/BUILD.gn b/kernel/common/patchfs/BUILD.gn new file mode 100644 index 00000000..28d5e761 --- /dev/null +++ b/kernel/common/patchfs/BUILD.gn @@ -0,0 +1,44 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_PLATFORM_PATCHFS) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "los_partition_utils.c", + "los_patchfs.c", + ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "." ] +} diff --git a/kernel/common/rootfs/BUILD.gn b/kernel/common/rootfs/BUILD.gn new file mode 100644 index 00000000..e69ae93e --- /dev/null +++ b/kernel/common/rootfs/BUILD.gn @@ -0,0 +1,44 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_PLATFORM_ROOTFS) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "los_bootargs.c", + "los_rootfs.c", + ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "." ] +} diff --git a/kernel/common/Kconfig b/kernel/common/rootfs/Kconfig similarity index 100% rename from kernel/common/Kconfig rename to kernel/common/rootfs/Kconfig diff --git a/kernel/common/Makefile b/kernel/common/rootfs/Makefile similarity index 100% rename from kernel/common/Makefile rename to kernel/common/rootfs/Makefile diff --git a/kernel/common/los_bootargs.c b/kernel/common/rootfs/los_bootargs.c similarity index 100% rename from kernel/common/los_bootargs.c rename to kernel/common/rootfs/los_bootargs.c diff --git a/kernel/common/los_bootargs.h b/kernel/common/rootfs/los_bootargs.h similarity index 100% rename from kernel/common/los_bootargs.h rename to kernel/common/rootfs/los_bootargs.h diff --git a/kernel/common/los_rootfs.c b/kernel/common/rootfs/los_rootfs.c similarity index 100% rename from kernel/common/los_rootfs.c rename to kernel/common/rootfs/los_rootfs.c diff --git a/kernel/common/los_rootfs.h b/kernel/common/rootfs/los_rootfs.h similarity index 100% rename from kernel/common/los_rootfs.h rename to kernel/common/rootfs/los_rootfs.h diff --git a/kernel/extended/BUILD.gn b/kernel/extended/BUILD.gn new file mode 100644 index 00000000..d171bc1f --- /dev/null +++ b/kernel/extended/BUILD.gn @@ -0,0 +1,56 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +group("extended") { + deps = [ + "cppsupport", + "cpup", + "dynload", + "hilog", + "liteipc", + "pipes", + "power", + "trace", + "vdso", + ] +} + +config("public") { + configs = [ + "cpup:public", + "dynload:public", + "vdso:public", + "trace:public", + "liteipc:public", + "pipes:public", + "hilog:public", + ] +} diff --git a/kernel/extended/cppsupport/BUILD.gn b/kernel/extended/cppsupport/BUILD.gn new file mode 100644 index 00000000..d264cd20 --- /dev/null +++ b/kernel/extended/cppsupport/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_KERNEL_CPPSUPPORT) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "los_cppsupport.c" ] +} diff --git a/kernel/extended/cpup/BUILD.gn b/kernel/extended/cpup/BUILD.gn new file mode 100644 index 00000000..2482774f --- /dev/null +++ b/kernel/extended/cpup/BUILD.gn @@ -0,0 +1,45 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_KERNEL_CPUP) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "cpup_shellcmd.c", + "los_cpup.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "." ] +} diff --git a/kernel/extended/include/los_cpup_pri.h b/kernel/extended/cpup/los_cpup_pri.h similarity index 100% rename from kernel/extended/include/los_cpup_pri.h rename to kernel/extended/cpup/los_cpup_pri.h diff --git a/kernel/extended/dynload/BUILD.gn b/kernel/extended/dynload/BUILD.gn new file mode 100644 index 00000000..110abc4c --- /dev/null +++ b/kernel/extended/dynload/BUILD.gn @@ -0,0 +1,45 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_KERNEL_DYNLOAD) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/los_exec_elf.c", + "src/los_load_elf.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/kernel/extended/hilog/BUILD.gn b/kernel/extended/hilog/BUILD.gn new file mode 100644 index 00000000..16e05fe9 --- /dev/null +++ b/kernel/extended/hilog/BUILD.gn @@ -0,0 +1,45 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_BASE_CORE_HILOG) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "//base/hiviewdfx/hilog_lite/frameworks/featured/hiview_log.c" ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ + "//base/hiviewdfx/hilog_lite/interfaces/native/kits", + "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog", + ] +} diff --git a/kernel/extended/liteipc/BUILD.gn b/kernel/extended/liteipc/BUILD.gn new file mode 100644 index 00000000..5074fe3a --- /dev/null +++ b/kernel/extended/liteipc/BUILD.gn @@ -0,0 +1,41 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_KERNEL_LITEIPC) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "hm_liteipc.c" ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "." ] +} diff --git a/kernel/extended/power/BUILD.gn b/kernel/extended/power/BUILD.gn new file mode 100644 index 00000000..d21ffda6 --- /dev/null +++ b/kernel/extended/power/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_KERNEL_PM) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "los_pm.c" ] +} diff --git a/kernel/extended/trace/BUILD.gn b/kernel/extended/trace/BUILD.gn new file mode 100644 index 00000000..ac772b6e --- /dev/null +++ b/kernel/extended/trace/BUILD.gn @@ -0,0 +1,45 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_KERNEL_TRACE) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "los_trace.c", + "los_trace_frame.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "." ] +} diff --git a/kernel/extended/include/los_trace_pri.h b/kernel/extended/trace/los_trace_pri.h similarity index 100% rename from kernel/extended/include/los_trace_pri.h rename to kernel/extended/trace/los_trace_pri.h diff --git a/kernel/extended/vdso/BUILD.gn b/kernel/extended/vdso/BUILD.gn new file mode 100644 index 00000000..82062c17 --- /dev/null +++ b/kernel/extended/vdso/BUILD.gn @@ -0,0 +1,53 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_KERNEL_VDSO) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/los_vdso.c", + "src/los_vdso_text.S", + ] + + asmflags = [ "-DOHOS_VDSO_SO=\"OHOS-vdso.so\"" ] + deps = [ ":copy_ohos_vdso" ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} + +copy("copy_ohos_vdso") { + deps = [ "usr:OHOS-vdso" ] + sources = [ "$root_out_dir/libOHOS-vdso.so" ] + outputs = [ "$root_out_dir/OHOS-vdso.so" ] +} diff --git a/kernel/extended/vdso/src/Makefile b/kernel/extended/vdso/src/Makefile index 90e2c714..f5de37ee 100644 --- a/kernel/extended/vdso/src/Makefile +++ b/kernel/extended/vdso/src/Makefile @@ -35,6 +35,6 @@ LOCAL_SRCS := $(wildcard *.c) $(wildcard *.S) LOCAL_INCLUDE := -I $(LITEOSTOPDIR)/kernel/base/include -I $(LITEOSTOPDIR)/kernel/extended/include -I $(LITEOSTOPDIR)/kernel/extended/vdso/include -LOCAL_FLAGS := $(LOCAL_INCLUDE) +LOCAL_FLAGS := $(LOCAL_INCLUDE) -DOHOS_VDSO_SO=\"../usr/OHOS-vdso.so\" include $(MODULE) \ No newline at end of file diff --git a/kernel/extended/vdso/src/los_vdso_text.S b/kernel/extended/vdso/src/los_vdso_text.S index fcf8224e..c8e1f268 100644 --- a/kernel/extended/vdso/src/los_vdso_text.S +++ b/kernel/extended/vdso/src/los_vdso_text.S @@ -31,4 +31,4 @@ .globl __vdso_text_start .section .data.vdso.text __vdso_text_start: - .incbin "../usr/OHOS-vdso.so" \ No newline at end of file + .incbin OHOS_VDSO_SO \ No newline at end of file diff --git a/kernel/extended/vdso/usr/BUILD.gn b/kernel/extended/vdso/usr/BUILD.gn new file mode 100644 index 00000000..db79bb3a --- /dev/null +++ b/kernel/extended/vdso/usr/BUILD.gn @@ -0,0 +1,54 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +shared_library("OHOS-vdso") { + sources = [ "los_vdso_sys.c" ] + + include_dirs = [ + "$LITEOSTOPDIR/kernel/extended/vdso/include", + "$LITEOSTOPDIR/kernel/include", + "$LITEOSTOPDIR/platform", + "$LITEOSTOPDIR/bsd/compat/linuxkpi/include", + ] + + cflags = [ + "-nostdlib", + "-fPIC", + "-fno-common", + "-fno-strict-aliasing", + ] + + ldflags = [ + "-s", + "-Bsymbolic", + "-Tlos_vdso.ld", + ] +} diff --git a/kernel/extended/vdso/usr/Makefile b/kernel/extended/vdso/usr/Makefile index dde4d96d..68819e19 100644 --- a/kernel/extended/vdso/usr/Makefile +++ b/kernel/extended/vdso/usr/Makefile @@ -34,7 +34,7 @@ VDSO_SO = OHOS-vdso VDSO_SRCS := los_vdso_sys.c VDSO_INCLUDE := -I $(LITEOSTOPDIR)/kernel/extended/vdso/include \ -I $(LITEOSTOPDIR)/kernel/include \ - -I $(LITEOSTOPDIR)/kernel/common \ + -I $(LITEOSTOPDIR)/platform \ -I $(LITEOSTOPDIR)/bsd/compat/linuxkpi/include VDSO_CCFLAGS := -nostdlib -fPIC -fno-common -fno-strict-aliasing \ diff --git a/kernel/user/BUILD.gn b/kernel/user/BUILD.gn new file mode 100644 index 00000000..42efa259 --- /dev/null +++ b/kernel/user/BUILD.gn @@ -0,0 +1,57 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_name = "userinit" +shared_library(module_name) { + sources = [ "src/los_user_init.c" ] + + include_dirs = [ + "include", + "$LITEOSTOPDIR/syscall", + ] + + configs = [] + configs += [ + "$LITEOSTOPDIR:public", + "$LITEOSTOPDIR:los_config", + ] + + ldflags = [ + "-static", + "-r", + ] + + output_extension = "O" +} + +group("user") { + public_deps = [ ":$module_name" ] +} diff --git a/lib/BUILD.gn b/lib/BUILD.gn new file mode 100644 index 00000000..03142ff2 --- /dev/null +++ b/lib/BUILD.gn @@ -0,0 +1,50 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +group("lib") { + deps = [ + "libc", + "libmbedtls", + "libscrew", + "libsec", + "zlib", + ] +} + +config("public") { + configs = [ + "libc:public", + "libmbedtls:public", + "libscrew:public", + "libsec:public", + "zlib:public", + ] +} diff --git a/lib/libc/BUILD.gn b/lib/libc/BUILD.gn new file mode 100644 index 00000000..d7087821 --- /dev/null +++ b/lib/libc/BUILD.gn @@ -0,0 +1,92 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +MUSLDIR = "$LITEOSTHIRDPARTY/musl" +OPTRTDIR = "$LITEOSTHIRDPARTY/optimized-routines" + +import("$MUSLDIR/porting/liteos_a/kernel/musl.gni") + +module_switch = defined(LOSCFG_LIB_LIBC) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = MUSL_SRC_COMMON + + if (defined(LOSCFG_ARCH_ARM_AARCH32)) { + sources += MUSL_SRC_ARM + foreach(f, MUSL_SRC_ARM) { + sources -= [ string_replace(f, "/arm/", "/") ] + } + } + + if (LOSCFG_ARCH_ARM_VER == "armv7-a") { + sources -= [ + "$MUSLPORTINGDIR/src/string/memchr.c", + "$MUSLPORTINGDIR/src/string/memcpy.c", + "$MUSLPORTINGDIR/src/string/strcmp.c", + "$MUSLPORTINGDIR/src/string/strcpy.c", + "$MUSLPORTINGDIR/src/string/strlen.c", + ] + sources += [ + "$OPTRTDIR/string/arm/memchr.S", + "$OPTRTDIR/string/arm/memcpy.S", + "$OPTRTDIR/string/arm/strcmp.S", + "$OPTRTDIR/string/arm/strcpy.c", + "$OPTRTDIR/string/arm/strlen-armv6t2.S", + ] + } + + public_configs = [ ":public" ] + configs += [ ":private" ] +} + +config("public") { + include_dirs = [ "$MUSLPORTINGDIR/include" ] +} + +config("private") { + if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { + cflags = [ + "-Wno-char-subscripts", + "-Wno-unknown-pragmas", + ] + } else { + cflags = [ + "-frounding-math", + "-Wno-unused-but-set-variable", + "-Wno-unknown-pragmas", + ] + } + + include_dirs = [ + "$MUSLPORTINGDIR/src/include", + "$MUSLPORTINGDIR/src/internal", + ] +} diff --git a/lib/libmbedtls/BUILD.gn b/lib/libmbedtls/BUILD.gn new file mode 100644 index 00000000..d9aa20af --- /dev/null +++ b/lib/libmbedtls/BUILD.gn @@ -0,0 +1,122 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_DRIVERS_TZDRIVER) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "$LITEOSTHIRDPARTY/mbedtls/library/aes.c", + "$LITEOSTHIRDPARTY/mbedtls/library/aesni.c", + "$LITEOSTHIRDPARTY/mbedtls/library/arc4.c", + "$LITEOSTHIRDPARTY/mbedtls/library/aria.c", + "$LITEOSTHIRDPARTY/mbedtls/library/asn1parse.c", + "$LITEOSTHIRDPARTY/mbedtls/library/asn1write.c", + "$LITEOSTHIRDPARTY/mbedtls/library/base64.c", + "$LITEOSTHIRDPARTY/mbedtls/library/bignum.c", + "$LITEOSTHIRDPARTY/mbedtls/library/blowfish.c", + "$LITEOSTHIRDPARTY/mbedtls/library/camellia.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ccm.c", + "$LITEOSTHIRDPARTY/mbedtls/library/certs.c", + "$LITEOSTHIRDPARTY/mbedtls/library/chacha20.c", + "$LITEOSTHIRDPARTY/mbedtls/library/chachapoly.c", + "$LITEOSTHIRDPARTY/mbedtls/library/cipher.c", + "$LITEOSTHIRDPARTY/mbedtls/library/cipher_wrap.c", + "$LITEOSTHIRDPARTY/mbedtls/library/cmac.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ctr_drbg.c", + "$LITEOSTHIRDPARTY/mbedtls/library/debug.c", + "$LITEOSTHIRDPARTY/mbedtls/library/des.c", + "$LITEOSTHIRDPARTY/mbedtls/library/dhm.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ecdh.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ecdsa.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ecjpake.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ecp.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ecp_curves.c", + "$LITEOSTHIRDPARTY/mbedtls/library/entropy.c", + "$LITEOSTHIRDPARTY/mbedtls/library/entropy_poll.c", + "$LITEOSTHIRDPARTY/mbedtls/library/error.c", + "$LITEOSTHIRDPARTY/mbedtls/library/gcm.c", + "$LITEOSTHIRDPARTY/mbedtls/library/havege.c", + "$LITEOSTHIRDPARTY/mbedtls/library/hkdf.c", + "$LITEOSTHIRDPARTY/mbedtls/library/hmac_drbg.c", + "$LITEOSTHIRDPARTY/mbedtls/library/md.c", + "$LITEOSTHIRDPARTY/mbedtls/library/md2.c", + "$LITEOSTHIRDPARTY/mbedtls/library/md4.c", + "$LITEOSTHIRDPARTY/mbedtls/library/md5.c", + "$LITEOSTHIRDPARTY/mbedtls/library/md_wrap.c", + "$LITEOSTHIRDPARTY/mbedtls/library/memory_buffer_alloc.c", + "$LITEOSTHIRDPARTY/mbedtls/library/net_sockets.c", + "$LITEOSTHIRDPARTY/mbedtls/library/nist_kw.c", + "$LITEOSTHIRDPARTY/mbedtls/library/oid.c", + "$LITEOSTHIRDPARTY/mbedtls/library/padlock.c", + "$LITEOSTHIRDPARTY/mbedtls/library/pem.c", + "$LITEOSTHIRDPARTY/mbedtls/library/pk.c", + "$LITEOSTHIRDPARTY/mbedtls/library/pk_wrap.c", + "$LITEOSTHIRDPARTY/mbedtls/library/pkcs11.c", + "$LITEOSTHIRDPARTY/mbedtls/library/pkcs12.c", + "$LITEOSTHIRDPARTY/mbedtls/library/pkcs5.c", + "$LITEOSTHIRDPARTY/mbedtls/library/pkparse.c", + "$LITEOSTHIRDPARTY/mbedtls/library/pkwrite.c", + "$LITEOSTHIRDPARTY/mbedtls/library/platform.c", + "$LITEOSTHIRDPARTY/mbedtls/library/platform_util.c", + "$LITEOSTHIRDPARTY/mbedtls/library/poly1305.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ripemd160.c", + "$LITEOSTHIRDPARTY/mbedtls/library/rsa.c", + "$LITEOSTHIRDPARTY/mbedtls/library/rsa_internal.c", + "$LITEOSTHIRDPARTY/mbedtls/library/sha1.c", + "$LITEOSTHIRDPARTY/mbedtls/library/sha256.c", + "$LITEOSTHIRDPARTY/mbedtls/library/sha512.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ssl_cache.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ssl_ciphersuites.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ssl_cli.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ssl_cookie.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ssl_srv.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ssl_ticket.c", + "$LITEOSTHIRDPARTY/mbedtls/library/ssl_tls.c", + "$LITEOSTHIRDPARTY/mbedtls/library/threading.c", + "$LITEOSTHIRDPARTY/mbedtls/library/timing.c", + "$LITEOSTHIRDPARTY/mbedtls/library/version.c", + "$LITEOSTHIRDPARTY/mbedtls/library/version_features.c", + "$LITEOSTHIRDPARTY/mbedtls/library/x509.c", + "$LITEOSTHIRDPARTY/mbedtls/library/x509_create.c", + "$LITEOSTHIRDPARTY/mbedtls/library/x509_crl.c", + "$LITEOSTHIRDPARTY/mbedtls/library/x509_crt.c", + "$LITEOSTHIRDPARTY/mbedtls/library/x509_csr.c", + "$LITEOSTHIRDPARTY/mbedtls/library/x509write_crt.c", + "$LITEOSTHIRDPARTY/mbedtls/library/x509write_csr.c", + "$LITEOSTHIRDPARTY/mbedtls/library/xtea.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "$LITEOSTHIRDPARTY/mbedtls/include" ] +} diff --git a/lib/libscrew/BUILD.gn b/lib/libscrew/BUILD.gn new file mode 100644 index 00000000..87b4cae6 --- /dev/null +++ b/lib/libscrew/BUILD.gn @@ -0,0 +1,46 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/los_crc32.c", + "src/los_rbtree.c", + ] + + sources += [ "$LITEOSTHIRDPARTY/FreeBSD/sys/libkern/crc32.c" ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/lib/libsec/BUILD.gn b/lib/libsec/BUILD.gn new file mode 100644 index 00000000..f93a7652 --- /dev/null +++ b/lib/libsec/BUILD.gn @@ -0,0 +1,83 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_LIB_LIBC) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "$LITEOSTHIRDPARTY/bounds_checking_function/src/fscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/fwscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/gets_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/memcpy_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/memmove_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/memset_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/scanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/securecutil.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/secureinput_a.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/secureinput_w.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/secureprintoutput_a.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/secureprintoutput_w.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/snprintf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/sprintf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/sscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/strcat_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/strcpy_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/strncat_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/strncpy_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/strtok_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/swprintf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/swscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/vfscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/vfwscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/vscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/vsnprintf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/vsprintf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/vsscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/vswprintf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/vswscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/vwscanf_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/wcscat_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/wcscpy_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/wcsncat_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/wcsncpy_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/wcstok_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/wmemcpy_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/wmemmove_s.c", + "$LITEOSTHIRDPARTY/bounds_checking_function/src/wscanf_s.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "$LITEOSTHIRDPARTY/bounds_checking_function/include" ] + defines = [ "SECUREC_IN_KERNEL=0" ] +} diff --git a/lib/zlib/BUILD.gn b/lib/zlib/BUILD.gn new file mode 100644 index 00000000..5b75164e --- /dev/null +++ b/lib/zlib/BUILD.gn @@ -0,0 +1,62 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_LIB_ZLIB) +module_name = "z" +kernel_module(module_name) { + sources = [ + "$LITEOSTHIRDPARTY/zlib/adler32.c", + "$LITEOSTHIRDPARTY/zlib/compress.c", + "$LITEOSTHIRDPARTY/zlib/crc32.c", + "$LITEOSTHIRDPARTY/zlib/deflate.c", + "$LITEOSTHIRDPARTY/zlib/gzclose.c", + "$LITEOSTHIRDPARTY/zlib/gzlib.c", + "$LITEOSTHIRDPARTY/zlib/gzread.c", + "$LITEOSTHIRDPARTY/zlib/gzwrite.c", + "$LITEOSTHIRDPARTY/zlib/infback.c", + "$LITEOSTHIRDPARTY/zlib/inffast.c", + "$LITEOSTHIRDPARTY/zlib/inflate.c", + "$LITEOSTHIRDPARTY/zlib/inftrees.c", + "$LITEOSTHIRDPARTY/zlib/trees.c", + "$LITEOSTHIRDPARTY/zlib/uncompr.c", + "$LITEOSTHIRDPARTY/zlib/zutil.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "$LITEOSTHIRDPARTY/zlib" ] +} + +group("zlib") { + public_deps = [ ":$module_name" ] +} diff --git a/liteos.gni b/liteos.gni new file mode 100644 index 00000000..5e2e723c --- /dev/null +++ b/liteos.gni @@ -0,0 +1,63 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("$root_out_dir/config.gni") + +LITEOSTOPDIR = "//kernel/liteos_a" +LITEOSTHIRDPARTY = "//third_party" +HDFTOPDIR = "//drivers/adapter/khdf/liteos" + +template("kernel_module") { + if (defined(invoker.module_switch) && !invoker.module_switch) { + group(target_name) { + not_needed(invoker, "*") + } + } else { + static_library(target_name) { + forward_variables_from(invoker, "*") + } + } +} + +template("config") { + config(target_name) { + if (defined(invoker.module_switch) && !invoker.module_switch && target_name == "public") { + not_needed(invoker, "*") + } else { + forward_variables_from(invoker, "*") + } + } +} + +set_defaults("kernel_module") { + configs = [ + "$LITEOSTOPDIR:public", + "$LITEOSTOPDIR:los_config", + ] +} diff --git a/net/BUILD.gn b/net/BUILD.gn new file mode 100644 index 00000000..9dcb78a2 --- /dev/null +++ b/net/BUILD.gn @@ -0,0 +1,44 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +group("net") { + deps = [ + "lwip-2.1", + "telnet", + ] +} + +config("public") { + configs = [ + "lwip-2.1:public", + "telnet:public", + ] +} diff --git a/net/lwip-2.1/BUILD.gn b/net/lwip-2.1/BUILD.gn new file mode 100644 index 00000000..f4009b22 --- /dev/null +++ b/net/lwip-2.1/BUILD.gn @@ -0,0 +1,63 @@ +# Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") +import("$LITEOSTHIRDPARTY/lwip/lwip.gni") +import("lwip_porting.gni") + +module_switch = defined(LOSCFG_NET_LWIP_SACK_2_1) +module_name = "lwip" +kernel_module(module_name) { + include_dirs = [ "$LWIP_PORTING_DIR/enhancement/include" ] + + sources = LWIP_PORTING_FILES + LWIPNOAPPSFILES + + sources -= [ + "$LWIPDIR/api/sockets.c", + "$LWIPDIR/core/ipv4/dhcp.c", + "$LWIPDIR/core/ipv4/etharp.c", + ] + + public_configs = [ ":public" ] + + defines = [ + "__LWIP__", + "LWIP_NOASSERT", + "_BSD_SOURCE=1", + ] +} + +config("public") { + include_dirs = [ "../mac" ] + include_dirs += LWIP_PORTING_INCLUDE_DIRS + include_dirs += LWIP_INCLUDE_DIRS +} + +group("lwip-2.1") { + public_deps = [ ":$module_name" ] +} diff --git a/net/lwip-2.1/lwip_porting.gni b/net/lwip-2.1/lwip_porting.gni new file mode 100644 index 00000000..1f373670 --- /dev/null +++ b/net/lwip-2.1/lwip_porting.gni @@ -0,0 +1,40 @@ +# Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +LWIP_PORTING_DIR = get_path_info(".", "abspath") + +LWIP_PORTING_INCLUDE_DIRS = [ "$LWIP_PORTING_DIR/porting/include" ] + +LWIP_PORTING_FILES = [ + "$LWIP_PORTING_DIR/porting/src/driverif.c", + "$LWIP_PORTING_DIR/porting/src/sockets.c", + "$LWIP_PORTING_DIR/porting/src/sys_arch.c", + "$LWIP_PORTING_DIR/enhancement/src/api_shell.c", + "$LWIP_PORTING_DIR/enhancement/src/fixme.c", + "$LWIP_PORTING_DIR/enhancement/src/dhcps.c", +] diff --git a/net/telnet/BUILD.gn b/net/telnet/BUILD.gn new file mode 100644 index 00000000..0601c60a --- /dev/null +++ b/net/telnet/BUILD.gn @@ -0,0 +1,45 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_NET_TELNET) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "src/telnet_dev.c", + "src/telnet_loop.c", + ] + + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] +} diff --git a/platform/BUILD.gn b/platform/BUILD.gn new file mode 100644 index 00000000..13c15ef1 --- /dev/null +++ b/platform/BUILD.gn @@ -0,0 +1,101 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +cmd = "if [ -f " + rebase_path("//$LOSCFG_BOARD_CONFIG_PATH/BUILD.gn") + " ]; then echo true; else echo false; fi" +HAVE_BOARD_CONFIG = exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value") + +module_name = "bsp" +kernel_module(module_name) { + sources = [ "main.c" ] + + sources += [ + "hwi_shell.c", + "los_cir_buf.c", + "los_config.c", + "los_excinfo.c", + "los_init.c", + "los_magickey.c", + "los_printf.c", + "los_seq_buf.c", + ] + + if (defined(LOSCFG_FS_VFS)) { + sources += [ + "console.c", + "virtual_serial.c", + ] + } + + if (defined(LOSCFG_BASE_CORE_HILOG)) { + sources += [ "los_hilog.c" ] + } + + public_configs = [ ":public" ] +} + +group("platform") { + public_deps = [ ":$module_name" ] + deps = [ ":board.ld" ] + if (HAVE_BOARD_CONFIG) { + deps += [ "//$LOSCFG_BOARD_CONFIG_PATH" ] + } +} + +config("public") { + include_dirs = [ + ".", + ] + if (HAVE_BOARD_CONFIG) { + configs = [ "//$LOSCFG_BOARD_CONFIG_PATH:public" ] + } +} + +source_set("board") { + sources = [ "board.ld.S" ] + + configs = [] + configs += [ + "$LITEOSTOPDIR:los_config", + "$LITEOSTOPDIR/kernel/base:public", + ":public", + ] + + asmflags = [ + "-P", + "-E", + ] +} + +copy("board.ld") { + deps = [ ":board" ] + sources = [ "$target_out_dir/board.board.ld.o" ] + outputs = [ "$root_out_dir/board.ld" ] +} diff --git a/platform/Makefile b/platform/Makefile index 27934023..94f9dd24 100644 --- a/platform/Makefile +++ b/platform/Makefile @@ -36,13 +36,12 @@ LOCAL_SRCS = $(wildcard ./main.c) LOCAL_INCLUDE += -I $(LITEOSTOPDIR)/compat/posix/src \ -I $(LITEOSTOPDIR)/bsd/dev/random -LOCAL_SRCS += $(wildcard ../kernel/common/*.c) -LOCAL_SRCS := $(filter-out ../kernel/common/los_rootfs.c ../kernel/common/los_bootargs.c, $(LOCAL_SRCS)) +LOCAL_SRCS += $(wildcard *.c) ifneq ($(LOSCFG_FS_VFS), y) -LOCAL_SRCS := $(filter-out ../kernel/common/console.c ../kernel/common/virtual_serial.c, $(LOCAL_SRCS)) +LOCAL_SRCS := $(filter-out console.c virtual_serial.c, $(LOCAL_SRCS)) endif ifneq ($(LOSCFG_BASE_CORE_HILOG), y) -LOCAL_SRCS := $(filter-out ../kernel/common/los_hilog.c, $(LOCAL_SRCS)) +LOCAL_SRCS := $(filter-out los_hilog.c, $(LOCAL_SRCS)) endif ifeq ($(LOSCFG_KERNEL_TICKLESS), y) diff --git a/platform/bsp.mk b/platform/bsp.mk index c937f81a..0d1fe022 100644 --- a/platform/bsp.mk +++ b/platform/bsp.mk @@ -49,7 +49,8 @@ PLATFORM_BSP_BASE := $(LITEOSTOPDIR)/platform PLATFORM_INCLUDE := -I $(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH) \ -I $(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH)/include \ - -I $(PLATFORM_BSP_BASE)/../kernel/common \ + -I $(PLATFORM_BSP_BASE)/../kernel/common/rootfs \ + -I $(PLATFORM_BSP_BASE) \ -I $(PLATFORM_BSP_BASE)/../../../drivers/liteos/platform/pm \ -I $(PLATFORM_BSP_BASE)/hw/include \ -I $(PLATFORM_BSP_BASE)/include diff --git a/kernel/common/console.c b/platform/console.c similarity index 100% rename from kernel/common/console.c rename to platform/console.c diff --git a/kernel/common/console.h b/platform/console.h similarity index 100% rename from kernel/common/console.h rename to platform/console.h diff --git a/kernel/common/hwi_shell.c b/platform/hwi_shell.c similarity index 100% rename from kernel/common/hwi_shell.c rename to platform/hwi_shell.c diff --git a/kernel/common/los_builddef.h b/platform/los_builddef.h similarity index 100% rename from kernel/common/los_builddef.h rename to platform/los_builddef.h diff --git a/kernel/common/los_cir_buf.c b/platform/los_cir_buf.c similarity index 100% rename from kernel/common/los_cir_buf.c rename to platform/los_cir_buf.c diff --git a/kernel/common/los_cir_buf_pri.h b/platform/los_cir_buf_pri.h similarity index 100% rename from kernel/common/los_cir_buf_pri.h rename to platform/los_cir_buf_pri.h diff --git a/kernel/common/los_config.c b/platform/los_config.c similarity index 100% rename from kernel/common/los_config.c rename to platform/los_config.c diff --git a/kernel/common/los_config.h b/platform/los_config.h similarity index 99% rename from kernel/common/los_config.h rename to platform/los_config.h index 3ce31935..36c3c4d5 100644 --- a/kernel/common/los_config.h +++ b/platform/los_config.h @@ -115,7 +115,7 @@ extern UINT32 __heap_end; * @ingroup los_config * External configuration item for timer tailoring */ -#ifndef LOSCFG_BASE_CORE_TICK_HW_TIME +#if defined(LOSCFG_BASE_CORE_TICK_HW_TIME) && (LOSCFG_BASE_CORE_TICK_HW_TIME == 0) #undef LOSCFG_BASE_CORE_TICK_HW_TIME #endif /****************************** Hardware interrupt module configuration ******************************/ diff --git a/kernel/common/los_excinfo.c b/platform/los_excinfo.c similarity index 100% rename from kernel/common/los_excinfo.c rename to platform/los_excinfo.c diff --git a/kernel/common/los_excinfo_pri.h b/platform/los_excinfo_pri.h similarity index 100% rename from kernel/common/los_excinfo_pri.h rename to platform/los_excinfo_pri.h diff --git a/kernel/common/los_hilog.c b/platform/los_hilog.c similarity index 100% rename from kernel/common/los_hilog.c rename to platform/los_hilog.c diff --git a/kernel/common/los_hilog.h b/platform/los_hilog.h similarity index 100% rename from kernel/common/los_hilog.h rename to platform/los_hilog.h diff --git a/kernel/common/los_init.c b/platform/los_init.c similarity index 100% rename from kernel/common/los_init.c rename to platform/los_init.c diff --git a/kernel/common/los_init.h b/platform/los_init.h similarity index 100% rename from kernel/common/los_init.h rename to platform/los_init.h diff --git a/kernel/common/los_init_info.h b/platform/los_init_info.h similarity index 100% rename from kernel/common/los_init_info.h rename to platform/los_init_info.h diff --git a/kernel/common/los_init_pri.h b/platform/los_init_pri.h similarity index 100% rename from kernel/common/los_init_pri.h rename to platform/los_init_pri.h diff --git a/kernel/common/los_magickey.c b/platform/los_magickey.c similarity index 100% rename from kernel/common/los_magickey.c rename to platform/los_magickey.c diff --git a/kernel/common/los_magickey.h b/platform/los_magickey.h similarity index 100% rename from kernel/common/los_magickey.h rename to platform/los_magickey.h diff --git a/kernel/common/los_printf.c b/platform/los_printf.c similarity index 100% rename from kernel/common/los_printf.c rename to platform/los_printf.c diff --git a/kernel/common/los_seq_buf.c b/platform/los_seq_buf.c similarity index 100% rename from kernel/common/los_seq_buf.c rename to platform/los_seq_buf.c diff --git a/kernel/common/los_seq_buf.h b/platform/los_seq_buf.h similarity index 100% rename from kernel/common/los_seq_buf.h rename to platform/los_seq_buf.h diff --git a/kernel/common/los_timer_pri.h b/platform/los_timer_pri.h similarity index 100% rename from kernel/common/los_timer_pri.h rename to platform/los_timer_pri.h diff --git a/kernel/common/sys_config.h b/platform/sys_config.h similarity index 100% rename from kernel/common/sys_config.h rename to platform/sys_config.h diff --git a/kernel/common/virtual_serial.c b/platform/virtual_serial.c similarity index 100% rename from kernel/common/virtual_serial.c rename to platform/virtual_serial.c diff --git a/kernel/common/virtual_serial.h b/platform/virtual_serial.h similarity index 100% rename from kernel/common/virtual_serial.h rename to platform/virtual_serial.h diff --git a/security/BUILD.gn b/security/BUILD.gn new file mode 100644 index 00000000..1a7f6f3f --- /dev/null +++ b/security/BUILD.gn @@ -0,0 +1,44 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +group("security") { + deps = [ + "cap", + "vid", + ] +} + +config("public") { + configs = [ + "cap:public", + "vid:public", + ] +} diff --git a/security/cap/BUILD.gn b/security/cap/BUILD.gn new file mode 100644 index 00000000..a4e95342 --- /dev/null +++ b/security/cap/BUILD.gn @@ -0,0 +1,41 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_SECURITY_CAPABILITY) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "capability.c" ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "." ] +} diff --git a/security/vid/BUILD.gn b/security/vid/BUILD.gn new file mode 100644 index 00000000..7b53edc7 --- /dev/null +++ b/security/vid/BUILD.gn @@ -0,0 +1,41 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_SECURITY_VID) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ "vid.c" ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "." ] +} diff --git a/shell/BUILD.gn b/shell/BUILD.gn index 6e8dc0bb..c3b8e522 100644 --- a/shell/BUILD.gn +++ b/shell/BUILD.gn @@ -25,19 +25,28 @@ # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -import("//build/lite/config/component/lite_component.gni") +import("//kernel/liteos_a/liteos.gni") -lite_component("shell") { - version = "1.0.0" - dependences = [ - "fs:^1.0.0", - "kernel:^1.0.0", +module_switch = defined(LOSCFG_SHELL) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "full/src/base/shcmd.c", + "full/src/base/shcmdparse.c", + "full/src/base/shell_lk.c", + "full/src/base/shmsg.c", + "full/src/base/show.c", + "full/src/cmds/date_shell.c", + "full/src/cmds/dmesg.c", + "full/src/cmds/shell_shellcmd.c", + "full/src/cmds/watch_shell.c", ] - features = [] - if (LOSCFG_SHELL) { - features += [ "full:shell_full" ] - } + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "full/include" ] } diff --git a/syscall/BUILD.gn b/syscall/BUILD.gn new file mode 100644 index 00000000..b3f2b3e9 --- /dev/null +++ b/syscall/BUILD.gn @@ -0,0 +1,46 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +module_switch = defined(LOSCFG_KERNEL_SYSCALL) +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "fs_syscall.c", + "ipc_syscall.c", + "los_syscall.c", + "misc_syscall.c", + "net_syscall.c", + "process_syscall.c", + "syscall_pub.c", + "time_syscall.c", + "vm_syscall.c", + ] +} diff --git a/testsuites/BUILD.gn b/testsuites/BUILD.gn new file mode 100644 index 00000000..17bddbfe --- /dev/null +++ b/testsuites/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import("//kernel/liteos_a/liteos.gni") + +group("testsuites") { + deps = [ + #"kernel", + "unittest", + ] +} diff --git a/tools/build/mk/los_config.mk b/tools/build/mk/los_config.mk index b332f723..840f64b2 100644 --- a/tools/build/mk/los_config.mk +++ b/tools/build/mk/los_config.mk @@ -27,7 +27,8 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --include $(LITEOSTOPDIR)/.config +CONFIG_FILE ?= $(LITEOSTOPDIR)/.config +-include $(CONFIG_FILE) ifeq ($(LOSCFG_COMPILER_HIMIX_32), y) CROSS_COMPILE := arm-linux-ohoseabi- else ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) @@ -121,8 +122,8 @@ CXX_PATH = $(LITEOSTOPDIR)/lib/cxxstl JFFS_PATH = $(LITEOSTOPDIR)/fs/jffs2 LITEOS_SCRIPTPATH ?= $(LITEOSTOPDIR)/tools/scripts LITEOS_LIB_BIGODIR = $(OUT)/lib/obj -LITEOS_MENUCONFIG_H = $(LITEOSTOPDIR)/config.h -LOSCFG_ENTRY_SRC = $(LITEOSTOPDIR)/kernel/common/los_config.c +LITEOS_MENUCONFIG_H ?= $(LITEOSTOPDIR)/config.h +LOSCFG_ENTRY_SRC = $(LITEOSTOPDIR)/platform/los_config.c ### include variable MODULE = $(MK_PATH)/module.mk @@ -158,7 +159,7 @@ include $(LITEOSTOPDIR)/platform/bsp.mk ifeq ($(LOSCFG_PLATFORM_ROOTFS), y) LITEOS_BASELIB += -lrootfs - LIB_SUBDIRS += $(LITEOSTOPDIR)/kernel/common + LIB_SUBDIRS += $(LITEOSTOPDIR)/kernel/common/rootfs endif ifeq ($(LOSCFG_PLATFORM_PATCHFS), y) @@ -703,7 +704,8 @@ endif # temporary LITEOS_PLATFORM_INCLUDE += \ -I $(LITEOSTOPDIR)/kernel/base/include \ - -I $(LITEOSTOPDIR)/kernel/extended/include + -I $(LITEOSTOPDIR)/kernel/extended/cpup \ + -I $(LITEOSTOPDIR)/kernel/extended/trace LITEOS_CXXINCLUDE += \ $(LITEOS_NET_INCLUDE) \ -- GitLab