boot/mxs-bootlets: add support for zImage with appended DTB
PATCH v2 1/1 boot/mxs-bootlets: add support for zImage with appended DTB
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.
--- boot/mxs-bootlets/mxs-bootlets.mk | 36 +++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 9 deletions(-)
boot/mxs-bootlets/mxs-bootlets.mk +27 -9
@@ -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))
Signature · 6 lines
2.17.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v3 1/2 boot/mxs-bootlets: fix build with recent toolchains
The 10.12.01 bootlets no longer build with a current toolchain:
- GCC >= 14 makes implicit function declarations an error:
src/hw_power_fiq.c:90:9: error: implicit declaration of function 'hw_icoll_SoftTrigger'
Build in C89 mode, where they are allowed.
- The default stack protector breaks the link, as the bootlets have no runtime for it:
power_prep.c:(.text+0x89c): undefined reference to `__stack_chk_fail'
Build with -fno-stack-protector.
- The ARM assembler rejects the "#alloc" section flag in linux_prep/core/cmdlines.S. Add a patch to use "a" instead.
Pass the compiler flags in CC on the make command line. The bootlets Makefiles set CC to $(CROSS_COMPILE)gcc and some of them reset CFLAGS, so a command line CC is the one way to reach all of them.
---
Changes v2 -> v3:
- new patch: without it, the 10.12.01 bootlets don't build with GCC >= 14, so patch 2/2 can't be tested
...rep-use-the-GNU-section-flags-syntax.patch | 33 +++++++++++++++++++ boot/mxs-bootlets/mxs-bootlets.mk | 16 +++++---- 2 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 boot/mxs-bootlets/0001-linux_prep-use-the-GNU-section-flags-syntax.patch
boot/mxs-bootlets/0001-linux_prep-use-the-GNU-section-flags-syntax.patch new file +33 -0
@@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Angelo Compagnucci <[email protected]> +Date: Sat, 21 Nov 2026 23:10:57 +0100 +Subject: [PATCH] linux_prep: use the GNU section flags syntax + +The ARM assembler of current binutils rejects the "#alloc" section flag: + + core/cmdlines.S:17: Error: junk at end of line, first unrecognized character is `#' + +Use the "a" flag string instead, which means the same. + +Upstream: dead +Signed-off-by: Angelo Compagnucci <[email protected]> +--- + linux_prep/core/cmdlines.S | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/linux_prep/core/cmdlines.S b/linux_prep/core/cmdlines.S +index a760fbf..f36960d 100644 +--- a/linux_prep/core/cmdlines.S ++++ b/linux_prep/core/cmdlines.S +@@ -14,7 +14,7 @@ + #define CMDLINES_FILE "output-target/command_lines_stripped.txt" + #endif + +- .section .cmdlines, #alloc ++ .section .cmdlines, "a" + .globl cmdlines_start + cmdlines_start: + .incbin CMDLINES_FILE +-- +2.53.0 +
boot/mxs-bootlets/mxs-bootlets.mk +10 -6
@@ -38,6 +38,13 @@ endif MXS_BOOTLETS_DEPENDENCIES = host-elftosb MXS_BOOTLETS_LICENSE = GPL-2.0+ +# The bootlets need C89 to build with GCC >= 14, and have no stack +# protector runtime. +MXS_BOOTLETS_MAKE_OPTS = \ + BOARD=$(MXS_BOOTLETS_BOARD) \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + CC="$(TARGET_CC) -std=gnu89 -fno-stack-protector" + ifeq ($(BR2_TARGET_MXS_BOOTLETS_BAREBOX),y) MXS_BOOTLETS_DEPENDENCIES += barebox MXS_BOOTLETS_BOOTDESC = barebox$(MXS_BOOTLETS_IVT_SUFFIX).bd
@@ -62,8 +69,7 @@ endif ifeq ($(BR2_TARGET_MXS_BOOTLETS_LINUX),y) define MXS_BOOTLETS_BUILD_LINUX_PREP - BOARD=$(MXS_BOOTLETS_BOARD) CROSS_COMPILE="$(TARGET_CROSS)" \ - $(MAKE1) -C $(@D) 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)
@@ -84,10 +90,8 @@ endef MXS_BOOTLETS_POST_EXTRACT_HOOKS += MXS_BOOTLETS_INSTALL_BAREBOX_BOOTDESC 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)" \ - $(MAKE1) -C $(@D) boot_prep + $(MAKE1) $(MXS_BOOTLETS_MAKE_OPTS) -C $(@D) power_prep + $(MAKE1) $(MXS_BOOTLETS_MAKE_OPTS) -C $(@D) boot_prep $(MXS_BOOTLETS_BUILD_LINUX_PREP) sed -i 's,[^ *]power_prep.*;,\tpower_prep="$(@D)/power_prep/power_prep";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC) sed -i 's,[^ *]sdram_prep.*;,\tsdram_prep="$(@D)/boot_prep/boot_prep";,' $(@D)/$(MXS_BOOTLETS_BOOTDESC)
Signature · 6 lines
2.53.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v3 2/2 boot/mxs-bootlets: add support for zImage with appended DTB
From: Laurent Badel <[email protected]>
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.
---
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/[email protected]/
boot/mxs-bootlets/mxs-bootlets.mk | 36 ++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 8 deletions(-)
boot/mxs-bootlets/mxs-bootlets.mk +28 -8
@@ -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))
Signature · 6 lines
2.53.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot