diff --git a/BUILD.gn b/BUILD.gn index 073d508e..86e1f12c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -49,23 +49,19 @@ declare_args() { liteos_config_file = "${ohos_build_type}${tee}.config" } -liteos_config_file = rebase_path(liteos_config_file, "", "$product_path/kernel_configs") +liteos_config_file = + rebase_path(liteos_config_file, "", "$product_path/kernel_configs") print("liteos_config_file:", liteos_config_file) 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", - ], "", [ liteos_config_file ]) + [ "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" ], + "", + [ liteos_config_file ]) import("liteos.gni") @@ -113,7 +109,7 @@ config("arch_config") { ldflags = cflags if (defined(LOSCFG_ARCH_ARM_AARCH32)) { if (!defined(LOSCFG_COMPILER_CLANG_LLVM)) { - cflags += ["-mthumb-interwork"] + cflags += [ "-mthumb-interwork" ] } } if (defined(LOSCFG_THUMB)) { @@ -127,7 +123,9 @@ config("arch_config") { } config("stdinc_config") { - std_include = exec_script("//build/lite/run_shell_cmd.py", [ "$cc -print-file-name=include" ], "trim string") + std_include = exec_script("//build/lite/run_shell_cmd.py", + [ "$cc -print-file-name=include" ], + "trim string") cflags = [ "-isystem", std_include, @@ -251,7 +249,7 @@ config("los_config") { } executable("liteos") { - configs = [] # clear default configs + configs = [] # clear default configs configs += [ ":arch_config" ] configs += [ ":public" ] @@ -263,13 +261,17 @@ executable("liteos") { "-Wl,--no-eh-frame-hdr", ] - libgcc = exec_script("//build/lite/run_shell_cmd.py", [ "$cc -print-libgcc-file-name" ], "trim string") + libgcc = exec_script("//build/lite/run_shell_cmd.py", + [ "$cc -print-libgcc-file-name" ], + "trim string") libs = [ libgcc ] if (defined(LOSCFG_COMPILER_CLANG_LLVM)) { - ldflags += [ "-Wl,-T" + rebase_path("tools/build/liteos_llvm.ld", root_build_dir) ] + ldflags += + [ "-Wl,-T" + rebase_path("tools/build/liteos_llvm.ld", root_build_dir) ] inputs = [ "tools/build/liteos_llvm.ld" ] } else { - ldflags += [ "-Wl,-T" + rebase_path("tools/build/liteos.ld", root_build_dir) ] + ldflags += + [ "-Wl,-T" + rebase_path("tools/build/liteos.ld", root_build_dir) ] ldflags += [ "-Wl,-nostartfiles" ] inputs = [ "tools/build/liteos.ld" ] } @@ -279,8 +281,8 @@ executable("liteos") { output_dir = target_out_dir deps = [ - "platform:copy_board.ld", ":modules", + "platform:copy_board.ld", ] } @@ -298,14 +300,14 @@ build_ext_component("build_kernel_image") { objdump = "${compile_prefix}objdump$toolchain_cmd_suffix" command = "$objcopy -O binary $liteos_name $liteos_name.bin" - command += " && sh -c '$objdump -t $liteos_name | sort >$liteos_name.sym.sorted'" + command += + " && sh -c '$objdump -t $liteos_name | sort >$liteos_name.sym.sorted'" command += " && sh -c '$objdump -d $liteos_name >$liteos_name.asm'" } config("public") { configs = [ "arch:public", - "platform:public", "kernel:public", "compat:public", "bsd:public", @@ -337,15 +339,14 @@ group("modules") { "kernel", "lib", "net", - "platform", "security", "shell", "syscall", ] deps += [ - HDFTOPDIR, "//drivers/liteos", + HDFTOPDIR, ] if (HAVE_DEVICE_SDK) { diff --git a/Kconfig b/Kconfig index 0e985d87..1ba7afc9 100644 --- a/Kconfig +++ b/Kconfig @@ -94,15 +94,6 @@ source "platform/Kconfig" ######################### config options of cpu arch ################ source "arch/Kconfig" -######################### config options of rootfs ##################### -source "kernel/common/rootfs/Kconfig" -######################### config options of patchfs ##################### -source "kernel/common/patchfs/Kconfig" -######################### config options of blackbox ##################### -source "kernel/common/blackbox/Kconfig" -######################### config options of hidumper ##################### -source "kernel/common/hidumper/Kconfig" - config QUICK_START bool "Enable QUICK_START" default n @@ -123,36 +114,7 @@ endmenu ######################## config options of filesystem ################## menu "FileSystem" -source "fs/vfs/Kconfig" -source "fs/fat/Kconfig" -source "fs/ramfs/Kconfig" -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 - depends on FS_VFS - help - Answer Y to add enable read buffer Option. - -config MAX_VNODE_SIZE - int "Vnode max number" - range 0 512 - default 512 - depends on FS_VFS - help - vnode number, range from 0 to 512. - -config MAX_PATH_CACHE_SIZE - int "PathCache max number" - range 0 1024 - default 512 - depends on FS_VFS - help - pathCache number, range from 0 to 1024. +source "fs/Kconfig" endmenu ######################## config options of net ############################ @@ -324,29 +286,10 @@ endmenu ######################## config options os drivers ######################## menu "Driver" -config DRIVERS - bool "Enable Driver" - default y - help - Answer Y to enable LiteOS support driver. - -source "bsd/dev/usb/Kconfig" -source "../../drivers/adapter/khdf/liteos/Kconfig" - -# Device driver Kconfig import -source "$(DEVICE_PATH)/drivers/Kconfig" - -source "drivers/char/mem/Kconfig" -source "drivers/char/quickstart/Kconfig" -source "drivers/char/random/Kconfig" -source "drivers/char/video/Kconfig" -source "drivers/char/trace/Kconfig" - -source "../../drivers/liteos/tzdriver/Kconfig" -source "../../drivers/liteos/hievent/Kconfig" - +source "drivers/Kconfig" endmenu +######################## config options os security ####################### menu "Security" source "security/Kconfig" endmenu diff --git a/arch/arm/arm/Makefile b/arch/arm/arm/Makefile index 83a241a2..f12ec1cc 100644 --- a/arch/arm/arm/Makefile +++ b/arch/arm/arm/Makefile @@ -32,11 +32,6 @@ include $(LITEOSTOPDIR)/config.mk MODULE_NAME := $(LOSCFG_ARCH_CPU) LOCAL_SRCS := $(wildcard src/*.c) $(wildcard src/*.S) -LOCAL_INCLUDE := \ - -I $(LITEOSTOPDIR)/kernel/base/include \ - -I $(LITEOSTOPDIR)/kernel/extended/include \ - -I $(LITEOSTOPDIR)/kernel/extended/dynload/include \ - -I $(LITEOSTOPDIR)/arch/arm/arm/include \ ifeq ($(LOSCFG_ARCH_ARM_VER), "armv7-a") LOCAL_SRCS += $(wildcard src/armv7a/*.S) @@ -48,7 +43,7 @@ else LOCAL_SRCS += src/startup/reset_vector_up.S endif -LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS) +LOCAL_FLAGS := $(LITEOS_GCOV_OPTS) AS_OBJS_LIBC_FLAGS = -D__ASSEMBLY__ # linux style macros diff --git a/arch/arm/gic/Makefile b/arch/arm/gic/Makefile index 76218e41..376cfa2e 100644 --- a/arch/arm/gic/Makefile +++ b/arch/arm/gic/Makefile @@ -31,18 +31,10 @@ include $(LITEOSTOPDIR)/config.mk MODULE_NAME := $(notdir $(shell pwd)) -# LOCAL_SRCS := $(wildcard *.c) - ifeq ($(LOSCFG_ARCH_GIC_V2), y) LOCAL_SRCS := gic_v2.c else ifeq ($(LOSCFG_ARCH_GIC_V3), y) LOCAL_SRCS := gic_v3.c endif -LOCAL_INCLUDE := \ - -I $(LITEOSTOPDIR)/kernel/base/include \ - -I $(LITEOSTOPDIR)/arch/arm/include \ - -I $(LITEOSTOPDIR)/arch/arm/arm/src/include \ - -LOCAL_FLAGS := $(LOCAL_INCLUDE) include $(MODULE) diff --git a/bsd/Makefile b/bsd/Makefile index e8544349..33101c2c 100644 --- a/bsd/Makefile +++ b/bsd/Makefile @@ -41,14 +41,8 @@ LOCAL_SRCS += $(wildcard crypto/rijndael/*.c) \ $(wildcard crypto/sha2/*.c) \ $(wildcard dev/random/*.c) \ $(wildcard libkern/*.c) - endif -LOCAL_INCLUDE := \ - -I $(LITEOSTOPDIR)/kernel/base/include \ - -I $(LITEOSTOPDIR)/bsd \ - -I $(LITEOSTOPDIR)/bsd/kern \ - -LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS) +LOCAL_FLAGS := $(LITEOS_GCOV_OPTS) include $(MODULE) diff --git a/bsd/compat/linuxkpi/Makefile b/bsd/compat/linuxkpi/Makefile index 1b270ae1..1eb41c16 100644 --- a/bsd/compat/linuxkpi/Makefile +++ b/bsd/compat/linuxkpi/Makefile @@ -37,10 +37,6 @@ ifneq ($(LOSCFG_HRTIMER_ENABLE), y) LOCAL_SRCS := $(filter-out src/linux_hrtimer.c, $(LOCAL_SRCS)) endif -LOCAL_INCLUDE := \ - -I $(LITEOSTOPDIR)/kernel/base/include \ - -I $(LITEOSTOPDIR)/bsd/compat/linuxkpi/include - -LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS) +LOCAL_FLAGS := $(LITEOS_GCOV_OPTS) include $(MODULE) diff --git a/bsd/dev/usb/BUILD.gn b/bsd/dev/usb/BUILD.gn index e31ba650..205a8f51 100644 --- a/bsd/dev/usb/BUILD.gn +++ b/bsd/dev/usb/BUILD.gn @@ -137,14 +137,13 @@ kernel_module(module_name) { ] } - configs += [ - "$HDFTOPDIR:hdf_config" - ] + configs += [ "$HDFTOPDIR:hdf_config" ] public_configs = [ ":public" ] } config("public") { + defines = [ "USB_DEBUG_VAR=5" ] include_dirs = [ "." ] include_dirs += [ "$LITEOSTHIRDPARTY/FreeBSD/sys/dev/evdev" ] } diff --git a/compat/posix/Makefile b/compat/posix/Makefile index c9cd39b0..85c4fedb 100644 --- a/compat/posix/Makefile +++ b/compat/posix/Makefile @@ -33,9 +33,7 @@ MODULE_NAME := $(notdir $(shell pwd)) LOCAL_SRCS := $(wildcard src/*.c) -LOCAL_INCLUDE := \ - -I $(LITEOSTOPDIR)/compat/posix/src \ - -I $(LITEOSTOPDIR)/kernel/base/include \ +LOCAL_INCLUDE := -I $(LITEOSTOPDIR)/compat/posix/src LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS) diff --git a/compat/posix/include/time_posix.h b/compat/posix/include/time_posix.h index df5b3dd7..3f19bde8 100644 --- a/compat/posix/include/time_posix.h +++ b/compat/posix/include/time_posix.h @@ -86,6 +86,7 @@ STATIC INLINE VOID OsTick2TimeSpec(struct timespec *tp, UINT32 tick) } int OsTimerCreate(clockid_t, struct ksigevent *__restrict, timer_t *__restrict); +void OsAdjTime(void); #ifdef __cplusplus #if __cplusplus diff --git a/drivers/Kconfig b/drivers/Kconfig new file mode 100644 index 00000000..9810a8e6 --- /dev/null +++ b/drivers/Kconfig @@ -0,0 +1,20 @@ +config DRIVERS + bool "Enable Driver" + default y + help + Answer Y to enable LiteOS support driver. + +source "bsd/dev/usb/Kconfig" +source "../../drivers/adapter/khdf/liteos/Kconfig" + +# Device driver Kconfig import +source "$(DEVICE_PATH)/drivers/Kconfig" + +source "drivers/char/mem/Kconfig" +source "drivers/char/quickstart/Kconfig" +source "drivers/char/random/Kconfig" +source "drivers/char/video/Kconfig" +source "drivers/char/trace/Kconfig" + +source "../../drivers/liteos/tzdriver/Kconfig" +source "../../drivers/liteos/hievent/Kconfig" diff --git a/drivers/block/disk/Makefile b/drivers/block/disk/Makefile index 1a2ddf61..e743b7d5 100644 --- a/drivers/block/disk/Makefile +++ b/drivers/block/disk/Makefile @@ -33,8 +33,6 @@ MODULE_NAME := $(notdir $(shell pwd)) LOCAL_SRCS := $(wildcard src/*.c) -LOCAL_INCLUDE := \ - -LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS) +LOCAL_FLAGS := $(LITEOS_GCOV_OPTS) include $(MODULE) diff --git a/drivers/char/bch/Makefile b/drivers/char/bch/Makefile index 5b89f50f..76ebc566 100644 --- a/drivers/char/bch/Makefile +++ b/drivers/char/bch/Makefile @@ -34,8 +34,7 @@ MODULE_NAME := $(notdir $(shell pwd)) LOCAL_SRCS := $(wildcard $(LITEOSTHIRDPARTY)/NuttX/drivers/bch/*.c) LOCAL_INCLUDE := \ - -I $(LITEOSTHIRDPARTY)/NuttX/drivers/bch \ - -I $(LITEOSTOPDIR)/fs/include \ + -I $(LITEOSTHIRDPARTY)/NuttX/drivers/bch LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS) diff --git a/drivers/char/random/Makefile b/drivers/char/random/Makefile index edd03c4a..6f43d9ee 100644 --- a/drivers/char/random/Makefile +++ b/drivers/char/random/Makefile @@ -37,9 +37,4 @@ ifdef LOSCFG_HW_RANDOM_ENABLE LOCAL_SRCS += $(wildcard src/random_hw.c) endif -LOCAL_INCLUDE := -I $(LITEOSTOPDIR)/drivers/char/random/include \ - -I $(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH)/include - -LOCAL_FLAGS := $(LOCAL_INCLUDE) - include $(MODULE) diff --git a/fs/BUILD.gn b/fs/BUILD.gn index f148c269..26b27df3 100644 --- a/fs/BUILD.gn +++ b/fs/BUILD.gn @@ -35,9 +35,11 @@ group("fs") { "fat/virpart", "jffs2", "nfs", + "patchfs", "proc", "ramfs", "romfs", + "rootfs", "vfs", "vfs/bcache", "zpfs", @@ -52,5 +54,7 @@ config("public") { "fat:public", "fat/virpart:public", "proc:public", + "patchfs:public", + "rootfs:public", ] } diff --git a/fs/Kconfig b/fs/Kconfig new file mode 100644 index 00000000..13deaebe --- /dev/null +++ b/fs/Kconfig @@ -0,0 +1,10 @@ +source "fs/vfs/Kconfig" +source "fs/fat/Kconfig" +source "fs/ramfs/Kconfig" +source "fs/romfs/Kconfig" +source "fs/nfs/Kconfig" +source "fs/proc/Kconfig" +source "fs/jffs2/Kconfig" +source "fs/rootfs/Kconfig" +source "fs/patchfs/Kconfig" +source "fs/zpfs/Kconfig" \ No newline at end of file diff --git a/kernel/common/patchfs/BUILD.gn b/fs/patchfs/BUILD.gn similarity index 100% rename from kernel/common/patchfs/BUILD.gn rename to fs/patchfs/BUILD.gn diff --git a/kernel/common/patchfs/Kconfig b/fs/patchfs/Kconfig similarity index 100% rename from kernel/common/patchfs/Kconfig rename to fs/patchfs/Kconfig diff --git a/kernel/common/patchfs/Makefile b/fs/patchfs/Makefile similarity index 100% rename from kernel/common/patchfs/Makefile rename to fs/patchfs/Makefile diff --git a/kernel/common/patchfs/los_partition_utils.c b/fs/patchfs/los_partition_utils.c similarity index 100% rename from kernel/common/patchfs/los_partition_utils.c rename to fs/patchfs/los_partition_utils.c diff --git a/kernel/common/patchfs/los_partition_utils.h b/fs/patchfs/los_partition_utils.h similarity index 100% rename from kernel/common/patchfs/los_partition_utils.h rename to fs/patchfs/los_partition_utils.h diff --git a/kernel/common/patchfs/los_patchfs.c b/fs/patchfs/los_patchfs.c similarity index 100% rename from kernel/common/patchfs/los_patchfs.c rename to fs/patchfs/los_patchfs.c diff --git a/kernel/common/patchfs/los_patchfs.h b/fs/patchfs/los_patchfs.h similarity index 100% rename from kernel/common/patchfs/los_patchfs.h rename to fs/patchfs/los_patchfs.h diff --git a/kernel/common/rootfs/BUILD.gn b/fs/rootfs/BUILD.gn similarity index 100% rename from kernel/common/rootfs/BUILD.gn rename to fs/rootfs/BUILD.gn diff --git a/kernel/common/rootfs/Kconfig b/fs/rootfs/Kconfig similarity index 100% rename from kernel/common/rootfs/Kconfig rename to fs/rootfs/Kconfig diff --git a/kernel/common/rootfs/Makefile b/fs/rootfs/Makefile similarity index 100% rename from kernel/common/rootfs/Makefile rename to fs/rootfs/Makefile diff --git a/kernel/common/rootfs/los_bootargs.c b/fs/rootfs/los_bootargs.c similarity index 94% rename from kernel/common/rootfs/los_bootargs.c rename to fs/rootfs/los_bootargs.c index 3f54115c..82d02c22 100644 --- a/kernel/common/rootfs/los_bootargs.c +++ b/fs/rootfs/los_bootargs.c @@ -48,7 +48,7 @@ STATIC CHAR *g_cmdLine = NULL; STATIC UINT64 g_alignSize = 0; STATIC struct BootArgs g_bootArgs[MAX_ARGS_NUM] = {0}; -INT32 LOS_GetCmdLine() +INT32 LOS_GetCmdLine(VOID) { int ret; @@ -118,7 +118,7 @@ ERROUT: return LOS_NOK; } -VOID LOS_FreeCmdLine() +VOID LOS_FreeCmdLine(VOID) { if (g_cmdLine != NULL) { free(g_cmdLine); @@ -155,7 +155,7 @@ STATIC INT32 GetBootargs(CHAR **args) #endif } -INT32 LOS_ParseBootargs() +INT32 LOS_ParseBootargs(VOID) { INT32 idx = 0; INT32 ret; @@ -204,7 +204,7 @@ INT32 LOS_GetArgValue(CHAR *argName, CHAR **argValue) return LOS_NOK; } -UINT64 LOS_GetAlignsize() +UINT64 LOS_GetAlignsize(VOID) { return g_alignSize; } diff --git a/kernel/common/rootfs/los_bootargs.h b/fs/rootfs/los_bootargs.h similarity index 100% rename from kernel/common/rootfs/los_bootargs.h rename to fs/rootfs/los_bootargs.h diff --git a/kernel/common/rootfs/los_rootfs.c b/fs/rootfs/los_rootfs.c similarity index 96% rename from kernel/common/rootfs/los_rootfs.c rename to fs/rootfs/los_rootfs.c index 0c53cf5d..58cbce12 100644 --- a/kernel/common/rootfs/los_rootfs.c +++ b/fs/rootfs/los_rootfs.c @@ -321,7 +321,6 @@ STATIC INT32 MountPartitions(CHAR *fsType, UINT32 mountFlags) STATIC INT32 CheckValidation(UINT64 rootAddr, UINT64 rootSize, UINT64 userAddr, UINT64 userSize) { UINT64 alignSize = LOS_GetAlignsize(); - if (alignSize == 0) { return LOS_OK; } diff --git a/kernel/common/rootfs/los_rootfs.h b/fs/rootfs/los_rootfs.h similarity index 100% rename from kernel/common/rootfs/los_rootfs.h rename to fs/rootfs/los_rootfs.h diff --git a/fs/vfs/Kconfig b/fs/vfs/Kconfig index 05990b51..d81e15cd 100644 --- a/fs/vfs/Kconfig +++ b/fs/vfs/Kconfig @@ -18,3 +18,26 @@ config FILE_MODE depends on FS_VFS help Answer Y to enable LiteOS support file mode. + +config ENABLE_READ_BUFFER + bool "Enable read buffer Option" + default n + depends on FS_VFS + help + Answer Y to add enable read buffer Option. + +config MAX_VNODE_SIZE + int "Vnode max number" + range 0 512 + default 512 + depends on FS_VFS + help + vnode number, range from 0 to 512. + +config MAX_PATH_CACHE_SIZE + int "PathCache max number" + range 0 1024 + default 512 + depends on FS_VFS + help + pathCache number, range from 0 to 1024. \ No newline at end of file diff --git a/kernel/Kconfig b/kernel/Kconfig index 8c3f4cf7..c5564597 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -53,171 +53,7 @@ config KERNEL_SYSCALL help This option will enable syscall. -config KERNEL_EXTKERNEL - bool "Enable Extend Kernel" - default y - help - This option will enable extend Kernel of LiteOS. Extend kernel include - cppsupport, cpup, and dynload. You can select one or some - of them. - -config KERNEL_CPPSUPPORT - bool "C++ Support" - default y - depends on KERNEL_EXTKERNEL - help - If you wish to build LiteOS with support for C++. - -config KERNEL_CPUP - bool "Enable Cpup" - default y - depends on KERNEL_EXTKERNEL - help - If you wish to build LiteOS with support for cpup. - -config CPUP_INCLUDE_IRQ - bool "Enable Cpup include irq" - default y - depends on KERNEL_CPUP - help - If you wish to include irq usage for cpup. - -config KERNEL_DYNLOAD - bool "Enable Dynamic Load Feature" - default y - depends on KERNEL_EXTKERNEL && KERNEL_VM && KERNEL_SYSCALL - help - If you wish to build LiteOS with support for dynamic load. - -config KERNEL_PM - bool "Enable Power Management" - default y - depends on KERNEL_EXTKERNEL - help - If you wish to build LiteOS with support for power management. - -config ASLR - bool "Enable Address Space Layout Randomization" - default n - depends on KERNEL_DYNLOAD && HW_RANDOM_ENABLE - help - If you wish to enable ASLR for user aspace. - -config KERNEL_VDSO - bool "Enable VDSO Feature" - default n - depends on KERNEL_EXTKERNEL && KERNEL_VM && KERNEL_SYSCALL - help - If you wish to speed up some system calls. - -config KERNEL_HOOK - bool "Enable Hook Feature" - default n - depends on KERNEL_EXTKERNEL && DEBUG_VERSION - -config KERNEL_TRACE - bool "Enable Trace Feature" - default n - depends on KERNEL_HOOK - -config TRACE_MSG_EXTEND - bool "Enable Record more extended content" - default n - depends on KERNEL_TRACE - -config TRACE_FRAME_CORE_MSG - bool "Record cpuid, hardware interrupt status, task lock status" - default n - depends on TRACE_MSG_EXTEND - -config TRACE_FRAME_EVENT_COUNT - bool "Record event count, which indicate the sequence of happend events" - default n - depends on TRACE_MSG_EXTEND - -config TRACE_FRAME_MAX_PARAMS - int "Record max params" - default 3 - depends on KERNEL_TRACE - help - Make sure the max value is bigger than the number defined by each #MODULE#_#TYPE#_PARMAS in los_trace.h, e.g. TASK_SWITCH_PARAMS - -choice - prompt "Trace work mode" - default RECORDER_MODE_OFFLINE - depends on KERNEL_TRACE - -config RECORDER_MODE_ONLINE - bool "Online mode" - select TRACE_CLIENT_INTERACT - -config RECORDER_MODE_OFFLINE - bool "Offline mode" - -endchoice - -config TRACE_BUFFER_SIZE - int "Trace record buffer size" - default 10000 - -config TRACE_CLIENT_INTERACT - bool "Enable Trace Client Visualization and Control" - default n - depends on KERNEL_TRACE - -choice - prompt "Trace Pipeline for Data Transmission" - depends on TRACE_CLIENT_INTERACT - -config TRACE_PIPELINE_SERIAL - bool "Via Serial" - -endchoice - -choice - prompt "Trace Control" - default TRACE_CONTROL_VIA_SHELL - depends on TRACE_CLIENT_INTERACT - help - If you wish to control Trace's start/stop etc.,dynamically by Trace Client. - -config TRACE_CONTROL_VIA_SHELL - bool "Via Shell" - select LOSCFG_SHELL - -config TRACE_CONTROL_AGENT - bool "Via Trace Agent Task" - -config TRACE_NO_CONTROL - bool "No Control" - -endchoice - -config KERNEL_SHM - bool "Enable Shared Memory" - default y - depends on KERNEL_EXTKERNEL && KERNEL_VM && KERNEL_SYSCALL - help - Answer Y to enable LiteOS support shared memory. - -config KERNEL_LITEIPC - bool "Enable liteipc" - default y - depends on KERNEL_EXTKERNEL && KERNEL_VM - help - Answer Y to enable LiteOS support liteipc. - -config KERNEL_PIPE - bool "Enable pipes" - default y - depends on KERNEL_EXTKERNEL - help - Answer Y to enable LiteOS support pipes. - -config BASE_CORE_HILOG - bool "Enable Hilog" - default y - help - If you wish to include hilog. +######################### config options of extended ##################### +source "kernel/extended/Kconfig" endmenu diff --git a/kernel/base/vm/oom.c b/kernel/base/vm/oom.c index 176429d5..72996781 100644 --- a/kernel/base/vm/oom.c +++ b/kernel/base/vm/oom.c @@ -29,7 +29,6 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "sys_config.h" #include "los_oom.h" #include "los_init.h" #include "los_vm_dump.h" diff --git a/kernel/common/BUILD.gn b/kernel/common/BUILD.gn index 02da36bc..476ab6d7 100644 --- a/kernel/common/BUILD.gn +++ b/kernel/common/BUILD.gn @@ -29,20 +29,27 @@ import("//kernel/liteos_a/liteos.gni") -group("common") { - deps = [ - "blackbox", - "hidumper", - "patchfs", - "rootfs", +module_name = get_path_info(rebase_path("."), "name") +kernel_module(module_name) { + sources = [ + "los_config.c", + "los_excinfo.c", + "los_init.c", + "los_magickey.c", + "los_printf.c", + "main.c", ] + + if (defined(LOSCFG_FS_VFS)) { + sources += [ + "console.c", + "virtual_serial.c", + ] + } + + public_configs = [ ":public" ] } config("public") { - configs = [ - "blackbox:public", - "hidumper:public", - "patchfs:public", - "rootfs:public", - ] + include_dirs = [ "." ] } diff --git a/kernel/common/Makefile b/kernel/common/Makefile new file mode 100644 index 00000000..0bfc44e8 --- /dev/null +++ b/kernel/common/Makefile @@ -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. + +include $(LITEOSTOPDIR)/config.mk + +MODULE_NAME := common + +LOCAL_SRCS = $(wildcard ./main.c) + +LOCAL_INCLUDE += -I $(LITEOSTOPDIR)/compat/posix/src \ + -I $(LITEOSTOPDIR)/bsd/dev/random + +LOCAL_SRCS += $(wildcard *.c) +ifneq ($(LOSCFG_FS_VFS), y) +LOCAL_SRCS := $(filter-out console.c virtual_serial.c, $(LOCAL_SRCS)) +endif + +LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS) + +include $(MODULE) diff --git a/platform/console.c b/kernel/common/console.c similarity index 100% rename from platform/console.c rename to kernel/common/console.c diff --git a/platform/console.h b/kernel/common/console.h similarity index 99% rename from platform/console.h rename to kernel/common/console.h index 68018385..25122e83 100644 --- a/platform/console.h +++ b/kernel/common/console.h @@ -40,7 +40,7 @@ #include "telnet_dev.h" #endif #include "virtual_serial.h" -#include "los_cir_buf_pri.h" +#include "los_cir_buf.h" #endif #ifdef __cplusplus diff --git a/platform/los_config.c b/kernel/common/los_config.c similarity index 99% rename from platform/los_config.c rename to kernel/common/los_config.c index 3096dc07..708e7047 100644 --- a/platform/los_config.c +++ b/kernel/common/los_config.c @@ -51,6 +51,9 @@ #include "los_tick.h" #include "los_vm_boot.h" #include "los_smp.h" +#ifdef LOSCFG_ENABLE_KERNEL_TEST +#include "los_test_pri.h" +#endif STATIC SystemRebootFunc g_rebootHook = NULL; @@ -294,7 +297,6 @@ STATIC UINT32 OsSystemInitTaskCreate(VOID) #ifndef LOSCFG_ENABLE_KERNEL_TEST sysTask.pfnTaskEntry = (TSK_ENTRY_FUNC)SystemInit; #else - extern void TestSystemInit(void); sysTask.pfnTaskEntry = (TSK_ENTRY_FUNC)TestSystemInit; #endif sysTask.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE; diff --git a/platform/los_config.h b/kernel/common/los_config.h similarity index 99% rename from platform/los_config.h rename to kernel/common/los_config.h index e1ecf20d..5e787d18 100644 --- a/platform/los_config.h +++ b/kernel/common/los_config.h @@ -38,7 +38,6 @@ #include "los_tick.h" #include "los_vm_zone.h" -#include "sys_config.h" #ifdef __cplusplus #if __cplusplus diff --git a/platform/los_excinfo.c b/kernel/common/los_excinfo.c similarity index 100% rename from platform/los_excinfo.c rename to kernel/common/los_excinfo.c diff --git a/platform/los_excinfo_pri.h b/kernel/common/los_excinfo_pri.h similarity index 100% rename from platform/los_excinfo_pri.h rename to kernel/common/los_excinfo_pri.h diff --git a/platform/los_init.c b/kernel/common/los_init.c similarity index 100% rename from platform/los_init.c rename to kernel/common/los_init.c diff --git a/platform/los_init_info.h b/kernel/common/los_init_info.h similarity index 100% rename from platform/los_init_info.h rename to kernel/common/los_init_info.h diff --git a/platform/los_init_pri.h b/kernel/common/los_init_pri.h similarity index 100% rename from platform/los_init_pri.h rename to kernel/common/los_init_pri.h diff --git a/platform/los_magickey.c b/kernel/common/los_magickey.c similarity index 100% rename from platform/los_magickey.c rename to kernel/common/los_magickey.c diff --git a/platform/los_magickey.h b/kernel/common/los_magickey.h similarity index 100% rename from platform/los_magickey.h rename to kernel/common/los_magickey.h diff --git a/platform/los_printf.c b/kernel/common/los_printf.c similarity index 100% rename from platform/los_printf.c rename to kernel/common/los_printf.c diff --git a/platform/main.c b/kernel/common/main.c similarity index 100% rename from platform/main.c rename to kernel/common/main.c diff --git a/platform/virtual_serial.c b/kernel/common/virtual_serial.c similarity index 100% rename from platform/virtual_serial.c rename to kernel/common/virtual_serial.c diff --git a/platform/virtual_serial.h b/kernel/common/virtual_serial.h similarity index 100% rename from platform/virtual_serial.h rename to kernel/common/virtual_serial.h diff --git a/kernel/extended/BUILD.gn b/kernel/extended/BUILD.gn index 2acf20b9..a05c9097 100644 --- a/kernel/extended/BUILD.gn +++ b/kernel/extended/BUILD.gn @@ -31,14 +31,16 @@ import("//kernel/liteos_a/liteos.gni") group("extended") { deps = [ + "blackbox", "cppsupport", "cpup", "dynload", + "hidumper", "hilog", + "hook", "liteipc", "pipes", "power", - "hook", "trace", "vdso", ] @@ -46,12 +48,14 @@ group("extended") { config("public") { configs = [ + "blackbox:public", "cpup:public", "dynload:public", - "vdso:public", + "hidumper:public", + "hilog:public", "hook:public", "liteipc:public", "pipes:public", - "hilog:public", + "vdso:public", ] } diff --git a/kernel/extended/Kconfig b/kernel/extended/Kconfig new file mode 100644 index 00000000..2bd98c90 --- /dev/null +++ b/kernel/extended/Kconfig @@ -0,0 +1,98 @@ +config KERNEL_EXTKERNEL + bool "Enable Extend Kernel" + default y + help + This option will enable extend Kernel of LiteOS. Extend kernel include + cppsupport, cpup, and dynload. You can select one or some + of them. + +config KERNEL_CPPSUPPORT + bool "Enable C++ Support" + default y + depends on KERNEL_EXTKERNEL + help + If you wish to build LiteOS with support for C++. + +config KERNEL_CPUP + bool "Enable Cpup" + default y + depends on KERNEL_EXTKERNEL + help + If you wish to build LiteOS with support for cpup. + +config CPUP_INCLUDE_IRQ + bool "Enable Cpup include irq" + default y + depends on KERNEL_CPUP + help + If you wish to include irq usage for cpup. + +config KERNEL_DYNLOAD + bool "Enable Dynamic Load Feature" + default y + depends on KERNEL_EXTKERNEL && KERNEL_VM && KERNEL_SYSCALL + help + If you wish to build LiteOS with support for dynamic load. + +config ASLR + bool "Enable Address Space Layout Randomization" + default n + depends on KERNEL_DYNLOAD && HW_RANDOM_ENABLE + help + If you wish to enable ASLR for user aspace. + +config KERNEL_PM + bool "Enable Power Management" + default y + depends on KERNEL_EXTKERNEL + help + If you wish to build LiteOS with support for power management. + +config KERNEL_VDSO + bool "Enable VDSO Feature" + default n + depends on KERNEL_EXTKERNEL && KERNEL_VM && KERNEL_SYSCALL + help + If you wish to speed up some system calls. + +config KERNEL_SHM + bool "Enable Shared Memory" + default y + depends on KERNEL_EXTKERNEL && KERNEL_VM && KERNEL_SYSCALL + help + Answer Y to enable LiteOS support shared memory. + +config KERNEL_LITEIPC + bool "Enable liteipc" + default y + depends on KERNEL_EXTKERNEL && KERNEL_VM + help + Answer Y to enable LiteOS support liteipc. + +config KERNEL_PIPE + bool "Enable pipes" + default y + depends on KERNEL_EXTKERNEL + help + Answer Y to enable LiteOS support pipes. + +config BASE_CORE_HILOG + bool "Enable Hilog" + default y + depends on KERNEL_EXTKERNEL + help + If you wish to include hilog. + +config KERNEL_HOOK + bool "Enable Hook Feature" + default n + depends on KERNEL_EXTKERNEL && DEBUG_VERSION + +######################### config options of trace ######################### +source "kernel/extended/trace/Kconfig" + +######################### config options of blackbox ######################### +source "kernel/extended/blackbox/Kconfig" + +######################### config options of hidumper ######################### +source "kernel/extended/hidumper/Kconfig" diff --git a/kernel/common/blackbox/BUILD.gn b/kernel/extended/blackbox/BUILD.gn similarity index 100% rename from kernel/common/blackbox/BUILD.gn rename to kernel/extended/blackbox/BUILD.gn diff --git a/kernel/common/blackbox/Kconfig b/kernel/extended/blackbox/Kconfig similarity index 96% rename from kernel/common/blackbox/Kconfig rename to kernel/extended/blackbox/Kconfig index 34807c59..0a06a656 100644 --- a/kernel/common/blackbox/Kconfig +++ b/kernel/extended/blackbox/Kconfig @@ -1,6 +1,7 @@ config BLACKBOX bool "Enable BlackBox" default n + depends on KERNEL_EXTKERNEL help Answer Y to enable LiteOS support blackbox diff --git a/kernel/common/blackbox/Makefile b/kernel/extended/blackbox/Makefile similarity index 100% rename from kernel/common/blackbox/Makefile rename to kernel/extended/blackbox/Makefile diff --git a/kernel/common/blackbox/los_blackbox.h b/kernel/extended/blackbox/los_blackbox.h similarity index 99% rename from kernel/common/blackbox/los_blackbox.h rename to kernel/extended/blackbox/los_blackbox.h index 87baabe2..5afd3e7d 100644 --- a/kernel/common/blackbox/los_blackbox.h +++ b/kernel/extended/blackbox/los_blackbox.h @@ -31,15 +31,15 @@ #ifndef LOS_BLACKBOX_H #define LOS_BLACKBOX_H +#include "stdarg.h" +#include "los_typedef.h" + #ifdef __cplusplus #if __cplusplus extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ -#include "stdarg.h" -#include "los_typedef.h" - #define PATH_MAX_LEN 256 #define EVENT_MAX_LEN 32 #define MODULE_MAX_LEN 32 diff --git a/kernel/common/blackbox/los_blackbox_common.c b/kernel/extended/blackbox/los_blackbox_common.c similarity index 98% rename from kernel/common/blackbox/los_blackbox_common.c rename to kernel/extended/blackbox/los_blackbox_common.c index 18cc1d2f..3e3ef8e6 100644 --- a/kernel/common/blackbox/los_blackbox_common.c +++ b/kernel/extended/blackbox/los_blackbox_common.c @@ -98,7 +98,7 @@ int FullWriteFile(const char *filePath, const char *buf, size_t bufSize, int isA #endif } -int SaveBasicErrorInfo(const char *filePath, struct ErrorInfo *info) +int SaveBasicErrorInfo(const char *filePath, const struct ErrorInfo *info) { char *buf = NULL; diff --git a/kernel/common/blackbox/los_blackbox_common.h b/kernel/extended/blackbox/los_blackbox_common.h similarity index 96% rename from kernel/common/blackbox/los_blackbox_common.h rename to kernel/extended/blackbox/los_blackbox_common.h index 21fdb7e8..cfbb28a8 100644 --- a/kernel/common/blackbox/los_blackbox_common.h +++ b/kernel/extended/blackbox/los_blackbox_common.h @@ -31,16 +31,16 @@ #ifndef LOS_BLACKBOX_COMMON_H #define LOS_BLACKBOX_COMMON_H +#include "los_blackbox.h" +#include "los_printf.h" +#include "los_typedef.h" + #ifdef __cplusplus #if __cplusplus extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ -#include "los_blackbox.h" -#include "los_printf.h" -#include "los_typedef.h" - #define ERROR_INFO_HEADER_FORMAT "#### error info ####\nevent: %s\nmodule: %s\nerrorDesc: %s\n" #define ERROR_INFO_MAX_LEN 768 #define Min(a, b) (((a) > (b)) ? (b) : (a)) @@ -49,7 +49,7 @@ extern "C" { #define BBOX_PRINT_INFO(format, ...) PRINTK("bbox: Info: " format, ##__VA_ARGS__) int FullWriteFile(const char *filePath, const char *buf, size_t bufSize, int isAppend); -int SaveBasicErrorInfo(const char *filePath, struct ErrorInfo *info); +int SaveBasicErrorInfo(const char *filePath, const struct ErrorInfo *info); int CreateLogDir(const char *dirPath); bool IsLogPartReady(void); diff --git a/kernel/common/blackbox/los_blackbox_core.c b/kernel/extended/blackbox/los_blackbox_core.c similarity index 97% rename from kernel/common/blackbox/los_blackbox_core.c rename to kernel/extended/blackbox/los_blackbox_core.c index bf5e74de..6e0fef4e 100644 --- a/kernel/common/blackbox/los_blackbox_core.c +++ b/kernel/extended/blackbox/los_blackbox_core.c @@ -70,9 +70,9 @@ struct ErrorInfo *g_tempErrInfo; /* ------------ function definitions ------------ */ static void FormatErrorInfo(struct ErrorInfo *info, - const char event[EVENT_MAX_LEN], - const char module[MODULE_MAX_LEN], - const char errorDesc[ERROR_DESC_MAX_LEN]) + const char event[EVENT_MAX_LEN], + const char module[MODULE_MAX_LEN], + const char errorDesc[ERROR_DESC_MAX_LEN]) { if (info == NULL || event == NULL || module == NULL || errorDesc == NULL) { BBOX_PRINT_ERR("info: %p, event: %p, module: %p, errorDesc: %p!\n", info, event, module, errorDesc); @@ -136,7 +136,7 @@ static bool FindModuleOps(struct ErrorInfo *info, BBoxOps **ops) return found; } -static void InvokeModuleOps(struct ErrorInfo *info, BBoxOps *ops) +static void InvokeModuleOps(struct ErrorInfo *info, const BBoxOps *ops) { if (info == NULL || ops == NULL) { BBOX_PRINT_ERR("info: %p, ops: %p!\n", info, ops); @@ -203,7 +203,7 @@ static void SaveLastLog(const char *logDir) } } else { BBOX_PRINT_ERR("module [%s], GetLastLogInfo: %p, SaveLastLog: %p!\n", - ops->ops.module, ops->ops.GetLastLogInfo, ops->ops.SaveLastLog); + ops->ops.module, ops->ops.GetLastLogInfo, ops->ops.SaveLastLog); } } (void)LOS_SemPost(g_opsListSem); diff --git a/kernel/common/blackbox/los_blackbox_detector.c b/kernel/extended/blackbox/los_blackbox_detector.c similarity index 100% rename from kernel/common/blackbox/los_blackbox_detector.c rename to kernel/extended/blackbox/los_blackbox_detector.c diff --git a/kernel/common/blackbox/los_blackbox_detector.h b/kernel/extended/blackbox/los_blackbox_detector.h similarity index 99% rename from kernel/common/blackbox/los_blackbox_detector.h rename to kernel/extended/blackbox/los_blackbox_detector.h index f6714aad..9e630d52 100644 --- a/kernel/common/blackbox/los_blackbox_detector.h +++ b/kernel/extended/blackbox/los_blackbox_detector.h @@ -31,14 +31,14 @@ #ifndef LOS_BLACKBOX_DETECTOR_H #define LOS_BLACKBOX_DETECTOR_H +#include "los_typedef.h" + #ifdef __cplusplus #if __cplusplus extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ -#include "los_typedef.h" - int UploadEventByFile(const char *filePath); int UploadEventByStream(const char *buf, size_t bufSize); diff --git a/kernel/common/blackbox/los_blackbox_system_adapter.c b/kernel/extended/blackbox/los_blackbox_system_adapter.c similarity index 99% rename from kernel/common/blackbox/los_blackbox_system_adapter.c rename to kernel/extended/blackbox/los_blackbox_system_adapter.c index c760ef44..647d5858 100644 --- a/kernel/common/blackbox/los_blackbox_system_adapter.c +++ b/kernel/extended/blackbox/los_blackbox_system_adapter.c @@ -218,7 +218,7 @@ static int SaveLastLog(const char *logDir, struct ErrorInfo *info) #ifdef LOSCFG_BLACKBOX_TEST static void BBoxTest(void) { - struct ModuleOps ops = { + struct ModuleOps ops = { .module = "MODULE_TEST", .Dump = NULL, .Reset = NULL, diff --git a/kernel/common/blackbox/los_blackbox_system_adapter.h b/kernel/extended/blackbox/los_blackbox_system_adapter.h similarity index 99% rename from kernel/common/blackbox/los_blackbox_system_adapter.h rename to kernel/extended/blackbox/los_blackbox_system_adapter.h index eb61bf83..2f1e7128 100644 --- a/kernel/common/blackbox/los_blackbox_system_adapter.h +++ b/kernel/extended/blackbox/los_blackbox_system_adapter.h @@ -31,15 +31,15 @@ #ifndef LOS_BLACKBOX_SYSTEM_ADAPTER_H #define LOS_BLACKBOX_SYSTEM_ADAPTER_H +#include "los_blackbox.h" +#include "los_blackbox_common.h" + #ifdef __cplusplus #if __cplusplus extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ -#include "los_blackbox.h" -#include "los_blackbox_common.h" - int OsBBoxSystemAdapterInit(void); #ifdef __cplusplus diff --git a/kernel/extended/dynload/Makefile b/kernel/extended/dynload/Makefile index 28d86ed1..6d719c2c 100644 --- a/kernel/extended/dynload/Makefile +++ b/kernel/extended/dynload/Makefile @@ -34,7 +34,7 @@ MODULE_NAME := $(notdir $(shell pwd)) LOCAL_SRCS := $(wildcard src/*.c) LOCAL_INCLUDE := \ - -I $(LITEOSTOPDIR)/kernel/base/include -I $(LITEOSTOPDIR)/kernel/extended/include \ + -I $(LITEOSTOPDIR)/kernel/base/include \ -I $(LITEOSTOPDIR)/fs/include LOCAL_FLAGS := $(LITEOS_CFLAGS_INTERWORK) $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS) diff --git a/kernel/common/hidumper/BUILD.gn b/kernel/extended/hidumper/BUILD.gn similarity index 100% rename from kernel/common/hidumper/BUILD.gn rename to kernel/extended/hidumper/BUILD.gn diff --git a/kernel/common/hidumper/Kconfig b/kernel/extended/hidumper/Kconfig similarity index 78% rename from kernel/common/hidumper/Kconfig rename to kernel/extended/hidumper/Kconfig index b15d50a8..068290fc 100644 --- a/kernel/common/hidumper/Kconfig +++ b/kernel/extended/hidumper/Kconfig @@ -1,5 +1,6 @@ config HIDUMPER bool "Enable hidumper" default n + depends on KERNEL_EXTKERNEL help Answer Y to enable LiteOS support hidumper diff --git a/kernel/common/hidumper/Makefile b/kernel/extended/hidumper/Makefile similarity index 100% rename from kernel/common/hidumper/Makefile rename to kernel/extended/hidumper/Makefile diff --git a/kernel/common/hidumper/los_hidumper.c b/kernel/extended/hidumper/los_hidumper.c similarity index 100% rename from kernel/common/hidumper/los_hidumper.c rename to kernel/extended/hidumper/los_hidumper.c diff --git a/kernel/common/hidumper/los_hidumper.h b/kernel/extended/hidumper/los_hidumper.h similarity index 100% rename from kernel/common/hidumper/los_hidumper.h rename to kernel/extended/hidumper/los_hidumper.h diff --git a/kernel/extended/hilog/BUILD.gn b/kernel/extended/hilog/BUILD.gn index 16e05fe9..b925ff76 100644 --- a/kernel/extended/hilog/BUILD.gn +++ b/kernel/extended/hilog/BUILD.gn @@ -32,7 +32,10 @@ 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" ] + sources = [ + "//base/hiviewdfx/hilog_lite/frameworks/featured/hiview_log.c", + "los_hilog.c", + ] public_configs = [ ":public" ] } @@ -41,5 +44,6 @@ config("public") { include_dirs = [ "//base/hiviewdfx/hilog_lite/interfaces/native/kits", "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog", + ".", ] } diff --git a/kernel/extended/hilog/Makefile b/kernel/extended/hilog/Makefile new file mode 100644 index 00000000..eef9b37a --- /dev/null +++ b/kernel/extended/hilog/Makefile @@ -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. + +include $(LITEOSTOPDIR)/config.mk + +MODULE_NAME := $(notdir $(shell pwd)) + +LOCAL_SRCS := $(wildcard *.c) + +LOCAL_INCLUDE := -I $(LITEOSTOPDIR)/kernel/base/include + +LOCAL_FLAGS := $(LITEOS_CFLAGS_INTERWORK) $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS) + +include $(MODULE) diff --git a/platform/los_hilog.c b/kernel/extended/hilog/los_hilog.c similarity index 99% rename from platform/los_hilog.c rename to kernel/extended/hilog/los_hilog.c index f4bc5f9d..210addca 100644 --- a/platform/los_hilog.c +++ b/kernel/extended/hilog/los_hilog.c @@ -126,7 +126,7 @@ static void HiLogBufferDec(size_t sz) } } -static int HiLogBufferCopy(unsigned char *dst, unsigned dstLen, unsigned char *src, size_t srcLen) +static int HiLogBufferCopy(unsigned char *dst, unsigned dstLen, const unsigned char *src, size_t srcLen) { int retval = -1; size_t minLen = (dstLen > srcLen) ? srcLen : dstLen; diff --git a/platform/los_hilog.h b/kernel/extended/hilog/los_hilog.h similarity index 100% rename from platform/los_hilog.h rename to kernel/extended/hilog/los_hilog.h diff --git a/kernel/extended/trace/Kconfig b/kernel/extended/trace/Kconfig new file mode 100644 index 00000000..946cb8bf --- /dev/null +++ b/kernel/extended/trace/Kconfig @@ -0,0 +1,78 @@ +config KERNEL_TRACE + bool "Enable Trace Feature" + default n + depends on KERNEL_HOOK + +config TRACE_MSG_EXTEND + bool "Enable Record more extended content" + default n + depends on KERNEL_TRACE + +config TRACE_FRAME_CORE_MSG + bool "Record cpuid, hardware interrupt status, task lock status" + default n + depends on TRACE_MSG_EXTEND + +config TRACE_FRAME_EVENT_COUNT + bool "Record event count, which indicate the sequence of happend events" + default n + depends on TRACE_MSG_EXTEND + +config TRACE_FRAME_MAX_PARAMS + int "Record max params" + default 3 + depends on KERNEL_TRACE + help + Make sure the max value is bigger than the number defined by each #MODULE#_#TYPE#_PARMAS in los_trace.h, e.g. TASK_SWITCH_PARAMS + +choice + prompt "Trace work mode" + default RECORDER_MODE_OFFLINE + depends on KERNEL_TRACE + +config RECORDER_MODE_ONLINE + bool "Online mode" + select TRACE_CLIENT_INTERACT + +config RECORDER_MODE_OFFLINE + bool "Offline mode" + +endchoice + +config TRACE_BUFFER_SIZE + int "Trace record buffer size" + default 10000 + depends on RECORDER_MODE_OFFLINE + +config TRACE_CLIENT_INTERACT + bool "Enable Trace Client Visualization and Control" + default n + depends on KERNEL_TRACE + +choice + prompt "Trace Pipeline for Data Transmission" + depends on TRACE_CLIENT_INTERACT + +config TRACE_PIPELINE_SERIAL + bool "Via Serial" + +endchoice + +choice + prompt "Trace Control" + default TRACE_CONTROL_VIA_SHELL + depends on TRACE_CLIENT_INTERACT + help + If you wish to control Trace's start/stop etc.,dynamically by Trace Client. + +config TRACE_CONTROL_VIA_SHELL + bool "Via Shell" + select LOSCFG_SHELL + +config TRACE_CONTROL_AGENT + bool "Via Trace Agent Task" + +config TRACE_NO_CONTROL + bool "No Control" + +endchoice \ No newline at end of file diff --git a/kernel/extended/vdso/usr/BUILD.gn b/kernel/extended/vdso/usr/BUILD.gn index 55d703c4..3a3702a4 100644 --- a/kernel/extended/vdso/usr/BUILD.gn +++ b/kernel/extended/vdso/usr/BUILD.gn @@ -35,7 +35,6 @@ shared_library("OHOS-vdso") { include_dirs = [ "$LITEOSTOPDIR/kernel/extended/vdso/include", "$LITEOSTOPDIR/kernel/include", - "$LITEOSTOPDIR/platform", "$LITEOSTOPDIR/bsd/compat/linuxkpi/include", ] diff --git a/platform/los_builddef.h b/kernel/include/los_builddef.h similarity index 99% rename from platform/los_builddef.h rename to kernel/include/los_builddef.h index c00ae1f9..2a91bc84 100644 --- a/platform/los_builddef.h +++ b/kernel/include/los_builddef.h @@ -94,8 +94,6 @@ extern "C" { #define LITE_OS_SEC_DTCM /* __attribute__((section(".dtcm"))) */ #endif -#define PACK1 - #ifdef __cplusplus #if __cplusplus } diff --git a/platform/los_init.h b/kernel/include/los_init.h similarity index 100% rename from platform/los_init.h rename to kernel/include/los_init.h diff --git a/kernel/include/los_printf.h b/kernel/include/los_printf.h index 510839a1..d92c83d4 100644 --- a/kernel/include/los_printf.h +++ b/kernel/include/los_printf.h @@ -37,7 +37,6 @@ #ifndef _LOS_PRINTF_H #define _LOS_PRINTF_H -#include "sys_config.h" #ifdef LOSCFG_LIB_LIBC #include "stdarg.h" #endif diff --git a/lib/libscrew/BUILD.gn b/lib/libscrew/BUILD.gn index 87b4cae6..227fced9 100644 --- a/lib/libscrew/BUILD.gn +++ b/lib/libscrew/BUILD.gn @@ -32,8 +32,10 @@ import("//kernel/liteos_a/liteos.gni") module_name = get_path_info(rebase_path("."), "name") kernel_module(module_name) { sources = [ + "src/los_cir_buf.c", "src/los_crc32.c", "src/los_rbtree.c", + "src/los_seq_buf.c", ] sources += [ "$LITEOSTHIRDPARTY/FreeBSD/sys/libkern/crc32.c" ] diff --git a/platform/los_cir_buf_pri.h b/lib/libscrew/include/los_cir_buf.h similarity index 100% rename from platform/los_cir_buf_pri.h rename to lib/libscrew/include/los_cir_buf.h diff --git a/platform/los_seq_buf.h b/lib/libscrew/include/los_seq_buf.h similarity index 98% rename from platform/los_seq_buf.h rename to lib/libscrew/include/los_seq_buf.h index e048ba61..88e63fa2 100644 --- a/platform/los_seq_buf.h +++ b/lib/libscrew/include/los_seq_buf.h @@ -32,8 +32,9 @@ #ifndef __LOS_SEQ_BUF_H__ #define __LOS_SEQ_BUF_H__ -#include "los_typedef.h" -#include "pthread.h" +#include "stdarg.h" +#include "stddef.h" + #ifdef __cplusplus #if __cplusplus diff --git a/platform/los_cir_buf.c b/lib/libscrew/src/los_cir_buf.c similarity index 99% rename from platform/los_cir_buf.c rename to lib/libscrew/src/los_cir_buf.c index 3c4db019..c090ed16 100644 --- a/platform/los_cir_buf.c +++ b/lib/libscrew/src/los_cir_buf.c @@ -29,7 +29,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "los_cir_buf_pri.h" +#include "los_cir_buf.h" UINT32 LOS_CirBufUsedSize(CirBuf *cirbufCB) diff --git a/platform/los_seq_buf.c b/lib/libscrew/src/los_seq_buf.c similarity index 98% rename from platform/los_seq_buf.c rename to lib/libscrew/src/los_seq_buf.c index f91ffa71..00ab78c4 100644 --- a/platform/los_seq_buf.c +++ b/lib/libscrew/src/los_seq_buf.c @@ -30,7 +30,9 @@ */ #include "los_seq_buf.h" +#include "los_typedef.h" #include +#include "securec.h" static int ExpandSeqBuf(struct SeqBuf *seqBuf, size_t oldCount) { diff --git a/platform/BUILD.gn b/platform/BUILD.gn index d2d4a74f..f8eec886 100644 --- a/platform/BUILD.gn +++ b/platform/BUILD.gn @@ -29,43 +29,6 @@ import("//kernel/liteos_a/liteos.gni") -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" ] -} - -config("public") { - include_dirs = [ "." ] -} - kernel_module("board.ld") { sources = [ "board.ld.S" ] asmflags = [ diff --git a/platform/Makefile b/platform/Makefile index 5cf034df..cd1eeef8 100644 --- a/platform/Makefile +++ b/platform/Makefile @@ -29,37 +29,12 @@ include $(LITEOSTOPDIR)/config.mk -MODULE_NAME := bsp - -LOCAL_SRCS = $(wildcard ./main.c) - -LOCAL_INCLUDE += -I $(LITEOSTOPDIR)/compat/posix/src \ - -I $(LITEOSTOPDIR)/bsd/dev/random - -LOCAL_SRCS += $(wildcard *.c) -ifneq ($(LOSCFG_FS_VFS), y) -LOCAL_SRCS := $(filter-out console.c virtual_serial.c, $(LOCAL_SRCS)) -endif -ifneq ($(LOSCFG_BASE_CORE_HILOG), y) -LOCAL_SRCS := $(filter-out los_hilog.c, $(LOCAL_SRCS)) -endif - -ALL_ASSRCS := $(wildcard *.S) -ASSRCS := $(filter-out board.ld.S,$(ALL_ASSRCS)) - -LOCAL_SRCS += $(ASSRCS) - -LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS) - BOARD_LD = $(OUT)/lib/board.ld $(BOARD_LD): board.ld.S $(HIDE)$(CC) $(LITEOS_CFLAGS) -P -E $< -o $@ -.PHONY: rm_board_ld -rm_board_ld: +.PHONY: all clean +clean: $(HIDE)$(RM) $(BOARD_LD) all: $(BOARD_LD) -clean: rm_board_ld - -include $(MODULE) diff --git a/platform/bsp.mk b/platform/bsp.mk index 5d065491..c497e9d8 100644 --- a/platform/bsp.mk +++ b/platform/bsp.mk @@ -27,13 +27,12 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -LITEOS_BASELIB += -lbsp -lbsp_config +LITEOS_BASELIB += -lbsp_config PLATFORM_BSP_BASE := $(LITEOSTOPDIR)/platform PLATFORM_INCLUDE := -I $(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH) \ -I $(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH)/include \ - -I $(PLATFORM_BSP_BASE) LIB_SUBDIRS += $(PLATFORM_BSP_BASE) $(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH) LITEOS_PLATFORM_INCLUDE += $(PLATFORM_INCLUDE) diff --git a/platform/los_timer_pri.h b/platform/los_timer_pri.h deleted file mode 100644 index 6017d8b0..00000000 --- a/platform/los_timer_pri.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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. - */ - -#ifndef _LOS_TIMER_PRI_H -#define _LOS_TIMER_PRI_H - -#include "los_typedef.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif /* __cplusplus */ -#endif /* __cplusplus */ - -extern VOID OsAdjTime(VOID); - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cplusplus */ -#endif /* __cplusplus */ -#endif /* _LOS_TIMER_PRI_H */ diff --git a/platform/sys_config.h b/platform/sys_config.h deleted file mode 100644 index 40decfaf..00000000 --- a/platform/sys_config.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ - -#ifndef _SYS_CONFIG_H -#define _SYS_CONFIG_H - - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif /* __cplusplus */ -#endif /* __cplusplus */ - -#ifndef LOSCFG_MACRO_CONFIG -#define LOSCFG_MACRO_CONFIG - -#ifdef LOSCFG_LIB_LIBC -#define CONFIG_STRERROR -#endif - -#ifdef LOSCFG_NET_LWIP_SACK -#define LWIP_BSD_API 1 -#endif - -#ifdef LOSCFG_DRIVERS_USB -#define SUPPORT_LOS_USB_NEW_DRIVER -#define USB_DEBUG_VAR 5 -#endif -#endif - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cplusplus */ -#endif /* __cplusplus */ - -#endif /* _SYS_CONFIG_H */ \ No newline at end of file diff --git a/shell/BUILD.gn b/shell/BUILD.gn index c3b8e522..0eaa2922 100644 --- a/shell/BUILD.gn +++ b/shell/BUILD.gn @@ -38,10 +38,11 @@ kernel_module(module_name) { "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/date_shellcmd.c", "full/src/cmds/dmesg.c", + "full/src/cmds/hwi_shellcmd.c", "full/src/cmds/shell_shellcmd.c", - "full/src/cmds/watch_shell.c", + "full/src/cmds/watch_shellcmd.c", ] public_configs = [ ":public" ] diff --git a/shell/full/include/dmesg_pri.h b/shell/full/include/dmesg_pri.h index 6f73ca19..8d4f6485 100644 --- a/shell/full/include/dmesg_pri.h +++ b/shell/full/include/dmesg_pri.h @@ -32,7 +32,6 @@ #ifndef _HWLITEOS_SHELL_DMESG_PRI_H #define _HWLITEOS_SHELL_DMESG_PRI_H -#include "sys_config.h" #ifdef LOSCFG_SHELL_DMESG #include "dmesg.h" diff --git a/shell/full/src/cmds/date_shell.c b/shell/full/src/cmds/date_shellcmd.c similarity index 100% rename from shell/full/src/cmds/date_shell.c rename to shell/full/src/cmds/date_shellcmd.c diff --git a/shell/full/src/cmds/dmesg.c b/shell/full/src/cmds/dmesg.c index 8c100c7c..2d1eea9c 100644 --- a/shell/full/src/cmds/dmesg.c +++ b/shell/full/src/cmds/dmesg.c @@ -50,7 +50,6 @@ Case B: Tail Head */ -#include "sys_config.h" #ifdef LOSCFG_SHELL_DMESG #include "dmesg_pri.h" #include "show.h" diff --git a/platform/hwi_shell.c b/shell/full/src/cmds/hwi_shellcmd.c similarity index 100% rename from platform/hwi_shell.c rename to shell/full/src/cmds/hwi_shellcmd.c diff --git a/shell/full/src/cmds/watch_shell.c b/shell/full/src/cmds/watch_shellcmd.c similarity index 100% rename from shell/full/src/cmds/watch_shell.c rename to shell/full/src/cmds/watch_shellcmd.c diff --git a/testsuites/kernel/BUILD.gn b/testsuites/kernel/BUILD.gn index 77a11a87..ee97651b 100644 --- a/testsuites/kernel/BUILD.gn +++ b/testsuites/kernel/BUILD.gn @@ -27,116 +27,122 @@ # 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") static_library("test_base") { + sources = [ + "src/ChipTest.c", + "src/iCunit.c", + "src/osTest.c", + "src/testrun_shellcmd.c", + "src/testusb_shellcmd.c", + ] - sources = [ - "src/ChipTest.c", - "src/iCunit.c", - "src/osTest.c", - "src/testrun_shellcmd.c", - "src/testusb_shellcmd.c", - ] + include_dirs = [ + "../kernel/base/includ", + "../kernel/include", + "../kernel/extended/include", + "include", + "../fs/vfs", + "../fs/proc/include", + "../fs/jffs2/include", + "../fs/nfs/include", + "../bsd/compat/linuxkpi/include", + ] - include_dirs = [ - "../kernel/base/includ", - "../kernel/include", - "../kernel/extended/include", - "include", - "../fs/vfs", - "../fs/proc/include", - "../fs/jffs2/include", - "../fs/nfs/include", - "../bsd/compat/linuxkpi/include", - ] + public_configs = [ ":public" ] +} + +config("public") { + include_dirs = [ "include" ] } lite_component("test") { - features = [ ":test_base" ] + features = [ ":test_base" ] -# KERNEL BASE TEST - if (LOSCFG_TEST_KERNEL_BASE_IPC) { - features += [ "sample/kernel_base/ipc:test_ipc" ] - } - if (LOSCFG_TEST_KERNEL_BASE_CORE) { - features += [ "sample/kernel_base/core:test_core" ] - } - if (LOSCFG_TEST_KERNEL_BASE_MP) { - features += [ "sample/kernel_base/mp:test_mp" ] - } - if (LOSCFG_TEST_KERNEL_BASE_MEM) { - features += [ "sample/kernel_base/mem:test_mem" ] - } - if (LOSCFG_TEST_KERNEL_BASE_MISC) { - features += [ "sample/kernel_base/misc:test_misc" ] - } - if (LOSCFG_TEST_KERNEL_BASE_OM) { - features += [ "sample/kernel_base/om:test_om" ] - } - if (LOSCFG_TEST_KERNEL_BASE_ATOMIC) { - features += [ "sample/kernel_base/atomic:test_atomic" ] - } + # KERNEL BASE TEST + if (LOSCFG_TEST_KERNEL_BASE_IPC) { + features += [ "sample/kernel_base/ipc:test_ipc" ] + } + if (LOSCFG_TEST_KERNEL_BASE_CORE) { + features += [ "sample/kernel_base/core:test_core" ] + } + if (LOSCFG_TEST_KERNEL_BASE_MP) { + features += [ "sample/kernel_base/mp:test_mp" ] + } + if (LOSCFG_TEST_KERNEL_BASE_MEM) { + features += [ "sample/kernel_base/mem:test_mem" ] + } + if (LOSCFG_TEST_KERNEL_BASE_MISC) { + features += [ "sample/kernel_base/misc:test_misc" ] + } + if (LOSCFG_TEST_KERNEL_BASE_OM) { + features += [ "sample/kernel_base/om:test_om" ] + } + if (LOSCFG_TEST_KERNEL_BASE_ATOMIC) { + features += [ "sample/kernel_base/atomic:test_atomic" ] + } -# KERNEL EXTEND TEST - if (LOSCFG_TEST_KERNEL_EXTEND_CPP) { - features += [ "sample/kernel_extend/cpp:test_cpp" ] - } - if (LOSCFG_TEST_KERNEL_EXTEND_CPUP) { - features += [ "sample/kernel_extend/cpup:test_cpup" ] - } - if (LOSCFG_TEST_KERNEL_EXTEND_MMU) { - features += [ "sample/kernel_extend/mmu:test_mmu" ] - } + # KERNEL EXTEND TEST + if (LOSCFG_TEST_KERNEL_EXTEND_CPP) { + features += [ "sample/kernel_extend/cpp:test_cpp" ] + } + if (LOSCFG_TEST_KERNEL_EXTEND_CPUP) { + features += [ "sample/kernel_extend/cpup:test_cpup" ] + } + if (LOSCFG_TEST_KERNEL_EXTEND_MMU) { + features += [ "sample/kernel_extend/mmu:test_mmu" ] + } -# COMPAT TEST - if (LOSCFG_TEST_POSIX) { - features += [ - "sample/posix:test_posix", - # "sample/posix/smp:test_posix_smp", - ] - } - # if (LOSCFG_TEST_POSIX_MEM) { - # features += [ "sample/posix/mem:test_posix_mem" ] - # } - # if (LOSCFG_TEST_POSIX_MQUEUE) { - # features += [ "sample/posix/mqueue:test_posix_mqueue" ] - # } - # if (LOSCFG_TEST_POSIX_MUTEX) { - # features += [ "sample/posix/mutex:test_posix_mutex" ] - # } - # if (LOSCFG_TEST_POSIX_PTHREAD) { - # features += [ "sample/posix/pthread:test_posix_pthread" ] - # } - # if (LOSCFG_TEST_POSIX_SCHED) { - # features += [ "sample/posix/sched:test_posix_sched" ] - # } - # if (LOSCFG_TEST_POSIX_SEM) { - # features += [ "sample/posix/sem:test_posix_sem" ] - # } - # if (LOSCFG_TEST_POSIX_SWTMR) { - # features += [ "sample/posix/swtmr:test_posix_swtmr" ] - # } - if (LOSCFG_TEST_LINUX) { - features += [ "sample/linux:test_linux" ] - } - #if (LOSCFG_TEST_LINUX_HRTIMER) { - # features += [ "sample/linux/hrtimer:test_linux_hrtimer" ] - #} + # COMPAT TEST + if (LOSCFG_TEST_POSIX) { + features += [ + "sample/posix:test_posix", + # "sample/posix/smp:test_posix_smp", + ] + } -# LIBC TEST - if (LOSCFG_TEST_LIBC) { - features += [ "sample/libc:test_libc" ] - } + # if (LOSCFG_TEST_POSIX_MEM) { + # features += [ "sample/posix/mem:test_posix_mem" ] + # } + # if (LOSCFG_TEST_POSIX_MQUEUE) { + # features += [ "sample/posix/mqueue:test_posix_mqueue" ] + # } + # if (LOSCFG_TEST_POSIX_MUTEX) { + # features += [ "sample/posix/mutex:test_posix_mutex" ] + # } + # if (LOSCFG_TEST_POSIX_PTHREAD) { + # features += [ "sample/posix/pthread:test_posix_pthread" ] + # } + # if (LOSCFG_TEST_POSIX_SCHED) { + # features += [ "sample/posix/sched:test_posix_sched" ] + # } + # if (LOSCFG_TEST_POSIX_SEM) { + # features += [ "sample/posix/sem:test_posix_sem" ] + # } + # if (LOSCFG_TEST_POSIX_SWTMR) { + # features += [ "sample/posix/swtmr:test_posix_swtmr" ] + # } + if (LOSCFG_TEST_LINUX) { + features += [ "sample/linux:test_linux" ] + } -# LIBM TEST - if (LOSCFG_TEST_LIBM) { - features += [ "sample/libm:test_libm" ] - } + #if (LOSCFG_TEST_LINUX_HRTIMER) { + # features += [ "sample/linux/hrtimer:test_linux_hrtimer" ] + #} -# SHELL TEST - if (LOSCFG_TEST_SHELL) { - features += [ "sample/shell:test_shell" ] - } + # LIBC TEST + if (LOSCFG_TEST_LIBC) { + features += [ "sample/libc:test_libc" ] + } + + # LIBM TEST + if (LOSCFG_TEST_LIBM) { + features += [ "sample/libm:test_libm" ] + } + + # SHELL TEST + if (LOSCFG_TEST_SHELL) { + features += [ "sample/shell:test_shell" ] + } } diff --git a/testsuites/kernel/include/los_test_pri.h b/testsuites/kernel/include/los_test_pri.h index f6015bf2..b7b8de4e 100644 --- a/testsuites/kernel/include/los_test_pri.h +++ b/testsuites/kernel/include/los_test_pri.h @@ -38,7 +38,7 @@ extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ -extern UINT32 OsTestInit(VOID); +extern UINT32 TestSystemInit(VOID); #ifdef __cplusplus #if __cplusplus diff --git a/testsuites/kernel/include/osTest.h b/testsuites/kernel/include/osTest.h index 901dcf72..f401ca20 100644 --- a/testsuites/kernel/include/osTest.h +++ b/testsuites/kernel/include/osTest.h @@ -337,7 +337,7 @@ extern VOID ItSuitePosixPthread(VOID); extern VOID TestRunShell(VOID); -extern UINT32 OsTestInit(VOID); +extern void TestSystemInit(void); extern void TEST_DT_COMMON(void); extern VOID dprintf(const char *fmt, ...); diff --git a/tools/build/mk/los_config.mk b/tools/build/mk/los_config.mk index b43a95b9..31f7e71a 100644 --- a/tools/build/mk/los_config.mk +++ b/tools/build/mk/los_config.mk @@ -114,17 +114,6 @@ include $(LITEOSTOPDIR)/arch/cpu.mk ############################# Platform Option Begin################################# include $(LITEOSTOPDIR)/platform/bsp.mk - -ifeq ($(LOSCFG_PLATFORM_ROOTFS), y) - LITEOS_BASELIB += -lrootfs - LIB_SUBDIRS += $(LITEOSTOPDIR)/kernel/common/rootfs - LITEOS_PLATFORM_INCLUDE += -I $(LITEOSTOPDIR)/kernel/common/rootfs -endif - -ifeq ($(LOSCFG_PLATFORM_PATCHFS), y) - LITEOS_BASELIB += -lpatchfs - LIB_SUBDIRS += $(LITEOSTOPDIR)/kernel/common/patchfs -endif ############################# Platform Option End ################################# ####################################### Kernel Option Begin ########################################### @@ -133,6 +122,16 @@ LIB_SUBDIRS += kernel/base LITEOS_KERNEL_INCLUDE := -I $(LITEOSTOPDIR)/kernel/include \ -I $(LITEOSTOPDIR)/kernel/base/include +LITEOS_BASELIB += -lcommon +LIB_SUBDIRS += kernel/common +LITEOS_KERNEL_INCLUDE += -I $(LITEOSTOPDIR)/kernel/common + +ifeq ($(LOSCFG_KERNEL_CPPSUPPORT), y) + LITEOS_BASELIB += -lcppsupport + LIB_SUBDIRS += kernel/extended/cppsupport + LITEOS_CPPSUPPORT_INCLUDE += -I $(LITEOSTOPDIR)/kernel/extended/cppsupport +endif + ifeq ($(LOSCFG_KERNEL_CPUP), y) LITEOS_BASELIB += -lcpup LIB_SUBDIRS += kernel/extended/cpup @@ -181,9 +180,19 @@ ifeq ($(LOSCFG_KERNEL_PM), y) LITEOS_PIPE_INCLUDE += -I $(LITEOSTOPDIR)/kernel/extended/power endif +ifeq ($(LOSCFG_KERNEL_SYSCALL), y) + LITEOS_BASELIB += -lsyscall + LIB_SUBDIRS += syscall +endif +LIB_SUBDIRS += kernel/user + ################################### Kernel Option End ################################ #################################### Lib Option Begin ############################### +LITEOS_BASELIB += -lscrew +LIB_SUBDIRS += lib/libscrew +LITEOS_LIBSCREW_INCLUDE += -I $(LITEOSTOPDIR)/lib/libscrew/include + ifeq ($(LOSCFG_LIB_LIBC), y) LIB_SUBDIRS += lib/libc LITEOS_BASELIB += -lc @@ -197,16 +206,6 @@ ifeq ($(LOSCFG_LIB_LIBC), y) LITEOS_CMACRO += -DSECUREC_IN_KERNEL=0 endif - LITEOS_BASELIB += -lscrew - LIB_SUBDIRS += lib/libscrew - LITEOS_LIBSCREW_INCLUDE += -I $(LITEOSTOPDIR)/lib/libscrew/include - -ifeq ($(LOSCFG_KERNEL_CPPSUPPORT), y) - LITEOS_BASELIB += -lcppsupport - LIB_SUBDIRS += kernel/extended/cppsupport - LITEOS_CPPSUPPORT_INCLUDE += -I $(LITEOSTOPDIR)/kernel/extended/cppsupport -endif - ifeq ($(LOSCFG_LIB_ZLIB), y) LITEOS_BASELIB += -lz LIB_SUBDIRS += lib/zlib @@ -301,6 +300,17 @@ ifeq ($(LOSCFG_FS_JFFS), y) LIB_SUBDIRS += fs/jffs2 endif +ifeq ($(LOSCFG_PLATFORM_ROOTFS), y) + LITEOS_BASELIB += -lrootfs + LIB_SUBDIRS += fs/rootfs + LITEOS_PLATFORM_INCLUDE += -I $(LITEOSTOPDIR)/fs/rootfs +endif + +ifeq ($(LOSCFG_PLATFORM_PATCHFS), y) + LITEOS_BASELIB += -lpatchfs + LIB_SUBDIRS += fs/patchfs +endif + ifeq ($(LOSCFG_FS_ZPFS), y) LITEOS_BASELIB += -lzpfs LIB_SUBDIRS += fs/zpfs @@ -380,6 +390,7 @@ ifeq ($(LOSCFG_DRIVERS_USB), y) LITEOS_BASELIB += -lusb_base LIB_SUBDIRS += $(LITEOSTOPDIR)/bsd/dev/usb LITEOS_USB_INCLUDE += -I $(LITEOSTOPDIR)/bsd/dev/usb + LITEOS_CMACRO += -DUSB_DEBUG_VAR=5 endif ifeq ($(LOSCFG_DRIVERS_VIDEO), y) @@ -392,20 +403,22 @@ endif ############################## Dfx Option Begin####################################### ifeq ($(LOSCFG_BASE_CORE_HILOG), y) - LITEOS_BASELIB += -lhilog - LIB_SUBDIRS += $(LITEOSTOPDIR)/../../base/hiviewdfx/hilog_lite/frameworks/featured + LITEOS_BASELIB += -lhilog + LIB_SUBDIRS += $(LITEOSTOPDIR)/../../base/hiviewdfx/hilog_lite/frameworks/featured + LIB_SUBDIRS += $(LITEOSTOPDIR)/kernel/extended/hilog LITEOS_HILOG_INCLUDE += -I $(LITEOSTOPDIR)/../../base/hiviewdfx/hilog_lite/interfaces/native/kits LITEOS_HILOG_INCLUDE += -I $(LITEOSTOPDIR)/../../base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog + LITEOS_HILOG_INCLUDE += -I $(LITEOSTOPDIR)/kernel/extended/hilog endif ifeq ($(LOSCFG_BLACKBOX), y) LITEOS_BASELIB += -lblackbox - LIB_SUBDIRS += $(LITEOSTOPDIR)/kernel/common/blackbox - LITEOS_BLACKBOX_INCLUDE += -I $(LITEOSTOPDIR)/kernel/common/blackbox + LIB_SUBDIRS += $(LITEOSTOPDIR)/kernel/extended/blackbox + LITEOS_BLACKBOX_INCLUDE += -I $(LITEOSTOPDIR)/kernel/extended/blackbox endif ifeq ($(LOSCFG_HIDUMPER), y) LITEOS_BASELIB += -lhidumper - LIB_SUBDIRS += $(LITEOSTOPDIR)/kernel/common/hidumper - LITEOS_HIDUMPER_INCLUDE += -I $(LITEOSTOPDIR)/kernel/common/hidumper + LIB_SUBDIRS += $(LITEOSTOPDIR)/kernel/extended/hidumper + LITEOS_HIDUMPER_INCLUDE += -I $(LITEOSTOPDIR)/kernel/extended/hidumper endif ############################## Dfx Option End ####################################### @@ -457,13 +470,6 @@ ifeq ($(LOSCFG_NET_TELNET), y) LITEOS_TELNET_INCLUDE += \ -I $(LITEOSTOPDIR)/net/telnet/include endif - -ifeq ($(LOSCFG_KERNEL_SYSCALL), y) -LITEOS_BASELIB += -lsyscall -LIB_SUBDIRS += syscall -endif -LIB_SUBDIRS += kernel/user - ############################# Tools && Debug Option End ################################# ############################# Security Option Begin ############################## @@ -481,13 +487,13 @@ ifeq ($(LOSCFG_CC_STACKPROTECTOR_ALL), y) endif ifeq ($(LOSCFG_SECURITY), y) -LIB_SUBDIRS += security -LITEOS_BASELIB += -lsecurity + LIB_SUBDIRS += security + LITEOS_BASELIB += -lsecurity ifeq ($(LOSCFG_SECURITY_CAPABILITY), y) -LITEOS_SECURITY_CAP_INC := -I $(LITEOSTOPDIR)/security/cap + LITEOS_SECURITY_CAP_INC := -I $(LITEOSTOPDIR)/security/cap endif ifeq ($(LOSCFG_SECURITY_VID), y) -LITEOS_SECURITY_VID_INC := -I $(LITEOSTOPDIR)/security/vid + LITEOS_SECURITY_VID_INC := -I $(LITEOSTOPDIR)/security/vid endif endif