Skip to contentSkip to conversation

boot/arm-trusted-firmware: Update FIP image generation with BL33_CFG option

PATCH Applied Kory Maincent 2 participants 6 messages Jul 9, 2021 – Aug 31, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 boot/arm-trusted-firmware: Update FIP image generation with BL33_CFG option

Update the FIP image generation by adding the BL33_CFG parameter. This is needed for the ST version of ATF.

---
 boot/arm-trusted-firmware/Config.in               | 9 +++++++++
 boot/arm-trusted-firmware/arm-trusted-firmware.mk | 4 ++++
 2 files changed, 13 insertions(+)
boot/arm-trusted-firmware/Config.in +9 -0
index 7e46a10270..80f6161597 100644
@@ -133,6 +133,15 @@ config BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_BL33_IMAGE
 	  Name of the U-Boot BL33 image to include in ATF, it must
 	  have been installed to BINARIES_DIR by the U-Boot package.
 
+config BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_BL33_IMAGE_CFG
+	string "U-Boot BL33 image devicetree name"
+	default ""
+	help
+	  Name of the U-Boot BL33 image devicetree to include in ATF.
+	  It must have been installed to BINARIES_DIR by the U-Boot
+	  package.
+	  Needed for the stm32mp1 platform.
+
 endif
 
 config BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33
boot/arm-trusted-firmware/arm-trusted-firmware.mk +4 -0
index 1f08f5dabb..9fc8b51a80 100644
@@ -92,6 +92,10 @@ endif
 ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33),y)
 ARM_TRUSTED_FIRMWARE_UBOOT_BIN = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_BL33_IMAGE))
 ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33=$(BINARIES_DIR)/$(ARM_TRUSTED_FIRMWARE_UBOOT_BIN)
+ARM_TRUSTED_FIRMWARE_UBOOT_BIN_CFG = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_BL33_IMAGE_CFG))
+ifneq ($(ARM_TRUSTED_FIRMWARE_UBOOT_BIN_CFG),)
+ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33_CFG=$(BINARIES_DIR)/$(ARM_TRUSTED_FIRMWARE_UBOOT_BIN_CFG)
+endif
 ARM_TRUSTED_FIRMWARE_DEPENDENCIES += uboot
 endif
 
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 boot/arm-trusted-firmware: Add out-of-source ATF device tree support

Similarly to Uboot, this patch adds the ability to copy in and build out-of-source device tree sources during an ATF build.

---
 boot/arm-trusted-firmware/Config.in               | 9 +++++++++
 boot/arm-trusted-firmware/arm-trusted-firmware.mk | 5 +++++
 2 files changed, 14 insertions(+)
boot/arm-trusted-firmware/Config.in +9 -0
index 80f6161597..7bd289137b 100644
@@ -68,6 +68,15 @@ config BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM
 	help
 	  Target plaform to build for.
 
+config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_DTS_PATH
+	string "Device Tree Source file paths"
+	help
+	  Space-separated list of paths to device tree source files
+	  that will be copied to fdts/ before starting the build.
+
+	  To use this device tree source file, the ATF configuration
+	  file must refer to it.
+
 config BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP
 	bool "Build FIP image"
 	help
boot/arm-trusted-firmware/arm-trusted-firmware.mk +5 -0
index 9fc8b51a80..e902c1aca9 100644
@@ -166,7 +166,12 @@ endif
 ARM_TRUSTED_FIRMWARE_MAKE_TARGETS += \
 	$(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_TARGETS))
 
+ARM_TRUSTED_FIRMWARE_CUSTOM_DTS_PATH = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_DTS_PATH))
+
 define ARM_TRUSTED_FIRMWARE_BUILD_CMDS
+	$(if $(ARM_TRUSTED_FIRMWARE_CUSTOM_DTS_PATH),
+		cp -f $(ARM_TRUSTED_FIRMWARE_CUSTOM_DTS_PATH) $(@D)/fdts/
+	)
 	$(ARM_TRUSTED_FIRMWARE_BUILD_FIPTOOL)
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(ARM_TRUSTED_FIRMWARE_MAKE_OPTS) \
 		$(ARM_TRUSTED_FIRMWARE_MAKE_TARGETS)
Signature · 1 line
2.25.1
#2 lore raw

Re: [Buildroot] [PATCH 2/2] boot/arm-trusted-firmware: Add out-of-source ATF device tree support

Quoted 8 lines · On Fri, 9 Jul 2021 11:49:25 +0200 Kory Maincent <[email protected]>…

Similarly to Uboot, this patch adds the ability to copy in and build out-of-source device tree sources during an ATF build.

---
 boot/arm-trusted-firmware/Config.in               | 9 +++++++++
 boot/arm-trusted-firmware/arm-trusted-firmware.mk | 5 +++++
 2 files changed, 14 insertions(+)

Applied to next, thanks.

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
#3 lore raw
In reply to Kory Maincent

Hello,

I am just following up with these two patches, to make sure you did not forget or miss it. Thanks.

Regards,

Quoted 36 lines · On Fri, 9 Jul 2021 11:49:24 +0200 Kory Maincent <[email protected]>…

Update the FIP image generation by adding the BL33_CFG parameter. This is needed for the ST version of ATF.

---
 boot/arm-trusted-firmware/Config.in               | 9 +++++++++
 boot/arm-trusted-firmware/arm-trusted-firmware.mk | 4 ++++
 2 files changed, 13 insertions(+)
(quoted diff) +0 -0

b/boot/arm-trusted-firmware/Config.in index 7e46a10270..80f6161597 100644

boot/arm-trusted-firmware/Config.in +9 -0
@@ -133,6 +133,15 @@ config BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_BL33_IMAGE
 	  Name of the U-Boot BL33 image to include in ATF, it must
 	  have been installed to BINARIES_DIR by the U-Boot package.
 
+config BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_BL33_IMAGE_CFG
+	string "U-Boot BL33 image devicetree name"
+	default ""
+	help
+	  Name of the U-Boot BL33 image devicetree to include in ATF.
+	  It must have been installed to BINARIES_DIR by the U-Boot
+	  package.
+	  Needed for the stm32mp1 platform.
+
 endif
 
 config BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33
(quoted diff) +0 -0

b/boot/arm-trusted-firmware/arm-trusted-firmware.mk index 1f08f5dabb..9fc8b51a80 100644 --- a/boot/arm-trusted-firmware/arm-trusted-firmware.mk +++ b/boot/arm-trusted-firmware/arm-trusted-firmware.mk @@ -92,6 +92,10 @@ endif
ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33),y) ARM_TRUSTED_FIRMWARE_UBOOT_BIN = $(call

Quoted 8 lines

qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_BL33_IMAGE)) ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33=$(BINARIES_DIR)/$(ARM_TRUSTED_FIRMWARE_UBOOT_BIN) +ARM_TRUSTED_FIRMWARE_UBOOT_BIN_CFG = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_BL33_IMAGE_CFG)) +ifneq ($(ARM_TRUSTED_FIRMWARE_UBOOT_BIN_CFG),) +ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33_CFG=$(BINARIES_DIR)/$(ARM_TRUSTED_FIRMWARE_UBOOT_BIN_CFG) +endif ARM_TRUSTED_FIRMWARE_DEPENDENCIES += uboot endif

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

#4 lore raw
In reply to Kory Maincent

Hello Köry,

Quoted 34 lines · On Fri, 9 Jul 2021 11:49:24 +0200 Kory Maincent <[email protected]>…

Update the FIP image generation by adding the BL33_CFG parameter. This is needed for the ST version of ATF.

---
 boot/arm-trusted-firmware/Config.in               | 9 +++++++++
 boot/arm-trusted-firmware/arm-trusted-firmware.mk | 4 ++++
 2 files changed, 13 insertions(+)
boot/arm-trusted-firmware/Config.in +9 -0
index 7e46a10270..80f6161597 100644
@@ -133,6 +133,15 @@ config BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_BL33_IMAGE
 	  Name of the U-Boot BL33 image to include in ATF, it must
 	  have been installed to BINARIES_DIR by the U-Boot package.
 
+config BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_BL33_IMAGE_CFG
+	string "U-Boot BL33 image devicetree name"
+	default ""
+	help
+	  Name of the U-Boot BL33 image devicetree to include in ATF.
+	  It must have been installed to BINARIES_DIR by the U-Boot
+	  package.
+	  Needed for the stm32mp1 platform.
+
 endif
 
 config BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33
boot/arm-trusted-firmware/arm-trusted-firmware.mk +0 -0
index 1f08f5dabb..9fc8b51a80 100644

boot/arm-trusted-firmware/arm-trusted-firmware.mk endif · line 98

Quoted 7 lines
boot/arm-trusted-firmware/arm-trusted-firmware.mk +4 -0
@@ -92,6 +92,10 @@ endif
 ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33),y)
 ARM_TRUSTED_FIRMWARE_UBOOT_BIN = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_BL33_IMAGE))
 ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33=$(BINARIES_DIR)/$(ARM_TRUSTED_FIRMWARE_UBOOT_BIN)
+ARM_TRUSTED_FIRMWARE_UBOOT_BIN_CFG = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_BL33_IMAGE_CFG))
+ifneq ($(ARM_TRUSTED_FIRMWARE_UBOOT_BIN_CFG),)
+ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33_CFG=$(BINARIES_DIR)/$(ARM_TRUSTED_FIRMWARE_UBOOT_BIN_CFG)
+endif

What I don't like about this is that (for now) this BL33_CFG variable is specific to the ST fork of TF-A. If we start adding support for all the random variables that vendor-specific forks create, it's soon going to be a nightmare.

Instead of this, could you try to add something like:

BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES="BL33_CFG=$(BINARIES_DIR)/your-dtb.dtb"

and see if that works ?

Best regards,

Thomas

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

Hello Thomas,

Quoted 4 lines · On Thu, 19 Aug 2021 23:26:30 +0200 Thomas Petazzoni…

What I don't like about this is that (for now) this BL33_CFG variable is specific to the ST fork of TF-A. If we start adding support for all the random variables that vendor-specific forks create, it's soon going to be a nightmare.

Ok, that's fair.

Quoted 6 lines

Instead of this, could you try to add something like:

BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES="BL33_CFG=$(BINARIES_DIR)/your-dtb.dtb"

and see if that works ?

It works. Thanks.

Regards,
Köry
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot