!403 Board 和 SoC分离,编译适配

Merge pull request !403 from SimonLi/master
This commit is contained in:
openharmony_ci 2021-11-21 02:17:37 +00:00 committed by Gitee
commit 4e0bf74f4a
3 changed files with 57 additions and 4 deletions

View File

@ -44,6 +44,7 @@ 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" +
" BOARD_COMPANY=$device_company" +
" DEVICE_PATH=$device_path" + " srctree=" + rebase_path(".") +
" genconfig" + " --header-path $LITEOS_MENUCONFIG_H" +
" --file-list kconfig_files.txt" +
@ -223,6 +224,9 @@ config("los_config") {
cmd = "if [ -f $device_path/BUILD.gn ]; then echo true; else echo false; fi"
HAVE_DEVICE_SDK = exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value")
# board and soc decoupling feature, device_path should contains board
BOARD_SOC_FEATURE = device_path != string_replace(device_path, "/board/", "")
config("public") {
configs = [
"arch:public",
@ -232,8 +236,13 @@ config("public") {
"utils:public",
]
if (HAVE_DEVICE_SDK) {
configs += [ "$device_path:public" ]
if (BOARD_SOC_FEATURE) {
configs += [ "//device/board/$device_company:public" ]
configs += [ "//device/soc/$LOSCFG_SOC_COMPANY:public" ]
} else {
if (HAVE_DEVICE_SDK) {
configs += [ "$device_path:public" ]
}
}
configs +=
@ -252,14 +261,22 @@ group("modules") {
HDFTOPDIR,
]
if (HAVE_DEVICE_SDK) {
deps += [ device_path ]
if (BOARD_SOC_FEATURE) {
deps += [ "//device/board/$device_company" ]
deps += [ "//device/soc/$LOSCFG_SOC_COMPANY" ]
} else {
if (HAVE_DEVICE_SDK) {
deps += [ device_path ]
}
}
deps += [ "$LITEOSTHIRDPARTY/bounds_checking_function:libsec_static" ]
deps += [ "$LITEOSTHIRDPARTY/musl/porting/liteos_m/kernel" ]
}
# when HAVE_DEVICE_SDK is not reached, gn raises an error. so we just use it as
# not needed
not_needed("*", [ "$HAVE_DEVICE_SDK" ])
static_library("libkernel") {
deps = [ ":modules" ]
public_configs = [

29
Kconfig
View File

@ -177,6 +177,35 @@ source "arch/Kconfig"
# Device Kconfig import
osource "$(DEVICE_PATH)/Kconfig"
config SOC_COMPANY
string "SoC company name to locate soc build path"
help
This option specifies the SoC company name, used to locate the build path for soc. This option is set by the
SoC's Kconfig file, and should be exactly the same with SoC company path, and the user should generally avoid
modifying it via the menu configuration.
orsource "../../device/board/*/Kconfig.liteos_m.shields"
orsource "../../device/board/$(BOARD_COMPANY)/Kconfig.liteos_m.defconfig.boards"
choice
prompt "Board Selection"
orsource "../../device/board/$(BOARD_COMPANY)/Kconfig.liteos_m.boards"
endchoice
orsource "../../device/soc/*/Kconfig.liteos_m.defconfig"
choice
prompt "SoC Series Selection"
orsource "../../device/soc/*/Kconfig.liteos_m.series"
endchoice
orsource "../../device/soc/*/Kconfig.liteos_m.soc"
config QUICK_START
bool "Enable QUICK_START"
default n

View File

@ -48,6 +48,10 @@ ifeq ($(DEVICE_PATH),)
DEVICE_PATH:=$(ohos_device_path)
endif
ifeq ($(BOARD_COMPANY),)
BOARD_COMPANY:=$(ohos_device_company)
endif
ifeq ($(TEE:1=y),y)
tee = _tee
endif
@ -64,6 +68,9 @@ LITEOS_CONFIG_FILE ?= $(LITEOSTOPDIR)/.config
# export los_config.mk related environment variables
export LITEOS_MENUCONFIG_H
export LITEOS_CONFIG_FILE
export BOARD_COMPANY
export DEVICE_PATH
export PRODUCT_PATH
# export kconfig related environment variables
export CONFIG_=LOSCFG_