All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2] boot/uboot: add initial environment support
Date: Mon, 27 May 2019 21:23:42 +0200	[thread overview]
Message-ID: <20190527192342.23406-1-michael@walle.cc> (raw)

Since v2019.07 U-Boot supports extracting the compiled-in environment.
As a first step, add support to the environment generation in buildroot.
In the future, the text file may also be copied into the target
filesystem, where it will be used by the uboot-tools.

Signed-off-by: Michael Walle <michael@walle.cc>
---

changes since v1:
 - rename _INITIAL to _BUILTIN
 - add help texts
 - make commit message little bit more clearer, hopefully ;)

 boot/uboot/Config.in | 24 ++++++++++++++++++++++++
 boot/uboot/uboot.mk  | 17 ++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
index 33b7e67ff7..45bbf88b6f 100644
--- a/boot/uboot/Config.in
+++ b/boot/uboot/Config.in
@@ -488,7 +488,30 @@ menuconfig BR2_TARGET_UBOOT_ENVIMAGE
 	  The environment image will be called uboot-env.bin.
 
 if BR2_TARGET_UBOOT_ENVIMAGE
+choice
+	prompt "Environment image source"
+	default BR2_TARGET_UBOOT_ENVIMAGE_CUSTOM
+
+config BR2_TARGET_UBOOT_ENVIMAGE_BUILTIN
+	bool "Using uboot's built-in environment file"
+	help
+	  Select this option if you want to build the image from
+	  u-boot's built-in environment. The content will be the
+	  same as the default environment of the u-boot binary.
+
+	  This feature requires commit
+	  bdaa73a5b3923257add182b4ab8058dbfa33421b from upstream
+	  U-Boot, available from versions 2019.07 or later.
+
+config BR2_TARGET_UBOOT_ENVIMAGE_CUSTOM
+	bool "Using a custom environment file"
+	help
+	  Select this option if you want to specify your own
+	  custom environment file.
+
+endchoice
 
+if BR2_TARGET_UBOOT_ENVIMAGE_CUSTOM
 config BR2_TARGET_UBOOT_ENVIMAGE_SOURCE
 	string "Source files for environment"
 	help
@@ -497,6 +520,7 @@ config BR2_TARGET_UBOOT_ENVIMAGE_SOURCE
 	  lines starting with a # are ignored.
 
 	  Multiple source files are concatenated in the order listed.
+endif # BR2_TARGET_UBOOT_ENVIMAGE_CUSTOM
 
 config BR2_TARGET_UBOOT_ENVIMAGE_SIZE
 	string "Size of environment"
diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index ae09c37d84..0da1f37cbd 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -271,9 +271,22 @@ define UBOOT_BUILD_OMAP_IFT
 endef
 
 ifneq ($(BR2_TARGET_UBOOT_ENVIMAGE),)
-define UBOOT_GENERATE_ENV_IMAGE
+ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE_CUSTOM),y)
+define UBOOT_CREATE_ENV_SOURCE
 	cat $(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)) \
 		>$(@D)/buildroot-env.txt
+endef
+endif
+
+ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE_BUILTIN),y)
+UBOOT_MAKE_TARGET += u-boot-initial-env
+define UBOOT_CREATE_ENV_SOURCE
+	cp -dpf $(@D)/u-boot-initial-env $(@D)/buildroot-env.txt
+endef
+endif
+
+define UBOOT_GENERATE_ENV_IMAGE
+	$(UBOOT_CREATE_ENV_SOURCE)
 	$(HOST_DIR)/bin/mkenvimage -s $(BR2_TARGET_UBOOT_ENVIMAGE_SIZE) \
 		$(if $(BR2_TARGET_UBOOT_ENVIMAGE_REDUNDANT),-r) \
 		$(if $(filter "BIG",$(BR2_ENDIAN)),-b) \
@@ -385,9 +398,11 @@ endef
 
 ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE),y)
 ifeq ($(BR_BUILDING),y)
+ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE_CUSTOM),y)
 ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)),)
 $(error Please define a source file for Uboot environment (BR2_TARGET_UBOOT_ENVIMAGE_SOURCE setting))
 endif
+endif
 ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SIZE)),)
 $(error Please provide Uboot environment size (BR2_TARGET_UBOOT_ENVIMAGE_SIZE setting))
 endif
-- 
2.11.0

             reply	other threads:[~2019-05-27 19:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-27 19:23 Michael Walle [this message]
2019-05-30 20:29 ` [Buildroot] [PATCH v2] boot/uboot: add initial environment support Pierre-Jean Texier
2019-06-16 12:37 ` Michael Walle
2019-08-05 14:00   ` Michael Walle
2019-10-27 19:38 ` Thomas Petazzoni
2019-11-07 22:44   ` Michael Walle

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=20190527192342.23406-1-michael@walle.cc \
    --to=michael@walle.cc \
    --cc=buildroot@busybox.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.