Skip to contentSkip to conversation

rock-5b: add

PATCH Applied Trevor Woerner 2 participants 6 messages Sep 27, 2023 – Sep 29, 2023 Arm Rockchip

lore
Share & tools
lore
#0 lore raw

v4 cover rock-5b: add

Version 4 of the patch to add Radxa's Rock 5B.

v4:
- add a patch before the "rock 5b: add" patch to rename the U-Boot variables to not be TF-A specific
- clean up the U-Boot initial binary blob dependency variable name, the EXTRA_OEMAKE handling, and remove the rk3588's dependency on tf-a (which it does not have)

v3:
- change name from "rock5b" to "rock-5b", there seem to be more instances of the latter on the manufacturer's website than the former
- fix the MACHINEOVERRIDE in conf/machine/include/rk3588s.inc to be "rk3588s" and not "rk3588"

v2:
- fix the logic behind the MACHINEOVERRIDES to get the content, and ordering, correct
- improved the commit message around TF-A/rkbin
- correct Quentin's SoB line

Trevor Woerner (2):
u-boot: rename firmware dependency
rock-5b: add

 README                                        |  1 +
 conf/machine/include/rk3588.inc               |  6 ++
 conf/machine/include/rk3588s.inc              | 17 ++++
 conf/machine/rock-5b.conf                     | 12 +++
 recipes-bsp/rkbin/rockchip-rkbin_git.bb       | 37 ++++++++
 recipes-bsp/u-boot/u-boot%.bbappend           | 17 ++--
 recipes-kernel/linux/linux-yocto-dev.bbappend |  3 +
 .../rockchip/remove-non-rockchip-arch-arm.cfg | 85 +++++++++++++++++++
 .../rockchip/remove-non-rockchip-arch-arm.scc |  1 +
 .../remove-non-rockchip-arch-arm64.cfg        | 66 ++++++++++++++
 .../remove-non-rockchip-arch-arm64.scc        |  1 +
 11 files changed, 240 insertions(+), 6 deletions(-)
 create mode 100644 conf/machine/include/rk3588.inc
 create mode 100644 conf/machine/include/rk3588s.inc
 create mode 100644 conf/machine/rock-5b.conf
 create mode 100644 recipes-bsp/rkbin/rockchip-rkbin_git.bb
 create mode 100644 recipes-kernel/linux/linux-yocto-dev.bbappend
 create mode 100644 recipes-kernel/linux/linux-yocto-dev/rockchip-kmeta/bsp/rockchip/remove-non-rockchip-arch-arm.cfg
 create mode 100644 recipes-kernel/linux/linux-yocto-dev/rockchip-kmeta/bsp/rockchip/remove-non-rockchip-arch-arm.scc
 create mode 100644 recipes-kernel/linux/linux-yocto-dev/rockchip-kmeta/bsp/rockchip/remove-non-rockchip-arch-arm64.cfg
 create mode 100644 recipes-kernel/linux/linux-yocto-dev/rockchip-kmeta/bsp/rockchip/remove-non-rockchip-arch-arm64.scc
Signature · 1 line
2.41.0.327.gaa9166bcc0ba
#1 lore raw

PATCH v4 1/2 u-boot: rename firmware dependency

In anticipation of Rockchip SoC families to which the TF-A project has not been ported, the initial boot firmware needs to come from other sources (e.g. Rockchip's rkbin binaries). Update the variable used to describe this dependency to be more generic and not TF-A specific.

---
 recipes-bsp/u-boot/u-boot%.bbappend | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
recipes-bsp/u-boot/u-boot%.bbappend +5 -6
index db8e0166f5b3..050f55e124d4 100644
@@ -9,14 +9,13 @@ DEPENDS:append:rock-pi-4 = " gnutls-native"
 # various machines require the pyelftools library for parsing dtb files
 DEPENDS:append = " python3-pyelftools-native"
 
-ATF_DEPENDS ??= ""
+INIT_FIRMWARE_DEPENDS ??= ""
 
 EXTRA_OEMAKE:append:rk3399 = " BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3399.elf"
-ATF_DEPENDS:rk3399 = " trusted-firmware-a:do_deploy"
+INIT_FIRMWARE_DEPENDS:rk3399 = " trusted-firmware-a:do_deploy"
 EXTRA_OEMAKE:append:rk3328 = " BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3328.elf"
-ATF_DEPENDS:rk3328 = " trusted-firmware-a:do_deploy"
+INIT_FIRMWARE_DEPENDS:rk3328 = " trusted-firmware-a:do_deploy"
 EXTRA_OEMAKE:append:px30 = " BL31=${DEPLOY_DIR_IMAGE}/bl31-px30.elf"
-ATF_DEPENDS:px30 = " trusted-firmware-a:do_deploy"
-
-do_compile[depends] .= "${ATF_DEPENDS}"
+INIT_FIRMWARE_DEPENDS:px30 = " trusted-firmware-a:do_deploy"
 
+do_compile[depends] .= "${INIT_FIRMWARE_DEPENDS}"
Signature · 1 line
2.41.0.327.gaa9166bcc0ba
#2 lore raw

PATCH v4 2/2 rock-5b: add

In reply to Trevor Woerner

Add support for the Radxa Rock 5B
https://wiki.radxa.com/Rock5/5b

The device-tree for this board is better in the 6.5 (and later) kernels, therefore set the kernel to linux-yocto-dev for now (eventually this won't be needed as linux-yocto moves forward).

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

The rk3588 comes in two variants: rk3588 and rk3588s. The "s" option is a stripped-down version of the rk3588. In the Linux kernel these two SoCs are kept separate, with the rk3588 building on the rk3588s, so we've mimicked that same behaviour here.

---
 README                                        |  1 +
 conf/machine/include/rk3588.inc               |  6 ++
 conf/machine/include/rk3588s.inc              | 17 ++++
 conf/machine/rock-5b.conf                     | 12 +++
 recipes-bsp/rkbin/rockchip-rkbin_git.bb       | 37 ++++++++
 recipes-bsp/u-boot/u-boot%.bbappend           |  6 ++
 recipes-kernel/linux/linux-yocto-dev.bbappend |  3 +
 .../rockchip/remove-non-rockchip-arch-arm.cfg | 85 +++++++++++++++++++
 .../rockchip/remove-non-rockchip-arch-arm.scc |  1 +
 .../remove-non-rockchip-arch-arm64.cfg        | 66 ++++++++++++++
 .../remove-non-rockchip-arch-arm64.scc        |  1 +
 11 files changed, 235 insertions(+)
 create mode 100644 conf/machine/include/rk3588.inc
 create mode 100644 conf/machine/include/rk3588s.inc
 create mode 100644 conf/machine/rock-5b.conf
 create mode 100644 recipes-bsp/rkbin/rockchip-rkbin_git.bb
 create mode 100644 recipes-kernel/linux/linux-yocto-dev.bbappend
 create mode 100644 recipes-kernel/linux/linux-yocto-dev/rockchip-kmeta/bsp/rockchip/remove-non-rockchip-arch-arm.cfg
 create mode 100644 recipes-kernel/linux/linux-yocto-dev/rockchip-kmeta/bsp/rockchip/remove-non-rockchip-arch-arm.scc
 create mode 100644 recipes-kernel/linux/linux-yocto-dev/rockchip-kmeta/bsp/rockchip/remove-non-rockchip-arch-arm64.cfg
 create mode 100644 recipes-kernel/linux/linux-yocto-dev/rockchip-kmeta/bsp/rockchip/remove-non-rockchip-arch-arm64.scc
README +1 -0
index 286dafbe1020..d4576d73c636 100644
@@ -30,6 +30,7 @@ Status of supported boards:
 		vyasa-rk3288
 		firefly-rk3288
 		nanopi-r4s
+		rock-5b
 	builds:
 		marsboard-rk3066
 		radxarock
conf/machine/include/rk3588.inc new file +6 -0
new file mode 100644
index 000000000000..34f0627dc085
@@ -0,0 +1,6 @@
+MACHINEOVERRIDES =. "rk3588:"
+
+# the rk3588s is a "stripped-down" version of the rk3588
+# in the kernel's device-tree the rk3588 builds on top of the rk3588s
+# so anything that is valid for the rk3588s is valid for the rk3588
+require conf/machine/include/rk3588s.inc
conf/machine/include/rk3588s.inc new file +17 -0
new file mode 100644
index 000000000000..7bfc9474e96e
@@ -0,0 +1,17 @@
+MACHINEOVERRIDES =. "rk3588s:"
+DEFAULTTUNE ?= "cortexa76-cortexa55-crypto"
+
+require conf/machine/include/arm/armv8-2a/tune-cortexa76-cortexa55.inc
+require conf/machine/include/rockchip-defaults.inc
+require conf/machine/include/rockchip-wic.inc
+
+KBUILD_DEFCONFIG ?= "defconfig"
+KERNEL_FEATURES:append:rk3588s = " 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-5b.conf new file +12 -0
new file mode 100644
index 000000000000..d1371084becc
@@ -0,0 +1,12 @@
+#@TYPE: Machine
+#@NAME: Radxa Rock 5B
+#@DESCRIPTION: ROCK5 is the 5th generation of SBC designed by Radxa.
+#https://wiki.radxa.com/Rock5/5b
+
+require conf/machine/include/rk3588.inc
+
+PREFERRED_PROVIDER_virtual/kernel = "linux-yocto-dev"
+KERNEL_DEVICETREE = "rockchip/rk3588-rock-5b.dtb"
+MACHINE_EXTRA_RRECOMMENDS += "kernel-modules"
+
+UBOOT_MACHINE = "rock5b-rk3588_defconfig"
recipes-bsp/rkbin/rockchip-rkbin_git.bb new file +37 -0
new file mode 100644
index 000000000000..7fefb017053b
@@ -0,0 +1,37 @@
+DESCRIPTION = "Rockchip Firmware and Tool Binaries"
+LICENSE = "Proprietary"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=15faa4a01e7eb0f5d33f9f2bcc7bff62"
+
+SRC_URI = "git://github.com/rockchip-linux/rkbin;protocol=https;branch=master"
+SRCREV = "b4558da0860ca48bf1a571dd33ccba580b9abe23"
+
+PROVIDES += "trusted-firmware-a"
+PROVIDES += "optee-os"
+
+inherit bin_package deploy
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_MACHINE = ""
+COMPATIBLE_MACHINE:rk3588s = "rk3588s"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+do_install() {
+	# Nothing in this recipe is useful in a filesystem
+	:
+}
+
+PACKAGES = "${PN}"
+ALLOW_EMPTY:${PN} = "1"
+
+do_deploy() {
+	# Prebuilt TF-A
+	install -m 644 ${S}/bin/rk35/rk3588_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3588.elf
+	# Prebuilt OPTEE-OS
+	install -m 644 ${S}/bin/rk35/rk3588_bl32_v*.bin ${DEPLOYDIR}/tee-rk3588.bin
+	# Prebuilt U-Boot TPL (DDR init)
+	install -m 644 ${S}/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin ${DEPLOYDIR}/ddr-rk3588.bin
+}
+
+addtask deploy after do_install
recipes-bsp/u-boot/u-boot%.bbappend +6 -0
index 050f55e124d4..f7800625aaf1 100644
@@ -11,6 +11,12 @@ DEPENDS:append = " python3-pyelftools-native"
 
 INIT_FIRMWARE_DEPENDS ??= ""
 
+EXTRA_OEMAKE:append:rk3588s = " \
+	BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3588.elf \
+	ROCKCHIP_TPL=${DEPLOY_DIR_IMAGE}/ddr-rk3588.bin \
+	"
+INIT_FIRMWARE_DEPENDS:rk3588s = " rockchip-rkbin:do_deploy"
+
 EXTRA_OEMAKE:append:rk3399 = " BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3399.elf"
 INIT_FIRMWARE_DEPENDS:rk3399 = " trusted-firmware-a:do_deploy"
 EXTRA_OEMAKE:append:rk3328 = " BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3328.elf"
recipes-kernel/linux/linux-yocto-dev.bbappend new file +3 -0
new file mode 100644
index 000000000000..419ebc18b229
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+COMPATIBLE_MACHINE:rock-5b = "rock-5b"
+SRC_URI:append:rock-5b = " file://rockchip-kmeta;type=kmeta;name=rockchip-kmeta;destsuffix=rockchip-kmeta"
recipes-kernel/linux/linux-yocto-dev/rockchip-kmeta/bsp/rockchip/remove-non-rockchip-arch-arm.cfg new file +85 -0

85 lines not on this page · raw message

recipes-kernel/linux/linux-yocto-dev/rockchip-kmeta/bsp/rockchip/remove-non-rockchip-arch-arm.scc new file +1 -0
new file mode 100644
index 000000000000..ce7770456ea4
@@ -0,0 +1 @@
+kconf hardware remove-non-rockchip-arch-arm.cfg
recipes-kernel/linux/linux-yocto-dev/rockchip-kmeta/bsp/rockchip/remove-non-rockchip-arch-arm64.cfg new file +66 -0

66 lines not on this page · raw message

recipes-kernel/linux/linux-yocto-dev/rockchip-kmeta/bsp/rockchip/remove-non-rockchip-arch-arm64.scc new file +1 -0
new file mode 100644
index 000000000000..e169240f5067
@@ -0,0 +1 @@
+kconf hardware remove-non-rockchip-arch-arm64.cfg
Signature · 1 line
2.41.0.327.gaa9166bcc0ba
#3 lore raw

Hi Trevor,

On 9/27/23 04:42, Trevor Woerner wrote:
[...]

Quoted 48 lines
recipes-bsp/rkbin/rockchip-rkbin_git.bb new file +37 -0
new file mode 100644
index 000000000000..7fefb017053b
@@ -0,0 +1,37 @@
+DESCRIPTION = "Rockchip Firmware and Tool Binaries"
+LICENSE = "Proprietary"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=15faa4a01e7eb0f5d33f9f2bcc7bff62"
+
+SRC_URI = "git://github.com/rockchip-linux/rkbin;protocol=https;branch=master"
+SRCREV = "b4558da0860ca48bf1a571dd33ccba580b9abe23"
+
+PROVIDES += "trusted-firmware-a"
+PROVIDES += "optee-os"
+
+inherit bin_package deploy
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_MACHINE = ""
+COMPATIBLE_MACHINE:rk3588s = "rk3588s"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+do_install() {
+	# Nothing in this recipe is useful in a filesystem
+	:
+}
+
+PACKAGES = "${PN}"
+ALLOW_EMPTY:${PN} = "1"
+
+do_deploy() {
+	# Prebuilt TF-A
+	install -m 644 ${S}/bin/rk35/rk3588_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3588.elf
+	# Prebuilt OPTEE-OS
+	install -m 644 ${S}/bin/rk35/rk3588_bl32_v*.bin ${DEPLOYDIR}/tee-rk3588.bin
+	# Prebuilt U-Boot TPL (DDR init)
+	install -m 644 ${S}/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin ${DEPLOYDIR}/ddr-rk3588.bin
+}
+
+addtask deploy after do_install
recipes-bsp/u-boot/u-boot%.bbappend +0 -0
index 050f55e124d4..f7800625aaf1 100644

recipes-bsp/u-boot/u-boot%.bbappend DEPENDS:append = " python3-pyelftools-native" · line 19

Quoted 9 lines
recipes-bsp/u-boot/u-boot%.bbappend +6 -0
@@ -11,6 +11,12 @@ DEPENDS:append = " python3-pyelftools-native"
 
  INIT_FIRMWARE_DEPENDS ??= ""
 
+EXTRA_OEMAKE:append:rk3588s = " \
+	BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3588.elf \
+	ROCKCHIP_TPL=${DEPLOY_DIR_IMAGE}/ddr-rk3588.bin \
+	"
+INIT_FIRMWARE_DEPENDS:rk3588s = " rockchip-rkbin:do_deploy"
+

Mmmmmm thinking about this... I think we'll have a difficult time allowing rkbin for ddr.bin and upstream trusted-firmware-a from another recipe for bl31.elf because both would be installing the same bl31 file in the deploy directory. I guess we can postpone this problem until we have to handle it though because nothing comes to mind on how to handle this properly right now.

Cheers,
Quentin

#4 lore raw

Hi Quentin,

Quoted 58 lines · Quentin Schulz

Hi Trevor,

On 9/27/23 04:42, Trevor Woerner wrote:
[...]

Quoted 54 lines
recipes-bsp/rkbin/rockchip-rkbin_git.bb new file +37 -0
new file mode 100644
index 000000000000..7fefb017053b
@@ -0,0 +1,37 @@
+DESCRIPTION = "Rockchip Firmware and Tool Binaries"
+LICENSE = "Proprietary"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=15faa4a01e7eb0f5d33f9f2bcc7bff62"
+
+SRC_URI = "git://github.com/rockchip-linux/rkbin;protocol=https;branch=master"
+SRCREV = "b4558da0860ca48bf1a571dd33ccba580b9abe23"
+
+PROVIDES += "trusted-firmware-a"
+PROVIDES += "optee-os"
+
+inherit bin_package deploy
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_MACHINE = ""
+COMPATIBLE_MACHINE:rk3588s = "rk3588s"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+do_install() {
+	# Nothing in this recipe is useful in a filesystem
+	:
+}
+
+PACKAGES = "${PN}"
+ALLOW_EMPTY:${PN} = "1"
+
+do_deploy() {
+	# Prebuilt TF-A
+	install -m 644 ${S}/bin/rk35/rk3588_bl31_v*.elf ${DEPLOYDIR}/bl31-rk3588.elf
+	# Prebuilt OPTEE-OS
+	install -m 644 ${S}/bin/rk35/rk3588_bl32_v*.bin ${DEPLOYDIR}/tee-rk3588.bin
+	# Prebuilt U-Boot TPL (DDR init)
+	install -m 644 ${S}/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin ${DEPLOYDIR}/ddr-rk3588.bin
+}
+
+addtask deploy after do_install
recipes-bsp/u-boot/u-boot%.bbappend +5 -0
index 050f55e124d4..f7800625aaf1 100644
@@ -11,6 +11,12 @@ DEPENDS:append = " python3-pyelftools-native"
  INIT_FIRMWARE_DEPENDS ??= ""
+EXTRA_OEMAKE:append:rk3588s = " \
+	BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3588.elf \
+	ROCKCHIP_TPL=${DEPLOY_DIR_IMAGE}/ddr-rk3588.bin \
+	"
+INIT_FIRMWARE_DEPENDS:rk3588s = " rockchip-rkbin:do_deploy"
Quoted 8 lines

recipes-bsp/u-boot/u-boot%.bbappend DEPENDS:append = " python3-pyelftools-native" · line 17

Quoted 1 line
recipes-bsp/u-boot/u-boot%.bbappend +1 -0
+

Mmmmmm thinking about this... I think we'll have a difficult time allowing rkbin for ddr.bin and upstream trusted-firmware-a from another recipe for bl31.elf because both would be installing the same bl31 file in the deploy directory. I guess we can postpone this problem until we have to handle it though because nothing comes to mind on how to handle this properly right now.

If/when that time comes, we could tweak the do_install()s of rockchip-rkbin and/or tf-a to install or not install various pieces as required by the specific case.

Thanks for reviewing!

author Applied
#5 lore raw
In reply to Trevor Woerner
Quoted 38 lines · Trevor Woerner

Version 4 of the patch to add Radxa's Rock 5B.

v4:
- add a patch before the "rock 5b: add" patch to rename the U-Boot variables to not be TF-A specific
- clean up the U-Boot initial binary blob dependency variable name, the EXTRA_OEMAKE handling, and remove the rk3588's dependency on tf-a (which it does not have)

v3:
- change name from "rock5b" to "rock-5b", there seem to be more instances of the latter on the manufacturer's website than the former
- fix the MACHINEOVERRIDE in conf/machine/include/rk3588s.inc to be "rk3588s" and not "rk3588"

v2:
- fix the logic behind the MACHINEOVERRIDES to get the content, and ordering, correct
- improved the commit message around TF-A/rkbin
- correct Quentin's SoB line

Trevor Woerner (2):
u-boot: rename firmware dependency
rock-5b: add

 README                                        |  1 +
 conf/machine/include/rk3588.inc               |  6 ++
 conf/machine/include/rk3588s.inc              | 17 ++++
 conf/machine/rock-5b.conf                     | 12 +++
 recipes-bsp/rkbin/rockchip-rkbin_git.bb       | 37 ++++++++
 recipes-bsp/u-boot/u-boot%.bbappend           | 17 ++--
 recipes-kernel/linux/linux-yocto-dev.bbappend |  3 +
 .../rockchip/remove-non-rockchip-arch-arm.cfg | 85 +++++++++++++++++++
 .../rockchip/remove-non-rockchip-arch-arm.scc |  1 +
 .../remove-non-rockchip-arch-arm64.cfg        | 66 ++++++++++++++
 .../remove-non-rockchip-arch-arm64.scc        |  1 +
 11 files changed, 240 insertions(+), 6 deletions(-)
 create mode 100644 conf/machine/include/rk3588.inc
Quoted 8 lines
 create mode 100644 conf/machine/include/rk3588s.inc
 create mode 100644 conf/machine/rock-5b.conf
 create mode 100644 recipes-bsp/rkbin/rockchip-rkbin_git.bb
 create mode 100644 recipes-kernel/linux/linux-yocto-dev.bbappend
 create mode 100644 recipes-kernel/linux/linux-yocto-dev/rockchip-kmeta/bsp/rockchip/remove-non-rockchip-arch-arm.cfg
 create mode 100644 recipes-kernel/linux/linux-yocto-dev/rockchip-kmeta/bsp/rockchip/remove-non-rockchip-arch-arm.scc
 create mode 100644 recipes-kernel/linux/linux-yocto-dev/rockchip-kmeta/bsp/rockchip/remove-non-rockchip-arch-arm64.cfg
 create mode 100644 recipes-kernel/linux/linux-yocto-dev/rockchip-kmeta/bsp/rockchip/remove-non-rockchip-arch-arm64.scc

Applied to meta-rockchip, master branch.