diff mbox series

[meta-rockchip,v2,6/9] bsp: rkbin: optee-os: factor out do_deploy to be SoC-agnostic

Message ID 20250418-ddrbin-custom-v2-6-700828527faf@cherry.de
State New
Headers show
Series rkbin: factoring do_deploy, customize ddrbin and bump rkbin | expand

Commit Message

Quentin Schulz April 18, 2025, 2:50 p.m. UTC
From: Quentin Schulz <quentin.schulz@cherry.de>

The do_deploy task is essentially the same for all SoCs, install a file
from a specific path to another one.

No magic involved, so let's rather have one generic do_deploy task. For
this to work nicely, we check that all necessary variables are set and
notify the developer otherwise. This may be useful whenever a new SoC
will be supported by this recipe.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
---
 recipes-bsp/rkbin/rockchip-rkbin-optee-os_git.bb | 46 ++++++++++++++++--------
 1 file changed, 32 insertions(+), 14 deletions(-)
diff mbox series

Patch

diff --git a/recipes-bsp/rkbin/rockchip-rkbin-optee-os_git.bb b/recipes-bsp/rkbin/rockchip-rkbin-optee-os_git.bb
index 6d25368d3392c29438d5ff34c621552633885f1b..7858688b23679d67df5ac2739312ef83b677af6b 100644
--- a/recipes-bsp/rkbin/rockchip-rkbin-optee-os_git.bb
+++ b/recipes-bsp/rkbin/rockchip-rkbin-optee-os_git.bb
@@ -4,24 +4,42 @@  require rockchip-rkbin.inc
 
 PROVIDES += "optee-os"
 
-do_deploy:rk3308() {
-	# Prebuilt OPTEE-OS
-	install -m 644 ${S}/bin/rk33/rk3308_bl32_v*.bin ${DEPLOYDIR}/tee-rk3308.bin
-}
+RKBIN_BINDIR:rk3308 ?= "bin/rk33/"
+RKBIN_BINVERS:rk3308 ?= "v2.08"
+RKBIN_BINFILE:rk3308 ?= "rk3308_bl32_${RKBIN_BINVERS}.bin"
+RKBIN_DEPLOY_FILENAME:rk3308 ?= "tee-rk3308.bin"
 
+RKBIN_BINVERS_RK356x ?= "v2.14"
+RKBIN_BINDIR:rk3566 ?= "bin/rk35/"
+RKBIN_BINVERS:rk3566 ?= "${RKBIN_BINVERS_RK356x}"
 # NOTE: the following are not typos
 #       the rk3566 uses the same bl32 as the rk3568
-do_deploy:rk3566() {
-	# Prebuilt OPTEE-OS
-	install -m 644 ${S}/bin/rk35/rk3568_bl32_v*.bin ${DEPLOYDIR}/tee-rk3566.bin
-}
+RKBIN_BINFILE:rk3566 ?= "rk3568_bl32_${RKBIN_BINVERS}.bin"
+RKBIN_DEPLOY_FILENAME:rk3566 ?= "tee-rk3566.bin"
 
-do_deploy:rk3568() {
-	# Prebuilt OPTEE-OS
-	install -m 644 ${S}/bin/rk35/rk3568_bl32_v*.bin ${DEPLOYDIR}/tee-rk3568.bin
-}
+RKBIN_BINDIR:rk3568 ?= "bin/rk35/"
+RKBIN_BINVERS:rk3568 ?= "${RKBIN_BINVERS_RK356x}"
+RKBIN_BINFILE:rk3568 ?= "rk3568_bl32_${RKBIN_BINVERS}.bin"
+RKBIN_DEPLOY_FILENAME:rk3568 ?= "tee-rk3568.bin"
+
+RKBIN_BINDIR:rk3588s ?= "bin/rk35/"
+RKBIN_BINVERS:rk3588s ?= "v1.17"
+RKBIN_BINFILE:rk3588s ?= "rk3588_bl32_${RKBIN_BINVERS}.bin"
+RKBIN_DEPLOY_FILENAME:rk3588s ?= "tee-rk3588.bin"
+
+do_deploy() {
+	if [ -z "${RKBIN_BINDIR}" ]; then
+		bbfatal "Non-empty RKBIN_BINDIR:<MACHINE> required!"
+	fi
+
+	if [ -z "${RKBIN_BINFILE}" ]; then
+		bbfatal "Non-empty RKBIN_BINFILE:<MACHINE> required!"
+	fi
+
+	if [ -z "${RKBIN_DEPLOY_FILENAME}" ]; then
+		bbfatal "Non-empty RKBIN_DEPLOY_FILENAME:<MACHINE> required!"
+	fi
 
-do_deploy:rk3588s() {
 	# Prebuilt OPTEE-OS
-	install -m 644 ${S}/bin/rk35/rk3588_bl32_v*.bin ${DEPLOYDIR}/tee-rk3588.bin
+	install -m 644 ${S}/${RKBIN_BINDIR}${RKBIN_BINFILE} ${DEPLOYDIR}/${RKBIN_DEPLOY_FILENAME}
 }