Skip to contentSkip to conversation

bsp: fix upstream TF-A deploy desync

PATCH Applied Quentin Schulz 3 participants 6 messages Jan 21 – Feb 10 Arm Rockchip

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bsp: fix upstream TF-A deploy desync

From: Quentin Schulz <[email protected]>

Since commit 7bce36a2c64b ("arm/trusted-firmware-a: Use firmware.bbclass") in meta-arm, the BL31 firmware is deployed in a subdirectory named trusted-firmware-a and the binary is simply called bl31.elf without any other string.

This differs from what it used to be by the use of the subdirectory and the name of the file itself. This is an issue for us because the U-Boot recipe is given the path to the BL31 binary in deploy directory and that now was wrong.

The second issue is that we want rockchip-rkbin-tf-a to be a drop-in replacement for the upstream recipe and have nothing to change in other recipes dependent on *an* implementation of TF-A (such as the U-Boot recipe).

We can either fixup the path like was done in 2a13a49da4af ("fix u-boot for tf-a firmware") but we'll need to do that for all current and future SoCs (and also wasn't a complete fix as for example px30 didn't have the fixup applied). Or we can simply adapt the rockchip-rkbin-tf-a recipe to deploy the same way that the upstream trusted-firmware-a recipe does by installing in a trusted-firmware-a subdirectory, simply name the binary bl31.elf and update the BL31 environment variable in the U-Boot recipe to use the new path.

Because RKBIN_DEPLOY_FILENAME now contains a directory in it, we need to make sure the directory is created (with install -D).

This was tested with upstream+downstream TF-A for RK3588, upstream TF-A for RK3399 and PX30.

---
This is a follow-up to
https://lore.kernel.org/yocto-meta-arm/[email protected]/T/#m76f7d4b56849cc28fe80a76953f4e6e61ff0f7cc
and
https://lore.kernel.org/yocto-patches/[email protected]/

---
 recipes-bsp/rkbin/rk3308-rkbin_git.bb                        |  2 +-
 recipes-bsp/rkbin/rockchip-rkbin-tf-a_git.bb                 |  9 +++++----
 recipes-bsp/rkbin/rockchip-rkbin.inc                         |  2 +-
 recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend | 11 -----------
 recipes-bsp/u-boot/u-boot-rockchip.inc                       |  4 +---
 5 files changed, 8 insertions(+), 20 deletions(-)
recipes-bsp/rkbin/rk3308-rkbin_git.bb +1 -1
index ab2c70f..0661fc4 100644
@@ -28,7 +28,7 @@ ALLOW_EMPTY:${PN} = "1"
 
 do_deploy:rk3308() {
 	# Prebuilt TF-A
-	install -m 644 ${S}/bin/rk33/rk3308_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3308.elf
+	install -m 644 ${S}/bin/rk33/rk3308_bl31_v*.elf ${DEPLOYDIR}/trusted-firmware-a/bl31.elf
 	# Prebuilt OPTEE-OS
 	install -m 644 ${S}/bin/rk33/rk3308_bl32_v*.bin ${DEPLOYDIR}/tee-rk3308.bin
 	# Prebuilt U-Boot TPL (DDR init)
recipes-bsp/rkbin/rockchip-rkbin-tf-a_git.bb +5 -4
index f51d9e9..ece5faa 100644
@@ -4,21 +4,22 @@ require rockchip-rkbin.inc
 
 PROVIDES += "trusted-firmware-a"
 
+# Must match the naming and path used in
+# meta-arm/recipes-bsp/trusted-firmware-a/ trusted-firmware-a recipes (see also
+# do_deploy() in meta-arm/classes-recipes/firmware.bbclass)
+RKBIN_DEPLOY_FILENAME = "trusted-firmware-a/bl31.elf"
+
 RKBIN_BINVERS:rk3308 ?= "v2.26"
 RKBIN_BINFILE:rk3308 ?= "rk3308_bl31_${RKBIN_BINVERS}.elf"
-RKBIN_DEPLOY_FILENAME:rk3308 ?= "bl31-rk3308.elf"
 
 RKBIN_BINVERS_RK356x ?= "v1.44"
 RKBIN_BINVERS:rk3566 ?= "${RKBIN_BINVERS_RK356x}"
 # NOTE: the following are not typos
 #       the rk3566 uses the same bl31 as the rk3568
 RKBIN_BINFILE:rk3566 ?= "rk3568_bl31_${RKBIN_BINVERS}.elf"
-RKBIN_DEPLOY_FILENAME:rk3566 ?= "bl31-rk3566.elf"
 
 RKBIN_BINVERS:rk3568 ?= "${RKBIN_BINVERS_RK356x}"
 RKBIN_BINFILE:rk3568 ?= "rk3568_bl31_${RKBIN_BINVERS}.elf"
-RKBIN_DEPLOY_FILENAME:rk3568 ?= "bl31-rk3568.elf"
 
 RKBIN_BINVERS:rk3588s ?= "v1.48"
 RKBIN_BINFILE:rk3588s ?= "rk3588_bl31_${RKBIN_BINVERS}.elf"
-RKBIN_DEPLOY_FILENAME:rk3588s ?= "bl31-rk3588.elf"
recipes-bsp/rkbin/rockchip-rkbin.inc +1 -1
index 25ec58c..9ddd54f 100644
@@ -41,7 +41,7 @@ do_deploy() {
 		bbfatal "Non-empty RKBIN_DEPLOY_FILENAME:<MACHINE> required!"
 	fi
 
-	install -m 644 ${S}/${RKBIN_BINDIR}${RKBIN_BINFILE} ${DEPLOYDIR}/${RKBIN_DEPLOY_FILENAME}
+	install -D -m 644 ${S}/${RKBIN_BINDIR}${RKBIN_BINFILE} ${DEPLOYDIR}/${RKBIN_DEPLOY_FILENAME}
 }
 
 addtask deploy after do_install
recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend +0 -11
index 7c94b64..4c7fc3c 100644
@@ -47,14 +47,3 @@ fixup_baudrate:rk3588s() {
 # If you use upstream U-Boot with SPL_ATF_NO_PLATFORM_PARAM disabled, you can
 # simply override this function to do nothing.
 do_patch[postfuncs] += "fixup_baudrate"
-
-do_deploy() {
-    :
-}
-do_deploy:rk3328() {
-    cp -rf ${D}/firmware/trusted-firmware-a/bl31.elf ${DEPLOYDIR}/bl31-rk3328.elf
-}
-do_deploy:rk3399() {
-    cp -rf ${D}/firmware/trusted-firmware-a/bl31.elf ${DEPLOYDIR}/bl31-rk3399.elf
-}
-addtask deploy after do_install
recipes-bsp/u-boot/u-boot-rockchip.inc +1 -3
index 2b5bbd7..69aaf03 100644
@@ -1,6 +1,4 @@
-BL31:rockchip:aarch64 = "${DEPLOY_DIR_IMAGE}/bl31-${SOC_FAMILY}.elf"
-# SOC_FAMILY for RK3588S is rk3588s but it should use the binaries from rk3588
-BL31:rk3588s = "${DEPLOY_DIR_IMAGE}/bl31-rk3588.elf"
+BL31:rockchip:aarch64 = "${DEPLOY_DIR_IMAGE}/trusted-firmware-a/bl31.elf"
 EXTRA_OEMAKE:append:rockchip:aarch64 = " BL31=${BL31}"
 
 TFA_DEPENDS ??= ""

---
base-commit: 2a13a49da4af4487ee71db6aff19364220da694a
change-id: 20260112-tf-a-fix-cd7944bd8441

Best regards,

Signature · 1 line
Quentin Schulz <[email protected]>
#1 lore raw

Hi Trevor,

Quoted 32 lines · Quentin Schulz

From: Quentin Schulz <[email protected]>

Since commit 7bce36a2c64b ("arm/trusted-firmware-a: Use firmware.bbclass") in meta-arm, the BL31 firmware is deployed in a subdirectory named trusted-firmware-a and the binary is simply called bl31.elf without any other string.

This differs from what it used to be by the use of the subdirectory and the name of the file itself. This is an issue for us because the U-Boot recipe is given the path to the BL31 binary in deploy directory and that now was wrong.

The second issue is that we want rockchip-rkbin-tf-a to be a drop-in replacement for the upstream recipe and have nothing to change in other recipes dependent on *an* implementation of TF-A (such as the U-Boot recipe).

We can either fixup the path like was done in 2a13a49da4af ("fix u-boot for tf-a firmware") but we'll need to do that for all current and future SoCs (and also wasn't a complete fix as for example px30 didn't have the fixup applied). Or we can simply adapt the rockchip-rkbin-tf-a recipe to deploy the same way that the upstream trusted-firmware-a recipe does by installing in a trusted-firmware-a subdirectory, simply name the binary bl31.elf and update the BL31 environment variable in the U-Boot recipe to use the new path.

Because RKBIN_DEPLOY_FILENAME now contains a directory in it, we need to make sure the directory is created (with install -D).

This was tested with upstream+downstream TF-A for RK3588, upstream TF-A for RK3399 and PX30.

Quoted 6 lines

---
This is a follow-up to
https://lore.kernel.org/yocto-meta-arm/[email protected]/T/#m76f7d4b56849cc28fe80a76953f4e6e61ff0f7cc
and
https://lore.kernel.org/yocto-patches/[email protected]/

Forgot to say, but I think you want to branch off a whinlatter branch *before* this patch as the meta-arm commit that broke us is only in master and not whinlatter.

Cheers,
Quentin

#2 lore raw
Quoted 42 lines · Quentin Schulz

Hi Trevor,

Quoted 32 lines · Quentin Schulz

From: Quentin Schulz <[email protected]>

Since commit 7bce36a2c64b ("arm/trusted-firmware-a: Use firmware.bbclass") in meta-arm, the BL31 firmware is deployed in a subdirectory named trusted-firmware-a and the binary is simply called bl31.elf without any other string.

This differs from what it used to be by the use of the subdirectory and the name of the file itself. This is an issue for us because the U-Boot recipe is given the path to the BL31 binary in deploy directory and that now was wrong.

The second issue is that we want rockchip-rkbin-tf-a to be a drop-in replacement for the upstream recipe and have nothing to change in other recipes dependent on *an* implementation of TF-A (such as the U-Boot recipe).

We can either fixup the path like was done in 2a13a49da4af ("fix u-boot for tf-a firmware") but we'll need to do that for all current and future SoCs (and also wasn't a complete fix as for example px30 didn't have the fixup applied). Or we can simply adapt the rockchip-rkbin-tf-a recipe to deploy the same way that the upstream trusted-firmware-a recipe does by installing in a trusted-firmware-a subdirectory, simply name the binary bl31.elf and update the BL31 environment variable in the U-Boot recipe to use the new path.

Because RKBIN_DEPLOY_FILENAME now contains a directory in it, we need to make sure the directory is created (with install -D).

This was tested with upstream+downstream TF-A for RK3588, upstream TF-A for RK3399 and PX30.

Quoted 6 lines

---
This is a follow-up to
https://lore.kernel.org/yocto-meta-arm/[email protected]/T/#m76f7d4b56849cc28fe80a76953f4e6e61ff0f7cc
and
https://lore.kernel.org/yocto-patches/[email protected]/

Quoted 3 lines

Forgot to say, but I think you want to branch off a whinlatter branch *before* this patch as the meta-arm commit that broke us is only in master and not whinlatter.

I broke off a whinlatter branch back in June. I try to create the release branches once I'm aware of their existence in oe-core rather than trying to figure out the last possible moment before they need to be created.

#3 lore raw
In reply to Quentin Schulz

Hi Trevor,

Quoted 51 lines · Quentin Schulz

From: Quentin Schulz <[email protected]>

Since commit 7bce36a2c64b ("arm/trusted-firmware-a: Use firmware.bbclass") in meta-arm, the BL31 firmware is deployed in a subdirectory named trusted-firmware-a and the binary is simply called bl31.elf without any other string.

This differs from what it used to be by the use of the subdirectory and the name of the file itself. This is an issue for us because the U-Boot recipe is given the path to the BL31 binary in deploy directory and that now was wrong.

The second issue is that we want rockchip-rkbin-tf-a to be a drop-in replacement for the upstream recipe and have nothing to change in other recipes dependent on *an* implementation of TF-A (such as the U-Boot recipe).

We can either fixup the path like was done in 2a13a49da4af ("fix u-boot for tf-a firmware") but we'll need to do that for all current and future SoCs (and also wasn't a complete fix as for example px30 didn't have the fixup applied). Or we can simply adapt the rockchip-rkbin-tf-a recipe to deploy the same way that the upstream trusted-firmware-a recipe does by installing in a trusted-firmware-a subdirectory, simply name the binary bl31.elf and update the BL31 environment variable in the U-Boot recipe to use the new path.

Because RKBIN_DEPLOY_FILENAME now contains a directory in it, we need to make sure the directory is created (with install -D).

This was tested with upstream+downstream TF-A for RK3588, upstream TF-A for RK3399 and PX30.

---
This is a follow-up to
https://lore.kernel.org/yocto-meta-arm/[email protected]/T/#m76f7d4b56849cc28fe80a76953f4e6e61ff0f7cc
and
https://lore.kernel.org/yocto-patches/[email protected]/

---
  recipes-bsp/rkbin/rk3308-rkbin_git.bb                        |  2 +-
  recipes-bsp/rkbin/rockchip-rkbin-tf-a_git.bb                 |  9 +++++----
  recipes-bsp/rkbin/rockchip-rkbin.inc                         |  2 +-
  recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend | 11 -----------
  recipes-bsp/u-boot/u-boot-rockchip.inc                       |  4 +---
  5 files changed, 8 insertions(+), 20 deletions(-)
recipes-bsp/rkbin/rk3308-rkbin_git.bb +0 -0
index ab2c70f..0661fc4 100644

recipes-bsp/rkbin/rk3308-rkbin_git.bb ALLOW_EMPTY:${PN} = "1" · line 31

Quoted 5 lines
recipes-bsp/rkbin/rk3308-rkbin_git.bb +1 -1
@@ -28,7 +28,7 @@ ALLOW_EMPTY:${PN} = "1"
 
  do_deploy:rk3308() {
  	# Prebuilt TF-A
-	install -m 644 ${S}/bin/rk33/rk3308_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3308.elf
+	install -m 644 ${S}/bin/rk33/rk3308_bl31_v*.elf ${DEPLOYDIR}/trusted-firmware-a/bl31.elf

I believe we should add -D after install here. Do you mind doing this change when applying or should I send a v2?

Cheers,
Quentin

#4 lore raw
Quoted 49 lines · Quentin Schulz

Hi Trevor,

Quoted 46 lines · Quentin Schulz

From: Quentin Schulz <[email protected]>

Since commit 7bce36a2c64b ("arm/trusted-firmware-a: Use firmware.bbclass") in meta-arm, the BL31 firmware is deployed in a subdirectory named trusted-firmware-a and the binary is simply called bl31.elf without any other string.

This differs from what it used to be by the use of the subdirectory and the name of the file itself. This is an issue for us because the U-Boot recipe is given the path to the BL31 binary in deploy directory and that now was wrong.

The second issue is that we want rockchip-rkbin-tf-a to be a drop-in replacement for the upstream recipe and have nothing to change in other recipes dependent on *an* implementation of TF-A (such as the U-Boot recipe).

We can either fixup the path like was done in 2a13a49da4af ("fix u-boot for tf-a firmware") but we'll need to do that for all current and future SoCs (and also wasn't a complete fix as for example px30 didn't have the fixup applied). Or we can simply adapt the rockchip-rkbin-tf-a recipe to deploy the same way that the upstream trusted-firmware-a recipe does by installing in a trusted-firmware-a subdirectory, simply name the binary bl31.elf and update the BL31 environment variable in the U-Boot recipe to use the new path.

Because RKBIN_DEPLOY_FILENAME now contains a directory in it, we need to make sure the directory is created (with install -D).

This was tested with upstream+downstream TF-A for RK3588, upstream TF-A for RK3399 and PX30.

---
This is a follow-up to
https://lore.kernel.org/yocto-meta-arm/[email protected]/T/#m76f7d4b56849cc28fe80a76953f4e6e61ff0f7cc
and
https://lore.kernel.org/yocto-patches/[email protected]/

---
  recipes-bsp/rkbin/rk3308-rkbin_git.bb                        |  2 +-
  recipes-bsp/rkbin/rockchip-rkbin-tf-a_git.bb                 |  9 +++++----
  recipes-bsp/rkbin/rockchip-rkbin.inc                         |  2 +-
  recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend | 11 -----------
  recipes-bsp/u-boot/u-boot-rockchip.inc                       |  4 +---
  5 files changed, 8 insertions(+), 20 deletions(-)
Quoted 12 lines

recipes-bsp/rkbin/rk3308-rkbin_git.bb ALLOW_EMPTY:${PN} = "1" · line 30

Quoted 9 lines
recipes-bsp/rkbin/rk3308-rkbin_git.bb +1 -1
index ab2c70f..0661fc4 100644
@@ -28,7 +28,7 @@ ALLOW_EMPTY:${PN} = "1"
  do_deploy:rk3308() {
  	# Prebuilt TF-A
-	install -m 644 ${S}/bin/rk33/rk3308_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3308.elf
+	install -m 644 ${S}/bin/rk33/rk3308_bl31_v*.elf ${DEPLOYDIR}/trusted-firmware-a/bl31.elf

I believe we should add -D after install here. Do you mind doing this change when applying or should I send a v2?

Done!

#5 lore raw
In reply to Quentin Schulz
Quoted 38 lines · Quentin Schulz

From: Quentin Schulz <[email protected]>

Since commit 7bce36a2c64b ("arm/trusted-firmware-a: Use firmware.bbclass") in meta-arm, the BL31 firmware is deployed in a subdirectory named trusted-firmware-a and the binary is simply called bl31.elf without any other string.

This differs from what it used to be by the use of the subdirectory and the name of the file itself. This is an issue for us because the U-Boot recipe is given the path to the BL31 binary in deploy directory and that now was wrong.

The second issue is that we want rockchip-rkbin-tf-a to be a drop-in replacement for the upstream recipe and have nothing to change in other recipes dependent on *an* implementation of TF-A (such as the U-Boot recipe).

We can either fixup the path like was done in 2a13a49da4af ("fix u-boot for tf-a firmware") but we'll need to do that for all current and future SoCs (and also wasn't a complete fix as for example px30 didn't have the fixup applied). Or we can simply adapt the rockchip-rkbin-tf-a recipe to deploy the same way that the upstream trusted-firmware-a recipe does by installing in a trusted-firmware-a subdirectory, simply name the binary bl31.elf and update the BL31 environment variable in the U-Boot recipe to use the new path.

Because RKBIN_DEPLOY_FILENAME now contains a directory in it, we need to make sure the directory is created (with install -D).

This was tested with upstream+downstream TF-A for RK3588, upstream TF-A for RK3399 and PX30.

---
This is a follow-up to
https://lore.kernel.org/yocto-meta-arm/[email protected]/T/#m76f7d4b56849cc28fe80a76953f4e6e61ff0f7cc
and
https://lore.kernel.org/yocto-patches/[email protected]/

Quoted 7 lines
---
 recipes-bsp/rkbin/rk3308-rkbin_git.bb                        |  2 +-
 recipes-bsp/rkbin/rockchip-rkbin-tf-a_git.bb                 |  9 +++++----
 recipes-bsp/rkbin/rockchip-rkbin.inc                         |  2 +-
 recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend | 11 -----------
 recipes-bsp/u-boot/u-boot-rockchip.inc                       |  4 +---
 5 files changed, 8 insertions(+), 20 deletions(-)

Applied to meta-rockchip master branch (with added -D), thanks!