This patch series adds Kconfig to SeaBIOS. The goal is to do this with a minimal impact to the current SeaBIOS build and config system.
Further build and config changes can be done in subsequent patches.
This imports the latest Kconfig from the Linux 2.6 tree.
-Kevin
Kevin O'Connor (4): Initial commit of Kconfig build tool. Build changes for Linux kconfig code to work in seabios dir structure. Change kconfig to emit disabled symbols in autoconf.h. Start using Kconfig to configure SeaBIOS settings.
.gitignore | 2 + Makefile | 27 +- src/Kconfig | 15 + src/config.h | 11 +- src/defconfig | 6 + tools/kconfig/.gitignore | 23 + tools/kconfig/Makefile | 361 +++++ tools/kconfig/POTFILES.in | 12 + tools/kconfig/check.sh | 14 + tools/kconfig/conf.c | 654 ++++++++ tools/kconfig/confdata.c | 1062 +++++++++++++ tools/kconfig/expr.c | 1173 ++++++++++++++ tools/kconfig/expr.h | 231 +++ tools/kconfig/gconf.c | 1577 +++++++++++++++++++ tools/kconfig/gconf.glade | 661 ++++++++ tools/kconfig/images.c | 326 ++++ tools/kconfig/kconfig_load.c | 35 + tools/kconfig/kxgettext.c | 236 +++ tools/kconfig/lex.zconf.c_shipped | 2430 +++++++++++++++++++++++++++++ tools/kconfig/lkc.h | 196 +++ tools/kconfig/lkc_proto.h | 53 + tools/kconfig/lxdialog/.gitignore | 4 + tools/kconfig/lxdialog/BIG.FAT.WARNING | 4 + tools/kconfig/lxdialog/check-lxdialog.sh | 84 + tools/kconfig/lxdialog/checklist.c | 332 ++++ tools/kconfig/lxdialog/dialog.h | 230 +++ tools/kconfig/lxdialog/inputbox.c | 238 +++ tools/kconfig/lxdialog/menubox.c | 434 ++++++ tools/kconfig/lxdialog/textbox.c | 391 +++++ tools/kconfig/lxdialog/util.c | 657 ++++++++ tools/kconfig/lxdialog/yesno.c | 114 ++ tools/kconfig/mconf.c | 862 ++++++++++ tools/kconfig/menu.c | 609 ++++++++ tools/kconfig/nconf.c | 1561 +++++++++++++++++++ tools/kconfig/nconf.gui.c | 617 ++++++++ tools/kconfig/nconf.h | 96 ++ tools/kconfig/qconf.cc | 1787 +++++++++++++++++++++ tools/kconfig/qconf.h | 337 ++++ tools/kconfig/symbol.c | 1260 +++++++++++++++ tools/kconfig/util.c | 138 ++ tools/kconfig/zconf.gperf | 47 + tools/kconfig/zconf.hash.c_shipped | 245 +++ tools/kconfig/zconf.l | 360 +++++ tools/kconfig/zconf.tab.c_shipped | 2505 ++++++++++++++++++++++++++++++ tools/kconfig/zconf.y | 749 +++++++++ 45 files changed, 22754 insertions(+), 12 deletions(-) create mode 100644 src/Kconfig create mode 100644 src/defconfig create mode 100644 tools/kconfig/.gitignore create mode 100644 tools/kconfig/Makefile create mode 100644 tools/kconfig/POTFILES.in create mode 100755 tools/kconfig/check.sh create mode 100644 tools/kconfig/conf.c create mode 100644 tools/kconfig/confdata.c create mode 100644 tools/kconfig/expr.c create mode 100644 tools/kconfig/expr.h create mode 100644 tools/kconfig/gconf.c create mode 100644 tools/kconfig/gconf.glade create mode 100644 tools/kconfig/images.c create mode 100644 tools/kconfig/kconfig_load.c create mode 100644 tools/kconfig/kxgettext.c create mode 100644 tools/kconfig/lex.zconf.c_shipped create mode 100644 tools/kconfig/lkc.h create mode 100644 tools/kconfig/lkc_proto.h create mode 100644 tools/kconfig/lxdialog/.gitignore create mode 100644 tools/kconfig/lxdialog/BIG.FAT.WARNING create mode 100644 tools/kconfig/lxdialog/check-lxdialog.sh create mode 100644 tools/kconfig/lxdialog/checklist.c create mode 100644 tools/kconfig/lxdialog/dialog.h create mode 100644 tools/kconfig/lxdialog/inputbox.c create mode 100644 tools/kconfig/lxdialog/menubox.c create mode 100644 tools/kconfig/lxdialog/textbox.c create mode 100644 tools/kconfig/lxdialog/util.c create mode 100644 tools/kconfig/lxdialog/yesno.c create mode 100644 tools/kconfig/mconf.c create mode 100644 tools/kconfig/menu.c create mode 100644 tools/kconfig/nconf.c create mode 100644 tools/kconfig/nconf.gui.c create mode 100644 tools/kconfig/nconf.h create mode 100644 tools/kconfig/qconf.cc create mode 100644 tools/kconfig/qconf.h create mode 100644 tools/kconfig/symbol.c create mode 100644 tools/kconfig/util.c create mode 100644 tools/kconfig/zconf.gperf create mode 100644 tools/kconfig/zconf.hash.c_shipped create mode 100644 tools/kconfig/zconf.l create mode 100644 tools/kconfig/zconf.tab.c_shipped create mode 100644 tools/kconfig/zconf.y
This is a pure copy of the tool from the Linux v2.6.38-rc2 scripts/kconfig/ directory. --- tools/kconfig/.gitignore | 23 + tools/kconfig/Makefile | 354 +++++ tools/kconfig/POTFILES.in | 12 + tools/kconfig/check.sh | 14 + tools/kconfig/conf.c | 654 ++++++++ tools/kconfig/confdata.c | 1053 +++++++++++++ tools/kconfig/expr.c | 1173 ++++++++++++++ tools/kconfig/expr.h | 231 +++ tools/kconfig/gconf.c | 1577 +++++++++++++++++++ tools/kconfig/gconf.glade | 661 ++++++++ tools/kconfig/images.c | 326 ++++ tools/kconfig/kconfig_load.c | 35 + tools/kconfig/kxgettext.c | 236 +++ tools/kconfig/lex.zconf.c_shipped | 2430 +++++++++++++++++++++++++++++ tools/kconfig/lkc.h | 196 +++ tools/kconfig/lkc_proto.h | 53 + tools/kconfig/lxdialog/.gitignore | 4 + tools/kconfig/lxdialog/BIG.FAT.WARNING | 4 + tools/kconfig/lxdialog/check-lxdialog.sh | 84 + tools/kconfig/lxdialog/checklist.c | 332 ++++ tools/kconfig/lxdialog/dialog.h | 230 +++ tools/kconfig/lxdialog/inputbox.c | 238 +++ tools/kconfig/lxdialog/menubox.c | 434 ++++++ tools/kconfig/lxdialog/textbox.c | 391 +++++ tools/kconfig/lxdialog/util.c | 657 ++++++++ tools/kconfig/lxdialog/yesno.c | 114 ++ tools/kconfig/mconf.c | 862 ++++++++++ tools/kconfig/menu.c | 609 ++++++++ tools/kconfig/nconf.c | 1561 +++++++++++++++++++ tools/kconfig/nconf.gui.c | 617 ++++++++ tools/kconfig/nconf.h | 96 ++ tools/kconfig/qconf.cc | 1787 +++++++++++++++++++++ tools/kconfig/qconf.h | 337 ++++ tools/kconfig/symbol.c | 1260 +++++++++++++++ tools/kconfig/util.c | 138 ++ tools/kconfig/zconf.gperf | 47 + tools/kconfig/zconf.hash.c_shipped | 245 +++ tools/kconfig/zconf.l | 360 +++++ tools/kconfig/zconf.tab.c_shipped | 2505 ++++++++++++++++++++++++++++++ tools/kconfig/zconf.y | 749 +++++++++ 40 files changed, 22689 insertions(+), 0 deletions(-) create mode 100644 tools/kconfig/.gitignore create mode 100644 tools/kconfig/Makefile create mode 100644 tools/kconfig/POTFILES.in create mode 100755 tools/kconfig/check.sh create mode 100644 tools/kconfig/conf.c create mode 100644 tools/kconfig/confdata.c create mode 100644 tools/kconfig/expr.c create mode 100644 tools/kconfig/expr.h create mode 100644 tools/kconfig/gconf.c create mode 100644 tools/kconfig/gconf.glade create mode 100644 tools/kconfig/images.c create mode 100644 tools/kconfig/kconfig_load.c create mode 100644 tools/kconfig/kxgettext.c create mode 100644 tools/kconfig/lex.zconf.c_shipped create mode 100644 tools/kconfig/lkc.h create mode 100644 tools/kconfig/lkc_proto.h create mode 100644 tools/kconfig/lxdialog/.gitignore create mode 100644 tools/kconfig/lxdialog/BIG.FAT.WARNING create mode 100644 tools/kconfig/lxdialog/check-lxdialog.sh create mode 100644 tools/kconfig/lxdialog/checklist.c create mode 100644 tools/kconfig/lxdialog/dialog.h create mode 100644 tools/kconfig/lxdialog/inputbox.c create mode 100644 tools/kconfig/lxdialog/menubox.c create mode 100644 tools/kconfig/lxdialog/textbox.c create mode 100644 tools/kconfig/lxdialog/util.c create mode 100644 tools/kconfig/lxdialog/yesno.c create mode 100644 tools/kconfig/mconf.c create mode 100644 tools/kconfig/menu.c create mode 100644 tools/kconfig/nconf.c create mode 100644 tools/kconfig/nconf.gui.c create mode 100644 tools/kconfig/nconf.h create mode 100644 tools/kconfig/qconf.cc create mode 100644 tools/kconfig/qconf.h create mode 100644 tools/kconfig/symbol.c create mode 100644 tools/kconfig/util.c create mode 100644 tools/kconfig/zconf.gperf create mode 100644 tools/kconfig/zconf.hash.c_shipped create mode 100644 tools/kconfig/zconf.l create mode 100644 tools/kconfig/zconf.tab.c_shipped create mode 100644 tools/kconfig/zconf.y
The actual file additions have been ommitted from this email so as to not fill the inboxes of those on the mailing list. If interested, please see the above files in the linux-2.6.38-rc2 repository in scripts/kconfig/ .
--- Makefile | 15 +++++++++++++++ tools/kconfig/Makefile | 29 ++++++++++++++++++----------- tools/kconfig/POTFILES.in | 24 ++++++++++++------------ tools/kconfig/gconf.c | 2 +- tools/kconfig/kconfig_load.c | 2 +- 5 files changed, 47 insertions(+), 25 deletions(-)
diff --git a/Makefile b/Makefile index 384bf79..b67c8fc 100644 --- a/Makefile +++ b/Makefile @@ -193,10 +193,25 @@ src/%.hex: src/%.dsl
$(OUT)ccode32flat.o: src/acpi-dsdt.hex
+####### Kconfig rules +export HOSTCC := $(CC) +export CONFIG_SHELL := sh +export KCONFIG_AUTOHEADER := autoconf.h +export KCONFIG_CONFIG := $(CURDIR)/.config +MAKEFLAGS += --no-print-directory + +%onfig: + $(Q)mkdir -p $(OUT)/tools/kconfig/lxdialog + $(Q)mkdir -p $(OUT)/include/config + $(Q)$(MAKE) -C $(OUT) -f $(CURDIR)/tools/kconfig/Makefile srctree=$(CURDIR) src=tools/kconfig obj=tools/kconfig Q=$(Q) Kconfig=$(CURDIR)/src/Kconfig $@ + ####### Generic rules clean: $(Q)rm -rf $(OUT)
+distclean: clean + $(Q)rm -f .config .config.old + $(OUT): $(Q)mkdir $@
diff --git a/tools/kconfig/Makefile b/tools/kconfig/Makefile index 368ae30..502c2c4 100644 --- a/tools/kconfig/Makefile +++ b/tools/kconfig/Makefile @@ -30,8 +30,9 @@ oldconfig: $(obj)/conf $< --$@ $(Kconfig)
silentoldconfig: $(obj)/conf + @echo " Build Kconfig config file" $(Q)mkdir -p include/generated - $< --$@ $(Kconfig) + $(Q)$< --$@ $(Kconfig)
# if no path is given, then use src directory to find file ifdef LSMOD @@ -80,7 +81,7 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h $(Q)xgettext --default-domain=linux \ --add-comments --keyword=_ --keyword=N_ \ --from-code=UTF-8 \ - --files-from=scripts/kconfig/POTFILES.in \ + --files-from=tools/kconfig/POTFILES.in \ --output $(obj)/config.pot $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot $(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch @@ -109,15 +110,8 @@ savedefconfig: $(obj)/conf $< --$@=defconfig $(Kconfig)
defconfig: $(obj)/conf -ifeq ($(KBUILD_DEFCONFIG),) - $< --defconfig $(Kconfig) -else - @echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'" - $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) -endif - -%_defconfig: $(obj)/conf - $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) + @echo " Build default config" + $(Q)$< --defconfig=$(KBUILD_DEFCONFIG) $(Kconfig)
# Help text used by make help help: @@ -352,3 +346,16 @@ lex.%.c: %.l cp $@ $@_shipped
endif + +VPATH := $(srctree) + +$(obj)/%:: $(src)/%_shipped + $(Q)cat $< > $@ + +host-cobjs := $(sort $(foreach m,$(hostprogs-y),$($(m)-objs))) +host-cobjs := $(addprefix $(obj)/,$(host-cobjs)) +hostprogs-y := $(addprefix $(obj)/,$(hostprogs-y)) +$(host-cobjs) : $(obj)/%.o : $(src)/%.c + $(Q)$(HOSTCC) -I$(obj) -I$(srctree)/$(src) $(HOSTCFLAGS) $(HOSTCFLAGS_$(@F)) $(HOST_EXTRACFLAGS) -c -o $@ $< +$(hostprogs-y) : $(obj)/% : $(host-cobjs) + $(Q)$(HOSTCC) $(HOSTLDFLAGS) -o $@ $(addprefix $(obj)/,$($(@F)-objs)) $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) diff --git a/tools/kconfig/POTFILES.in b/tools/kconfig/POTFILES.in index 9674573..f0baccd 100644 --- a/tools/kconfig/POTFILES.in +++ b/tools/kconfig/POTFILES.in @@ -1,12 +1,12 @@ -scripts/kconfig/lxdialog/checklist.c -scripts/kconfig/lxdialog/inputbox.c -scripts/kconfig/lxdialog/menubox.c -scripts/kconfig/lxdialog/textbox.c -scripts/kconfig/lxdialog/util.c -scripts/kconfig/lxdialog/yesno.c -scripts/kconfig/mconf.c -scripts/kconfig/conf.c -scripts/kconfig/confdata.c -scripts/kconfig/gconf.c -scripts/kconfig/gconf.glade.h -scripts/kconfig/qconf.cc +tools/kconfig/lxdialog/checklist.c +tools/kconfig/lxdialog/inputbox.c +tools/kconfig/lxdialog/menubox.c +tools/kconfig/lxdialog/textbox.c +tools/kconfig/lxdialog/util.c +tools/kconfig/lxdialog/yesno.c +tools/kconfig/mconf.c +tools/kconfig/conf.c +tools/kconfig/confdata.c +tools/kconfig/gconf.c +tools/kconfig/gconf.glade.h +tools/kconfig/qconf.cc diff --git a/tools/kconfig/gconf.c b/tools/kconfig/gconf.c index 4558961..b7f31f2 100644 --- a/tools/kconfig/gconf.c +++ b/tools/kconfig/gconf.c @@ -1521,7 +1521,7 @@ int main(int ac, char *av[]) /* Determine GUI path */ env = getenv(SRCTREE); if (env) - glade_file = g_strconcat(env, "/scripts/kconfig/gconf.glade", NULL); + glade_file = g_strconcat(env, "/tools/kconfig/gconf.glade", NULL); else if (av[0][0] == '/') glade_file = g_strconcat(av[0], ".glade", NULL); else diff --git a/tools/kconfig/kconfig_load.c b/tools/kconfig/kconfig_load.c index dbdcaad..2d0cff8 100644 --- a/tools/kconfig/kconfig_load.c +++ b/tools/kconfig/kconfig_load.c @@ -15,7 +15,7 @@ void kconfig_load(void)
handle = dlopen("./libkconfig.so", RTLD_LAZY); if (!handle) { - handle = dlopen("./scripts/kconfig/libkconfig.so", RTLD_LAZY); + handle = dlopen("./tools/kconfig/libkconfig.so", RTLD_LAZY); if (!handle) { fprintf(stderr, "%s\n", dlerror()); exit(1);
Always emit CONFIG_X definitions in autoconf.h - set them to 0 when they are disabled. --- tools/kconfig/confdata.c | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/tools/kconfig/confdata.c b/tools/kconfig/confdata.c index 61c35bf..f110bf5 100644 --- a/tools/kconfig/confdata.c +++ b/tools/kconfig/confdata.c @@ -830,8 +830,15 @@ int conf_write_autoconf(void)
for_all_symbols(i, sym) { sym_calc_value(sym); - if (!(sym->flags & SYMBOL_WRITE) || !sym->name) + if (!sym->name) continue; + if (!(sym->flags & SYMBOL_WRITE)) { + if (sym->type == S_BOOLEAN || sym->type == S_HEX + || sym->type == S_INT) + fprintf(out_h, "#define %s%s 0\n", + CONFIG_, sym->name); + continue; + }
/* write symbol to config file */ conf_write_symbol(sym, out, false); @@ -842,6 +849,8 @@ int conf_write_autoconf(void) case S_TRISTATE: switch (sym_get_tristate_value(sym)) { case no: + fprintf(out_h, "#define %s%s 0\n", + CONFIG_, sym->name); break; case mod: fprintf(tristate, "%s%s=M\n",
Create autoconf.h during the build.
Move a couple of config settings from config.h to Kconfig. --- .gitignore | 2 ++ Makefile | 12 +++++++++--- src/Kconfig | 15 +++++++++++++++ src/config.h | 11 ++--------- src/defconfig | 6 ++++++ 5 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 src/Kconfig create mode 100644 src/defconfig
diff --git a/.gitignore b/.gitignore index 3aa6a21..f9990fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ out *.pyc +.config +.config.old diff --git a/Makefile b/Makefile index b67c8fc..e830728 100644 --- a/Makefile +++ b/Makefile @@ -119,11 +119,11 @@ $(OUT)asm-offsets.h: $(OUT)asm-offsets.s $(Q)./tools/gen-offsets.sh $< $@
-$(OUT)ccode.16.s: ; $(call whole-compile, $(CFLAGS16) -S, $(addprefix src/, $(SRC16)),$@) +$(OUT)ccode.16.s: out/autoconf.h ; $(call whole-compile, $(CFLAGS16) -S, $(addprefix src/, $(SRC16)),$@)
-$(OUT)code32seg.o: ; $(call whole-compile, $(CFLAGS32SEG), $(addprefix src/, $(SRC32SEG)),$@) +$(OUT)code32seg.o: out/autoconf.h ; $(call whole-compile, $(CFLAGS32SEG), $(addprefix src/, $(SRC32SEG)),$@)
-$(OUT)ccode32flat.o: ; $(call whole-compile, $(CFLAGS32FLAT), $(addprefix src/, $(SRC32FLAT)),$@) +$(OUT)ccode32flat.o: out/autoconf.h ; $(call whole-compile, $(CFLAGS32FLAT), $(addprefix src/, $(SRC32FLAT)),$@)
$(OUT)code16.o: romlayout.S $(OUT)ccode.16.s $(OUT)asm-offsets.h @echo " Compiling (16bit) $@" @@ -200,6 +200,12 @@ export KCONFIG_AUTOHEADER := autoconf.h export KCONFIG_CONFIG := $(CURDIR)/.config MAKEFLAGS += --no-print-directory
+out/autoconf.h : $(KCONFIG_CONFIG) + $(Q)$(MAKE) silentoldconfig + +$(KCONFIG_CONFIG): + $(Q)$(MAKE) defconfig + %onfig: $(Q)mkdir -p $(OUT)/tools/kconfig/lxdialog $(Q)mkdir -p $(OUT)/include/config diff --git a/src/Kconfig b/src/Kconfig new file mode 100644 index 0000000..f753c63 --- /dev/null +++ b/src/Kconfig @@ -0,0 +1,15 @@ +# Kconfig SeaBIOS configuration + +mainmenu "SeaBIOS Configuration" + config COREBOOT + bool "Configure as a coreboot payload." + default n + config DEBUG_LEVEL + int "Control how verbose debug output is." + default 1 + config DEBUG_SERIAL + bool "Send debugging information to serial port" + default n + config VGAHOOKS + bool "Support bios callbacks specific to via vgabios." + default n diff --git a/src/config.h b/src/config.h index db3e578..6356941 100644 --- a/src/config.h +++ b/src/config.h @@ -1,6 +1,8 @@ #ifndef __CONFIG_H #define __CONFIG_H
+#include "../out/autoconf.h" + // Configuration definitions.
//#define CONFIG_APPNAME "QEMU" @@ -12,13 +14,6 @@ #define CONFIG_APPNAME6 "BOCHS " #define CONFIG_APPNAME4 "BXPC"
-// Configure as a coreboot payload. -#define CONFIG_COREBOOT 0 - -// Control how verbose debug output is. -#define CONFIG_DEBUG_LEVEL 1 -// Send debugging information to serial port -#define CONFIG_DEBUG_SERIAL 0 // Screen writes are also sent to debug ports. #define CONFIG_SCREEN_AND_DEBUG 1
@@ -119,8 +114,6 @@ #define CONFIG_UUID_BACKDOOR 1 // Support generation of ACPI tables (for emulators) #define CONFIG_ACPI 1 -// Support bios callbacks specific to via vgabios. -#define CONFIG_VGAHOOKS 0 // Support S3 resume handler. #define CONFIG_S3_RESUME 1 // Run the vga rom during S3 resume. diff --git a/src/defconfig b/src/defconfig new file mode 100644 index 0000000..f632a4a --- /dev/null +++ b/src/defconfig @@ -0,0 +1,6 @@ +# SeaBIOS default configuration +# +# CONFIG_COREBOOT is not set +CONFIG_DEBUG_LEVEL=1 +# CONFIG_DEBUG_SERIAL is not set +# CONFIG_VGAHOOKS is not set