diff mbox series

[v2] boot/arm-trusted-firmware: Barebox available as BL33

Message ID 20230119185041.3430421-1-casey@xogium.me
State Accepted
Headers show
Series [v2] boot/arm-trusted-firmware: Barebox available as BL33 | expand

Commit Message

Casey Reeves Jan. 19, 2023, 6:50 p.m. UTC
Since version 2022.04.0, Barebox now support a generic image built for
platforms, to be used as BL33 to generate FIP images. This patch makes
it available as choice of BL33 to be used with ATF and is based on the
similar work put into U-Boot as BL33.

Signed-off-by: Casey Reeves <casey@xogium.me>

---
Changes v1 -> v2:
- fixed quoting issue in the default image name
---
 boot/arm-trusted-firmware/Config.in           | 21 +++++++++++++++++++
 .../arm-trusted-firmware.mk                   |  6 ++++++
 2 files changed, 27 insertions(+)

Comments

Vincent Fazio Feb. 6, 2023, 1:36 p.m. UTC | #1
Casey,

> -----Original Message-----
> From: buildroot <buildroot-bounces@buildroot.org> On Behalf Of Casey
> Reeves
> Sent: Thursday, January 19, 2023 12:51 PM
> To: buildroot@buildroot.org
> Cc: Sergey Matyukevich <geomatsi@gmail.com>
> Subject: [External] - [Buildroot] [PATCH v2] boot/arm-trusted-firmware:
> Barebox available as BL33
> 
> Since version 2022.04.0, Barebox now support a generic image built for
> platforms, to be used as BL33 to generate FIP images. This patch makes it
> available as choice of BL33 to be used with ATF and is based on the similar
> work put into U-Boot as BL33.
> 
> Signed-off-by: Casey Reeves <casey@xogium.me>
> 
> ---
> Changes v1 -> v2:
> - fixed quoting issue in the default image name
> ---
>  boot/arm-trusted-firmware/Config.in           | 21 +++++++++++++++++++
>  .../arm-trusted-firmware.mk                   |  6 ++++++
>  2 files changed, 27 insertions(+)
> 
> diff --git a/boot/arm-trusted-firmware/Config.in b/boot/arm-trusted-
> firmware/Config.in
> index a9b9bbcc5a..cb54c6c9d8 100644
> --- a/boot/arm-trusted-firmware/Config.in
> +++ b/boot/arm-trusted-firmware/Config.in
> @@ -129,6 +129,27 @@ config
> BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE
> 
>  endchoice
> 
> +config BR2_TARGET_ARM_TRUSTED_FIRMWARE_BAREBOX_AS_BL33
> +       bool "Use Barebox as BL33"
> +       depends on BR2_TARGET_BAREBOX

Does TFA allow multiple BL33 images to be defined? I don't see a guard if some other package such as U-Boot or EDK2 has been enabled as well. 
If only one image is supported but multiple images are supplied via BL33 on the make command line, is it last declared wins?

> +       help
> +         This option allows to embed the Barebox generic BL33 image in
> +         the ARM Trusted Firmware. It ensures that the Barebox package
> +         gets built before ATF, and that the appropriate BL33
> +         variable pointing to the generic bl33 image is passed
> +         when building ATF.
> +
> +if BR2_TARGET_ARM_TRUSTED_FIRMWARE_BAREBOX_AS_BL33
> +
> +config BR2_TARGET_ARM_TRUSTED_FIRMWARE_BAREBOX_BL33_IMAGE
> +       string "Barebox BL33 image name"
> +       default "*-generic-bl33.img"
> +       help
> +         Name of the Barebox BL33 image to include in ATF, it must
> +         have been installed to BINARIES_DIR by the Barebox package.
> +
> +endif
> +
>  config BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33
>         bool "Use U-Boot as BL33"
>         depends on BR2_TARGET_UBOOT
> diff --git a/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> index 1164c81410..648f62ed85 100644
> --- a/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> +++ b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
> @@ -105,6 +105,12 @@ ARM_TRUSTED_FIRMWARE_MAKE_OPTS +=
> AARCH32_SP=optee  endif  endif #
> BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE
> 
> +ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_BAREBOX_AS_BL33),y)
> +ARM_TRUSTED_FIRMWARE_BAREBOX_BIN = $(call
> +qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_BAREBOX_BL33_IMAGE
> ))
> +ARM_TRUSTED_FIRMWARE_MAKE_OPTS +=
> +BL33=$(BINARIES_DIR)/$(ARM_TRUSTED_FIRMWARE_BAREBOX_BIN)
> +ARM_TRUSTED_FIRMWARE_DEPENDENCIES += barebox endif
> +
>  ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33),y)
>  ARM_TRUSTED_FIRMWARE_DEPENDENCIES += edk2  # Since the flash
> device name vary between platforms, we use the variable
> --
> 2.39.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
> CAUTION: This email originated from outside of the organization. Do not click
> links or open attachments unless you recognize the sender and know the
> content is safe.
Thomas Petazzoni Feb. 21, 2023, 9:48 p.m. UTC | #2
On Thu, 19 Jan 2023 19:50:40 +0100
Casey Reeves <casey@xogium.me> wrote:

> Since version 2022.04.0, Barebox now support a generic image built for
> platforms, to be used as BL33 to generate FIP images. This patch makes
> it available as choice of BL33 to be used with ATF and is based on the
> similar work put into U-Boot as BL33.
> 
> Signed-off-by: Casey Reeves <casey@xogium.me>
> 
> ---
> Changes v1 -> v2:
> - fixed quoting issue in the default image name
> ---
>  boot/arm-trusted-firmware/Config.in           | 21 +++++++++++++++++++
>  .../arm-trusted-firmware.mk                   |  6 ++++++
>  2 files changed, 27 insertions(+)

Applied to next, thanks.

Thomas
Thomas Petazzoni Feb. 21, 2023, 9:54 p.m. UTC | #3
Hello Vincent,

On Mon, 6 Feb 2023 13:36:09 +0000
Vincent Fazio <vfazio@xes-inc.com> wrote:

> Does TFA allow multiple BL33 images to be defined? I don't see a guard if some other package such as U-Boot or EDK2 has been enabled as well. 
> If only one image is supported but multiple images are supplied via BL33 on the make command line, is it last declared wins?

This is absolutely true, so I have submitted
https://patchwork.ozlabs.org/project/buildroot/patch/20230221214904.454053-1-thomas.petazzoni@bootlin.com/
to move to a choice..endchoice in Config.in to select the BL33. Thanks
for reporting this!

Best regards,

Thomas
diff mbox series

Patch

diff --git a/boot/arm-trusted-firmware/Config.in b/boot/arm-trusted-firmware/Config.in
index a9b9bbcc5a..cb54c6c9d8 100644
--- a/boot/arm-trusted-firmware/Config.in
+++ b/boot/arm-trusted-firmware/Config.in
@@ -129,6 +129,27 @@  config BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE
 
 endchoice
 
+config BR2_TARGET_ARM_TRUSTED_FIRMWARE_BAREBOX_AS_BL33
+	bool "Use Barebox as BL33"
+	depends on BR2_TARGET_BAREBOX
+	help
+	  This option allows to embed the Barebox generic BL33 image in
+	  the ARM Trusted Firmware. It ensures that the Barebox package
+	  gets built before ATF, and that the appropriate BL33
+	  variable pointing to the generic bl33 image is passed
+	  when building ATF.
+
+if BR2_TARGET_ARM_TRUSTED_FIRMWARE_BAREBOX_AS_BL33
+
+config BR2_TARGET_ARM_TRUSTED_FIRMWARE_BAREBOX_BL33_IMAGE
+	string "Barebox BL33 image name"
+	default "*-generic-bl33.img"
+	help
+	  Name of the Barebox BL33 image to include in ATF, it must
+	  have been installed to BINARIES_DIR by the Barebox package.
+
+endif
+
 config BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33
 	bool "Use U-Boot as BL33"
 	depends on BR2_TARGET_UBOOT
diff --git a/boot/arm-trusted-firmware/arm-trusted-firmware.mk b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
index 1164c81410..648f62ed85 100644
--- a/boot/arm-trusted-firmware/arm-trusted-firmware.mk
+++ b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
@@ -105,6 +105,12 @@  ARM_TRUSTED_FIRMWARE_MAKE_OPTS += AARCH32_SP=optee
 endif
 endif # BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE
 
+ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_BAREBOX_AS_BL33),y)
+ARM_TRUSTED_FIRMWARE_BAREBOX_BIN = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_BAREBOX_BL33_IMAGE))
+ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33=$(BINARIES_DIR)/$(ARM_TRUSTED_FIRMWARE_BAREBOX_BIN)
+ARM_TRUSTED_FIRMWARE_DEPENDENCIES += barebox
+endif
+
 ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33),y)
 ARM_TRUSTED_FIRMWARE_DEPENDENCIES += edk2
 # Since the flash device name vary between platforms, we use the variable