All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Thiery <heiko.thiery@gmail.com>
To: buildroot@buildroot.org
Cc: Matt Weber <matthew.weber@rockwellcollins.com>,
	Michael Walle <michael@walle.cc>,
	Heiko Thiery <heiko.thiery@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: [Buildroot] [PATCH v2] package/uboot-tools: use U-Boot host tool printinitialenv to extract environment
Date: Mon,  5 Jan 2026 14:23:27 +0100	[thread overview]
Message-ID: <20260105132326.4867-1-heiko.thiery@gmail.com> (raw)

If u-boot is compiled with the LTO option, it is no longer possible to
use the script 'get_default_envs.sh' for creating an initial U-boot
environment binary image. The problem was already observed and a solution
available upstream u-boot since the commit 486aef08de09 [1].

This was first available in release v2023.04.

Now if the the new tool 'printinitialenv' is available it is used. The
tool is build with u-boot that is a dependency of this package.

[1] https://source.denx.de/u-boot/custodians/u-boot-tegra/-/commit/486aef08de091ca35386f32fe961a201c3cfa9d4

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
---
v2:
    - used hint from Arnout to check for availibity of the new tool

 boot/uboot/uboot.mk                | 4 ++++
 package/uboot-tools/uboot-tools.mk | 9 +++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index c92568a559..e613d015a9 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -144,6 +144,10 @@ UBOOT_MAKE_TARGET += u-boot.stm32
 endif
 endif
 
+ifeq ($(BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE),y)
+UBOOT_MAKE_TARGET += u-boot-initial-env
+endif
+
 ifeq ($(BR2_TARGET_UBOOT_INITIAL_ENV),y)
 UBOOT_MAKE_TARGET += u-boot-initial-env
 define UBOOT_INSTALL_UBOOT_INITIAL_ENV
diff --git a/package/uboot-tools/uboot-tools.mk b/package/uboot-tools/uboot-tools.mk
index 1925047ccd..f8d9cae270 100644
--- a/package/uboot-tools/uboot-tools.mk
+++ b/package/uboot-tools/uboot-tools.mk
@@ -154,10 +154,11 @@ HOST_UBOOT_TOOLS_DEPENDENCIES += uboot
 ifeq ($(UBOOT_TOOLS_GENERATE_ENV_FILE),)
 UBOOT_TOOLS_GENERATE_ENV_FILE = $(@D)/boot-env-defaults.txt
 define HOST_UBOOT_TOOLS_GENERATE_ENV_DEFAULTS
-	CROSS_COMPILE="$(TARGET_CROSS)" \
-		$(UBOOT_SRCDIR)/scripts/get_default_envs.sh \
-		$(UBOOT_SRCDIR) \
-		> $(UBOOT_TOOLS_GENERATE_ENV_FILE)
+	if [ -x $(UBOOT_SRCDIR)/tools/printinitialenv ]; then \
+		$(UBOOT_SRCDIR)/tools/printinitialenv > $(UBOOT_TOOLS_GENERATE_ENV_FILE); \
+	else \
+		CROSS_COMPILE="$(TARGET_CROSS)" $(UBOOT_SRCDIR)/scripts/get_default_envs.sh $(UBOOT_SRCDIR); \
+	fi
 endef
 endif # UBOOT_TOOLS_GENERATE_ENV_FILE
 endif # BR2_TARGET_UBOOT
-- 
2.39.5

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

             reply	other threads:[~2026-01-05 13:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05 13:23 Heiko Thiery [this message]
2026-01-05 13:42 ` [Buildroot] [PATCH v2] package/uboot-tools: use U-Boot host tool printinitialenv to extract environment Thomas Petazzoni via buildroot
2026-01-05 13:50   ` Heiko Thiery
2026-01-05 13:56     ` Thomas Petazzoni via buildroot
2026-01-05 15:31       ` Arnout Vandecappelle via buildroot

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=20260105132326.4867-1-heiko.thiery@gmail.com \
    --to=heiko.thiery@gmail.com \
    --cc=buildroot@buildroot.org \
    --cc=matthew.weber@rockwellcollins.com \
    --cc=michael@walle.cc \
    --cc=thomas.petazzoni@bootlin.com \
    /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.