Skip to contentSkip to conversation

arm-bsp/juno: use virtual/bootloader for u-boot/edk2

PATCH Applied Jon Mason 2 participants 5 messages Apr 22, 2022 – Apr 27, 2022

lore
Share & tools
lore

Jon Mason

author
#0 lore raw

PATCH 1/3 arm-bsp/juno: use virtual/bootloader for u-boot/edk2

To setup juno to use either u-boot or edk2 in CI, abstract out the relevant parts and setup the parts to allow for it to be done dynamically.

---
 meta-arm-bsp/conf/machine/juno.conf                            | 3 ++-
 .../recipes-bsp/trusted-firmware-a/trusted-firmware-a-juno.inc | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
meta-arm-bsp/conf/machine/juno.conf +2 -1
index 2da6ba6..fbff800 100644
@@ -19,8 +19,9 @@ SERIAL_CONSOLES = "115200;ttyAMA0"
 
 PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
 PREFERRED_VERSION_u-boot ?= "2020.07"
+PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot"
 
-EXTRA_IMAGEDEPENDS += "trusted-firmware-a edk2-firmware u-boot firmware-image-juno"
+EXTRA_IMAGEDEPENDS += "trusted-firmware-a virtual/bootloader firmware-image-juno"
 
 # Juno u-boot configuration
 UBOOT_MACHINE = "vexpress_aemv8a_juno_defconfig"
meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a-juno.inc +1 -1
index c7293c0..3ddd8cb 100644
@@ -4,7 +4,7 @@ COMPATIBLE_MACHINE = "juno"
 TFA_PLATFORM = "juno"
 TFA_DEBUG = "1"
 TFA_MBEDTLS = "1"
-TFA_UBOOT = "1"
+TFA_UBOOT ?= "1"
 TFA_BUILD_TARGET = "bl1 bl2 bl31 dtbs fip"
 
 # Juno needs the System Control Processor Firmware
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 2/3 arm/edk2-firmware: add PROVIDES virtual/bootloader

To prevent a collision with u-boot, add the same PROVIDES from it. The PROVIDES name need improvement, but this will work in the interim.

This causes a need for making TF-A more flexible. Add the ability to reference the UEFI binary for the BL33 portion of the TF-A build command. SGI575 is already doing this. So, it is really just making it more generic for others to use.

---
 .../trusted-firmware-a/trusted-firmware-a-sgi575.inc |  5 +----
 .../trusted-firmware-a/trusted-firmware-a.inc        | 12 ++++++++++--
 meta-arm/recipes-bsp/uefi/edk2-firmware.inc          |  3 ++-
 meta-arm/recipes-bsp/uefi/sbsa-acs_3.1.bb            |  1 +
 4 files changed, 14 insertions(+), 7 deletions(-)
meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a-sgi575.inc +1 -4
index 5786ce0..c0f5889 100644
@@ -7,11 +7,8 @@ TFA_INSTALL_TARGET = "bl1 fip"
 TFA_DEBUG          = "1"
 TFA_MBEDTLS        = "1"
 TFA_UBOOT          = "0"
+TFA_UEFI           = "1"
 
-# Sgi575 needs the UEFI as bl33
-DEPENDS += "edk2-firmware"
-
-EXTRA_OEMAKE += "BL33=${RECIPE_SYSROOT}/firmware/uefi.bin"
 EXTRA_OEMAKE += "TRUSTED_BOARD_BOOT=1 GENERATE_COT=1 ARM_ROTPK_LOCATION=devel_rsa \
                      ROT_KEY=plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem"
 EXTRA_OEMAKE += "CFLAGS=-mbranch-protection=none"
meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a.inc +10 -2
index b1a7522..9f588a7 100644
@@ -58,7 +58,11 @@ SRCREV_FORMAT:append = "${@bb.utils.contains('TFA_MBEDTLS', '1', '_mbedtls', '',
 
 # U-boot support (set TFA_UBOOT to 1 to activate)
 # When U-Boot support is activated BL33 is activated with u-boot.bin file
-TFA_UBOOT ?= "0"
+TFA_UBOOT ??= "0"
+
+# UEFI support (set TFA_UEFI to 1 to activate)
+# When UEFI support is activated BL33 is activated with uefi.bin file
+TFA_UEFI ??= "0"
 
 # What to build
 # By default we only build bl1, do_deploy will copy
@@ -125,7 +129,11 @@ EXTRA_OEMAKE += "${@bb.utils.contains('TFA_MBEDTLS', '1', 'MBEDTLS_DIR=${TFA_MBE
 # Uboot support
 DEPENDS += " ${@bb.utils.contains('TFA_UBOOT', '1', 'u-boot', '', d)}"
 do_compile[depends] += " ${@bb.utils.contains('TFA_UBOOT', '1', 'u-boot:do_deploy', '', d)}"
-EXTRA_OEMAKE += "${@bb.utils.contains('TFA_UBOOT', '1', 'BL33=${DEPLOY_DIR_IMAGE}/u-boot.bin', '',d)}"
+EXTRA_OEMAKE += "${@bb.utils.contains('TFA_UBOOT', '1', 'BL33=${DEPLOY_DIR_IMAGE}/u-boot.bin', '', d)}"
+
+# UEFI support
+DEPENDS += " ${@bb.utils.contains('TFA_UEFI', '1', 'edk2-firmware', '', d)}"
+EXTRA_OEMAKE += "${@bb.utils.contains('TFA_UEFI', '1', 'BL33=${RECIPE_SYSROOT}/firmware/uefi.bin', '', d)}"
 
 # Hafnium support
 SEL2_SPMC = "${@'${TFA_SPMD_SPM_AT_SEL2}' if d.getVar('TFA_SPD', True) == 'spmd' else ''}"
meta-arm/recipes-bsp/uefi/edk2-firmware.inc +2 -1
index a653d29..540eb00 100644
@@ -1,9 +1,10 @@
 SUMMARY = "UEFI EDK2 Firmware"
 DESCRIPTION = "UEFI EDK2 Firmware for Arm reference platforms"
 HOMEPAGE = "https://github.com/tianocore/edk2"
-
 LICENSE = "BSD-2-Clause-Patent"
 
+PROVIDES = "virtual/bootloader"
+
 # EDK2
 LIC_FILES_CHKSUM = "file://License.txt;md5=2b415520383f7964e96700ae12b4570a"
 # EDK2 Platforms
meta-arm/recipes-bsp/uefi/sbsa-acs_3.1.bb +1 -0
index 83852d0..5eb6767 100644
@@ -1,4 +1,5 @@
 require recipes-bsp/uefi/edk2-firmware_202202.bb
+PROVIDES:remove = "virtual/bootloader"
 
 LICENSE += "& Apache-2.0"
 LIC_FILES_CHKSUM += "file://ShellPkg/Application/sbsa-acs/LICENSE.md;md5=2a944942e1496af1886903d274dedb13"
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH 3/3 CI: add testing for edk2

In reply to Jon Mason

For platforms that can do both u-boot and edk2, add a yml to switch from u-boot to edk2.

---
 .gitlab-ci.yml | 1 +
 ci/edk2.yml    | 9 +++++++++
 2 files changed, 10 insertions(+)
 create mode 100644 ci/edk2.yml
.gitlab-ci.yml +1 -0
index bd1ae59..276cb26 100644
@@ -129,6 +129,7 @@ juno:
   parallel:
     matrix:
       - TOOLCHAINS: [gcc, clang]
+        FIRMWARE: [none, edk2]
 
 microbit-v1:
   extends: .build_and_test
ci/edk2.yml new file +9 -0
new file mode 100644
index 0000000..77eaee8
@@ -0,0 +1,9 @@
+header:
+  version: 11
+
+local_conf_header:
+  bootfirmware: |
+    PREFERRED_PROVIDER_virtual/bootloader = "edk2-firmware"
+    MACHINE_FEATURES += "efi"
+    TFA_UBOOT = "0"
+    TFA_UEFI = "1"
Signature · 1 line
2.17.1
Applied
#3 lore raw
In reply to Jon Mason
Quoted 3 lines · Jon Mason

To setup juno to use either u-boot or edk2 in CI, abstract out the relevant parts and setup the parts to allow for it to be done dynamically.

Applied, thanks!

[1/3] arm-bsp/juno: use virtual/bootloader for u-boot/edk2

      commit: 2b6e3fc1d160566d31e1dad4630da0b8ce5686ed
[2/3] arm/edk2-firmware: add PROVIDES virtual/bootloader
      commit: b37441921d732a707181619f6dfc40f602a77081
[3/3] CI: add testing for edk2
      commit: 9f0c90506661b34d5546f5f9ae9a43f07ed78ee9

Best regards,

Signature · 1 line
Jon Mason <[email protected]>
Applied
#4 lore raw
In reply to Jon Mason
Quoted 3 lines · Jon Mason

To setup juno to use either u-boot or edk2 in CI, abstract out the relevant parts and setup the parts to allow for it to be done dynamically.

Applied, thanks!

[1/3] arm-bsp/juno: use virtual/bootloader for u-boot/edk2

      commit: 2b6e3fc1d160566d31e1dad4630da0b8ce5686ed
[2/3] arm/edk2-firmware: add PROVIDES virtual/bootloader
      commit: b37441921d732a707181619f6dfc40f602a77081
[3/3] CI: add testing for edk2
      commit: 9f0c90506661b34d5546f5f9ae9a43f07ed78ee9

Best regards,

Signature · 1 line
Jon Mason <[email protected]>