refactor: 内核目录结构整理

1. 原kernel/common目录下属于内核拓展组件,统一移入kernel/extend管理
2. Kconfig分层,各模块自己的配置放到自己目录下管理
3. 原platform下不属于平台的公共代码抽到kernel/common下,只留板级链接脚本和一些编译脚本指向device目录下触发平台相关的编译
4. 对外公共头文件统一抽到对外include路径
5. 废弃宏,头文件清理

close: #I48KI4

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I0cf5ea81c92a8fa7b113da9cbdc8b7bc935f5aae
This commit is contained in:
arvinzzz 2021-09-06 16:55:45 +08:00
parent de8257bc82
commit 33d0c1bd0b
97 changed files with 586 additions and 670 deletions

View File

@ -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'" +
[ "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" +
" 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-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,
@ -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) {

63
Kconfig
View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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" ]
}

View File

@ -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)

View File

@ -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

20
drivers/Kconfig Normal file
View File

@ -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"

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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",
]
}

10
fs/Kconfig Normal file
View File

@ -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"

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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.

View File

@ -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

View File

@ -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"

View File

@ -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 = [ "." ]
}

46
kernel/common/Makefile Normal file
View File

@ -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)

View File

@ -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

View File

@ -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;

View File

@ -38,7 +38,6 @@
#include "los_tick.h"
#include "los_vm_zone.h"
#include "sys_config.h"
#ifdef __cplusplus
#if __cplusplus

View File

@ -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",
]
}

98
kernel/extended/Kconfig Normal file
View File

@ -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"

View File

@ -1,6 +1,7 @@
config BLACKBOX
bool "Enable BlackBox"
default n
depends on KERNEL_EXTKERNEL
help
Answer Y to enable LiteOS support blackbox

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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)

View File

@ -1,5 +1,6 @@
config HIDUMPER
bool "Enable hidumper"
default n
depends on KERNEL_EXTKERNEL
help
Answer Y to enable LiteOS support hidumper

View File

@ -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",
".",
]
}

View File

@ -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)

View File

@ -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;

View File

@ -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

View File

@ -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",
]

View File

@ -94,8 +94,6 @@ extern "C" {
#define LITE_OS_SEC_DTCM /* __attribute__((section(".dtcm"))) */
#endif
#define PACK1
#ifdef __cplusplus
#if __cplusplus
}

View File

@ -37,7 +37,6 @@
#ifndef _LOS_PRINTF_H
#define _LOS_PRINTF_H
#include "sys_config.h"
#ifdef LOSCFG_LIB_LIBC
#include "stdarg.h"
#endif

View File

@ -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" ]

View File

@ -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

View File

@ -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)

View File

@ -30,7 +30,9 @@
*/
#include "los_seq_buf.h"
#include "los_typedef.h"
#include <stdlib.h>
#include "securec.h"
static int ExpandSeqBuf(struct SeqBuf *seqBuf, size_t oldCount)
{

View File

@ -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 = [

View File

@ -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)

View File

@ -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)

View File

@ -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 */

View File

@ -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 */

View File

@ -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" ]

View File

@ -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"

View File

@ -50,7 +50,6 @@ Case B:
Tail Head
*/
#include "sys_config.h"
#ifdef LOSCFG_SHELL_DMESG
#include "dmesg_pri.h"
#include "show.h"

View File

@ -27,11 +27,9 @@
# 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",
@ -51,12 +49,18 @@ static_library("test_base") {
"../fs/nfs/include",
"../bsd/compat/linuxkpi/include",
]
public_configs = [ ":public" ]
}
config("public") {
include_dirs = [ "include" ]
}
lite_component("test") {
features = [ ":test_base" ]
# KERNEL BASE TEST
# KERNEL BASE TEST
if (LOSCFG_TEST_KERNEL_BASE_IPC) {
features += [ "sample/kernel_base/ipc:test_ipc" ]
}
@ -79,7 +83,7 @@ lite_component("test") {
features += [ "sample/kernel_base/atomic:test_atomic" ]
}
# KERNEL EXTEND TEST
# KERNEL EXTEND TEST
if (LOSCFG_TEST_KERNEL_EXTEND_CPP) {
features += [ "sample/kernel_extend/cpp:test_cpp" ]
}
@ -90,13 +94,14 @@ lite_component("test") {
features += [ "sample/kernel_extend/mmu:test_mmu" ]
}
# COMPAT TEST
# 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" ]
# }
@ -121,21 +126,22 @@ lite_component("test") {
if (LOSCFG_TEST_LINUX) {
features += [ "sample/linux:test_linux" ]
}
#if (LOSCFG_TEST_LINUX_HRTIMER) {
# features += [ "sample/linux/hrtimer:test_linux_hrtimer" ]
#}
# LIBC TEST
# LIBC TEST
if (LOSCFG_TEST_LIBC) {
features += [ "sample/libc:test_libc" ]
}
# LIBM TEST
# LIBM TEST
if (LOSCFG_TEST_LIBM) {
features += [ "sample/libm:test_libm" ]
}
# SHELL TEST
# SHELL TEST
if (LOSCFG_TEST_SHELL) {
features += [ "sample/shell:test_shell" ]
}

View File

@ -38,7 +38,7 @@ extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */
extern UINT32 OsTestInit(VOID);
extern UINT32 TestSystemInit(VOID);
#ifdef __cplusplus
#if __cplusplus

View File

@ -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, ...);

View File

@ -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)
@ -394,18 +405,20 @@ endif
ifeq ($(LOSCFG_BASE_CORE_HILOG), y)
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