Skip to contentSkip to conversation

rock-3a add

PATCH In review [email protected] 3 participants 8 messages Oct 16, 2023 – Jan 21, 2024 Arm Rockchip

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 rock-3a add

From: Anthony Davies <[email protected]>

Add support for the Radxa Rock 3A
https://wiki.radxa.com/Rock3/3a

The TF-A project does not currently have support for
the rk3568. Therefore, for the time-being, the only way to supply a TPL/DDR-init for the rk3568 is to use the closed-source rkbin binaries from Rockchip. If/when TF-A adds support for the rk3588 we can investigate switching.

recipes-bsp/rkbin/rockchip-rkbin_git.bb was modified to allow a machine override to allow both rk3568 and rk3588s to use differnet binary blobs

---
 README                                  |  1 +
 conf/machine/include/rk3568.inc         | 17 +++++++++++++++++
 conf/machine/rock-3a.conf               | 12 ++++++++++++
 recipes-bsp/rkbin/rockchip-rkbin_git.bb | 16 +++++++++++++++-
 recipes-bsp/u-boot/u-boot%.bbappend     |  5 +++++
 5 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 conf/machine/include/rk3568.inc
 create mode 100644 conf/machine/rock-3a.conf
README +1 -0
index 8104474..3357b47 100644
@@ -32,6 +32,7 @@ Status of supported boards:
 		nanopi-r4s
 		rock-5b
 		nanopi-r2s
+    rock-3a
 	builds:
 		marsboard-rk3066
 		radxarock
conf/machine/include/rk3568.inc new file +17 -0
new file mode 100644
index 0000000..5382b58
@@ -0,0 +1,17 @@
+MACHINEOVERRIDES =. "rk3568:"
+DEFAULTTUNE ?= "cortexa55"
+
+require conf/machine/include/arm/armv8-2a/tune-cortexa55.inc
+require conf/machine/include/rockchip-defaults.inc
+require conf/machine/include/rockchip-wic.inc
+
+KBUILD_DEFCONFIG ?= "defconfig"
+KERNEL_FEATURES:append:rk3568 = " bsp/rockchip/remove-non-rockchip-arch-arm64.scc"
+KERNEL_CLASSES ??= "kernel-fitimage"
+KERNEL_IMAGETYPE ??= "fitImage"
+
+PREFERRED_PROVIDER_trusted-firmware-a = "rockchip-rkbin"
+PREFERRED_PROVIDER_optee-os = "rockchip-rkbin"
+
+UBOOT_SUFFIX ?= "itb"
+UBOOT_ENTRYPOINT ?= "0x06000000"
conf/machine/rock-3a.conf new file +12 -0
new file mode 100644
index 0000000..2ed83a3
@@ -0,0 +1,12 @@
+#@TYPE: Machine
+#@NAME: Radxa Rock 3a
+#@DESCRIPTION: ROCK3 is a series of Rockchip RK3566/RK3568 based
+#SBC(Single Board Computer) and Compute Module by Radxa.
+#https://wiki.radxa.com/Rock3
+
+require conf/machine/include/rk3568.inc
+
+KERNEL_DEVICETREE = "rockchip/rk3568-rock-3a.dtb"
+MACHINE_EXTRA_RRECOMMENDS += "kernel-modules"
+
+UBOOT_MACHINE = "rock-3a-rk3568_defconfig"
recipes-bsp/rkbin/rockchip-rkbin_git.bb +15 -1
index 7fefb01..ad5593c 100644
@@ -14,6 +14,7 @@ S = "${WORKDIR}/git"
 
 COMPATIBLE_MACHINE = ""
 COMPATIBLE_MACHINE:rk3588s = "rk3588s"
+COMPATIBLE_MACHINE:rk3568 = "rk3568"
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
@@ -25,7 +26,16 @@ do_install() {
 PACKAGES = "${PN}"
 ALLOW_EMPTY:${PN} = "1"
 
-do_deploy() {
+do_deploy:rk3568() {
+	# Prebuilt TF-A
+	install -m 644 ${S}/bin/rk35/rk3568_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3568.elf
+	# Prebuilt OPTEE-OS
+	install -m 644 ${S}/bin/rk35/rk3568_bl32_v*.bin ${DEPLOYDIR}/tee-rk3568.bin
+	# Prebuilt U-Boot TPL (DDR init)
+	install -m 644 ${S}/bin/rk35/rk3568_ddr_1560MHz_v1.18.bin ${DEPLOYDIR}/ddr-rk3568.bin
+}
+
+do_deploy:rk3588s() {
 	# Prebuilt TF-A
 	install -m 644 ${S}/bin/rk35/rk3588_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3588.elf
 	# Prebuilt OPTEE-OS
@@ -34,4 +44,8 @@ do_deploy() {
 	install -m 644 ${S}/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin ${DEPLOYDIR}/ddr-rk3588.bin
 }
 
+do_deploy() {
+  bbfatal "COMPATIBLE_MACHINE requires a corressponding do_deploy:<MACHINE>() override"
+}
+
 addtask deploy after do_install
recipes-bsp/u-boot/u-boot%.bbappend +5 -0
index e79c471..66c81da 100644
@@ -9,12 +9,17 @@ EXTRA_OEMAKE:append:rk3588s = " \
 	BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3588.elf \
 	ROCKCHIP_TPL=${DEPLOY_DIR_IMAGE}/ddr-rk3588.bin \
 	"
+EXTRA_OEMAKE:append:rk3568 = " \
+	BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3568.elf \
+	ROCKCHIP_TPL=${DEPLOY_DIR_IMAGE}/ddr-rk3568.bin \
+	"
 
 INIT_FIRMWARE_DEPENDS ??= ""
 INIT_FIRMWARE_DEPENDS:px30 = " trusted-firmware-a:do_deploy"
 INIT_FIRMWARE_DEPENDS:rk3328 = " trusted-firmware-a:do_deploy"
 INIT_FIRMWARE_DEPENDS:rk3399 = " trusted-firmware-a:do_deploy"
 INIT_FIRMWARE_DEPENDS:rk3588s = " rockchip-rkbin:do_deploy"
+INIT_FIRMWARE_DEPENDS:rk3568 = " rockchip-rkbin:do_deploy"
 do_compile[depends] .= "${INIT_FIRMWARE_DEPENDS}"
 
 do_compile:append:rock2-square () {
Signature · 1 line
2.34.1
#1 lore raw

Hi Anthony,

Thanks for working on this.

Quoted 30 lines · On Mon 2023-10-16 @ 09:43:45 PM, [email protected] wrote:

From: Anthony Davies <[email protected]>

Add support for the Radxa Rock 3A
https://wiki.radxa.com/Rock3/3a

The TF-A project does not currently have support for
the rk3568. Therefore, for the time-being, the only way to supply a TPL/DDR-init for the rk3568 is to use the closed-source rkbin binaries from Rockchip. If/when TF-A adds support for the rk3588 we can investigate switching.

recipes-bsp/rkbin/rockchip-rkbin_git.bb was modified to allow a machine override to allow both rk3568 and rk3588s to use differnet binary blobs

---
 README                                  |  1 +
 conf/machine/include/rk3568.inc         | 17 +++++++++++++++++
 conf/machine/rock-3a.conf               | 12 ++++++++++++
 recipes-bsp/rkbin/rockchip-rkbin_git.bb | 16 +++++++++++++++-
 recipes-bsp/u-boot/u-boot%.bbappend     |  5 +++++
 5 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 conf/machine/include/rk3568.inc
 create mode 100644 conf/machine/rock-3a.conf
README +0 -0
index 8104474..3357b47 100644

README Status of supported boards: · line 35

Quoted 4 lines
README +1 -0
@@ -32,6 +32,7 @@ Status of supported boards:
 		nanopi-r4s
 		rock-5b
 		nanopi-r2s
+    rock-3a

There's still an issue with indents/tabs.

Quoted 75 lines
README +0 -0
 	builds:
 		marsboard-rk3066
 		radxarock
conf/machine/include/rk3568.inc new file +17 -0
new file mode 100644
index 0000000..5382b58
@@ -0,0 +1,17 @@
+MACHINEOVERRIDES =. "rk3568:"
+DEFAULTTUNE ?= "cortexa55"
+
+require conf/machine/include/arm/armv8-2a/tune-cortexa55.inc
+require conf/machine/include/rockchip-defaults.inc
+require conf/machine/include/rockchip-wic.inc
+
+KBUILD_DEFCONFIG ?= "defconfig"
+KERNEL_FEATURES:append:rk3568 = " bsp/rockchip/remove-non-rockchip-arch-arm64.scc"
+KERNEL_CLASSES ??= "kernel-fitimage"
+KERNEL_IMAGETYPE ??= "fitImage"
+
+PREFERRED_PROVIDER_trusted-firmware-a = "rockchip-rkbin"
+PREFERRED_PROVIDER_optee-os = "rockchip-rkbin"
+
+UBOOT_SUFFIX ?= "itb"
+UBOOT_ENTRYPOINT ?= "0x06000000"
conf/machine/rock-3a.conf new file +12 -0
new file mode 100644
index 0000000..2ed83a3
@@ -0,0 +1,12 @@
+#@TYPE: Machine
+#@NAME: Radxa Rock 3a
+#@DESCRIPTION: ROCK3 is a series of Rockchip RK3566/RK3568 based
+#SBC(Single Board Computer) and Compute Module by Radxa.
+#https://wiki.radxa.com/Rock3
+
+require conf/machine/include/rk3568.inc
+
+KERNEL_DEVICETREE = "rockchip/rk3568-rock-3a.dtb"
+MACHINE_EXTRA_RRECOMMENDS += "kernel-modules"
+
+UBOOT_MACHINE = "rock-3a-rk3568_defconfig"
recipes-bsp/rkbin/rockchip-rkbin_git.bb +11 -1
index 7fefb01..ad5593c 100644
@@ -14,6 +14,7 @@ S = "${WORKDIR}/git"
 
 COMPATIBLE_MACHINE = ""
 COMPATIBLE_MACHINE:rk3588s = "rk3588s"
+COMPATIBLE_MACHINE:rk3568 = "rk3568"
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 
@@ -25,7 +26,16 @@ do_install() {
 PACKAGES = "${PN}"
 ALLOW_EMPTY:${PN} = "1"
 
-do_deploy() {
+do_deploy:rk3568() {
+	# Prebuilt TF-A
+	install -m 644 ${S}/bin/rk35/rk3568_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3568.elf
+	# Prebuilt OPTEE-OS
+	install -m 644 ${S}/bin/rk35/rk3568_bl32_v*.bin ${DEPLOYDIR}/tee-rk3568.bin
+	# Prebuilt U-Boot TPL (DDR init)
+	install -m 644 ${S}/bin/rk35/rk3568_ddr_1560MHz_v1.18.bin ${DEPLOYDIR}/ddr-rk3568.bin
+}
+
+do_deploy:rk3588s() {
 	# Prebuilt TF-A
 	install -m 644 ${S}/bin/rk35/rk3588_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3588.elf
 	# Prebuilt OPTEE-OS

recipes-bsp/rkbin/rockchip-rkbin_git.bb do_deploy() { · line 50

Quoted 7 lines
recipes-bsp/rkbin/rockchip-rkbin_git.bb +4 -0
@@ -34,4 +44,8 @@ do_deploy() {
 	install -m 644 ${S}/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin ${DEPLOYDIR}/ddr-rk3588.bin
 }
 
+do_deploy() {
+  bbfatal "COMPATIBLE_MACHINE requires a corressponding do_deploy:<MACHINE>() override"
+}
+

This is not related to adding support for rock3a.

Quoted 26 lines
recipes-bsp/rkbin/rockchip-rkbin_git.bb +0 -0
 addtask deploy after do_install
recipes-bsp/u-boot/u-boot%.bbappend +5 -0
index e79c471..66c81da 100644
@@ -9,12 +9,17 @@ EXTRA_OEMAKE:append:rk3588s = " \
 	BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3588.elf \
 	ROCKCHIP_TPL=${DEPLOY_DIR_IMAGE}/ddr-rk3588.bin \
 	"
+EXTRA_OEMAKE:append:rk3568 = " \
+	BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3568.elf \
+	ROCKCHIP_TPL=${DEPLOY_DIR_IMAGE}/ddr-rk3568.bin \
+	"
 
 INIT_FIRMWARE_DEPENDS ??= ""
 INIT_FIRMWARE_DEPENDS:px30 = " trusted-firmware-a:do_deploy"
 INIT_FIRMWARE_DEPENDS:rk3328 = " trusted-firmware-a:do_deploy"
 INIT_FIRMWARE_DEPENDS:rk3399 = " trusted-firmware-a:do_deploy"
 INIT_FIRMWARE_DEPENDS:rk3588s = " rockchip-rkbin:do_deploy"
+INIT_FIRMWARE_DEPENDS:rk3568 = " rockchip-rkbin:do_deploy"
 do_compile[depends] .= "${INIT_FIRMWARE_DEPENDS}"
 
 do_compile:append:rock2-square () {
Signature · 1 line
2.34.1
#2 lore raw

Hi Trevor,

Quoted 120 lines · Trevor Woerner via lists.yoctoproject.org

Hi Anthony,

Thanks for working on this.

Quoted 30 lines · On Mon 2023-10-16 @ 09:43:45 PM, [email protected] wrote:

From: Anthony Davies <[email protected]>

Add support for the Radxa Rock 3A
https://wiki.radxa.com/Rock3/3a

The TF-A project does not currently have support for
the rk3568. Therefore, for the time-being, the only way to supply a TPL/DDR-init for the rk3568 is to use the closed-source rkbin binaries from Rockchip. If/when TF-A adds support for the rk3588 we can investigate switching.

recipes-bsp/rkbin/rockchip-rkbin_git.bb was modified to allow a machine override to allow both rk3568 and rk3588s to use differnet binary blobs

---
  README                                  |  1 +
  conf/machine/include/rk3568.inc         | 17 +++++++++++++++++
  conf/machine/rock-3a.conf               | 12 ++++++++++++
  recipes-bsp/rkbin/rockchip-rkbin_git.bb | 16 +++++++++++++++-
  recipes-bsp/u-boot/u-boot%.bbappend     |  5 +++++
  5 files changed, 50 insertions(+), 1 deletion(-)

create mode 100644 conf/machine/include/rk3568.inc create mode 100644 conf/machine/rock-3a.conf

README +0 -0
index 8104474..3357b47 100644

README Status of supported boards: · line 35

Quoted 4 lines
README +1 -0
@@ -32,6 +32,7 @@ Status of supported boards:
  		nanopi-r4s
  		rock-5b
  		nanopi-r2s
+    rock-3a

There's still an issue with indents/tabs.

Quoted 78 lines
README +0 -0
  	builds:
  		marsboard-rk3066
  		radxarock
conf/machine/include/rk3568.inc new file +17 -0
new file mode 100644
index 0000000..5382b58
@@ -0,0 +1,17 @@
+MACHINEOVERRIDES =. "rk3568:"
+DEFAULTTUNE ?= "cortexa55"
+
+require conf/machine/include/arm/armv8-2a/tune-cortexa55.inc
+require conf/machine/include/rockchip-defaults.inc
+require conf/machine/include/rockchip-wic.inc
+
+KBUILD_DEFCONFIG ?= "defconfig"
+KERNEL_FEATURES:append:rk3568 = " bsp/rockchip/remove-non-rockchip-arch-arm64.scc"
+KERNEL_CLASSES ??= "kernel-fitimage"
+KERNEL_IMAGETYPE ??= "fitImage"
+
+PREFERRED_PROVIDER_trusted-firmware-a = "rockchip-rkbin"
+PREFERRED_PROVIDER_optee-os = "rockchip-rkbin"
+
+UBOOT_SUFFIX ?= "itb"
+UBOOT_ENTRYPOINT ?= "0x06000000"
conf/machine/rock-3a.conf new file +12 -0
new file mode 100644
index 0000000..2ed83a3
@@ -0,0 +1,12 @@
+#@TYPE: Machine
+#@NAME: Radxa Rock 3a
+#@DESCRIPTION: ROCK3 is a series of Rockchip RK3566/RK3568 based
+#SBC(Single Board Computer) and Compute Module by Radxa.
+#https://wiki.radxa.com/Rock3
+
+require conf/machine/include/rk3568.inc
+
+KERNEL_DEVICETREE = "rockchip/rk3568-rock-3a.dtb"
+MACHINE_EXTRA_RRECOMMENDS += "kernel-modules"
+
+UBOOT_MACHINE = "rock-3a-rk3568_defconfig"
recipes-bsp/rkbin/rockchip-rkbin_git.bb +11 -1
index 7fefb01..ad5593c 100644
@@ -14,6 +14,7 @@ S = "${WORKDIR}/git"
 
  COMPATIBLE_MACHINE = ""
  COMPATIBLE_MACHINE:rk3588s = "rk3588s"
+COMPATIBLE_MACHINE:rk3568 = "rk3568"
 
  PACKAGE_ARCH = "${MACHINE_ARCH}"
 
@@ -25,7 +26,16 @@ do_install() {
  PACKAGES = "${PN}"
  ALLOW_EMPTY:${PN} = "1"
 
-do_deploy() {
+do_deploy:rk3568() {
+	# Prebuilt TF-A
+	install -m 644 ${S}/bin/rk35/rk3568_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3568.elf
+	# Prebuilt OPTEE-OS
+	install -m 644 ${S}/bin/rk35/rk3568_bl32_v*.bin ${DEPLOYDIR}/tee-rk3568.bin
+	# Prebuilt U-Boot TPL (DDR init)
+	install -m 644 ${S}/bin/rk35/rk3568_ddr_1560MHz_v1.18.bin ${DEPLOYDIR}/ddr-rk3568.bin
+}
+
+do_deploy:rk3588s() {
  	# Prebuilt TF-A
  	install -m 644 ${S}/bin/rk35/rk3588_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3588.elf
  	# Prebuilt OPTEE-OS
@@ -34,4 +44,8 @@ do_deploy() {
  	install -m 644 ${S}/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin ${DEPLOYDIR}/ddr-rk3588.bin
  }
 
Quoted 7 lines

recipes-bsp/rkbin/rockchip-rkbin_git.bb do_deploy() { · line 50

Quoted 4 lines
recipes-bsp/rkbin/rockchip-rkbin_git.bb +4 -0
+do_deploy() {
+  bbfatal "COMPATIBLE_MACHINE requires a corressponding do_deploy:<MACHINE>() override"
+}
+

This is not related to adding support for rock3a.

In a way it is, but would benefit in being in a different commit I agree.

So basically Anthony's issue (if I remember correctly) was that if you're not overriding the default do_deploy, the recipe will pass but install the wrong files with the wrong names, without telling you.

So instead, the thought was to make do_deploy fail by default (with bbfatal) unless it is overridden (e.g. for rk3588s and rk3568) so that people adding support for new SoCs don't wonder what's missing.

I could see a commit with a diff like:
"""
-do_deploy() {
+do_deploy:rk3588s() {
# Prebuilt TF-A
install -m 644 ${S}/bin/rk35/rk3588_bl31_v*.elf
${DEPLOYDIR}/bl31-rk3588.elf
# Prebuilt OPTEE-OS
@@ -34,4 +44,8 @@ do_deploy() {
install -m 644
${S}/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin ${DEPLOYDIR}/ddr-rk3588.bin
}

+do_deploy() {
+ bbfatal "COMPATIBLE_MACHINE requires a corressponding do_deploy:<MACHINE>() override" +}
+
"""

with a proper explanation in the commit log, and then a commit that adds one for rk3568.

Cheers,
Quentin

Quoted 36 lines
Quoted 36 lines
recipes-bsp/rkbin/rockchip-rkbin_git.bb +0 -0
  addtask deploy after do_install
recipes-bsp/u-boot/u-boot%.bbappend +5 -0
index e79c471..66c81da 100644
@@ -9,12 +9,17 @@ EXTRA_OEMAKE:append:rk3588s = " \
  	BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3588.elf \
  	ROCKCHIP_TPL=${DEPLOY_DIR_IMAGE}/ddr-rk3588.bin \
  	"
+EXTRA_OEMAKE:append:rk3568 = " \
+	BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3568.elf \
+	ROCKCHIP_TPL=${DEPLOY_DIR_IMAGE}/ddr-rk3568.bin \
+	"
 
  INIT_FIRMWARE_DEPENDS ??= ""
  INIT_FIRMWARE_DEPENDS:px30 = " trusted-firmware-a:do_deploy"
  INIT_FIRMWARE_DEPENDS:rk3328 = " trusted-firmware-a:do_deploy"
  INIT_FIRMWARE_DEPENDS:rk3399 = " trusted-firmware-a:do_deploy"
  INIT_FIRMWARE_DEPENDS:rk3588s = " rockchip-rkbin:do_deploy"
+INIT_FIRMWARE_DEPENDS:rk3568 = " rockchip-rkbin:do_deploy"
  do_compile[depends] .= "${INIT_FIRMWARE_DEPENDS}"
 
  do_compile:append:rock2-square () {
Signature · 11 lines
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#61481): https://lists.yoctoproject.org/g/yocto/message/61481
Mute This Topic: https://lists.yoctoproject.org/mt/101992957/6293953
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
#3 lore raw
Quoted 156 lines · Quentin Schulz

Hi Trevor,

Quoted 113 lines · Trevor Woerner via lists.yoctoproject.org

Hi Anthony,

Thanks for working on this.

Quoted 30 lines · On Mon 2023-10-16 @ 09:43:45 PM, [email protected] wrote:

From: Anthony Davies <[email protected]>

Add support for the Radxa Rock 3A
https://wiki.radxa.com/Rock3/3a

The TF-A project does not currently have support for
the rk3568. Therefore, for the time-being, the only way to supply a TPL/DDR-init for the rk3568 is to use the closed-source rkbin binaries from Rockchip. If/when TF-A adds support for the rk3588 we can investigate switching.

recipes-bsp/rkbin/rockchip-rkbin_git.bb was modified to allow a machine override to allow both rk3568 and rk3588s to use differnet binary blobs

---
  README                                  |  1 +
  conf/machine/include/rk3568.inc         | 17 +++++++++++++++++
  conf/machine/rock-3a.conf               | 12 ++++++++++++
  recipes-bsp/rkbin/rockchip-rkbin_git.bb | 16 +++++++++++++++-
  recipes-bsp/u-boot/u-boot%.bbappend     |  5 +++++
  5 files changed, 50 insertions(+), 1 deletion(-)

create mode 100644 conf/machine/include/rk3568.inc create mode 100644 conf/machine/rock-3a.conf

README +0 -0
index 8104474..3357b47 100644

README Status of supported boards: · line 35

Quoted 4 lines
README +1 -0
@@ -32,6 +32,7 @@ Status of supported boards:
  		nanopi-r4s
  		rock-5b
  		nanopi-r2s
+    rock-3a

There's still an issue with indents/tabs.

Quoted 71 lines
README +0 -0
  	builds:
  		marsboard-rk3066
  		radxarock
conf/machine/include/rk3568.inc new file +17 -0
new file mode 100644
index 0000000..5382b58
@@ -0,0 +1,17 @@
+MACHINEOVERRIDES =. "rk3568:"
+DEFAULTTUNE ?= "cortexa55"
+
+require conf/machine/include/arm/armv8-2a/tune-cortexa55.inc
+require conf/machine/include/rockchip-defaults.inc
+require conf/machine/include/rockchip-wic.inc
+
+KBUILD_DEFCONFIG ?= "defconfig"
+KERNEL_FEATURES:append:rk3568 = " bsp/rockchip/remove-non-rockchip-arch-arm64.scc"
+KERNEL_CLASSES ??= "kernel-fitimage"
+KERNEL_IMAGETYPE ??= "fitImage"
+
+PREFERRED_PROVIDER_trusted-firmware-a = "rockchip-rkbin"
+PREFERRED_PROVIDER_optee-os = "rockchip-rkbin"
+
+UBOOT_SUFFIX ?= "itb"
+UBOOT_ENTRYPOINT ?= "0x06000000"
conf/machine/rock-3a.conf new file +12 -0
new file mode 100644
index 0000000..2ed83a3
@@ -0,0 +1,12 @@
+#@TYPE: Machine
+#@NAME: Radxa Rock 3a
+#@DESCRIPTION: ROCK3 is a series of Rockchip RK3566/RK3568 based
+#SBC(Single Board Computer) and Compute Module by Radxa.
+#https://wiki.radxa.com/Rock3
+
+require conf/machine/include/rk3568.inc
+
+KERNEL_DEVICETREE = "rockchip/rk3568-rock-3a.dtb"
+MACHINE_EXTRA_RRECOMMENDS += "kernel-modules"
+
+UBOOT_MACHINE = "rock-3a-rk3568_defconfig"
recipes-bsp/rkbin/rockchip-rkbin_git.bb +11 -1
index 7fefb01..ad5593c 100644
@@ -14,6 +14,7 @@ S = "${WORKDIR}/git"
  COMPATIBLE_MACHINE = ""
  COMPATIBLE_MACHINE:rk3588s = "rk3588s"
+COMPATIBLE_MACHINE:rk3568 = "rk3568"
  PACKAGE_ARCH = "${MACHINE_ARCH}"
@@ -25,7 +26,16 @@ do_install() {
  PACKAGES = "${PN}"
  ALLOW_EMPTY:${PN} = "1"
-do_deploy() {
+do_deploy:rk3568() {
+	# Prebuilt TF-A
+	install -m 644 ${S}/bin/rk35/rk3568_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3568.elf
+	# Prebuilt OPTEE-OS
+	install -m 644 ${S}/bin/rk35/rk3568_bl32_v*.bin ${DEPLOYDIR}/tee-rk3568.bin
+	# Prebuilt U-Boot TPL (DDR init)
+	install -m 644 ${S}/bin/rk35/rk3568_ddr_1560MHz_v1.18.bin ${DEPLOYDIR}/ddr-rk3568.bin
+}
+
+do_deploy:rk3588s() {
  	# Prebuilt TF-A
  	install -m 644 ${S}/bin/rk35/rk3588_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3588.elf
  	# Prebuilt OPTEE-OS
@@ -34,4 +44,8 @@ do_deploy() {
Quoted 9 lines

recipes-bsp/rkbin/rockchip-rkbin_git.bb do_deploy() { · line 50

Quoted 6 lines
recipes-bsp/rkbin/rockchip-rkbin_git.bb +4 -0
  	install -m 644 ${S}/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin ${DEPLOYDIR}/ddr-rk3588.bin
  }
+do_deploy() {
+  bbfatal "COMPATIBLE_MACHINE requires a corressponding do_deploy:<MACHINE>() override"
+}
+

This is not related to adding support for rock3a.

In a way it is, but would benefit in being in a different commit I agree.

So basically Anthony's issue (if I remember correctly) was that if you're not overriding the default do_deploy, the recipe will pass but install the wrong files with the wrong names, without telling you.

So instead, the thought was to make do_deploy fail by default (with bbfatal) unless it is overridden (e.g. for rk3588s and rk3568) so that people adding support for new SoCs don't wonder what's missing.

I could see a commit with a diff like:
"""

recipes-bsp/rkbin/rockchip-rkbin_git.bb +1 -1
-do_deploy() {
+do_deploy:rk3588s() {
   	# Prebuilt TF-A
   	install -m 644 ${S}/bin/rk35/rk3588_bl31_v*.elf

${DEPLOYDIR}/bl31-rk3588.elf
# Prebuilt OPTEE-OS

(quoted diff) +0 -0
@@ -34,4 +44,8 @@ do_deploy() {
  	install -m 644 ${S}/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin

${DEPLOYDIR}/ddr-rk3588.bin
}

(quoted diff) +2 -0
+do_deploy() {
+  bbfatal "COMPATIBLE_MACHINE requires a corressponding

do_deploy:<MACHINE>() override"

(quoted diff) +2 -0
+}
+

"""

Quoted 2 lines

with a proper explanation in the commit log, and then a commit that adds one for rk3568.

...and then another set for kirkstone, no doubt?

Quoted 38 lines

Cheers,
Quentin

Quoted 34 lines
Quoted 34 lines
recipes-bsp/rkbin/rockchip-rkbin_git.bb +0 -0
  addtask deploy after do_install
recipes-bsp/u-boot/u-boot%.bbappend +5 -0
index e79c471..66c81da 100644
@@ -9,12 +9,17 @@ EXTRA_OEMAKE:append:rk3588s = " \
  	BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3588.elf \
  	ROCKCHIP_TPL=${DEPLOY_DIR_IMAGE}/ddr-rk3588.bin \
  	"
+EXTRA_OEMAKE:append:rk3568 = " \
+	BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3568.elf \
+	ROCKCHIP_TPL=${DEPLOY_DIR_IMAGE}/ddr-rk3568.bin \
+	"
  INIT_FIRMWARE_DEPENDS ??= ""
  INIT_FIRMWARE_DEPENDS:px30 = " trusted-firmware-a:do_deploy"
  INIT_FIRMWARE_DEPENDS:rk3328 = " trusted-firmware-a:do_deploy"
  INIT_FIRMWARE_DEPENDS:rk3399 = " trusted-firmware-a:do_deploy"
  INIT_FIRMWARE_DEPENDS:rk3588s = " rockchip-rkbin:do_deploy"
+INIT_FIRMWARE_DEPENDS:rk3568 = " rockchip-rkbin:do_deploy"
  do_compile[depends] .= "${INIT_FIRMWARE_DEPENDS}"
  do_compile:append:rock2-square () {
Signature · 11 lines
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#61481): https://lists.yoctoproject.org/g/yocto/message/61481
Mute This Topic: https://lists.yoctoproject.org/mt/101992957/6293953
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
#4 lore raw

Hi Trevor,

Quoted 157 lines · Trevor Woerner
Quoted 156 lines · Quentin Schulz

Hi Trevor,

Quoted 113 lines · Trevor Woerner via lists.yoctoproject.org

Hi Anthony,

Thanks for working on this.

Quoted 30 lines · On Mon 2023-10-16 @ 09:43:45 PM, [email protected] wrote:

From: Anthony Davies <[email protected]>

Add support for the Radxa Rock 3A
https://wiki.radxa.com/Rock3/3a

The TF-A project does not currently have support for
the rk3568. Therefore, for the time-being, the only way to supply a TPL/DDR-init for the rk3568 is to use the closed-source rkbin binaries from Rockchip. If/when TF-A adds support for the rk3588 we can investigate switching.

recipes-bsp/rkbin/rockchip-rkbin_git.bb was modified to allow a machine override to allow both rk3568 and rk3588s to use differnet binary blobs

---
   README                                  |  1 +
   conf/machine/include/rk3568.inc         | 17 +++++++++++++++++
   conf/machine/rock-3a.conf               | 12 ++++++++++++
   recipes-bsp/rkbin/rockchip-rkbin_git.bb | 16 +++++++++++++++-
   recipes-bsp/u-boot/u-boot%.bbappend     |  5 +++++
   5 files changed, 50 insertions(+), 1 deletion(-)

create mode 100644 conf/machine/include/rk3568.inc create mode 100644 conf/machine/rock-3a.conf

README +0 -0
index 8104474..3357b47 100644

README Status of supported boards: · line 35

Quoted 4 lines
README +1 -0
@@ -32,6 +32,7 @@ Status of supported boards:
   		nanopi-r4s
   		rock-5b
   		nanopi-r2s
+    rock-3a

There's still an issue with indents/tabs.

Quoted 71 lines
README +0 -0
   	builds:
   		marsboard-rk3066
   		radxarock
conf/machine/include/rk3568.inc new file +17 -0
new file mode 100644
index 0000000..5382b58
@@ -0,0 +1,17 @@
+MACHINEOVERRIDES =. "rk3568:"
+DEFAULTTUNE ?= "cortexa55"
+
+require conf/machine/include/arm/armv8-2a/tune-cortexa55.inc
+require conf/machine/include/rockchip-defaults.inc
+require conf/machine/include/rockchip-wic.inc
+
+KBUILD_DEFCONFIG ?= "defconfig"
+KERNEL_FEATURES:append:rk3568 = " bsp/rockchip/remove-non-rockchip-arch-arm64.scc"
+KERNEL_CLASSES ??= "kernel-fitimage"
+KERNEL_IMAGETYPE ??= "fitImage"
+
+PREFERRED_PROVIDER_trusted-firmware-a = "rockchip-rkbin"
+PREFERRED_PROVIDER_optee-os = "rockchip-rkbin"
+
+UBOOT_SUFFIX ?= "itb"
+UBOOT_ENTRYPOINT ?= "0x06000000"
conf/machine/rock-3a.conf new file +12 -0
new file mode 100644
index 0000000..2ed83a3
@@ -0,0 +1,12 @@
+#@TYPE: Machine
+#@NAME: Radxa Rock 3a
+#@DESCRIPTION: ROCK3 is a series of Rockchip RK3566/RK3568 based
+#SBC(Single Board Computer) and Compute Module by Radxa.
+#https://wiki.radxa.com/Rock3
+
+require conf/machine/include/rk3568.inc
+
+KERNEL_DEVICETREE = "rockchip/rk3568-rock-3a.dtb"
+MACHINE_EXTRA_RRECOMMENDS += "kernel-modules"
+
+UBOOT_MACHINE = "rock-3a-rk3568_defconfig"
recipes-bsp/rkbin/rockchip-rkbin_git.bb +11 -1
index 7fefb01..ad5593c 100644
@@ -14,6 +14,7 @@ S = "${WORKDIR}/git"
   COMPATIBLE_MACHINE = ""
   COMPATIBLE_MACHINE:rk3588s = "rk3588s"
+COMPATIBLE_MACHINE:rk3568 = "rk3568"
   PACKAGE_ARCH = "${MACHINE_ARCH}"
@@ -25,7 +26,16 @@ do_install() {
   PACKAGES = "${PN}"
   ALLOW_EMPTY:${PN} = "1"
-do_deploy() {
+do_deploy:rk3568() {
+	# Prebuilt TF-A
+	install -m 644 ${S}/bin/rk35/rk3568_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3568.elf
+	# Prebuilt OPTEE-OS
+	install -m 644 ${S}/bin/rk35/rk3568_bl32_v*.bin ${DEPLOYDIR}/tee-rk3568.bin
+	# Prebuilt U-Boot TPL (DDR init)
+	install -m 644 ${S}/bin/rk35/rk3568_ddr_1560MHz_v1.18.bin ${DEPLOYDIR}/ddr-rk3568.bin
+}
+
+do_deploy:rk3588s() {
   	# Prebuilt TF-A
   	install -m 644 ${S}/bin/rk35/rk3588_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3588.elf
   	# Prebuilt OPTEE-OS
@@ -34,4 +44,8 @@ do_deploy() {
Quoted 9 lines

recipes-bsp/rkbin/rockchip-rkbin_git.bb do_deploy() { · line 50

Quoted 6 lines
recipes-bsp/rkbin/rockchip-rkbin_git.bb +4 -0
   	install -m 644 ${S}/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin ${DEPLOYDIR}/ddr-rk3588.bin
   }
+do_deploy() {
+  bbfatal "COMPATIBLE_MACHINE requires a corressponding do_deploy:<MACHINE>() override"
+}
+

This is not related to adding support for rock3a.

In a way it is, but would benefit in being in a different commit I agree.

So basically Anthony's issue (if I remember correctly) was that if you're not overriding the default do_deploy, the recipe will pass but install the wrong files with the wrong names, without telling you.

So instead, the thought was to make do_deploy fail by default (with bbfatal) unless it is overridden (e.g. for rk3588s and rk3568) so that people adding support for new SoCs don't wonder what's missing.

I could see a commit with a diff like:
"""

recipes-bsp/rkbin/rockchip-rkbin_git.bb +1 -1
-do_deploy() {
+do_deploy:rk3588s() {
    	# Prebuilt TF-A
    	install -m 644 ${S}/bin/rk35/rk3588_bl31_v*.elf

${DEPLOYDIR}/bl31-rk3588.elf
# Prebuilt OPTEE-OS

(quoted diff) +0 -0
@@ -34,4 +44,8 @@ do_deploy() {
   	install -m 644 ${S}/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin

${DEPLOYDIR}/ddr-rk3588.bin
}

(quoted diff) +2 -0
+do_deploy() {
+  bbfatal "COMPATIBLE_MACHINE requires a corressponding

do_deploy:<MACHINE>() override"

(quoted diff) +2 -0
+}
+

"""

Quoted 5 lines
Quoted 2 lines

with a proper explanation in the commit log, and then a commit that adds one for rk3568.

...and then another set for kirkstone, no doubt?

I don't have a personal need for supporting anything else other than RK3588 on kirkstone, so I will not be pushing for it. Therefore, this is a decision for you to make as a maintainer if you actively want people to do it as part of follow-up of commits to master branch, do it yourself or wait for people to contribute backports to kirkstone whenever they need them.

Cheers,
Quentin

#5 lore raw
Quoted 166 lines · Quentin Schulz

Hi Trevor,

Quoted 157 lines · Trevor Woerner
Quoted 156 lines · Quentin Schulz

Hi Trevor,

Quoted 113 lines · Trevor Woerner via lists.yoctoproject.org

Hi Anthony,

Thanks for working on this.

Quoted 30 lines · On Mon 2023-10-16 @ 09:43:45 PM, [email protected] wrote:

From: Anthony Davies <[email protected]>

Add support for the Radxa Rock 3A
https://wiki.radxa.com/Rock3/3a

The TF-A project does not currently have support for
the rk3568. Therefore, for the time-being, the only way to supply a TPL/DDR-init for the rk3568 is to use the closed-source rkbin binaries from Rockchip. If/when TF-A adds support for the rk3588 we can investigate switching.

recipes-bsp/rkbin/rockchip-rkbin_git.bb was modified to allow a machine override to allow both rk3568 and rk3588s to use differnet binary blobs

---
   README                                  |  1 +
   conf/machine/include/rk3568.inc         | 17 +++++++++++++++++
   conf/machine/rock-3a.conf               | 12 ++++++++++++
   recipes-bsp/rkbin/rockchip-rkbin_git.bb | 16 +++++++++++++++-
   recipes-bsp/u-boot/u-boot%.bbappend     |  5 +++++
   5 files changed, 50 insertions(+), 1 deletion(-)

create mode 100644 conf/machine/include/rk3568.inc create mode 100644 conf/machine/rock-3a.conf

README +0 -0
index 8104474..3357b47 100644

README Status of supported boards: · line 35

Quoted 4 lines
README +1 -0
@@ -32,6 +32,7 @@ Status of supported boards:
   		nanopi-r4s
   		rock-5b
   		nanopi-r2s
+    rock-3a

There's still an issue with indents/tabs.

Quoted 71 lines
README +0 -0
   	builds:
   		marsboard-rk3066
   		radxarock
conf/machine/include/rk3568.inc new file +17 -0
new file mode 100644
index 0000000..5382b58
@@ -0,0 +1,17 @@
+MACHINEOVERRIDES =. "rk3568:"
+DEFAULTTUNE ?= "cortexa55"
+
+require conf/machine/include/arm/armv8-2a/tune-cortexa55.inc
+require conf/machine/include/rockchip-defaults.inc
+require conf/machine/include/rockchip-wic.inc
+
+KBUILD_DEFCONFIG ?= "defconfig"
+KERNEL_FEATURES:append:rk3568 = " bsp/rockchip/remove-non-rockchip-arch-arm64.scc"
+KERNEL_CLASSES ??= "kernel-fitimage"
+KERNEL_IMAGETYPE ??= "fitImage"
+
+PREFERRED_PROVIDER_trusted-firmware-a = "rockchip-rkbin"
+PREFERRED_PROVIDER_optee-os = "rockchip-rkbin"
+
+UBOOT_SUFFIX ?= "itb"
+UBOOT_ENTRYPOINT ?= "0x06000000"
conf/machine/rock-3a.conf new file +12 -0
new file mode 100644
index 0000000..2ed83a3
@@ -0,0 +1,12 @@
+#@TYPE: Machine
+#@NAME: Radxa Rock 3a
+#@DESCRIPTION: ROCK3 is a series of Rockchip RK3566/RK3568 based
+#SBC(Single Board Computer) and Compute Module by Radxa.
+#https://wiki.radxa.com/Rock3
+
+require conf/machine/include/rk3568.inc
+
+KERNEL_DEVICETREE = "rockchip/rk3568-rock-3a.dtb"
+MACHINE_EXTRA_RRECOMMENDS += "kernel-modules"
+
+UBOOT_MACHINE = "rock-3a-rk3568_defconfig"
recipes-bsp/rkbin/rockchip-rkbin_git.bb +11 -1
index 7fefb01..ad5593c 100644
@@ -14,6 +14,7 @@ S = "${WORKDIR}/git"
   COMPATIBLE_MACHINE = ""
   COMPATIBLE_MACHINE:rk3588s = "rk3588s"
+COMPATIBLE_MACHINE:rk3568 = "rk3568"
   PACKAGE_ARCH = "${MACHINE_ARCH}"
@@ -25,7 +26,16 @@ do_install() {
   PACKAGES = "${PN}"
   ALLOW_EMPTY:${PN} = "1"
-do_deploy() {
+do_deploy:rk3568() {
+	# Prebuilt TF-A
+	install -m 644 ${S}/bin/rk35/rk3568_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3568.elf
+	# Prebuilt OPTEE-OS
+	install -m 644 ${S}/bin/rk35/rk3568_bl32_v*.bin ${DEPLOYDIR}/tee-rk3568.bin
+	# Prebuilt U-Boot TPL (DDR init)
+	install -m 644 ${S}/bin/rk35/rk3568_ddr_1560MHz_v1.18.bin ${DEPLOYDIR}/ddr-rk3568.bin
+}
+
+do_deploy:rk3588s() {
   	# Prebuilt TF-A
   	install -m 644 ${S}/bin/rk35/rk3588_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3588.elf
   	# Prebuilt OPTEE-OS
@@ -34,4 +44,8 @@ do_deploy() {
Quoted 9 lines

recipes-bsp/rkbin/rockchip-rkbin_git.bb do_deploy() { · line 50

Quoted 6 lines
recipes-bsp/rkbin/rockchip-rkbin_git.bb +4 -0
   	install -m 644 ${S}/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin ${DEPLOYDIR}/ddr-rk3588.bin
   }
+do_deploy() {
+  bbfatal "COMPATIBLE_MACHINE requires a corressponding do_deploy:<MACHINE>() override"
+}
+

This is not related to adding support for rock3a.

In a way it is, but would benefit in being in a different commit I agree.

So basically Anthony's issue (if I remember correctly) was that if you're not overriding the default do_deploy, the recipe will pass but install the wrong files with the wrong names, without telling you.

So instead, the thought was to make do_deploy fail by default (with bbfatal) unless it is overridden (e.g. for rk3588s and rk3568) so that people adding support for new SoCs don't wonder what's missing.

I could see a commit with a diff like:
"""

recipes-bsp/rkbin/rockchip-rkbin_git.bb +1 -1
-do_deploy() {
+do_deploy:rk3588s() {
    	# Prebuilt TF-A
    	install -m 644 ${S}/bin/rk35/rk3588_bl31_v*.elf

${DEPLOYDIR}/bl31-rk3588.elf
# Prebuilt OPTEE-OS

(quoted diff) +0 -0
@@ -34,4 +44,8 @@ do_deploy() {
   	install -m 644 ${S}/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin

${DEPLOYDIR}/ddr-rk3588.bin
}

(quoted diff) +2 -0
+do_deploy() {
+  bbfatal "COMPATIBLE_MACHINE requires a corressponding

do_deploy:<MACHINE>() override"

(quoted diff) +2 -0
+}
+

"""

Quoted 5 lines
Quoted 2 lines

with a proper explanation in the commit log, and then a commit that adds one for rk3568.

...and then another set for kirkstone, no doubt?

Quoted 5 lines

I don't have a personal need for supporting anything else other than RK3588 on kirkstone, so I will not be pushing for it. Therefore, this is a decision for you to make as a maintainer if you actively want people to do it as part of follow-up of commits to master branch, do it yourself or wait for people to contribute backports to kirkstone whenever they need them.

Okay, sounds good. I won't backport until/unless I know someone is interested. Also, rk3568 support is probably poor in kirkstone anyway (same as rk3588/s).

#6 lore raw
In reply to Quentin Schulz

Hi,

It is in that the rk3568 won't boot without rkbin and it needed to be modified to allow multiple machines to be able to have their own rkbin.

I never had a problem with not having the catchall, just old habits of never have a conditional without a catchall explaining the problem of getting there (if it should never get there)

Quoted 205 lines · Quentin Schulz

Hi Trevor,

Quoted 120 lines · Trevor Woerner via lists.yoctoproject.org

Hi Anthony,

Thanks for working on this.

Quoted 30 lines · On Mon 2023-10-16 @ 09:43:45 PM, [email protected] wrote:

From: Anthony Davies <[email protected]>

Add support for the Radxa Rock 3A
https://wiki.radxa.com/Rock3/3a

The TF-A project does not currently have support for
the rk3568. Therefore, for the time-being, the only way to supply a TPL/DDR-init for the rk3568 is to use the closed-source rkbin binaries from Rockchip. If/when TF-A adds support for the rk3588 we can investigate switching.

recipes-bsp/rkbin/rockchip-rkbin_git.bb was modified to allow a machine override to allow both rk3568 and rk3588s to use differnet binary blobs

---
  README                                  |  1 +
  conf/machine/include/rk3568.inc         | 17 +++++++++++++++++
  conf/machine/rock-3a.conf               | 12 ++++++++++++
  recipes-bsp/rkbin/rockchip-rkbin_git.bb | 16 +++++++++++++++-
  recipes-bsp/u-boot/u-boot%.bbappend     |  5 +++++
  5 files changed, 50 insertions(+), 1 deletion(-)

create mode 100644 conf/machine/include/rk3568.inc create mode 100644 conf/machine/rock-3a.conf

README +0 -0
index 8104474..3357b47 100644

README Status of supported boards: · line 35

Quoted 4 lines
README +1 -0
@@ -32,6 +32,7 @@ Status of supported boards:
             nanopi-r4s
             rock-5b
             nanopi-r2s
+    rock-3a

There's still an issue with indents/tabs.

Quoted 78 lines
README +0 -0
     builds:
             marsboard-rk3066
             radxarock
conf/machine/include/rk3568.inc new file +17 -0
new file mode 100644
index 0000000..5382b58
@@ -0,0 +1,17 @@
+MACHINEOVERRIDES =. "rk3568:"
+DEFAULTTUNE ?= "cortexa55"
+
+require conf/machine/include/arm/armv8-2a/tune-cortexa55.inc
+require conf/machine/include/rockchip-defaults.inc
+require conf/machine/include/rockchip-wic.inc
+
+KBUILD_DEFCONFIG ?= "defconfig"
+KERNEL_FEATURES:append:rk3568 = " bsp/rockchip/remove-non-rockchip-arch-arm64.scc"
+KERNEL_CLASSES ??= "kernel-fitimage"
+KERNEL_IMAGETYPE ??= "fitImage"
+
+PREFERRED_PROVIDER_trusted-firmware-a = "rockchip-rkbin"
+PREFERRED_PROVIDER_optee-os = "rockchip-rkbin"
+
+UBOOT_SUFFIX ?= "itb"
+UBOOT_ENTRYPOINT ?= "0x06000000"
conf/machine/rock-3a.conf new file +12 -0
new file mode 100644
index 0000000..2ed83a3
@@ -0,0 +1,12 @@
+#@TYPE: Machine
+#@NAME: Radxa Rock 3a
+#@DESCRIPTION: ROCK3 is a series of Rockchip RK3566/RK3568 based
+#SBC(Single Board Computer) and Compute Module by Radxa.
+#https://wiki.radxa.com/Rock3
+
+require conf/machine/include/rk3568.inc
+
+KERNEL_DEVICETREE = "rockchip/rk3568-rock-3a.dtb"
+MACHINE_EXTRA_RRECOMMENDS += "kernel-modules"
+
+UBOOT_MACHINE = "rock-3a-rk3568_defconfig"
recipes-bsp/rkbin/rockchip-rkbin_git.bb +11 -1
index 7fefb01..ad5593c 100644
@@ -14,6 +14,7 @@ S = "${WORKDIR}/git"
 
  COMPATIBLE_MACHINE = ""
  COMPATIBLE_MACHINE:rk3588s = "rk3588s"
+COMPATIBLE_MACHINE:rk3568 = "rk3568"
 
  PACKAGE_ARCH = "${MACHINE_ARCH}"
 
@@ -25,7 +26,16 @@ do_install() {
  PACKAGES = "${PN}"
  ALLOW_EMPTY:${PN} = "1"
 
-do_deploy() {
+do_deploy:rk3568() {
+    # Prebuilt TF-A
+    install -m 644 ${S}/bin/rk35/rk3568_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3568.elf
+    # Prebuilt OPTEE-OS
+    install -m 644 ${S}/bin/rk35/rk3568_bl32_v*.bin ${DEPLOYDIR}/tee-rk3568.bin
+    # Prebuilt U-Boot TPL (DDR init)
+    install -m 644 ${S}/bin/rk35/rk3568_ddr_1560MHz_v1.18.bin ${DEPLOYDIR}/ddr-rk3568.bin
+}
+
+do_deploy:rk3588s() {
     # Prebuilt TF-A
     install -m 644 ${S}/bin/rk35/rk3588_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3588.elf
     # Prebuilt OPTEE-OS
@@ -34,4 +44,8 @@ do_deploy() {
     install -m 644 ${S}/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin ${DEPLOYDIR}/ddr-rk3588.bin
  }
 
Quoted 7 lines

recipes-bsp/rkbin/rockchip-rkbin_git.bb do_deploy() { · line 50

Quoted 4 lines
recipes-bsp/rkbin/rockchip-rkbin_git.bb +4 -0
+do_deploy() {
+  bbfatal "COMPATIBLE_MACHINE requires a corressponding do_deploy:<MACHINE>() override"
+}
+

This is not related to adding support for rock3a.

In a way it is, but would benefit in being in a different commit I agree.

So basically Anthony's issue (if I remember correctly) was that if you're not overriding the default do_deploy, the recipe will pass but install the wrong files with the wrong names, without telling you.

So instead, the thought was to make do_deploy fail by default (with bbfatal) unless it is overridden (e.g. for rk3588s and rk3568) so that people adding support for new SoCs don't wonder what's missing.

I could see a commit with a diff like:
"""

recipes-bsp/rkbin/rockchip-rkbin_git.bb +1 -1
-do_deploy() {
+do_deploy:rk3588s() {
        # Prebuilt TF-A
        install -m 644 ${S}/bin/rk35/rk3588_bl31_v*.elf

${DEPLOYDIR}/bl31-rk3588.elf
# Prebuilt OPTEE-OS

(quoted diff) +0 -0
@@ -34,4 +44,8 @@ do_deploy() {
        install -m 644

${S}/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin ${DEPLOYDIR}/ddr-rk3588.bin
}

(quoted diff) +2 -0
+do_deploy() {
+  bbfatal "COMPATIBLE_MACHINE requires a corressponding

do_deploy:<MACHINE>() override"

(quoted diff) +2 -0
+}
+

"""

with a proper explanation in the commit log, and then a commit that adds one for rk3568.

Cheers,
Quentin

Quoted 36 lines
Quoted 36 lines
recipes-bsp/rkbin/rockchip-rkbin_git.bb +0 -0
  addtask deploy after do_install
recipes-bsp/u-boot/u-boot%.bbappend +5 -1
index e79c471..66c81da 100644
@@ -9,12 +9,17 @@ EXTRA_OEMAKE:append:rk3588s = " \
     BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3588.elf \
     ROCKCHIP_TPL=${DEPLOY_DIR_IMAGE}/ddr-rk3588.bin \
     "
+EXTRA_OEMAKE:append:rk3568 = " \
+    BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3568.elf \
+    ROCKCHIP_TPL=${DEPLOY_DIR_IMAGE}/ddr-rk3568.bin \
+    "
 
  INIT_FIRMWARE_DEPENDS ??= ""
  INIT_FIRMWARE_DEPENDS:px30 = " trusted-firmware-a:do_deploy"
  INIT_FIRMWARE_DEPENDS:rk3328 = " trusted-firmware-a:do_deploy"
  INIT_FIRMWARE_DEPENDS:rk3399 = " trusted-firmware-a:do_deploy"
  INIT_FIRMWARE_DEPENDS:rk3588s = " rockchip-rkbin:do_deploy"
+INIT_FIRMWARE_DEPENDS:rk3568 = " rockchip-rkbin:do_deploy"
  do_compile[depends] .= "${INIT_FIRMWARE_DEPENDS}"
 
  do_compile:append:rock2-square () {
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#61481): https://lists.yoctoproject.org/g/yocto/message/61481
Mute This Topic: https://lists.yoctoproject.org/mt/101992957/6293953
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#7 lore raw
In reply to [email protected]
Quoted 15 lines · On Mon 2023-10-16 @ 09:43:45 PM, [email protected] wrote:

From: Anthony Davies <[email protected]>

Add support for the Radxa Rock 3A
https://wiki.radxa.com/Rock3/3a

The TF-A project does not currently have support for
the rk3568. Therefore, for the time-being, the only way to supply a TPL/DDR-init for the rk3568 is to use the closed-source rkbin binaries from Rockchip. If/when TF-A adds support for the rk3588 we can investigate switching.

recipes-bsp/rkbin/rockchip-rkbin_git.bb was modified to allow a machine override to allow both rk3568 and rk3588s to use differnet binary blobs

Quoted 9 lines
---
 README                                  |  1 +
 conf/machine/include/rk3568.inc         | 17 +++++++++++++++++
 conf/machine/rock-3a.conf               | 12 ++++++++++++
 recipes-bsp/rkbin/rockchip-rkbin_git.bb | 16 +++++++++++++++-
 recipes-bsp/u-boot/u-boot%.bbappend     |  5 +++++
 5 files changed, 50 insertions(+), 1 deletion(-)
 create mode 100644 conf/machine/include/rk3568.inc
 create mode 100644 conf/machine/rock-3a.conf

Applied some form of this patch to meta-rockchip, master branch. Thanks!