Skip to contentSkip to conversation

board/freescale: fix arm-trusted-firmware for binutils 2.39+

PATCH Applied Brandon Maier via buildroot 3 participants 13 messages Sep 21, 2023 – Oct 13, 2023 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 board/freescale: fix arm-trusted-firmware for binutils 2.39+

The NXP arm-trusted-firmware forks use an older version of ATF that will error with "LOAD segment with RWX permissions". Similar patches are present in boot/arm-trusted-firmware/ for older ATF versions.

---
 ...dd-support-for-new-binutils-versions.patch | 61 +++++++++++++++++++
 configs/freescale_imx8mmevk_defconfig         |  1 +
 configs/freescale_imx8mnevk_defconfig         |  1 +
 configs/freescale_imx8mpevk_defconfig         |  1 +
 configs/freescale_imx8mqevk_defconfig         |  1 +
 configs/freescale_imx8qmmek_defconfig         |  1 +
 configs/freescale_imx8qxpmek_defconfig        |  1 +
 configs/ls1028ardb_defconfig                  |  3 +
 8 files changed, 70 insertions(+)
 create mode 100644 board/freescale/common/patches/arm-trusted-firmware/0001-feat-build-add-support-for-new-binutils-versions.patch
board/freescale/common/patches/arm-trusted-firmware/0001-feat-build-add-support-for-new-binutils-versions.patch new file +61 -0
new file mode 100644
index 0000000000..335c18553a
@@ -0,0 +1,61 @@
+From 0f75b03c008eacb9818af3a56dc088e72a623d17 Mon Sep 17 00:00:00 2001
+From: Marco Felsch <[email protected]>
+Date: Wed, 9 Nov 2022 12:59:09 +0100
+Subject: [PATCH] feat(build): add support for new binutils versions
+
+Users of GNU ld (BPF) from binutils 2.39+ will observe multiple instaces
+of a new warning when linking the bl*.elf in the form:
+
+  ld.bfd: warning: stm32mp1_helper.o: missing .note.GNU-stack section implies executable stack
+  ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
+  ld.bfd: warning: bl2.elf has a LOAD segment with RWX permissions
+  ld.bfd: warning: bl32.elf has a LOAD segment with RWX permissions
+
+These new warnings are enbaled by default to secure elf binaries:
+ - https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
+ - https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774
+
+Fix it in a similar way to what the Linux kernel does, see:
+https://lore.kernel.org/all/[email protected]/
+
+Following the reasoning there, we set "-z noexecstack" for all linkers
+(although LLVM's LLD defaults to it) and optional add
+--no-warn-rwx-segments since this a ld.bfd related.
+
+Signed-off-by: Marco Felsch <[email protected]>
+Signed-off-by: Robert Schwebel <[email protected]>
+Change-Id: I9430f5fa5036ca88da46cd3b945754d62616b617
+Signed-off-by: Heiko Thiery <[email protected]>
+Upstream: https://github.com/ARM-software/arm-trusted-firmware/commit/1f49db5f25cdd4e43825c9bcc0575070b80f628c
+---
+ Makefile | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 1ddb7b844..470956b19 100644
+--- a/Makefile
++++ b/Makefile
+@@ -416,6 +416,8 @@ endif
+ 
+ GCC_V_OUTPUT		:=	$(shell $(CC) -v 2>&1)
+ 
++TF_LDFLAGS		+=	-z noexecstack
++
+ # LD = armlink
+ ifneq ($(findstring armlink,$(notdir $(LD))),)
+ TF_LDFLAGS		+=	--diag_error=warning --lto_level=O1
+@@ -442,7 +444,10 @@ TF_LDFLAGS		+=	$(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH)))
+ 
+ # LD = gcc-ld (ld) or llvm-ld (ld.lld) or other
+ else
+-TF_LDFLAGS		+=	--fatal-warnings -O1
++# With ld.bfd version 2.39 and newer new warnings are added. Skip those since we
++# are not loaded by a elf loader.
++TF_LDFLAGS		+=	$(call ld_option, --no-warn-rwx-segments)
++TF_LDFLAGS		+=	-O1
+ TF_LDFLAGS		+=	--gc-sections
+ # ld.lld doesn't recognize the errata flags,
+ # therefore don't add those in that case
+-- 
+2.30.2
+
configs/freescale_imx8mmevk_defconfig +1 -0
index dcb4b42540..ca5c308da6 100644
@@ -1,6 +1,7 @@
 BR2_aarch64=y
 BR2_ARM_FPU_VFPV3=y
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_GLOBAL_PATCH_DIR="board/freescale/common/patches"
 BR2_TARGET_GENERIC_GETTY_PORT="ttymxc1"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-bootloader-prepare.sh board/freescale/common/imx/post-image.sh"
 BR2_ROOTFS_POST_SCRIPT_ARGS="${UBOOT_DIR}/arch/arm/dts/imx8mm-evk.dtb"
configs/freescale_imx8mnevk_defconfig +1 -0
index 0653978d91..ac73bea769 100644
@@ -1,6 +1,7 @@
 BR2_aarch64=y
 BR2_ARM_FPU_VFPV3=y
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_GLOBAL_PATCH_DIR="board/freescale/common/patches"
 BR2_TARGET_GENERIC_GETTY_PORT="ttymxc1"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-bootloader-prepare.sh board/freescale/common/imx/post-image.sh"
 BR2_ROOTFS_POST_SCRIPT_ARGS="${UBOOT_DIR}/arch/arm/dts/imx8mn-ddr4-evk.dtb"
configs/freescale_imx8mpevk_defconfig +1 -0
index 5a72406b67..913c190d87 100644
@@ -1,6 +1,7 @@
 BR2_aarch64=y
 BR2_ARM_FPU_VFPV3=y
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_GLOBAL_PATCH_DIR="board/freescale/common/patches"
 BR2_TARGET_GENERIC_GETTY_PORT="ttymxc1"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-bootloader-prepare.sh board/freescale/common/imx/post-image.sh"
 BR2_ROOTFS_POST_SCRIPT_ARGS="${UBOOT_DIR}/arch/arm/dts/imx8mp-evk.dtb"
configs/freescale_imx8mqevk_defconfig +1 -0
index e3f88dc44c..79375d7f88 100644
@@ -1,6 +1,7 @@
 BR2_aarch64=y
 BR2_ARM_FPU_VFPV3=y
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_GLOBAL_PATCH_DIR="board/freescale/common/patches"
 BR2_TARGET_GENERIC_GETTY_PORT="ttymxc0"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-bootloader-prepare.sh board/freescale/common/imx/post-image.sh"
 BR2_ROOTFS_POST_SCRIPT_ARGS="${UBOOT_DIR}/arch/arm/dts/imx8mq-evk.dtb"
configs/freescale_imx8qmmek_defconfig +1 -0
index 75777646df..0fc3fe7b07 100644
@@ -1,6 +1,7 @@
 BR2_aarch64=y
 BR2_ARM_FPU_VFPV4=y
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_GLOBAL_PATCH_DIR="board/freescale/common/patches"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-bootloader-prepare.sh board/freescale/common/imx/post-image.sh"
 BR2_ROOTFS_POST_SCRIPT_ARGS="${UBOOT_DIR}/arch/arm/dts/fsl-imx8qm-mek.dtb"
 BR2_LINUX_KERNEL=y
configs/freescale_imx8qxpmek_defconfig +1 -0
index ce8f6b7c84..47a2104d5b 100644
@@ -2,6 +2,7 @@ BR2_aarch64=y
 BR2_cortex_a35=y
 BR2_ARM_FPU_VFPV3=y
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_GLOBAL_PATCH_DIR="board/freescale/common/patches"
 BR2_TARGET_GENERIC_GETTY_PORT="ttyLP0"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-bootloader-prepare.sh board/freescale/common/imx/post-image.sh"
 BR2_ROOTFS_POST_SCRIPT_ARGS="${UBOOT_DIR}/arch/arm/dts/fsl-imx8qxp-mek.dtb"
configs/ls1028ardb_defconfig +3 -0
index a46b94511a..d92c543b44 100644
@@ -2,6 +2,9 @@
 BR2_aarch64=y
 BR2_cortex_a72=y
 
+# patches
+BR2_GLOBAL_PATCH_DIR="board/freescale/common/patches"
+
 # Toolchain
 # Linux headers same as kernel, a 5.10 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
Signature · 6 lines
2.41.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/4 board/freescale: fix imx arm-trusted-firmware for GCC12

The arm-trusted-firmware package for IMX boards fails due to a GCC bug. See the attached patch description for detail.

---
 ...Makefile-Suppress-array-bounds-error.patch | 51 +++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 board/freescale/common/patches/arm-trusted-firmware/0002-LF-7968-01-fix-Makefile-Suppress-array-bounds-error.patch
