mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Alexander Dahl <ada@thorsis.com>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [PATCH v2 2/4] u-boot: Add option to use Kconfig based configuration
Date: Tue,  5 Feb 2019 19:56:08 +0100	[thread overview]
Message-ID: <20190205185610.15346-3-ada@thorsis.com> (raw)
In-Reply-To: <20190205185610.15346-1-ada@thorsis.com>

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>
---

Notes:
    v1 -> v2:
      * Rewritten from scratch based on first patch by Ahmad Fatoum and
        suggestions by Michael Olbrich

 platforms/u-boot.in | 42 +++++++++++++++++++++++++++++++++++++++++-
 rules/u-boot.make   | 53 ++++++++++++++++++++++++++++++++++++++++++++++-------
 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
-- 
2.11.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

  parent reply	other threads:[~2019-02-05 18:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-05 18:56 [ptxdist] [PATCH v2 0/4] u-boot: Modernize rules Alexander Dahl
2019-02-05 18:56 ` [ptxdist] [PATCH v2 1/4] u-boot: Bump default version and tweak help texts Alexander Dahl
2019-02-05 18:56 ` Alexander Dahl [this message]
2019-02-05 18:56 ` [ptxdist] [PATCH v2 3/4] u-boot: Run install(1)/rm(1) with -v Alexander Dahl
2019-02-05 18:56 ` [ptxdist] [PATCH v2 4/4] u-boot: Add u-boot{-dtb, -with-spl-pbl}.bin image installation options Alexander Dahl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190205185610.15346-3-ada@thorsis.com \
    --to=ada@thorsis.com \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox