This is an intial stab at changing Kconfig for U-Boot. So far it is missing many things, notably SPL support and binary output. Also the output file is vmlinux instead of u-boot.
Linux modules are not supported, but it is quite possible that some enterprising soul will want to implement modules in U-Boot. For that reason and to minimise conflicts with future Kbuild updates, modules support is disabled rather than removed. Signed-off-by: Simon Glass <s...@chromium.org> --- Makefile.kbuild | 37 +++++++++++++++++++++++++++++++------ scripts/Makefile | 7 +------ scripts/Makefile.build | 1 + scripts/Makefile.lib | 10 ++++++---- scripts/kconfig/Makefile | 15 +++++++++++++-- scripts/link-vmlinux.sh | 13 +++++++------ 6 files changed, 59 insertions(+), 24 deletions(-) diff --git a/Makefile.kbuild b/Makefile.kbuild index 2547cca..dc241d4 100644 --- a/Makefile.kbuild +++ b/Makefile.kbuild @@ -2,7 +2,12 @@ VERSION = 2013 PATCHLEVEL = 04 SUBLEVEL = EXTRAVERSION = -NAME = Unicycling Gorilla +NAME = Uncular Umbrella +ifneq "$(SUBLEVEL)" "" +U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) +else +U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL)$(EXTRAVERSION) +endif # *DOCUMENTATION* # To see a list of typical targets execute "make help" @@ -172,6 +177,9 @@ export SRCTREE TOPDIR OBJTREE # Export U-Boot variables export BOARD CPU SOC VENDOR +TIMESTAMP_FILE = $(objtree)/include/generated/timestamp_autogenerated.h +VERSION_FILE = $(objtree)/include/generated/version_autogenerated.h + # SUBARCH tells the usermode build what the underlying arch is. That is set # first, and if a usermode build is happening, the "ARCH=um" on the command # line overrides the setting of ARCH below. If a native build is happening, @@ -807,9 +815,6 @@ fs-y := $(patsubst %/, %/built-in.o, $(fs-y)) init-y := $(patsubst %/, %/built-in.o, $(init-y)) net-y := $(patsubst %/, %/built-in.o, $(net-y)) spl-y := $(patsubst %/, %/built-in.o, $(spl-y)) -# libs-y1 := $(patsubst %/, %/lib.a, $(libs-y)) -# libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y)) -# libs-y := $(libs-y1) $(libs-y2) libs-y := $(patsubst %/, %/built-in.o, $(libs-y)) @@ -875,7 +880,7 @@ PHONY += prepare archprepare prepare0 prepare1 prepare2 prepare3 # prepare3 is used to check if we are building in a separate output directory, # and if so do: # 1) Check that make has not been executed in the kernel src $(srctree) -prepare3: include/config/kernel.release +prepare3: include/config/kernel.release $(TIMESTAMP_FILE) $(VERSION_FILE) ifneq ($(KBUILD_SRC),) @$(kecho) ' Using $(srctree) as source for kernel' $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ @@ -906,6 +911,26 @@ prepare: prepare0 # KERNELRELEASE can change from a few different places, meaning version.h # needs to be updated, so this check is forced on all builds +$(VERSION_FILE): + @mkdir -p $(dir $(VERSION_FILE)) + @( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \ + printf '#define PLAIN_VERSION "%s%s"\n' \ + "$(U_BOOT_VERSION)" "$${localvers}" ; \ + printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \ + "$(U_BOOT_VERSION)" "$${localvers}" ; \ + ) > $@.tmp + @( printf '#define CC_VERSION_STRING "%s"\n' \ + '$(shell $(CC) --version | head -n 1)' )>> $@.tmp + @( printf '#define LD_VERSION_STRING "%s"\n' \ + '$(shell $(LD) -v | head -n 1)' )>> $@.tmp + @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@ + +$(TIMESTAMP_FILE): + @mkdir -p $(dir $(TIMESTAMP_FILE)) + @LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > $@.tmp + @LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> $@.tmp + @cmp -s $@ $@.tmp && rm -f $@.tmp || mv -f $@.tmp $@ + uts_len := 64 define filechk_utsrelease.h if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \ @@ -1107,7 +1132,7 @@ clean: archclean vmlinuxclean # mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS)) mrproper: rm-files := $(wildcard $(MRPROPER_FILES)) -mrproper-dirs := $(addprefix _mrproper_,Documentation/DocBook scripts) +mrproper-dirs := $(addprefix _mrproper_,scripts) PHONY += $(mrproper-dirs) mrproper archmrproper $(mrproper-dirs): diff --git a/scripts/Makefile b/scripts/Makefile index 01e7adb..aedf135 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -33,10 +33,5 @@ build_unifdef: scripts/unifdef FORCE build_docproc: scripts/docproc FORCE @: -subdir-$(CONFIG_MODVERSIONS) += genksyms -subdir-y += mod -subdir-$(CONFIG_SECURITY_SELINUX) += selinux -subdir-$(CONFIG_DTC) += dtc - # Let clean descend into subdirs -subdir- += basic kconfig package selinux +subdir- += basic kconfig diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 0e801c3..82f099e 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -32,6 +32,7 @@ subdir-ccflags-y := # Read auto.conf if it exists, otherwise ignore -include include/config/auto.conf +-include $(objtree)/include/config/autoconf.mk include scripts/Kbuild.include diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 07125e6..8d960ad 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -27,7 +27,7 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m))) # --------------------------------------------------------------------------- # o if we encounter foo/ in $(obj-y), replace it by foo/built-in.o # and add the directory to the list of dirs to descend into: $(subdir-y) -# o if we encounter foo/ in $(obj-m), remove it from $(obj-m) +# o if we encounter foo/ in $(obj-m), remove it from $(obj-m) # and add the directory to the list of dirs to descend into: $(subdir-m) # Determine modorder. @@ -144,14 +144,16 @@ __a_flags = $(call flags,_a_flags) __cpp_flags = $(call flags,_cpp_flags) endif -c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ +_nostdinc_flags = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(NOSTDINC_FLAGS)) + +c_flags = -Wp,-MD,$(depfile) $(_nostdinc_flags) $(LINUXINCLUDE) \ $(__c_flags) $(modkern_cflags) \ -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) -a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ +a_flags = -Wp,-MD,$(depfile) $(_nostdinc_flags) $(LINUXINCLUDE) \ $(__a_flags) $(modkern_aflags) -cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \ +cpp_flags = -Wp,-MD,$(depfile) $(_nostdinc_flags) $(LINUXINCLUDE) \ $(__cpp_flags) ld_flags = $(LDFLAGS) $(ldflags-y) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index bd9b673..27d3890 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -106,8 +106,19 @@ else $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) endif -%_defconfig: $(obj)/conf - $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) +sinclude $(objtree)/include/config.mk + +SRCARCH = $(ARCH) + +CONFIGDIR := board/$(VENDOR)/$(BOARD)/configs + +# Create a default config if needed +%_config: $(obj)/conf + $(Q)if [ ! -f $(CONFIGDIR)/$@ ]; then \ + mkdir -p $(CONFIGDIR); \ + touch $(CONFIGDIR)/$@; \ + fi + $(Q)$< --defconfig=$(CONFIGDIR)/$@ $(Kconfig) # Help text used by make help help: diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index b3d907e..bc42b06 100644 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -52,10 +52,15 @@ vmlinux_link() { local lds="${objtree}/${KBUILD_LDS}" - if [ "${SRCARCH}" != "um" ]; then + if [ "${SRCARCH}" == "sandbox" ]; then + # Use gcc for sandbox, so we find the right libraries + ${CC} -o ${2} -T ${lds} ${KBUILD_VMLINUX_INIT} \ + -Wl,--start-group ${KBUILD_VMLINUX_MAIN} \ + -Wl,--end-group ${FINAL_LIBS} + elif [ "${SRCARCH}" != "um" ]; then ${LD} ${LDFLAGS} ${LDFLAGS_vmlinux} -o ${2} \ -T ${lds} ${KBUILD_VMLINUX_INIT} \ - --start-group ${KBUILD_VMLINUX_MAIN} --end-group ${1} + --start-group ${KBUILD_VMLINUX_MAIN} --end-group else ${CC} ${CFLAGS_vmlinux} -o ${2} \ -Wl,-T,${lds} ${KBUILD_VMLINUX_INIT} \ @@ -136,10 +141,6 @@ fi #link vmlinux.o info LD vmlinux.o -modpost_link vmlinux.o - -# modpost vmlinux.o to check for section mismatches -${MAKE} -f "${srctree}/scripts/Makefile.modpost" vmlinux.o # Update version info GEN .version -- 1.8.2.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot