Generate the kernel config choice, rather than having it hard-coded:

- change the menu label from 'Target OS' to 'Operating System',
  - bare-metal is a kind of kernel (OS), rename to 'bare-metal' from 'none',
  - update the kconfig.mk to generate the kernel choice entries,
  - update glibc&eglibc kernel version option accordingly.
Update the debug & tools confiog file generation to match with arch & kernel.
Print terse command lines when building in kconfig/ (a-la Linux kernel).
Fix the makefile rules in kconfig/kconfig.mk to be /simple/ rules.

 /trunk/kconfig/kconfig.mk                       |  117    81    36     0 +++++++++++++++++++++----------
 /trunk/config/kernel/linux.in                   |    4     4     0     0 +
 /trunk/config/kernel/bare-metal.experimental.in |   15    15     0     0 ++++
 /trunk/config/kernel.in                         |   33     5    28     0 +--------
 /trunk/config/libc/glibc-eglibc-common.in       |    4     2     2     0
 5 files changed, 107 insertions(+), 66 deletions(-)
This commit is contained in:
Yann E. MORIN" 2008-09-16 17:39:40 +00:00
parent 59b1a0929d
commit c36b921790
6 changed files with 110 additions and 69 deletions

View File

@ -1,42 +1,19 @@
# Kernel options
menu "Operating System"
config KERNEL
string
default "none" if BARE_METAL
default "linux" if KERNEL_LINUX
menu "Target OS"
choice
bool
prompt "Target OS"
default KERNEL_LINUX
config KERNEL_LINUX
bool
prompt "Linux"
help
Build a toolchain targeting systems running Linux as a kernel.
config BARE_METAL
bool
prompt "Bare metal (EXPERIMENTAL)"
depends on EXPERIMENTAL
help
Say 'y' here if you want a simple C compiler with no C library.
'Bare metal' also refer to those programs that run without any kernel.
You probably want to say 'y' here if you plan to use your compiler
to build only kernels or bootloaders
endchoice
config KERNEL_VERSION
string
if KERNEL_LINUX
source config/kernel/linux.in
endif
choice
bool
prompt "Target OS"
source config.gen/kernel.in
endchoice
endmenu

View File

@ -0,0 +1,15 @@
# Bare metal config options
config KERNEL_bare_metal
select BARE_METAL
help
Say 'y' here if you want a simple C compiler with no C library.
'Bare metal' also refer to those programs that run without any kernel.
You probably want to say 'y' here if you plan to use your compiler
to build only kernels or bootloaders.
config BARE_METAL
bool
default n

View File

@ -1,5 +1,9 @@
# Linux kernel options
config KERNEL_linux
help
Build a toolchain targeting systems running Linux as a kernel.
choice
bool
prompt "Get kernel headers from:"

View File

@ -70,7 +70,7 @@ config LIBC_ADDONS_LIST
Eg.: crypt (for very old libces)
if KERNEL_LINUX
if KERNEL_linux
choice
bool
@ -166,4 +166,4 @@ config LIBC_GLIBC_MIN_KERNEL
default KERNEL_VERSION if LIBC_GLIBC_KERNEL_VERSION_AS_HEADERS
default LIBC_GLIBC_MIN_KERNEL_VERSION if LIBC_GLIBC_USE_HEADERS_MIN_KERNEL
endif # KERNEL_LINUX
endif # KERNEL_linux

View File

@ -19,24 +19,31 @@ CFLAGS += -DKBUILD_NO_NLS
endif
# Build a list of all config files
ARCHS = $(patsubst $(CT_LIB_DIR)/arch/%,%,$(wildcard $(CT_LIB_DIR)/arch/*))
ARCH_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/arch/*/*.in)
ARCH_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/arch/*/config.in)
KERN_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/config/kernel/*.in)
DEBUG_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/config/debug/*.in)
TOOLS_CONFIG_FILES = $(wildcard $(CT_LIB_DIR)/config/tools/*.in)
STATIC_CONFIG_FILES = $(shell find $(CT_LIB_DIR)/config -type f -name '*.in')
GEN_CONFIG_FILES=$(CT_TOP_DIR)/config.gen/arch.in \
$(CT_TOP_DIR)/config.gen/kernel.in \
$(CT_TOP_DIR)/config.gen/debug.in \
$(CT_TOP_DIR)/config.gen/tools.in
CONFIG_FILES=$(STATIC_CONFIG_FILES) $(GEN_CONFIG_FILES)
$(GEN_CONFIG_FILES):: $(CT_TOP_DIR)/config.gen
# Build list of items
ARCHS = $(patsubst $(CT_LIB_DIR)/arch/%/config.in,%,$(ARCH_CONFIG_FILES))
KERNELS = $(patsubst $(CT_LIB_DIR)/config/kernel/%.in,%,$(KERN_CONFIG_FILES))
$(GEN_CONFIG_FILES): $(CT_TOP_DIR)/config.gen \
$(CT_LIB_DIR)/kconfig/kconfig.mk
$(CT_TOP_DIR)/config.gen:
@mkdir -p $(CT_TOP_DIR)/config.gen
$(CT_TOP_DIR)/config.gen/arch.in:: $(ARCH_CONFIG_FILES)
$(CT_TOP_DIR)/config.gen/arch.in: $(ARCH_CONFIG_FILES)
@echo ' IN config.gen/arch.in'
@(echo "# Architectures menu"; \
echo "# Generated file, do not edit!!!"; \
echo ""; \
@ -57,46 +64,77 @@ $(CT_TOP_DIR)/config.gen/arch.in:: $(ARCH_CONFIG_FILES)
echo "endif"; \
echo ""; \
done; \
) >$@
) >$@
$(CT_TOP_DIR)/config.gen/debug.in:: $(DEBUG_CONFIG_FILES)
@echo "# Debug facilities menu" >$@
@echo "# Generated file, do not edit!!!" >>$@
@echo "menu \"Debug facilities\"" >>$@
@for f in $(patsubst $(CT_TOP_DIR)/%,%,$(wildcard $(CT_TOP_DIR)/config/debug/*.in)); do \
echo "source $${f}"; \
done >>$@
@echo "endmenu" >>$@
$(CT_TOP_DIR)/config.gen/kernel.in: $(KERN_CONFIG_FILES)
@echo ' IN config.gen/kernel.in'
@(echo "# Kernel menu"; \
echo "# Generated file, do not edit!!!"; \
echo ""; \
for kern in $(KERNELS); do \
_exp="$${kern/*./}"; \
_kern1="$${kern/.experimental/}"; \
_kern2=$$(echo "$${_kern1}" |sed -r -e 's/[ -\/]/_/g;'); \
echo "config KERNEL_$${_kern2}"; \
echo " bool"; \
printf " prompt \"$${_kern1}"; \
if [ "$${_exp}" != "$${kern}" ]; then \
echo " (EXPERIMENTAL)\""; \
echo " depends on EXPERIMENTAL"; \
else \
echo "\""; \
fi; \
echo "if KERNEL_$${_kern2}"; \
echo "config KERNEL"; \
echo " default \"$${_kern1}\" if KERNEL_$${_kern2}"; \
echo "source config/kernel/$${kern}.in"; \
echo "endif"; \
echo ""; \
done; \
) >$@
$(CT_TOP_DIR)/config.gen/tools.in:: $(TOOLS_CONFIG_FILES)
@echo "# Tools facilities menu" >$@
@echo "# Generated file, do not edit!!!" >>$@
@echo "menu \"Tools facilities\"" >>$@
@for f in $(patsubst $(CT_TOP_DIR)/%,%,$(wildcard $(CT_TOP_DIR)/config/tools/*.in)); do \
echo "source $${f}"; \
done >>$@
@echo "endmenu" >>$@
$(CT_TOP_DIR)/config.gen/debug.in: $(DEBUG_CONFIG_FILES)
@echo ' IN config.gen/debug.in'
@(echo "# Debug facilities menu"; \
echo "# Generated file, do not edit!!!"; \
echo "menu \"Debug facilities\""; \
for f in $(patsubst $(CT_TOP_DIR)/%,%,$(DEBUG_CONFIG_FILES)); do \
echo "source $${f}"; \
done; \
echo "endmenu"; \
) >$@
config menuconfig oldconfig defoldconfig extractconfig:: $(KCONFIG_TOP)
$(CT_TOP_DIR)/config.gen/tools.in: $(TOOLS_CONFIG_FILES)
@echo ' IN config.gen/tools.in'
@(echo "# Tools facilities menu"; \
echo "# Generated file, do not edit!!!"; \
echo "menu \"Tools facilities\""; \
for f in $(patsubst $(CT_TOP_DIR)/%,%,$(TOOLS_CONFIG_FILES)); do \
echo "source $${f}"; \
done; \
echo "endmenu"; \
) >$@
config menuconfig oldconfig defoldconfig extractconfig: $(KCONFIG_TOP)
$(KCONFIG_TOP):
@ln -sf $(CT_LIB_DIR)/config config
menuconfig:: $(obj)/mconf $(CONFIG_FILES)
@$< $(KCONFIG_TOP)
menuconfig: $(CONFIG_FILES) $(obj)/mconf
@$(obj)/mconf $(KCONFIG_TOP)
config:: $(obj)/conf $(CONFIG_FILES)
@$< $(KCONFIG_TOP)
config: $(CONFIG_FILES) $(obj)/conf
@$(obj)/conf $(KCONFIG_TOP)
oldconfig:: $(obj)/conf $(CONFIG_FILES)
@$< -s $(KCONFIG_TOP)
oldconfig: $(CONFIG_FILES) $(obj)/conf
@$(obj)/conf -s $(KCONFIG_TOP)
defoldconfig:: $(obj)/conf $(CONFIG_FILES)
@yes "" |$< -s $(KCONFIG_TOP) >/dev/null
defoldconfig: $(CONFIG_FILES) $(obj)/conf
@yes "" |$(obj)/conf -s $(KCONFIG_TOP)
extractconfig:: $(obj)/conf $(CONFIG_FILES)
extractconfig: $(CONFIG_FILES) $(obj)/conf
@$(CT_LIB_DIR)/tools/extract-config.sh >.config
@$< -s $(KCONFIG_TOP)
@$(obj)/conf -s $(KCONFIG_TOP)
# Help text used by make help
help-config::
@ -111,9 +149,10 @@ help-config::
SHIPPED := $(CT_LIB_DIR)/kconfig/zconf.tab.c $(CT_LIB_DIR)/kconfig/lex.zconf.c $(CT_LIB_DIR)/kconfig/zconf.hash.c
%.c: %.c_shipped
@echo ' LN kconfig/$(notdir $@)'
@ln -s $(notdir $<) $@
$(obj)/conf $(obj)/mconf:: $(obj)
$(obj)/conf $(obj)/mconf: $(obj)
$(obj):
@mkdir -p $(obj)
@ -128,12 +167,18 @@ FILES = $(CT_LIB_DIR)/kconfig/confdata.c \
$(CT_LIB_DIR)/kconfig/symbol.c \
$(CT_LIB_DIR)/kconfig/util.c
$(obj)/mconf:: $(SHIPPED) $(CT_LIB_DIR)/kconfig/mconf.c $(HEADERS) $(FILES)
$(obj)/mconf: $(SHIPPED) $(CT_LIB_DIR)/kconfig/mconf.c \
$(HEADERS) $(FILES) \
$(CT_LIB_DIR)/kconfig/kconfig.mk
@echo ' LNK kconfig/mconf'
@$(HOST_CC) $(CFLAGS) -o $@ $(CT_LIB_DIR)/kconfig/{mconf.c,zconf.tab.c,lxdialog/*.c} \
$(shell $(CT_LIB_DIR)/kconfig/lxdialog/check-lxdialog.sh -ccflags) \
$(shell $(CT_LIB_DIR)/kconfig/lxdialog/check-lxdialog.sh -ldflags $(HOST_CC))
$(obj)/conf:: $(SHIPPED) $(CT_LIB_DIR)/kconfig/conf.c $(HEADERS) $(FILES)
$(obj)/conf: $(SHIPPED) $(CT_LIB_DIR)/kconfig/conf.c \
$(HEADERS) $(FILES) \
$(CT_LIB_DIR)/kconfig/kconfig.mk
@echo ' LNK kconfig/conf'
@$(HOST_CC) $(CFLAGS) -o $@ $(CT_LIB_DIR)/kconfig/{conf.c,zconf.tab.c}
clean::