mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] defaultenv: boot/bnet: fallback to booting generic 2nd stage FIT image
Date: Wed,  9 Apr 2025 15:19:14 +0200	[thread overview]
Message-ID: <20250409131914.1949302-1-a.fatoum@pengutronix.de> (raw)

With CONFIG_BOARD_GENERIC_FIT enabled, barebox generates a FIT image
containing a generic DT-based second-stage barebox images as well as all
enabled DTs.

Add it as fallback if the image with the hostname is missing, example:

  Board-specific image: afa-barebox-lxa-mc1
   Arch-specific image: afa-barebox-arm

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/globalvar.c                     | 3 +++
 defaultenv/defaultenv-2-base/boot/bnet | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/common/globalvar.c b/common/globalvar.c
index 5f5b7d44ae62..26202f2b493d 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -680,6 +680,8 @@ static int globalvar_init(void)
 	if (strlen(buildsystem_version_string) > 0)
 		globalvar_add_simple("buildsystem.version", buildsystem_version_string);
 
+	globalvar_add_simple("arch", CONFIG_ARCH_LINUX_NAME);
+
 #ifdef __BIG_ENDIAN
 	endianness = "big";
 #elif defined(__LITTLE_ENDIAN)
@@ -698,6 +700,7 @@ BAREBOX_MAGICVAR(global.version, "The barebox version");
 BAREBOX_MAGICVAR(global.buildsystem.version,
 		 "version of buildsystem barebox was built with");
 BAREBOX_MAGICVAR(global.endianness, "The barebox endianness");
+BAREBOX_MAGICVAR(global.arch, "Name of architecture as used by Linux");
 
 /**
  * nvvar_save - save NV variables to persistent environment
diff --git a/defaultenv/defaultenv-2-base/boot/bnet b/defaultenv/defaultenv-2-base/boot/bnet
index e378acd1e65a..b2eeab93d9b8 100644
--- a/defaultenv/defaultenv-2-base/boot/bnet
+++ b/defaultenv/defaultenv-2-base/boot/bnet
@@ -5,3 +5,6 @@
 path="/mnt/tftp"
 
 global.bootm.image="${path}/${global.user}-barebox-${global.hostname}"
+if [ ! -f "${global.bootm.image}" ]; then
+      global.bootm.image="${path}/${global.user}-barebox-${global.arch}"
+fi
-- 
2.39.5




             reply	other threads:[~2025-04-09 14:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09 13:19 Ahmad Fatoum [this message]
2025-04-10  7:34 ` Sascha Hauer

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=20250409131914.1949302-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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