[U-Boot] [RFC PATCH 6/7] Enable Kconfig for U-Boot

Simon Glass sjg at chromium.org
Mon May 13 04:25:39 CEST 2013


To use this, do

   make -f Makefile.kbuild

when building U-Boot, instead of just

   make

Signed-off-by: Simon Glass <sjg at chromium.org>
---
 .gitignore    |  6 ++++++
 config.mk     |  5 +++++
 init/Makefile | 21 +++++++++++++++++++++
 init/main.c   |  0
 rules.mk      | 25 +++++++++++++++++++++++++
 5 files changed, 57 insertions(+)
 create mode 100644 init/Makefile
 create mode 100644 init/main.c

diff --git a/.gitignore b/.gitignore
index ed21203..7e1bf99 100644
--- a/.gitignore
+++ b/.gitignore
@@ -81,3 +81,9 @@ cscope.*
 
 # spl ais files
 /spl/*.ais
+
+# new things
+modules.order
+*.o.cmd
+.config
+*.cmd
diff --git a/config.mk b/config.mk
index ddf350e..f5a5756 100644
--- a/config.mk
+++ b/config.mk
@@ -21,6 +21,9 @@
 # MA 02111-1307 USA
 #
 
+# Skip this entire file if using Kconfig
+ifeq ($(KCONFIG_CONFIG),)
+
 #########################################################################
 
 # Set shell to bash if possible, otherwise fall back to sh
@@ -362,3 +365,5 @@ cmd_link_o_target = $(if $(strip $1),\
 		      rm -f $@; $(AR) rcs $@ )
 
 #########################################################################
+
+endif  # Kconfig skip
diff --git a/init/Makefile b/init/Makefile
new file mode 100644
index 0000000..0168bbc
--- /dev/null
+++ b/init/Makefile
@@ -0,0 +1,21 @@
+#
+# Makefile for the linux kernel.
+#
+
+obj-y                          := main.o #version.o
+
+# dependencies on generated files need to be listed explicitly
+$(obj)/version.o: include/generated/compile.h
+
+# compile.h changes depending on hostname, generation number, etc,
+# so we regenerate it always.
+# mkcompile_h will make sure to only update the
+# actual file if its content has changed.
+
+       chk_compile.h = :
+ quiet_chk_compile.h = echo '  CHK     $@'
+silent_chk_compile.h = :
+include/generated/compile.h: FORCE
+	@$($(quiet)chk_compile.h)
+	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \
+	"$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(KBUILD_CFLAGS)"
diff --git a/init/main.c b/init/main.c
new file mode 100644
index 0000000..e69de29
diff --git a/rules.mk b/rules.mk
index fa929f9..84c27c4 100644
--- a/rules.mk
+++ b/rules.mk
@@ -21,6 +21,9 @@
 # MA 02111-1307 USA
 #
 
+# For Kconfig we do something completely different
+ifeq ($(KCONFIG_CONFIG),)
+
 #########################################################################
 
 _depend:	$(obj).depend
@@ -66,3 +69,25 @@ $(NOPEDOBJS): $(obj)%.o: %.c
 	$(HOSTCC) $(HOSTCFLAGS_NOPED) $(HOSTCFLAGS_$(@F)) $(HOSTCFLAGS_$(BCURDIR)) -o $@ $< -c
 
 #########################################################################
+
+else
+# Kconfig implementaiton
+
+# Pick up any object files that ended up in COBJS
+obj-y += $(COBJS)
+
+# Assembler files also
+obj-y += $(SOBJS)
+
+# File containing start of U-Boot
+obj-y += $(STARTOBJS)
+
+# ARM has some library files we want
+obj-y += $(GLSOBJS) $(GLCOBJS)
+
+# Mark those in COBJS- as missing (available but not to be linked)
+# Otherwise kbuild will fail to create an empty built-in.o in this
+# directory.
+obj- += $(COBJS-)
+
+endif
-- 
1.8.2.1



More information about the U-Boot mailing list