feat: using kconfiglib instead of kconfig

kconfiglib support the kconfig macro language,
we need this feature to handle product related
Kconfig configuration.

Signed-off-by: Caoruihong <crh.cao@huawei.com>
Change-Id: I6bb521e93aab6c67b8bc3ac664b64f5e52089a45
This commit is contained in:
Caoruihong 2021-07-07 20:20:09 +08:00
parent 78906f4a6c
commit 8784694686
10 changed files with 58 additions and 59 deletions

6
.gitignore vendored
View File

@ -16,9 +16,9 @@ cscope*
tags tags
# Menuconfig temp files # Menuconfig temp files
/include/config /config.h
/include/generated .config
.config* .config.old
# Build temp files # Build temp files
/platform/board.ld /platform/board.ld

View File

@ -80,5 +80,7 @@ build_ext_component("make") {
outdir = rebase_path(get_path_info(".", "out_dir")) outdir = rebase_path(get_path_info(".", "out_dir"))
sysroot_path = rebase_path(ohos_current_sysroot) sysroot_path = rebase_path(ohos_current_sysroot)
arch_cflags = string_join(" ", target_arch_cflags) arch_cflags = string_join(" ", target_arch_cflags)
command = "./build.sh ${board_name} ${ohos_build_compiler} ${root_build_dir} ${ohos_build_type} ${tee_enable} \"${device_company}\" \"${product_path}\" $outdir \"${ohos_version}\" ${sysroot_path} \"${arch_cflags}\"" command = "./build.sh ${board_name} ${ohos_build_compiler} ${root_build_dir} ${ohos_build_type} ${tee_enable}"
command += " \"${device_company}\" \"${product_path}\" $outdir \"${ohos_version}\" ${sysroot_path} \"${arch_cflags}\""
command += " \"${device_path}\""
} }

50
Kconfig
View File

