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
# Menuconfig temp files
/include/config
/include/generated
.config*
/config.h
.config
.config.old
# Build temp files
/platform/board.ld

View File

@ -80,5 +80,7 @@ build_ext_component("make") {
outdir = rebase_path(get_path_info(".", "out_dir"))
sysroot_path = rebase_path(ohos_current_sysroot)
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"
######################### config options of bsp #####################
source "../../kernel/liteos_a/platform/Kconfig"
source "platform/Kconfig"
######################### config options of cpu arch ################
source "../../kernel/liteos_a/arch/Kconfig"
source "arch/Kconfig"
######################### config options of rootfs #####################
source "../../kernel/liteos_a/kernel/common/Kconfig"
source "kernel/common/Kconfig"
######################### config options of patchfs #####################
source "../../kernel/liteos_a/kernel/common/patchfs/Kconfig"
source "kernel/common/patchfs/Kconfig"
config QUICK_START
bool "Enable QUICK_START"
@ -71,27 +71,24 @@ config QUICK_START
endmenu
######################### config options of kernel #####################
source "../../kernel/liteos_a/kernel/Kconfig"
source "kernel/Kconfig"
######################### config options of lib ########################
source "../../kernel/liteos_a/lib/Kconfig"
source "lib/Kconfig"
######################### config options of compatibility ##############
menu "Compat"
source "../../kernel/liteos_a/compat/posix/Kconfig"
source "../../kernel/liteos_a/bsd/Kconfig"
source "compat/posix/Kconfig"
source "bsd/Kconfig"
endmenu
######################### config options of framework ##################
#source "../../frameworks/m2mcomm/Kconfig"
######################## config options of filesystem ##################
menu "FileSystem"
source "../../kernel/liteos_a/fs/vfs/Kconfig"
source "../../kernel/liteos_a/fs/fat/Kconfig"
source "../../kernel/liteos_a/fs/ramfs/Kconfig"
source "../../kernel/liteos_a/fs/romfs/Kconfig"
source "../../kernel/liteos_a/fs/nfs/Kconfig"
source "../../kernel/liteos_a/fs/proc/Kconfig"
source "../../kernel/liteos_a/fs/jffs2/Kconfig"
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"
config ENABLE_READ_BUFFER
bool "Enable read buffer Option"
default n
@ -117,7 +114,7 @@ config MAX_PATH_CACHE_SIZE
endmenu
######################## config options of net ############################
source "../../kernel/liteos_a/net/Kconfig"
source "net/Kconfig"
######################## config options of debug ########################
menu "Debug"
@ -219,14 +216,14 @@ config DEBUG_SEMAPHORE
help
Answer Y to enable debug semaphore.
source "../../kernel/liteos_a/shell/Kconfig"
source "shell/Kconfig"
config NET_LWIP_SACK_TFTP
bool "Enable Tftp"
default y
depends on SHELL && NET_LWIP_SACK && DEBUG_VERSION
help
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
bool "Enable sched debug Feature"
default n
@ -290,20 +287,25 @@ config DRIVERS
help
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"
# Device driver Kconfig import
osource "$(DEVICE_PATH)/Kconfig"
osource "$(DEVICE_PATH)/config/Kconfig"
source "drivers/char/mem/Kconfig"
source "drivers/char/quickstart/Kconfig"
source "drivers/char/random/Kconfig"
source "../../drivers/liteos/tzdriver/Kconfig"
source "drivers/char/video/Kconfig"
source "../../drivers/liteos/tzdriver/Kconfig"
source "../../drivers/liteos/hievent/Kconfig"
endmenu
menu "Security"
source "../../kernel/liteos_a/security/Kconfig"
source "security/Kconfig"
endmenu
menu "Test"

View File

@ -47,22 +47,17 @@ ROOTFS = rootfs
LITEOS_TARGET = liteos
LITEOS_LIBS_TARGET = libs_target
LITEOS_MENUCONFIG_H = $(LITEOSTOPDIR)/include/generated/autoconf.h
LITEOS_PLATFORM_BASE = $(LITEOSTOPDIR)/platform
export CONFIG_=LOSCFG_
MENUCONFIG_PATH = $(LITEOSTOPDIR)/tools/menuconfig
KCONFIG_FILE_PATH = $(LITEOSTOPDIR)/Kconfig
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
ifeq ($(PRODUCT_PATH),)
export PRODUCT_PATH=$(LITEOSTOPDIR)/../../device/hisilicon/drivers
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
@ -148,17 +143,12 @@ $(LITEOS_LIBS_TARGET): $(__LIBS) sysroot
$(HIDE)echo "=============== make lib done ==============="
##### make menuconfig #####
menuconfig:$(MENUCONFIG_MCONF)
$< $(KCONFIG_FILE_PATH)
genconfig:$(MENUCONFIG_CONF)
$(HIDE)mkdir -p include/config include/generated
$< --olddefconfig $(KCONFIG_FILE_PATH)
$< --silentoldconfig $(KCONFIG_FILE_PATH)
menuconfig:
$(HIDE)menuconfig
##### menuconfig end #######
$(LITEOS_MENUCONFIG_H): .config
$(HIDE)$(MAKE) genconfig
$(HIDE)genconfig
$(LITEOS_TARGET): $(__LIBS) sysroot
$(HIDE)touch $(LOSCFG_ENTRY_SRC)
@ -223,11 +213,11 @@ update_all_config:
$(HIDE)shopt -s globstar && for f in tools/build/config/**/*.config ; \
do \
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
%.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)
update_config:
$(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: prepare sysroot cleanrootfs $(ROOTFS) $(ROOTFSDIR) $(APPS) menuconfig genconfig $(LITEOS_LIBS_TARGET) $(__LIBS) $(OUT)
.PHONY: all lib clean cleanall $(LITEOS_TARGET) debug release help update_all_config update_config
.PHONY: prepare sysroot cleanrootfs $(ROOTFS) $(ROOTFSDIR) $(APPS) menuconfig $(LITEOS_LIBS_TARGET) $(__LIBS) $(OUT)

View File

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

View File

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

View File

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

View File

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

Binary file not shown.

Binary file not shown.