board/freescale/common/patches/arm-trusted-firmware/0002-LF-7968-01-fix-Makefile-Suppress-array-bounds-error.patch new file +51 -0
new file mode 100644
index 0000000000..7a7a7bbc28
@@ -0,0 +1,51 @@
+From b2a94de52ae4a940a87d569815b19d3fa92dd32a Mon Sep 17 00:00:00 2001
+From: Tom Hochstein <[email protected]>
+Date: Mon, 16 May 2022 13:45:16 -0500
+Subject: [PATCH] LF-7968-01 fix(Makefile): Suppress array-bounds error
+
+The array-bounds error is triggered now in cases where it was silent
+before, causing errors like:
+
+```
+plat/imx/imx8m/hab.c: In function 'imx_hab_handler':
+plat/imx/imx8m/hab.c:64:57: error: array subscript 0 is outside array bounds of 'uint32_t[0]' {aka 'unsigned int[]'} [-Werror=array-bounds]
+   64 | #define HAB_RVT_CHECK_TARGET_ARM64      ((unsigned long)*(uint32_t *)(HAB_RVT_BASE + 0x18))
+      |                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+```
+
+The error is a false-positive and is entered as a bug [1]. The problem
+is fixed partially in GCC 12 and fully in GCC 13 [2].
+
+The partial fix does not work here because the constant addresses used
+are less than the 4kB boundary chosen for the partial fix, so suppress
+the error until GCC is upgraded to 13.
+
+[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578
+[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c39
+
+Upstream-Status: Inappropriate [other]
+Signed-off-by: Tom Hochstein <[email protected]>
+Signed-off-by: Jacky Bai <[email protected]>
+Reviewed-by: Ye Li <[email protected]>
+Signed-off-by: Brandon Maier <[email protected]>
+Upstream: https://github.com/nxp-imx/imx-atf/commit/058bf0f104115037d03e277f079825ef3659c5b9
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index c87c3ae08..2d6b90f47 100644
+--- a/Makefile
++++ b/Makefile
+@@ -346,7 +346,7 @@ WARNINGS	+=		-Wshift-overflow -Wshift-sign-overflow \
+ endif
+ 
+ ifneq (${E},0)
+-ERRORS := -Werror
++ERRORS := -Werror -Wno-error=array-bounds
+ endif
+ 
+ CPPFLAGS		=	${DEFINES} ${INCLUDES} ${MBEDTLS_INC} -nostdinc	\
+-- 
+2.41.0
+
Signature · 6 lines
2.41.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 2/4] board/freescale: fix imx arm-trusted-firmware for GCC12

Quoted 8 lines · On Thu, 21 Sep 2023 21:56:31 +0000 Brandon Maier via buildroot…

The arm-trusted-firmware package for IMX boards fails due to a GCC bug. See the attached patch description for detail.

---
 ...Makefile-Suppress-array-bounds-error.patch | 51 +++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 board/freescale/common/patches/arm-trusted-firmware/0002-LF-7968-01-fix-Makefile-Suppress-array-bounds-error.patch

Applied to master after adding references to the Gitlab CI failures fixed by this change. Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Re: [Buildroot] [PATCH 2/4] board/freescale: fix imx arm-trusted-firmware for GCC12

In reply to Brandon Maier via buildroot
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Brandon" == Brandon Maier via buildroot <[email protected]> writes:

The arm-trusted-firmware package for IMX boards fails due to a GCC bug. See the attached patch description for detail.

Committed to 2023.08.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

PATCH 3/4 package/qoriq-fm-ucode: add package for QorIQ FMan microcode

In reply to Brandon Maier via buildroot

This package provides firmware needed for the LS1046A-FRWY Ethernet.

---
 DEVELOPERS                                 |  1 +
 package/Config.in                          |  1 +
 package/qoriq-fm-ucode/Config.in           | 21 +++++++++++++++++++++
 package/qoriq-fm-ucode/qoriq-fm-ucode.hash |  3 +++
 package/qoriq-fm-ucode/qoriq-fm-ucode.mk   | 20 ++++++++++++++++++++
 5 files changed, 46 insertions(+)
 create mode 100644 package/qoriq-fm-ucode/Config.in
 create mode 100644 package/qoriq-fm-ucode/qoriq-fm-ucode.hash
 create mode 100644 package/qoriq-fm-ucode/qoriq-fm-ucode.mk
DEVELOPERS +1 -0
index e8b78a8d46..e1f0c1cf1b 100644
@@ -513,6 +513,7 @@ F:	package/iftop/
 F:	package/ncdu/
 
 N:	Brandon Maier <[email protected]>
+F:	package/qoriq-fm-ucode/
 F:	package/vmtouch/
 
 N:	Brock Williams <[email protected]>
package/Config.in +1 -0
index e8dbadadf3..41ead47fac 100644
@@ -443,6 +443,7 @@ menu "Firmware"
 	source "package/murata-cyw-fw/Config.in"
 	source "package/odroidc2-firmware/Config.in"
 	source "package/qcom-db410c-firmware/Config.in"
+	source "package/qoriq-fm-ucode/Config.in"
 	source "package/rcw-smarc-sal28/Config.in"
 	source "package/rpi-firmware/Config.in"
 	source "package/sunxi-boards/Config.in"
package/qoriq-fm-ucode/Config.in new file +21 -0
new file mode 100644
index 0000000000..224e7fde32
@@ -0,0 +1,21 @@
+config BR2_PACKAGE_QORIQ_FM_UCODE
+	bool "qoriq-fm-ucode"
+	help
+	  These are the microcode families of the Frame Manager hardware
+	  block in QorIQ products. Specific platforms require specific
+	  binaries, and those also have to further match specific
+	  software versions (Frame Manager Driver -- FMD).
+
+	  https://github.com/nxp-qoriq/qoriq-fm-ucode
+
+if BR2_PACKAGE_QORIQ_FM_UCODE
+
+config BR2_PACKAGE_QORIQ_FM_UCODE_PLATFORM
+	string "Platform"
+	help
+	  This option specifies which platform's microcode to use.
+
+	  This string should match a file in qoriq-fm-ucode of the form
+	  "fsl_fman_ucode_${PLATFORM}*.bin".
+
+endif
package/qoriq-fm-ucode/qoriq-fm-ucode.hash new file +3 -0
new file mode 100644
index 0000000000..5c664356c0
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  2e431dd726c4aa1db558931d80b318149abdf71fec6e39de9d5aa33399df1fb1  qoriq-fm-ucode-LSDK-21.08.tar.gz
+sha256  7a223031d76339df0e4e5a94d193a270fb9963d42b577aa42fe130a4657f3e17  NXP-Binary-EULA.txt
package/qoriq-fm-ucode/qoriq-fm-ucode.mk new file +20 -0
new file mode 100644
index 0000000000..239ab0d3c3
@@ -0,0 +1,20 @@
+################################################################################
+#
+# qoriq-fm-ucode
+#
+################################################################################
+
+QORIQ_FM_UCODE_VERSION = LSDK-21.08
+QORIQ_FM_UCODE_SITE = $(call github,nxp-qoriq,qoriq-fm-ucode,$(QORIQ_FM_UCODE_VERSION))
+QORIQ_FM_UCODE_LICENSE = NXP Binary EULA
+QORIQ_FM_UCODE_LICENSE_FILES = NXP-Binary-EULA.txt
+QORIQ_FM_UCODE_REDISTRIBUTE = NO
+QORIQ_FM_UCODE_INSTALL_IMAGES = YES
+QORIQ_FM_UCODE_INSTALL_TARGET = NO
+
+define QORIQ_FM_UCODE_INSTALL_IMAGES_CMDS
+	cp $(@D)/fsl_fman_ucode_$(BR2_PACKAGE_QORIQ_FM_UCODE_PLATFORM)*.bin \
+		$(BINARIES_DIR)
+endef
+
+$(eval $(generic-package))
Signature · 6 lines
2.41.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

Re: [Buildroot] [PATCH 3/4] package/qoriq-fm-ucode: add package for QorIQ FMan microcode

Quoted 3 lines · On Thu, 21 Sep 2023 21:56:32 +0000 Brandon Maier via buildroot…

This package provides firmware needed for the LS1046A-FRWY Ethernet.

Applied after doing a few changes. First, changed the commit title to "package/qoriq-fm-ucode: new package".

Quoted 10 lines
package/qoriq-fm-ucode/Config.in new file +4 -0
new file mode 100644
index 0000000000..224e7fde32
@@ -0,0 +1,21 @@
+config BR2_PACKAGE_QORIQ_FM_UCODE
+	bool "qoriq-fm-ucode"
+	help
+	  These are the microcode families of the Frame Manager hardware

package/qoriq-fm-ucode/Config.in line 14

Quoted 10 lines
package/qoriq-fm-ucode/Config.in new file +10 -0
+	  block in QorIQ products. Specific platforms require specific
+	  binaries, and those also have to further match specific
+	  software versions (Frame Manager Driver -- FMD).
+
+	  https://github.com/nxp-qoriq/qoriq-fm-ucode
+
+if BR2_PACKAGE_QORIQ_FM_UCODE
+
+config BR2_PACKAGE_QORIQ_FM_UCODE_PLATFORM
+	string "Platform"

Added a:

	default "ls1046"

just to make sure that our autobuilders that generate random configurations will have a valid configuration by default.

package/qoriq-fm-ucode/Config.in line 19

Quoted 5 lines
package/qoriq-fm-ucode/Config.in new file +5 -0
+QORIQ_FM_UCODE_VERSION = LSDK-21.08
+QORIQ_FM_UCODE_SITE = $(call github,nxp-qoriq,qoriq-fm-ucode,$(QORIQ_FM_UCODE_VERSION))
+QORIQ_FM_UCODE_LICENSE = NXP Binary EULA
+QORIQ_FM_UCODE_LICENSE_FILES = NXP-Binary-EULA.txt
+QORIQ_FM_UCODE_REDISTRIBUTE = NO

This was not correct: this package *is* redistributable.

package/qoriq-fm-ucode/Config.in

Quoted 5 lines
package/qoriq-fm-ucode/Config.in new file +5 -0
+QORIQ_FM_UCODE_INSTALL_IMAGES = YES
+QORIQ_FM_UCODE_INSTALL_TARGET = NO
+
+define QORIQ_FM_UCODE_INSTALL_IMAGES_CMDS
+	cp $(@D)/fsl_fman_ucode_$(BR2_PACKAGE_QORIQ_FM_UCODE_PLATFORM)*.bin \

Modified a bit to qstrip the $(BR2_PACKAGE_QORIQ_FM_UCODE_PLATFORM) variable.

As said above: applied with those changes. Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw

PATCH 4/4 configs/ls1046a-frwy: new defconfig

In reply to Brandon Maier via buildroot

This is a development platform for the NXP LS1046A SoC.

The config is heavily based on the ls1028ardb_defconfig.

see https://www.nxp.com/design/software/qoriq-developer-resources/ls1046a-freeway-board:FRWY-LS1046A

---
 DEVELOPERS                                    |  2 +
 board/freescale/ls1046a-frwy/genimage.cfg     | 29 ++++++
 board/freescale/ls1046a-frwy/readme.txt       | 90 +++++++++++++++++++
 .../boot/extlinux/extlinux.conf               |  4 +
 configs/ls1046a-frwy_defconfig                | 61 +++++++++++++
 5 files changed, 186 insertions(+)
 create mode 100644 board/freescale/ls1046a-frwy/genimage.cfg
 create mode 100644 board/freescale/ls1046a-frwy/readme.txt
 create mode 100644 board/freescale/ls1046a-frwy/rootfs_overlay/boot/extlinux/extlinux.conf
 create mode 100644 configs/ls1046a-frwy_defconfig
DEVELOPERS +2 -0
index e1f0c1cf1b..fd07865fb1 100644
@@ -513,6 +513,8 @@ F:	package/iftop/
 F:	package/ncdu/
 
 N:	Brandon Maier <[email protected]>
+F:	board/freescale/ls1046a-frwy/
+F:	configs/ls1046a-frwy_defconfig
 F:	package/qoriq-fm-ucode/
 F:	package/vmtouch/
 
board/freescale/ls1046a-frwy/genimage.cfg new file +29 -0
new file mode 100644
index 0000000000..63cca042b2
@@ -0,0 +1,29 @@
+image sdcard.img {
+	hdimage {
+	}
+
+	partition fsbl {
+		offset = 4K
+		in-partition-table = "no"
+		image = "bl2_sd.pbl"
+	}
+
+	partition ssbl {
+		offset = 1M
+		in-partition-table = "no"
+		image = "fip.bin"
+	}
+
+	partition fman {
+		offset = 9M
+		in-partition-table = "no"
+		image = "fsl_fman_ucode_ls1046_r1.0_106_4_18.bin"
+	}
+
+	partition rootfs {
+		offset = 16M
+		partition-type = 0x83
+		bootable = "true"
+		image = "rootfs.ext4"
+	}
+}
board/freescale/ls1046a-frwy/readme.txt new file +90 -0

90 lines not on this page · raw message

board/freescale/ls1046a-frwy/rootfs_overlay/boot/extlinux/extlinux.conf new file +4 -0
new file mode 100644
index 0000000000..536d62b6c5
@@ -0,0 +1,4 @@
+label ls1046afrwy-buildroot
+  kernel /boot/Image
+  devicetree /boot/fsl-ls1046a-frwy-sdk.dtb
+  append console=ttyS0,115200 root=/dev/mmcblk0p1 earlycon=uart8250,mmio,0x21c0500 rootwait
configs/ls1046a-frwy_defconfig new file +61 -0

61 lines not on this page · raw message

Signature · 6 lines
2.41.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw

Re: [Buildroot] [PATCH 4/4] configs/ls1046a-frwy: new defconfig

Quoted 7 lines · On Thu, 21 Sep 2023 21:56:33 +0000 Brandon Maier via buildroot…

This is a development platform for the NXP LS1046A SoC.

The config is heavily based on the ls1028ardb_defconfig.

see https://www.nxp.com/design/software/qoriq-developer-resources/ls1046a-freeway-board:FRWY-LS1046A

Quoted 11 lines
---
 DEVELOPERS                                    |  2 +
 board/freescale/ls1046a-frwy/genimage.cfg     | 29 ++++++
 board/freescale/ls1046a-frwy/readme.txt       | 90 +++++++++++++++++++
 .../boot/extlinux/extlinux.conf               |  4 +
 configs/ls1046a-frwy_defconfig                | 61 +++++++++++++
 5 files changed, 186 insertions(+)
 create mode 100644 board/freescale/ls1046a-frwy/genimage.cfg
 create mode 100644 board/freescale/ls1046a-frwy/readme.txt
 create mode 100644 board/freescale/ls1046a-frwy/rootfs_overlay/boot/extlinux/extlinux.conf
 create mode 100644 configs/ls1046a-frwy_defconfig

Applied to master, thanks.

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw
In reply to Brandon Maier via buildroot

Hello Brandon,

Le 21/09/2023 à 23:56, Brandon Maier via buildroot a écrit :

Quoted 3 lines

The NXP arm-trusted-firmware forks use an older version of ATF that will error with "LOAD segment with RWX permissions". Similar patches are present in boot/arm-trusted-firmware/ for older ATF versions.

Maybe it would be great to update Freescale defconfigs since they are not at the latest NXP BSP release. The last update is from 2021 already [1].

On another hand, your patch series is needed to fix the build for Buildroot 2023.08 since gcc 12 and binutils 2.39 are used by default.

I recently sent a patch to use the latest NXP defconfig for the freescale_imx8mpevk_defconfig [2].

[1]
https://gitlab.com/buildroot.org/buildroot/-/commits/fee1e1b85a65e8be84f1f7f9ead32a7c5e345dbc

[2]
http://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Best regards,
Romain

Quoted 158 lines
---
 ...dd-support-for-new-binutils-versions.patch | 61 +++++++++++++++++++
 configs/freescale_imx8mmevk_defconfig         |  1 +
 configs/freescale_imx8mnevk_defconfig         |  1 +
 configs/freescale_imx8mpevk_defconfig         |  1 +
 configs/freescale_imx8mqevk_defconfig         |  1 +
 configs/freescale_imx8qmmek_defconfig         |  1 +
 configs/freescale_imx8qxpmek_defconfig        |  1 +
 configs/ls1028ardb_defconfig                  |  3 +
 8 files changed, 70 insertions(+)
 create mode 100644 board/freescale/common/patches/arm-trusted-firmware/0001-feat-build-add-support-for-new-binutils-versions.patch
board/freescale/common/patches/arm-trusted-firmware/0001-feat-build-add-support-for-new-binutils-versions.patch new file +61 -0
new file mode 100644
index 0000000000..335c18553a
@@ -0,0 +1,61 @@
+From 0f75b03c008eacb9818af3a56dc088e72a623d17 Mon Sep 17 00:00:00 2001
+From: Marco Felsch <[email protected]>
+Date: Wed, 9 Nov 2022 12:59:09 +0100
+Subject: [PATCH] feat(build): add support for new binutils versions
+
+Users of GNU ld (BPF) from binutils 2.39+ will observe multiple instaces
+of a new warning when linking the bl*.elf in the form:
+
+  ld.bfd: warning: stm32mp1_helper.o: missing .note.GNU-stack section implies executable stack
+  ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
+  ld.bfd: warning: bl2.elf has a LOAD segment with RWX permissions
+  ld.bfd: warning: bl32.elf has a LOAD segment with RWX permissions
+
+These new warnings are enbaled by default to secure elf binaries:
+ - https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107
+ - https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774
+
+Fix it in a similar way to what the Linux kernel does, see:
+https://lore.kernel.org/all/[email protected]/
+
+Following the reasoning there, we set "-z noexecstack" for all linkers
+(although LLVM's LLD defaults to it) and optional add
+--no-warn-rwx-segments since this a ld.bfd related.
+
+Signed-off-by: Marco Felsch <[email protected]>
+Signed-off-by: Robert Schwebel <[email protected]>
+Change-Id: I9430f5fa5036ca88da46cd3b945754d62616b617
+Signed-off-by: Heiko Thiery <[email protected]>
+Upstream: https://github.com/ARM-software/arm-trusted-firmware/commit/1f49db5f25cdd4e43825c9bcc0575070b80f628c
+---
+ Makefile | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 1ddb7b844..470956b19 100644
+--- a/Makefile
++++ b/Makefile
+@@ -416,6 +416,8 @@ endif
+ 
+ GCC_V_OUTPUT		:=	$(shell $(CC) -v 2>&1)
+ 
++TF_LDFLAGS		+=	-z noexecstack
++
+ # LD = armlink
+ ifneq ($(findstring armlink,$(notdir $(LD))),)
+ TF_LDFLAGS		+=	--diag_error=warning --lto_level=O1
+@@ -442,7 +444,10 @@ TF_LDFLAGS		+=	$(subst --,-Xlinker --,$(TF_LDFLAGS_$(ARCH)))
+ 
+ # LD = gcc-ld (ld) or llvm-ld (ld.lld) or other
+ else
+-TF_LDFLAGS		+=	--fatal-warnings -O1
++# With ld.bfd version 2.39 and newer new warnings are added. Skip those since we
++# are not loaded by a elf loader.
++TF_LDFLAGS		+=	$(call ld_option, --no-warn-rwx-segments)
++TF_LDFLAGS		+=	-O1
+ TF_LDFLAGS		+=	--gc-sections
+ # ld.lld doesn't recognize the errata flags,
+ # therefore don't add those in that case
+-- 
+2.30.2
+
configs/freescale_imx8mmevk_defconfig +1 -0
index dcb4b42540..ca5c308da6 100644
@@ -1,6 +1,7 @@
 BR2_aarch64=y
 BR2_ARM_FPU_VFPV3=y
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_GLOBAL_PATCH_DIR="board/freescale/common/patches"
 BR2_TARGET_GENERIC_GETTY_PORT="ttymxc1"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-bootloader-prepare.sh board/freescale/common/imx/post-image.sh"
 BR2_ROOTFS_POST_SCRIPT_ARGS="${UBOOT_DIR}/arch/arm/dts/imx8mm-evk.dtb"
configs/freescale_imx8mnevk_defconfig +1 -0
index 0653978d91..ac73bea769 100644
@@ -1,6 +1,7 @@
 BR2_aarch64=y
 BR2_ARM_FPU_VFPV3=y
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_GLOBAL_PATCH_DIR="board/freescale/common/patches"
 BR2_TARGET_GENERIC_GETTY_PORT="ttymxc1"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-bootloader-prepare.sh board/freescale/common/imx/post-image.sh"
 BR2_ROOTFS_POST_SCRIPT_ARGS="${UBOOT_DIR}/arch/arm/dts/imx8mn-ddr4-evk.dtb"
configs/freescale_imx8mpevk_defconfig +1 -0
index 5a72406b67..913c190d87 100644
@@ -1,6 +1,7 @@
 BR2_aarch64=y
 BR2_ARM_FPU_VFPV3=y
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_GLOBAL_PATCH_DIR="board/freescale/common/patches"
 BR2_TARGET_GENERIC_GETTY_PORT="ttymxc1"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-bootloader-prepare.sh board/freescale/common/imx/post-image.sh"
 BR2_ROOTFS_POST_SCRIPT_ARGS="${UBOOT_DIR}/arch/arm/dts/imx8mp-evk.dtb"
configs/freescale_imx8mqevk_defconfig +1 -0
index e3f88dc44c..79375d7f88 100644
@@ -1,6 +1,7 @@
 BR2_aarch64=y
 BR2_ARM_FPU_VFPV3=y
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_GLOBAL_PATCH_DIR="board/freescale/common/patches"
 BR2_TARGET_GENERIC_GETTY_PORT="ttymxc0"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-bootloader-prepare.sh board/freescale/common/imx/post-image.sh"
 BR2_ROOTFS_POST_SCRIPT_ARGS="${UBOOT_DIR}/arch/arm/dts/imx8mq-evk.dtb"
configs/freescale_imx8qmmek_defconfig +1 -0
index 75777646df..0fc3fe7b07 100644
@@ -1,6 +1,7 @@
 BR2_aarch64=y
 BR2_ARM_FPU_VFPV4=y
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_GLOBAL_PATCH_DIR="board/freescale/common/patches"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-bootloader-prepare.sh board/freescale/common/imx/post-image.sh"
 BR2_ROOTFS_POST_SCRIPT_ARGS="${UBOOT_DIR}/arch/arm/dts/fsl-imx8qm-mek.dtb"
 BR2_LINUX_KERNEL=y
configs/freescale_imx8qxpmek_defconfig +1 -0
index ce8f6b7c84..47a2104d5b 100644
@@ -2,6 +2,7 @@ BR2_aarch64=y
 BR2_cortex_a35=y
 BR2_ARM_FPU_VFPV3=y
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y
+BR2_GLOBAL_PATCH_DIR="board/freescale/common/patches"
 BR2_TARGET_GENERIC_GETTY_PORT="ttyLP0"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-bootloader-prepare.sh board/freescale/common/imx/post-image.sh"
 BR2_ROOTFS_POST_SCRIPT_ARGS="${UBOOT_DIR}/arch/arm/dts/fsl-imx8qxp-mek.dtb"
configs/ls1028ardb_defconfig +0 -0
index a46b94511a..d92c543b44 100644

configs/ls1028ardb_defconfig line 10

Quoted 9 lines
configs/ls1028ardb_defconfig +3 -0
@@ -2,6 +2,9 @@
 BR2_aarch64=y
 BR2_cortex_a72=y
 
+# patches
+BR2_GLOBAL_PATCH_DIR="board/freescale/common/patches"
+
 # Toolchain
 # Linux headers same as kernel, a 5.10 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#9 lore raw
In reply to Brandon Maier via buildroot
Quoted 5 lines · On Thu, 21 Sep 2023 21:56:30 +0000 Brandon Maier via buildroot…

The NXP arm-trusted-firmware forks use an older version of ATF that will error with "LOAD segment with RWX permissions". Similar patches are present in boot/arm-trusted-firmware/ for older ATF versions.

Quoted 11 lines
---
 ...dd-support-for-new-binutils-versions.patch | 61 +++++++++++++++++++
 configs/freescale_imx8mmevk_defconfig         |  1 +
 configs/freescale_imx8mnevk_defconfig         |  1 +
 configs/freescale_imx8mpevk_defconfig         |  1 +
 configs/freescale_imx8mqevk_defconfig         |  1 +
 configs/freescale_imx8qmmek_defconfig         |  1 +
 configs/freescale_imx8qxpmek_defconfig        |  1 +
 configs/ls1028ardb_defconfig                  |  3 +
 8 files changed, 70 insertions(+)
 create mode 100644 board/freescale/common/patches/arm-trusted-firmware/0001-feat-build-add-support-for-new-binutils-versions.patch

Applied to master after references to the Gitlab CI failures that are fixed by this change. If you have the boards at hand, it would be even nicer to upgrade to newer BSP component versions. Perhaps this is something that Maeva, Stephane or Gilles can help with?

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#10 lore raw

Hi Thomas,

Quoted 30 lines

-----Original Message-----
From: Thomas Petazzoni <[email protected]>
Sent: Saturday, September 30, 2023 10:20 AM
To: Brandon Maier via buildroot <[email protected]>
Cc: Maier, Brandon L Collins <[email protected]>; Fabio Estevam <[email protected]>; Gilles Talis <[email protected]>; Stephane Viau <[email protected]>; Maeva Manuel <[email protected]>
Subject: [External] Re: [Buildroot] [PATCH 1/4] board/freescale: fix arm- trusted-firmware for binutils 2.39+

Quoted 5 lines · On Thu, 21 Sep 2023 21:56:30 +0000 Brandon Maier via buildroot…

The NXP arm-trusted-firmware forks use an older version of ATF that will error with "LOAD segment with RWX permissions". Similar patches are present in boot/arm-trusted-firmware/ for older ATF versions.

Quoted 11 lines
---
 ...dd-support-for-new-binutils-versions.patch | 61 +++++++++++++++++++
 configs/freescale_imx8mmevk_defconfig         |  1 +
 configs/freescale_imx8mnevk_defconfig         |  1 +
 configs/freescale_imx8mpevk_defconfig         |  1 +
 configs/freescale_imx8mqevk_defconfig         |  1 +
 configs/freescale_imx8qmmek_defconfig         |  1 +
 configs/freescale_imx8qxpmek_defconfig        |  1 +
 configs/ls1028ardb_defconfig                  |  3 +
 8 files changed, 70 insertions(+)
 create mode 100644 board/freescale/common/patches/arm-trusted-
Quoted 6 lines

firmware/0001-feat-build-add-support-for-new-binutils-versions.patch

Applied to master after references to the Gitlab CI failures that are fixed by this change. If you have the boards at hand, it would be even nicer to upgrade to newer BSP component versions. Perhaps this is something that Maeva, Stephane or Gilles can help with?

Romain said he updated one of the i.MX boards as well. I would like to update the others, as I'm using latest lf-6.1.22-2.0.0 for our own boards. But I do not own any of those other boards to boot test, I could send out a patch to update the versions and verify they build at least.

Quoted 10 lines

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://urldefense.com/v3/__https://bootlin.com__;!!MvWE!CEcPUERRV2wb
6IOiaXKEBuPqtpbxfJ7WlCyGhnSVJpmVsxQ-
BplmLtE6chgxY5ptrX1qJdKVaeR_cTbbMBQdNQ0nkDOmn90$

Thanks,
Brandon
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#11 lore raw
Quoted 10 lines · Brandon L Collins
Quoted 4 lines

Applied to master after references to the Gitlab CI failures that are fixed by this change. If you have the boards at hand, it would be even nicer to upgrade to newer BSP component versions. Perhaps this is something that Maeva, Stephane or Gilles can help with?

Romain said he updated one of the i.MX boards as well. I would like to update the others, as I'm using latest lf-6.1.22-2.0.0 for our own boards. But I do not own any of those other boards to boot test, I could send out a patch to update the versions and verify they build at least.

Several persons from NXP are in Cc of this e-mail, so hopefully they can help with the testing on those platforms.

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#12 lore raw
In reply to Brandon Maier via buildroot
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Brandon" == Brandon Maier via buildroot <[email protected]> writes:

The NXP arm-trusted-firmware forks use an older version of ATF that will error with "LOAD segment with RWX permissions". Similar patches are present in boot/arm-trusted-firmware/ for older ATF versions.

Committed to 2023.08.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot