Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] boot/mxs-bootlets: add support for zImage with appended DTB
@ 2024-01-11 13:19 Laurent Badel via buildroot
  2024-01-11 15:26 ` Yann E. MORIN
  0 siblings, 1 reply; 6+ messages in thread
From: Laurent Badel via buildroot @ 2024-01-11 13:19 UTC (permalink / raw)
  To: buildroot; +Cc: Laurent Badel

When building a zImage with appended DTB, buildroot creates a copy of
the zImage named zImage.$(LINUX_DTS_NAME). mxs-bootlets.mk does not
take this into consideration and instead passes the original zImage
(without DTB appended) to elftosb to generate the SB file. Thus,
make sure that the correct zImage is used in this process.

Note: this patch only supports a single DTS specified in the
configuration, because there is no obvious use case for multiple DTS's
with mxs-bootlets. If multiple DTS's are configured, only the first one
will be used.

Signed-off-by: Laurent Badel <laurentbadel@eaton.com>
---
 boot/mxs-bootlets/mxs-bootlets.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/boot/mxs-bootlets/mxs-bootlets.mk b/boot/mxs-bootlets/mxs-bootlets.mk
index adc22767..2003b23f 100644
--- a/boot/mxs-bootlets/mxs-bootlets.mk
+++ b/boot/mxs-bootlets/mxs-bootlets.mk
@@ -65,9 +65,10 @@ define MXS_BOOTLETS_BUILD_LINUX_PREP
 	BOARD=$(MXS_BOOTLETS_BOARD) CROSS_COMPILE="$(TARGET_CROSS)" \
 		$(MAKE1) -C $(@D) linux_prep
 endef
+ZIMAGE_NAME=zImage$(if $(BR2_LINUX_KERNEL_APPENDED_DTB),.$(notdir $(firstword $(LINUX_DTS_NAME))))
 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)
+	sed -i 's,[^ *]zImage.*;,\tzImage="$(LINUX_DIR)/arch/arm/boot/$(ZIMAGE_NAME)";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
 endef
 endif
 
-- 
2.17.1

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [Buildroot] [PATCH 1/1] boot/mxs-bootlets: add support for zImage with appended DTB
@ 2024-01-16  9:34 Laurent Badel via buildroot
  0 siblings, 0 replies; 6+ messages in thread
From: Laurent Badel via buildroot @ 2024-01-16  9:34 UTC (permalink / raw)
  To: buildroot; +Cc: Laurent Badel

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>
---
 boot/mxs-bootlets/mxs-bootlets.mk | 36 +++++++++++++++++++++++--------
 1 file changed, 27 insertions(+), 9 deletions(-)

diff --git a/boot/mxs-bootlets/mxs-bootlets.mk b/boot/mxs-bootlets/mxs-bootlets.mk
index adc22767..efcee16a 100644
--- a/boot/mxs-bootlets/mxs-bootlets.mk
+++ b/boot/mxs-bootlets/mxs-bootlets.mk
@@ -38,20 +38,21 @@ endif
 MXS_BOOTLETS_DEPENDENCIES = host-elftosb
 MXS_BOOTLETS_LICENSE = GPL-2.0+
 
+MXS_BOOTLETS_BOOTSTREAM_EXTS = .sb
 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)
@@ -65,10 +66,18 @@ define MXS_BOOTLETS_BUILD_LINUX_PREP
 	BOARD=$(MXS_BOOTLETS_BOARD) CROSS_COMPILE="$(TARGET_CROSS)" \
 		$(MAKE1) -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
+
+ifeq ($(BR2_LINUX_KERNEL_APPENDED_DTB), y)
+	MXS_BOOTLETS_BOOTSTREAM_EXTS = $(foreach dts_name,$(LINUX_DTS_NAME),.$(strip $(dts_name)).sb)
+endif
 endif
 
 ifeq ($(BR2_TARGET_MXS_BOOTLETS_UBOOT),y)
@@ -83,7 +92,13 @@ endef
 
 MXS_BOOTLETS_POST_EXTRACT_HOOKS += MXS_BOOTLETS_INSTALL_BAREBOX_BOOTDESC
 
-define MXS_BOOTLETS_BUILD_CMDS
+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	
 	BOARD=$(MXS_BOOTLETS_BOARD) CROSS_COMPILE="$(TARGET_CROSS)" \
 		$(MAKE1) -C $(@D) power_prep
 	BOARD=$(MXS_BOOTLETS_BOARD) CROSS_COMPILE="$(TARGET_CROSS)" \
@@ -94,13 +109,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,$(subst .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.17.1

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-01-16  9:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-11 13:19 [Buildroot] [PATCH 1/1] boot/mxs-bootlets: add support for zImage with appended DTB Laurent Badel via buildroot
2024-01-11 15:26 ` Yann E. MORIN
2024-01-12  8:30   ` Badel, Laurent via buildroot
2024-01-12 16:21     ` Yann E. MORIN
2024-01-16  9:32       ` Badel, Laurent via buildroot
  -- strict thread matches above, loose matches on Subject: below --
2024-01-16  9:34 Laurent Badel via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox