Build changes for Linux kconfig code to work in seabios dir structure.
diff --git a/Makefile b/Makefile
index 384bf79..c7dfc0b 100644
--- a/Makefile
+++ b/Makefile
@@ -54,13 +54,14 @@
 Q=
 else
 Q=@
+MAKEFLAGS += --no-print-directory
 endif
 
 OBJCOPY=objcopy
 OBJDUMP=objdump
 STRIP=strip
 
-.PHONY : all FORCE
+.PHONY : all clean distclean FORCE
 
 vpath %.c src vgasrc
 vpath %.S src vgasrc
@@ -193,10 +194,24 @@
 
 $(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
+
+%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..890243b 100644
--- a/tools/kconfig/Makefile
+++ b/tools/kconfig/Makefile
@@ -30,8 +30,9 @@
 	$< --$@ $(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 @@
 	$(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 @@
 	$< --$@=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=/dev/null $(Kconfig)
 
 # Help text used by make help
 help:
@@ -352,3 +346,16 @@
 	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 @@
 	/* 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 @@
 
 	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);