@ -52,15 +52,15 @@ endmenu
menu "Platform" menu "Platform"
######################### config options of bsp ##################### ######################### config options of bsp #####################
source "../../kernel/liteos_a/platform/Kconfig" source "platform/Kconfig"
######################### config options of cpu arch ################ ######################### config options of cpu arch ################
source "../../kernel/liteos_a/arch/Kconfig" source "arch/Kconfig"
######################### config options of rootfs ##################### ######################### config options of rootfs #####################
source "../../kernel/liteos_a/kernel/common/Kconfig" source "kernel/common/Kconfig"
######################### config options of patchfs ##################### ######################### config options of patchfs #####################
source "../../kernel/liteos_a/kernel/common/patchfs/Kconfig" source "kernel/common/patchfs/Kconfig"
config QUICK_START config QUICK_START
bool "Enable QUICK_START" bool "Enable QUICK_START"
@ -71,27 +71,24 @@ config QUICK_START
endmenu endmenu
######################### config options of kernel ##################### ######################### config options of kernel #####################
source "../../kernel/liteos_a/kernel/Kconfig" source "kernel/Kconfig"
######################### config options of lib ######################## ######################### config options of lib ########################
source "../../kernel/liteos_a/lib/Kconfig" source "lib/Kconfig"
######################### config options of compatibility ############## ######################### config options of compatibility ##############
menu "Compat" menu "Compat"
source "../../kernel/liteos_a/compat/posix/Kconfig" source "compat/posix/Kconfig"
source "../../kernel/liteos_a/bsd/Kconfig" source "bsd/Kconfig"
endmenu endmenu
######################### config options of framework ##################
#source "../../frameworks/m2mcomm/Kconfig"
######################## config options of filesystem ################## ######################## config options of filesystem ##################
menu "FileSystem" menu "FileSystem"
source "../../kernel/liteos_a/fs/vfs/Kconfig" source "fs/vfs/Kconfig"
source "../../kernel/liteos_a/fs/fat/Kconfig" source "fs/fat/Kconfig"
source "../../kernel/liteos_a/fs/ramfs/Kconfig" source "fs/ramfs/Kconfig"
source "../../kernel/liteos_a/fs/romfs/Kconfig" source "fs/romfs/Kconfig"
source "../../kernel/liteos_a/fs/nfs/Kconfig" source "fs/nfs/Kconfig"
source "../../kernel/liteos_a/fs/proc/Kconfig" source "fs/proc/Kconfig"
source "../../kernel/liteos_a/fs/jffs2/Kconfig" source "fs/jffs2/Kconfig"
config ENABLE_READ_BUFFER config ENABLE_READ_BUFFER
bool "Enable read buffer Option" bool "Enable read buffer Option"
default n default n
@ -117,7 +114,7 @@ config MAX_PATH_CACHE_SIZE
endmenu endmenu
######################## config options of net ############################ ######################## config options of net ############################
source "../../kernel/liteos_a/net/Kconfig" source "net/Kconfig"
######################## config options of debug ######################## ######################## config options of debug ########################
menu "Debug" menu "Debug"
@ -219,14 +216,14 @@ config DEBUG_SEMAPHORE
help help
Answer Y to enable debug semaphore. Answer Y to enable debug semaphore.
source "../../kernel/liteos_a/shell/Kconfig" source "shell/Kconfig"
config NET_LWIP_SACK_TFTP config NET_LWIP_SACK_TFTP
bool "Enable Tftp" bool "Enable Tftp"
default y default y
depends on SHELL && NET_LWIP_SACK && DEBUG_VERSION depends on SHELL && NET_LWIP_SACK && DEBUG_VERSION
help help
Answer Y to enable LiteOS support tftp cmd and tftp tool. Answer Y to enable LiteOS support tftp cmd and tftp tool.
source "../../kernel/liteos_a/net/telnet/Kconfig" source "net/telnet/Kconfig"
config SCHED_DEBUG config SCHED_DEBUG
bool "Enable sched debug Feature" bool "Enable sched debug Feature"
default n default n
@ -290,20 +287,25 @@ config DRIVERS
help help
Answer Y to enable LiteOS support driver. Answer Y to enable LiteOS support driver.
source "../../kernel/liteos_a/bsd/dev/usb/Kconfig" source "bsd/dev/usb/Kconfig"
source "../../drivers/adapter/khdf/liteos/Kconfig" source "../../drivers/adapter/khdf/liteos/Kconfig"
# Device driver Kconfig import
osource "$(DEVICE_PATH)/Kconfig"
osource "$(DEVICE_PATH)/config/Kconfig"
source "drivers/char/mem/Kconfig" source "drivers/char/mem/Kconfig"
source "drivers/char/quickstart/Kconfig" source "drivers/char/quickstart/Kconfig"
source "drivers/char/random/Kconfig" source "drivers/char/random/Kconfig"
source "../../drivers/liteos/tzdriver/Kconfig"
source "drivers/char/video/Kconfig" source "drivers/char/video/Kconfig"
source "../../drivers/liteos/tzdriver/Kconfig"
source "../../drivers/liteos/hievent/Kconfig" source "../../drivers/liteos/hievent/Kconfig"
endmenu endmenu
menu "Security" menu "Security"
source "../../kernel/liteos_a/security/Kconfig" source "security/Kconfig"
endmenu endmenu
menu "Test" menu "Test"

View File

@ -47,22 +47,17 @@ ROOTFS = rootfs
LITEOS_TARGET = liteos LITEOS_TARGET = liteos
LITEOS_LIBS_TARGET = libs_target LITEOS_LIBS_TARGET = libs_target
LITEOS_MENUCONFIG_H = $(LITEOSTOPDIR)/include/generated/autoconf.h
LITEOS_PLATFORM_BASE = $(LITEOSTOPDIR)/platform LITEOS_PLATFORM_BASE = $(LITEOSTOPDIR)/platform
export CONFIG_=LOSCFG_ export CONFIG_=LOSCFG_
MENUCONFIG_PATH = $(LITEOSTOPDIR)/tools/menuconfig ifeq ($(PRODUCT_PATH),)
KCONFIG_FILE_PATH = $(LITEOSTOPDIR)/Kconfig export PRODUCT_PATH=$(LITEOSTOPDIR)/../../device/hisilicon/drivers
ifeq ($(OS), Linux)
MENUCONFIG_MCONF := $(MENUCONFIG_PATH)/mconf
MENUCONFIG_CONF := $(MENUCONFIG_PATH)/conf
else
MENUCONFIG_MCONF := $(MENUCONFIG_PATH)/kconfig-mconf.exe
MENUCONFIG_CONF := $(MENUCONFIG_PATH)/kconfig-conf.exe
endif endif
$(shell env CONFIG_=$(CONFIG_) $(MENUCONFIG_CONF) -s --olddefconfig $(KCONFIG_FILE_PATH)) ifeq ($(shell which menuconfig),)
$(shell pip install --user kconfiglib >/dev/null)
endif
$(shell env CONFIG_=$(CONFIG_) PRODUCT_PATH=$(PRODUCT_PATH) olddefconfig >/dev/null)
-include $(LITEOSTOPDIR)/tools/build/config.mk -include $(LITEOSTOPDIR)/tools/build/config.mk
@ -148,17 +143,12 @@ $(LITEOS_LIBS_TARGET): $(__LIBS) sysroot
$(HIDE)echo "=============== make lib done ===============" $(HIDE)echo "=============== make lib done ==============="
##### make menuconfig ##### ##### make menuconfig #####
menuconfig:$(MENUCONFIG_MCONF) menuconfig:
$< $(KCONFIG_FILE_PATH) $(HIDE)menuconfig
genconfig:$(MENUCONFIG_CONF)
$(HIDE)mkdir -p include/config include/generated
$< --olddefconfig $(KCONFIG_FILE_PATH)
$< --silentoldconfig $(KCONFIG_FILE_PATH)
##### menuconfig end ####### ##### menuconfig end #######
$(LITEOS_MENUCONFIG_H): .config $(LITEOS_MENUCONFIG_H): .config
$(HIDE)$(MAKE) genconfig $(HIDE)genconfig
$(LITEOS_TARGET): $(__LIBS) sysroot $(LITEOS_TARGET): $(__LIBS) sysroot
$(HIDE)touch $(LOSCFG_ENTRY_SRC) $(HIDE)touch $(LOSCFG_ENTRY_SRC)
@ -223,11 +213,11 @@ update_all_config:
$(HIDE)shopt -s globstar && for f in tools/build/config/**/*.config ; \ $(HIDE)shopt -s globstar && for f in tools/build/config/**/*.config ; \
do \ do \
echo updating $$f; \ echo updating $$f; \
test -f $$f && cp $$f .config && $(MENUCONFIG_CONF) -s --olddefconfig $(KCONFIG_FILE_PATH) && $(MENUCONFIG_CONF) --savedefconfig $$f $(KCONFIG_FILE_PATH); \ test -f $$f && cp $$f .config && olddefconfig && savedefconfig --out $$f; \
done done
%.config: update_config:
$(HIDE)test -f tools/build/config/$@ && cp tools/build/config/$@ .config && $(MENUCONFIG_MCONF) $(KCONFIG_FILE_PATH) && $(MENUCONFIG_CONF) --savedefconfig tools/build/config/$@ $(KCONFIG_FILE_PATH) $(HIDE)test -f "$(CONFIG)" && cp "$(CONFIG)" .config && menuconfig && savedefconfig --out "$(CONFIG)"
.PHONY: all lib clean cleanall $(LITEOS_TARGET) debug release help update_all_config .PHONY: all lib clean cleanall $(LITEOS_TARGET) debug release help update_all_config update_config
.PHONY: prepare sysroot cleanrootfs $(ROOTFS) $(ROOTFSDIR) $(APPS) menuconfig genconfig $(LITEOS_LIBS_TARGET) $(__LIBS) $(OUT) .PHONY: prepare sysroot cleanrootfs $(ROOTFS) $(ROOTFSDIR) $(APPS) menuconfig $(LITEOS_LIBS_TARGET) $(__LIBS) $(OUT)

View File

@ -15,7 +15,7 @@ config DRIVERS_USB_HOST_DRIVER
choice choice
depends on DRIVERS_USB_HOST_DRIVER depends on DRIVERS_USB_HOST_DRIVER
prompt "USB HCD" prompt "USB HCD"
default y default DRIVERS_USB_HOST_EHCI
help help
Enable EHCI for USB 2.0. Enable EHCI for USB 2.0.
Enable XHCI for USB 3.0 Enable XHCI for USB 3.0

View File

@ -41,6 +41,7 @@ outdir=${8}
ohos_version=${9} ohos_version=${9}
sysroot_path=${10} sysroot_path=${10}
arch_cflags=${11} arch_cflags=${11}
device_path=${12}
echo "${board_name}" "${device_company}" echo "${board_name}" "${device_company}"
echo "sh param:" "$@" echo "sh param:" "$@"
@ -95,6 +96,10 @@ if [ "x" != "x${arch_cflags}" ]; then
export ARCH_CFLAGS="${arch_cflags}" export ARCH_CFLAGS="${arch_cflags}"
fi fi
export OUTDIR="${outdir}"
export PRODUCT_PATH="${product_path}"
export DEVICE_PATH="${device_path}"
main && \ main && \
make clean OUTDIR="${outdir}" PRODUCT_PATH="${product_path}" && \ make clean && \
make -j rootfs VERSION="${ohos_version}" OUTDIR="${outdir}" PRODUCT_PATH="${product_path}" make -j rootfs VERSION="${ohos_version}"

View File

@ -17,7 +17,7 @@ config NET_LWIP_SACK
choice choice
depends on NET_LWIP_SACK depends on NET_LWIP_SACK
prompt "Lwipsack" prompt "Lwipsack"
default y default NET_LWIP_SACK_2_1
help help
Enable Lwipsack for 2.x Enable Lwipsack for 2.x

View File

@ -121,7 +121,7 @@ CXX_PATH = $(LITEOSTOPDIR)/lib/cxxstl
JFFS_PATH = $(LITEOSTOPDIR)/fs/jffs2 JFFS_PATH = $(LITEOSTOPDIR)/fs/jffs2
LITEOS_SCRIPTPATH ?= $(LITEOSTOPDIR)/tools/scripts LITEOS_SCRIPTPATH ?= $(LITEOSTOPDIR)/tools/scripts
LITEOS_LIB_BIGODIR = $(OUT)/lib/obj LITEOS_LIB_BIGODIR = $(OUT)/lib/obj
LITEOS_MENUCONFIG_H = $(LITEOSTOPDIR)/include/generated/autoconf.h LITEOS_MENUCONFIG_H = $(LITEOSTOPDIR)/config.h
LOSCFG_ENTRY_SRC = $(LITEOSTOPDIR)/kernel/common/los_config.c LOSCFG_ENTRY_SRC = $(LITEOSTOPDIR)/kernel/common/los_config.c
### include variable ### include variable
@ -668,7 +668,7 @@ LITEOS_COPTS_EXTRA_INTERWORK := $(LITEOS_COPTS_EXTRA)
endif endif
# kernel configuration macros # kernel configuration macros
LITEOS_CMACRO += -imacros $(LITEOS_MENUCONFIG_H) LITEOS_CMACRO += -imacros "$(LITEOS_MENUCONFIG_H)"
ifneq ($(LOSCFG_COMPILER_CLANG_LLVM), y) ifneq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
LITEOS_LD_OPTS += -nostartfiles LITEOS_LD_OPTS += -nostartfiles

Binary file not shown.

Binary file not shown.