From: Angelo Compagnucci <angelo.compagnucci@gmail.com>
To: buildroot@buildroot.org
Cc: Laurent Badel <laurentbadel@eaton.com>
Subject: [Buildroot] [PATCH v3 2/2] boot/mxs-bootlets: add support for zImage with appended DTB
Date: Sat, 21 Nov 2026 23:23:10 +0100 [thread overview]
Message-ID: <20261121222310.213127-2-angelo.compagnucci@gmail.com> (raw)
In-Reply-To: <20261121222310.213127-1-angelo.compagnucci@gmail.com>
From: Laurent Badel <laurentbadel@eaton.com>
When building a zImage with appended DTBs, buildroot creates copies of
the zImage named zImage.$(LINUX_DTS_NAME). mxs-bootlets.mk does not
take this into consideration and passes only the original zImage
(without DTB appended) to elftosb to generate the SB file. Thus,
make sure that the correct zImage files are used in this process.
Signed-off-by: Laurent Badel <laurentbadel@eaton.com>
Co-authored-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Tested-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
---
Changes v2 -> v3:
- rebase on the new patch 1/2
- use the DTS name without its directory, as linux.mk does for the
zImage.<dts> copies: in-tree DTS names now have a vendor directory
(e.g. nxp/mxs/imx28-evk), so v2 looked for a missing file
- set MXS_BOOTLETS_BOOTSTREAM_EXTS in a single ifeq/else, to fix the
check-package "conditional override" warning
- drop the indent and trailing whitespace reported by check-package
- strip only the trailing .sb, with patsubst
Supersedes v2: https://patchwork.buildroot.org/project/buildroot/patch/20240206125833.10103-1-laurentbadel@eaton.com/
boot/mxs-bootlets/mxs-bootlets.mk | 36 ++++++++++++++++++++++++-------
1 file changed, 28 insertions(+), 8 deletions(-)
diff --git a/boot/mxs-bootlets/mxs-bootlets.mk b/boot/mxs-bootlets/mxs-bootlets.mk
index eb396da723..3c481c3595 100644
--- a/boot/mxs-bootlets/mxs-bootlets.mk
+++ b/boot/mxs-bootlets/mxs-bootlets.mk
@@ -45,20 +45,27 @@ MXS_BOOTLETS_MAKE_OPTS = \
CROSS_COMPILE="$(TARGET_CROSS)" \
CC="$(TARGET_CC) -std=gnu89 -fno-stack-protector"
+# With an appended DTB, build one bootstream per zImage.<dts> copy
+ifeq ($(BR2_TARGET_MXS_BOOTLETS_LINUX)$(BR2_LINUX_KERNEL_APPENDED_DTB),yy)
+MXS_BOOTLETS_BOOTSTREAM_EXTS = $(foreach dts_name,$(LINUX_DTS_NAME),.$(notdir $(dts_name)).sb)
+else
+MXS_BOOTLETS_BOOTSTREAM_EXTS = .sb
+endif
+
ifeq ($(BR2_TARGET_MXS_BOOTLETS_BAREBOX),y)
MXS_BOOTLETS_DEPENDENCIES += barebox
MXS_BOOTLETS_BOOTDESC = barebox$(MXS_BOOTLETS_IVT_SUFFIX).bd
-MXS_BOOTLETS_BOOTSTREAM = $(MXS_BOOTLETS_BOARD)_barebox$(MXS_BOOTLETS_IVT_SUFFIX).sb
+MXS_BOOTLETS_BOOTSTREAM_BASENAME = $(MXS_BOOTLETS_BOARD)_barebox$(MXS_BOOTLETS_IVT_SUFFIX)
else ifeq ($(BR2_TARGET_MXS_BOOTLETS_LINUX),y)
MXS_BOOTLETS_DEPENDENCIES += linux
MXS_BOOTLETS_BOOTDESC = linux$(MXS_BOOTLETS_IVT_SUFFIX).bd
-MXS_BOOTLETS_BOOTSTREAM = $(MXS_BOOTLETS_BOARD)_linux$(MXS_BOOTLETS_IVT_SUFFIX).sb
+MXS_BOOTLETS_BOOTSTREAM_BASENAME = $(MXS_BOOTLETS_BOARD)_linux$(MXS_BOOTLETS_IVT_SUFFIX)
else ifeq ($(BR2_TARGET_MXS_BOOTLETS_UBOOT),y)
MXS_BOOTLETS_DEPENDENCIES += uboot
MXS_BOOTLETS_BOOTDESC = uboot$(MXS_BOOTLETS_IVT_SUFFIX).bd
-MXS_BOOTLETS_BOOTSTREAM = $(MXS_BOOTLETS_BOARD)_uboot$(MXS_BOOTLETS_IVT_SUFFIX).sb
+MXS_BOOTLETS_BOOTSTREAM_BASENAME = $(MXS_BOOTLETS_BOARD)_uboot$(MXS_BOOTLETS_IVT_SUFFIX)
endif
ifeq ($(BR2_TARGET_MXS_BOOTLETS_BAREBOX),y)
@@ -71,9 +78,13 @@ ifeq ($(BR2_TARGET_MXS_BOOTLETS_LINUX),y)
define MXS_BOOTLETS_BUILD_LINUX_PREP
$(MAKE1) $(MXS_BOOTLETS_MAKE_OPTS) -C $(@D) linux_prep
endef
+
define MXS_BOOTLETS_SED_LINUX
sed -i 's,[^ *]linux_prep.*;,\tlinux_prep="$(@D)/linux_prep/output-target/linux_prep";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
- sed -i 's,[^ *]zImage.*;,\tzImage="$(LINUX_DIR)/arch/arm/boot/zImage";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
+endef
+
+define MXS_BOOTLETS_SED_ZIMAGE
+ sed -i 's,[^ *]zImage.*;,\tzImage="$(LINUX_DIR)/arch/arm/boot/zImage$(1)";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
endef
endif
@@ -89,6 +100,12 @@ endef
MXS_BOOTLETS_POST_EXTRACT_HOOKS += MXS_BOOTLETS_INSTALL_BAREBOX_BOOTDESC
+define MXS_BOOTLETS_ELFTOSB_CMD
+ $(HOST_DIR)/bin/elftosb $(MXS_BOOTLETS_ELFTOSB_OPTIONS) \
+ -z -c $(@D)/$(MXS_BOOTLETS_BOOTDESC) \
+ -o $(@D)/$(MXS_BOOTLETS_BOOTSTREAM_BASENAME)$(1)
+endef
+
define MXS_BOOTLETS_BUILD_CMDS
$(MAKE1) $(MXS_BOOTLETS_MAKE_OPTS) -C $(@D) power_prep
$(MAKE1) $(MXS_BOOTLETS_MAKE_OPTS) -C $(@D) boot_prep
@@ -98,13 +115,16 @@ define MXS_BOOTLETS_BUILD_CMDS
$(MXS_BOOTLETS_SED_BAREBOX)
$(MXS_BOOTLETS_SED_LINUX)
$(MXS_BOOTLETS_SED_UBOOT)
- $(HOST_DIR)/bin/elftosb $(MXS_BOOTLETS_ELFTOSB_OPTIONS) \
- -z -c $(@D)/$(MXS_BOOTLETS_BOOTDESC) \
- -o $(@D)/$(MXS_BOOTLETS_BOOTSTREAM)
+ $(foreach ext, $(MXS_BOOTLETS_BOOTSTREAM_EXTS),
+ $(call MXS_BOOTLETS_SED_ZIMAGE,$(patsubst %.sb,%,$(ext)))
+ $(call MXS_BOOTLETS_ELFTOSB_CMD,$(ext))
+ )
endef
define MXS_BOOTLETS_INSTALL_TARGET_CMDS
- cp $(@D)/$(MXS_BOOTLETS_BOOTSTREAM) $(BINARIES_DIR)/
+ $(foreach ext, $(MXS_BOOTLETS_BOOTSTREAM_EXTS),
+ cp $(@D)/$(MXS_BOOTLETS_BOOTSTREAM_BASENAME)$(ext) $(BINARIES_DIR)/
+ )
endef
$(eval $(generic-package))
--
2.53.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
prev parent reply other threads:[~2026-11-21 22:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-06 12:58 [Buildroot] [PATCH V2] boot/mxs-bootlets: add support for zImage with appended DTB Laurent Badel via buildroot
2026-11-21 22:23 ` [Buildroot] [PATCH v3 1/2] boot/mxs-bootlets: fix build with recent toolchains Angelo Compagnucci
2026-11-21 22:23 ` Angelo Compagnucci [this message]
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=20261121222310.213127-2-angelo.compagnucci@gmail.com \
--to=angelo.compagnucci@gmail.com \
--cc=buildroot@buildroot.org \
--cc=laurentbadel@eaton.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox