summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Dahl <ada@thorsis.com>2019-02-05 19:56:08 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2019-02-07 14:04:53 +0100
commit44e565de9b2d3d9b7ccce98cfc6e022f11bae44d (patch)
treeb25f76041b2612c001c29873095d00d83b84a6be
parent1656052b6f4fff8209d215b682de60612dacf411 (diff)
downloadptxdist-44e565de9b2d3d9b7ccce98cfc6e022f11bae44d.tar.gz
ptxdist-44e565de9b2d3d9b7ccce98cfc6e022f11bae44d.tar.xz
u-boot: Add option to use Kconfig based configuration
Recent versions of U-Boot (from 2014.10) use a Kconfig based configuration. To also support the old system and not break existing builds, this is introduced as optional, which also allows to build a defconfig without oldconfig/menuconfig and a .config file in the BSP. A new menu entry of type 'choice' was added to choose between the new Kconfig based and the legacy config system (boldly inspired by buildroot). Options for prepare and compile stage were revised and adapted to U-Boot build documentation (CROSS_COMPILE and HOSTCC in env instead of make options). That part is based on the first patch 'u-boot: add support for oldconfig/menuconfig' by Ahmad Fatoum from October 2018, but extended by the new menu options, which more or less follows a suggestion of Michael Olbrich to support both configuration systems and distinguish in the make rule. The option to avoid parallel building is only kept for the legacy build, modern U-Boot uses the kernel build system and should build fine in parallel. Also added is support for ptxdist option -v for a more verbose build. This is passed to make with V= option, which is based on a second patch 'u-boot: add V=$(PTXDIST_VERBOSE) to make options' by Ahmad Fatoum, but squashed into this, because all those variable stuff was rewritten anyway. Compile tested with: * recent DistroKit, ptxdist 2019.01.0, U-Boot 2019.01, and defconfig for Microchip SAMA5D27-SOM1-EK1 (platform-v7a), both build system approaches. * custom BSP, ptxdist 2018.05.0, U-Boot 2012.04.01, and config "at91sam9g20ek_nandflash" (arm-v5te), legacy build only. Co-authored-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Alexander Dahl <ada@thorsis.com> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--platforms/u-boot.in42
-rw-r--r--rules/u-boot.make53
2 files changed, 87 insertions, 8 deletions
diff --git a/platforms/u-boot.in b/platforms/u-boot.in
index 56e971659..6239a5369 100644
--- a/platforms/u-boot.in
+++ b/platforms/u-boot.in
@@ -28,9 +28,47 @@ config U_BOOT_SERIES
the u-boot patches directory. This way you can set a different
series file than the default.
-config U_BOOT_CONFIG
+choice
+ prompt "config system"
+ default U_BOOT_CONFIGSYSTEM_LEGACY
+
+config U_BOOT_CONFIGSYSTEM_KCONFIG
+ prompt "Kconfig"
+ bool
+ help
+ U-Boot from version 2014.10 uses Kconfig for configuring a target.
+ Use this if you want to configure U-Boot inside the BSP, e.g.
+ with menuconfig.
+
+ NOTE: if you just want to use a defconfig, you can still use the
+ legacy config system by using the name of a defconfig file from
+ the "configs" folder as config target.
+
+config U_BOOT_CONFIGSYSTEM_LEGACY
+ prompt "legacy"
+ bool
+ help
+ Select this if you use an old U-Boot prior 2014.10 or want to use
+ a defconfig as config target.
+
+endchoice
+
+if U_BOOT_CONFIGSYSTEM_KCONFIG
+
+config U_BOOT_CONFIGFILE_KCONFIG
+ prompt "config file"
string
+ default "u-boot.config"
+ help
+ This entry specifies the .config file used to compile U-Boot.
+
+endif
+
+if U_BOOT_CONFIGSYSTEM_LEGACY
+
+config U_BOOT_CONFIG
prompt "U-Boot config target"
+ string
help
The U-Boot make config target. Usually something like
"yourbox_config". Before U-Boot 2014.10 that was something from
@@ -40,6 +78,8 @@ config U_BOOT_CONFIG
"yourbox_defconfig", where that name is a file from the folder
"configs".
+endif
+
comment "target install"
config U_BOOT_INSTALL_SREC
diff --git a/rules/u-boot.make b/rules/u-boot.make
index 9f69f9d49..9416ab833 100644
--- a/rules/u-boot.make
+++ b/rules/u-boot.make
@@ -25,6 +25,11 @@ U_BOOT_URL := ftp://ftp.denx.de/pub/u-boot/$(U_BOOT).$(U_BOOT_SUFFIX)
U_BOOT_SOURCE := $(SRCDIR)/$(U_BOOT).$(U_BOOT_SUFFIX)
U_BOOT_DIR := $(BUILDDIR)/$(U_BOOT)
+ifdef PTXCONF_U_BOOT_CONFIGSYSTEM_KCONFIG
+U_BOOT_CONFIG := $(call ptx/in-platformconfigdir, \
+ $(call remove_quotes, $(PTXCONF_U_BOOT_CONFIGFILE_KCONFIG)))
+endif
+
# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------
@@ -36,17 +41,44 @@ U_BOOT_WRAPPER_BLACKLIST := \
TARGET_DEBUG \
TARGET_BUILD_ID
-U_BOOT_PATH := PATH=$(CROSS_PATH)
-U_BOOT_MAKE_OPT := CROSS_COMPILE=$(BOOTLOADER_CROSS_COMPILE) HOSTCC=$(HOSTCC)
-U_BOOT_MAKE_PAR := NO
-U_BOOT_TAGS_OPT := ctags cscope etags
+U_BOOT_MAKE_ENV := \
+ CROSS_COMPILE=$(BOOTLOADER_CROSS_COMPILE) \
+ HOSTCC=$(HOSTCC)
+U_BOOT_MAKE_OPT := V=$(PTXDIST_VERBOSE)
+U_BOOT_TAGS_OPT := ctags cscope etags
+
+ifdef PTXCONF_U_BOOT_CONFIGSYSTEM_KCONFIG
+U_BOOT_CONF_TOOL := kconfig
+U_BOOT_CONF_ENV := KCONFIG_NOTIMESTAMP=1 $(U_BOOT_MAKE_ENV)
+endif
+
+ifdef PTXCONF_U_BOOT_CONFIGSYSTEM_LEGACY
+U_BOOT_CONF_ENV := PATH=$(CROSS_PATH) $(U_BOOT_MAKE_ENV)
+U_BOOT_CONF_OPT := \
+ $(U_BOOT_MAKE_OPT) \
+ $(call remove_quotes, $(PTXCONF_U_BOOT_CONFIG))
+U_BOOT_MAKE_PAR := NO
+endif
+
+ifdef PTXCONF_U_BOOT
+$(U_BOOT_CONFIG):
+ @echo
+ @echo "****************************************************************************"
+ @echo "***** Please generate a u-boot config with 'ptxdist menuconfig u-boot' *****"
+ @echo "****************************************************************************"
+ @echo
+ @echo
+ @exit 1
+endif
+
+
+ifdef PTXCONF_U_BOOT_CONFIGSYSTEM_LEGACY
$(STATEDIR)/u-boot.prepare:
@$(call targetinfo)
- cd $(U_BOOT_DIR) && \
- $(U_BOOT_PATH) \
- $(MAKE) $(U_BOOT_MAKE_OPT) $(PTXCONF_U_BOOT_CONFIG)
+ $(U_BOOT_CONF_ENV) $(MAKE) -C $(U_BOOT_DIR) $(U_BOOT_CONF_OPT)
@$(call touch)
+endif
# ----------------------------------------------------------------------------
# Install
@@ -94,4 +126,11 @@ $(STATEDIR)/u-boot.clean:
@rm -f $(IMAGEDIR)/u-boot.img $(IMAGEDIR)/SPL $(IMAGEDIR)/MLO
@rm -f $(IMAGEDIR)/u-boot.imx
+# ----------------------------------------------------------------------------
+# oldconfig / menuconfig
+# ----------------------------------------------------------------------------
+
+u-boot_oldconfig u-boot_menuconfig u-boot_nconfig: $(STATEDIR)/u-boot.extract
+ @$(call world/kconfig, U_BOOT, $(subst u-boot_,,$@))
+
# vim: syntax=make