rock5b: add
PATCH 1/1 rock5b: add
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).
The Trusted Firmware A project (TF-A git://git.trustedfirmware.org/TF-A)
does not currently support the rk3588, but patches are in review. For the time-being we're using the binary DDR/TPL initialization blob from
https://github.com/rockchip-linux/rkbin. Hopefully this can change if/when TF-A gains support for the rk3588.
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 | 8 ++ conf/machine/include/rk3588s-base.inc | 16 ++++ conf/machine/include/rk3588s.inc | 5 ++ conf/machine/rock5b.conf | 12 +++ recipes-bsp/rkbin/rockchip-rkbin_git.bb | 37 ++++++++ recipes-bsp/u-boot/u-boot%.bbappend | 5 ++ 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 + 12 files changed, 240 insertions(+) create mode 100644 conf/machine/include/rk3588.inc create mode 100644 conf/machine/include/rk3588s-base.inc create mode 100644 conf/machine/include/rk3588s.inc create mode 100644 conf/machine/rock5b.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
@@ -30,6 +30,7 @@ Status of supported boards: vyasa-rk3288 firefly-rk3288 nanopi-r4s + rock5b builds: marsboard-rk3066 radxarock
conf/machine/include/rk3588.inc new file +8 -0
@@ -0,0 +1,8 @@ +# 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 +MACHINEOVERRIDES =. "rk3588:rk3588s:" +require conf/machine/include/rk3588s-base.inc + +SOC_FAMILY = "rk3588" +require conf/machine/include/soc-family.inc
conf/machine/include/rk3588s-base.inc new file +16 -0
@@ -0,0 +1,16 @@ +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:rk3588 = " 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/include/rk3588s.inc new file +5 -0
@@ -0,0 +1,5 @@ +MACHINEOVERRIDES =. "rk3588s:" +require conf/machine/include/rk3588s-base.inc + +SOC_FAMILY = "rk3588s" +require conf/machine/include/soc-family.inc
conf/machine/rock5b.conf new file +12 -0
@@ -0,0 +1,12 @@ +#@TYPE: Machine +#@NAME: Radxa Rock5b +#@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
@@ -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
@@ -11,6 +11,11 @@ DEPENDS:append = " python3-pyelftools-native" ATF_DEPENDS ??= "" +EXTRA_OEMAKE:append:rk3588s = " BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3588.elf" +ATF_DEPENDS:append:rk3588s = " trusted-firmware-a:do_deploy" +EXTRA_OEMAKE:append:rk3588s = " ROCKCHIP_TPL=${DEPLOY_DIR_IMAGE}/ddr-rk3588.bin" +ATF_DEPENDS:append:rk3588s = " rockchip-rkbin:do_deploy" + EXTRA_OEMAKE:append:rk3399 = " BL31=${DEPLOY_DIR_IMAGE}/bl31-rk3399.elf" ATF_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
@@ -0,0 +1,3 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" +COMPATIBLE_MACHINE:rock5b = "rock5b" +SRC_URI:append:rock5b = " 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
@@ -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
@@ -0,0 +1 @@ +kconf hardware remove-non-rockchip-arch-arm64.cfg
Signature · 1 line
2.41.0.327.gaa9166bcc0ba
Hi Trevor,
Looking good :) Thanks for looking into it, will be helpful to me in the upcoming weeks/months :)
Quoted 7 lines · Trevor Woerner via lists.yoctoproject.org
Add support for the Radxa Rock 5B
https://wiki.radxa.com/Rock5/5bThe 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).
Quoted 6 lines
The Trusted Firmware A project (TF-A
git://git.trustedfirmware.org/TF-A)
does not currently support the rk3588, but patches are in review. For the time-being we're using the binary DDR/TPL initialization blob from
https://github.com/rockchip-linux/rkbin. Hopefully this can change if/when TF-A gains support for the rk3588.
Because it's closed source, I cannot tell if DDR binary is based off TF-A but I would say it's likely not? It's fine like this but not entirely sure it's true.
Quoted 6 lines
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.
Signed-off-by Quentin Schulz <[email protected]>
I may have improperly wrote this in the github commit I sent you, but my professional mail address is:
[email protected]
:)
Quoted 44 lines
Signed-off-by Trevor Woerner <[email protected]>--- README | 1 + conf/machine/include/rk3588.inc | 8 ++ conf/machine/include/rk3588s-base.inc | 16 ++++ conf/machine/include/rk3588s.inc | 5 ++ conf/machine/rock5b.conf | 12 +++ recipes-bsp/rkbin/rockchip-rkbin_git.bb | 37 ++++++++ recipes-bsp/u-boot/u-boot%.bbappend | 5 ++ 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 + 12 files changed, 240 insertions(+)create mode 100644 conf/machine/include/rk3588.inc
create mode 100644 conf/machine/include/rk3588s-base.inc
create mode 100644 conf/machine/include/rk3588s.inc
create mode 100644conf/machine/rock5b.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.sccREADME +1
-0@@ -30,6 +30,7 @@ Status of supported boards: vyasa-rk3288 firefly-rk3288 nanopi-r4s + rock5b builds: marsboard-rk3066 radxarockconf/machine/include/rk3588.inc new file +0
-0
conf/machine/include/rk3588.inc line 4
Quoted 4 lines
conf/machine/include/rk3588.inc new file +4
-0@@ -0,0 +1,8 @@ +# 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 +MACHINEOVERRIDES =. "rk3588:rk3588s:"
This is incorrect, this makes rk3588s have precedence over rk3588, which is wrong for rk3588-based devices. Why not have MACHINEOVERRIDES for rk3588s in rk3588s-base.inc instead?
conf/machine/include/rk3588.inc line 8
Quoted 4 lines
conf/machine/include/rk3588.inc new file +4
-0+require conf/machine/include/rk3588s-base.inc + +SOC_FAMILY = "rk3588" +require conf/machine/include/soc-family.inc
The two lines above actually do MACHINEOVERRIDES =. "rk3588" so we don't need to repeat it.
Quoted 28 lines
conf/machine/include/rk3588s-base.inc new file +16
-0@@ -0,0 +1,16 @@ +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:rk3588 = " 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/include/rk3588s.inc new file +0
-0
conf/machine/include/rk3588s.inc line 1
Quoted 1 line
conf/machine/include/rk3588s.inc new file +1
-0@@ -0,0 +1,5 @@ +MACHINEOVERRIDES =. "rk3588s:"
Maybe we could move this directly to the -base.inc so we don't add it in rk3588.inc and rk3588s.inc?
To verify the MACHINEOVERRIDES is correct, I highly suggest to run:
"""
bitbake-getvar MACHINEOVERRIDES
"""
this variable is read from right to left, with the highest precedence on the right side.
So we should have something like:
"""
aarch64:rk3588s:rk3588:rock5b
aarch64:rk3588s:orangepi5
"""
for example.
Now also wondering if we shouldn't add "rockchip" to MACHINEOVERRIDES, which would make things a bit easier for COMPATIBLE_MACHINE in rockchip-rkbin (though not really useful).
Quoted 54 lines
conf/machine/include/rk3588s.inc new file +4
-0+require conf/machine/include/rk3588s-base.inc + +SOC_FAMILY = "rk3588s" +require conf/machine/include/soc-family.incconf/machine/rock5b.conf new file +12
-0@@ -0,0 +1,12 @@ +#@TYPE: Machine +#@NAME: Radxa Rock5b +#@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 +26
-0@@ -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"
recipes-bsp/rkbin/rockchip-rkbin_git.bb line 36
Quoted 10 lines
recipes-bsp/rkbin/rockchip-rkbin_git.bb new file +10
-0+ +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
Regarding the topic of adding support for more SoCs you brought up on IRC, we either need to have multiple deploy, e.g.
"""
do_deploy:rk3588s() {
install ...
}
do_deploy:rk3308() {
install ...
}
do_deploy() {
# Required because addtask needs to be able to run regardless ofCOMPATIBLE_MACHINE I believe?
: }
"""
or abstract the paths to instlal in variables, e.g.
"""
RKBIN_BL31:rk3588s = "rk35/rk3588_bl31_v*.elf"
RKBIN_BL31_INSTALLED:rk3588s = "bl31-rk3588.elf"
RKBIN_BL31:rk3308 = "rk33/rk3308_bl31_v*.elf"
RKBIN_BL31_INSTALLED:rk3308 = "bl31-rk3308.elf"
RKBIN_BL32:rk3588s = "rk35/rk3588_bl32_v*.bin"
RKBIN_BL32_INSTALLED:rk3588s = "tee-rk3588.bin"
RKBIN_BL32:rk3308 = "rk33/rk3308_bl32_v*.bin"
RKBIN_BL32_INSTALLED:rk3308 = "tee-rk3308.bin"
RKBIN_DDR:rk3588s = "rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin" RKBIN_DDR_INSTALLED:rk3588s = "ddr-rk3588.bin"
RKBIN_DDR:rk3308 = "rk33/rk3308_ddr_589MHz_uart4_m0_v*.bin" RKBIN_DDR_INSTALLED:rk3308 = "ddr-rk3308.bin"
do_deploy() {
# Prebuilt TF-A
install -m 644 ${S}/bin/${RKBIN_BL31} ${DEPLOYDIR}/${RKBIN_BL31_INSTALLED}
# Prebuilt OPTEE-OS
install -m 644 ${S}/bin/${RKBIN_BL32} ${DEPLOYDIR}/${RKBIN_BL32_INSTALLED}
# Prebuilt U-Boot TPL (DDR init)
install -m 644 ${S}/bin/${RKBIN_DDR} ${DEPLOYDIR}/${RKBIN_DDR_INSTALLED}
}"""
we could also simplify it by doing some educated guess:
"""
# In rkbin, rk3588s uses rk3588-prefixed binaries SOC_FAMILY:rk3588s = "rk3588" SHORT_SOC_FAMILY = "${@d.getVar("SOC_FAMILY")[:2]}"
RKBIN_BL31 = "${SHORT_SOC_FAMILY}/${SOC_FAMILY}_bl31_v*.elf" RKBIN_BL31_INSTALLED = "bl31-${SOC_FAMILY}.elf" RKBIN_BL32 = "${SHORT_SOC_FAMILY}/${SOC_FAMILY}_bl32_v*.bin" RKBIN_BL32_INSTALLED = "tee-${SOC_FAMILY}.bin" RKBIN_DDR_INSTALLED = "ddr-${SOC_FAMILY}.bin"
# We only want one match of this glob and they are difficult to guess based on SoC only RKBIN_DDR:rk3308 = "rk3308_ddr_589MHz_uart4_m0_v*.bin"
RKBIN_DDR:rk3588s = "rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin"
do_deploy() {
# Prebuilt TF-A
install -m 644 ${S}/bin/${SHORT_SOC_FAMILY}/${RKBIN_BL31}
${DEPLOYDIR}/${RKBIN_BL31_INSTALLED}
# Prebuilt OPTEE-OS
install -m 644 ${S}/bin/${SHORT_SOC_FAMILY}/${RKBIN_BL32}
${DEPLOYDIR}/${RKBIN_BL32_INSTALLED}
# Prebuilt U-Boot TPL (DDR init)
install -m 644 ${S}/bin/${SHORT_SOC_FAMILY}/${RKBIN_DDR} ${DEPLOYDIR}/${RKBIN_DDR_INSTALLED}
}
"""
Cheers,
Quentin
Quoted 20 lines · Quentin Schulz
Hi Trevor,
Looking good :) Thanks for looking into it, will be helpful to me in the upcoming weeks/months :)
Quoted 7 lines · Trevor Woerner via lists.yoctoproject.org
Add support for the Radxa Rock 5B
https://wiki.radxa.com/Rock5/5bThe 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).
Quoted 6 lines
The Trusted Firmware A project (TF-A
git://git.trustedfirmware.org/TF-A)
does not currently support the rk3588, but patches are in review. For the time-being we're using the binary DDR/TPL initialization blob from
https://github.com/rockchip-linux/rkbin. Hopefully this can change if/when TF-A gains support for the rk3588.
Quoted 3 lines
Because it's closed source, I cannot tell if DDR binary is based off TF-A but I would say it's likely not? It's fine like this but not entirely sure it's true.
Does this sound like I believe the binary blob is based on TF-A? If so I'll need to reword. I'm literally trying to say the opposite. I.e. we can't use TF-A yet so we're stuck using the blob... for now.
Quoted 11 lines
Quoted 6 lines
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.
Signed-off-by Quentin Schulz <[email protected]>I may have improperly wrote this in the github commit I sent you, but my professional mail address is:
[email protected]
:)
lol, I was wondering why that bounced.
Quoted 103 lines
Quoted 45 lines
Signed-off-by Trevor Woerner <[email protected]>--- README | 1 + conf/machine/include/rk3588.inc | 8 ++ conf/machine/include/rk3588s-base.inc | 16 ++++ conf/machine/include/rk3588s.inc | 5 ++ conf/machine/rock5b.conf | 12 +++ recipes-bsp/rkbin/rockchip-rkbin_git.bb | 37 ++++++++ recipes-bsp/u-boot/u-boot%.bbappend | 5 ++ 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 + 12 files changed, 240 insertions(+)create mode 100644 conf/machine/include/rk3588.inc
create mode 100644 conf/machine/include/rk3588s-base.inc
create mode 100644 conf/machine/include/rk3588s.inc
create mode 100644conf/machine/rock5b.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.sccREADME +1
-0@@ -30,6 +30,7 @@ Status of supported boards: vyasa-rk3288 firefly-rk3288 nanopi-r4s + rock5b builds: marsboard-rk3066 radxarockconf/machine/include/rk3588.inc new file +0
-0conf/machine/include/rk3588.inc line 4
Quoted 4 lines
conf/machine/include/rk3588.inc new file +4
-0@@ -0,0 +1,8 @@ +# 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 +MACHINEOVERRIDES =. "rk3588:rk3588s:"This is incorrect, this makes rk3588s have precedence over rk3588, which is wrong for rk3588-based devices. Why not have MACHINEOVERRIDES for rk3588s in rk3588s-base.inc instead?
conf/machine/include/rk3588.inc line 8
Quoted 4 lines
conf/machine/include/rk3588.inc new file +4
-0+require conf/machine/include/rk3588s-base.inc + +SOC_FAMILY = "rk3588" +require conf/machine/include/soc-family.incThe two lines above actually do MACHINEOVERRIDES =. "rk3588" so we don't need to repeat it.
Quoted 28 lines
conf/machine/include/rk3588s-base.inc new file +16
-0@@ -0,0 +1,16 @@ +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:rk3588 = " 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/include/rk3588s.inc new file +0
-0conf/machine/include/rk3588s.inc line 1
Quoted 1 line
conf/machine/include/rk3588s.inc new file +1
-0@@ -0,0 +1,5 @@ +MACHINEOVERRIDES =. "rk3588s:"Maybe we could move this directly to the -base.inc so we don't add it in rk3588.inc and rk3588s.inc?
To verify the MACHINEOVERRIDES is correct, I highly suggest to run:
"""
bitbake-getvar MACHINEOVERRIDES
"""this variable is read from right to left, with the highest precedence on the right side.
Quoted 6 lines
So we should have something like:
"""
aarch64:rk3588s:rk3588:rock5b
aarch64:rk3588s:orangepi5
"""
for example.
I spent quite a while checking MACHINEOVERRIDES and SOC_FAMILY with many variations until I was able to get exactly what you've just said we should be getting.
MACHINE="rock5b"
$ meta-rockchip> bitbake core-image-base -e | grep "^MACHINEOVERRIDES=" MACHINEOVERRIDES="rk3588:aarch64:armv8-2a:cortexa76-cortexa55:rk3588:rk3588s:rock5b" $ meta-rockchip> bitbake core-image-base -e | grep "^SOC_FAMILY=" SOC_FAMILY="rk3588"
MACHINE="orangepi5"
$ meta-rockchip> bitbake core-image-base -e | grep "^MACHINEOVERRIDES=" MACHINEOVERRIDES="rk3588s:aarch64:armv8-2a:cortexa76-cortexa55:rk3588s:orangepi5" $ meta-rockchip> bitbake core-image-base -e | grep "^SOC_FAMILY=" SOC_FAMILY="rk3588s"
Quoted 4 lines
Now also wondering if we shouldn't add "rockchip" to MACHINEOVERRIDES, which would make things a bit easier for
COMPATIBLE_MACHINEin rockchip-rkbin (though not really useful).
I've thought of adding a "rockchip" MACHINEOVERRIDES several times.
Quoted 77 lines
Quoted 54 lines
conf/machine/include/rk3588s.inc new file +4
-0+require conf/machine/include/rk3588s-base.inc + +SOC_FAMILY = "rk3588s" +require conf/machine/include/soc-family.incconf/machine/rock5b.conf new file +12
-0@@ -0,0 +1,12 @@ +#@TYPE: Machine +#@NAME: Radxa Rock5b +#@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 +26
-0@@ -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"recipes-bsp/rkbin/rockchip-rkbin_git.bb line 36
Quoted 10 lines
recipes-bsp/rkbin/rockchip-rkbin_git.bb new file +10
-0+ +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_installRegarding the topic of adding support for more SoCs you brought up on IRC, we either need to have multiple deploy, e.g.
"""
do_deploy:rk3588s() { install ... }do_deploy:rk3308() { install ... }
Quoted 6 lines
do_deploy(){
# Required because addtask needs to be able to run regardless ofCOMPATIBLE_MACHINEI believe?: }"""
Oh, I'll have to test the above. I know that simply doing:
do_deploy:rk3588() {
}by itself doesn't work; causes:
do_deploy not defined
Quoted 1 line
or abstract the paths to instlal in variables, e.g.
This is probably what we'll need to do. I'd prefer the do_deploy() overrides, but we'll have to do this if the other doesn't work.
Quoted 66 lines
"""
RKBIN_BL31:rk3588s = "rk35/rk3588_bl31_v*.elf"
RKBIN_BL31_INSTALLED:rk3588s = "bl31-rk3588.elf"RKBIN_BL31:rk3308 = "rk33/rk3308_bl31_v*.elf"
RKBIN_BL31_INSTALLED:rk3308 = "bl31-rk3308.elf"RKBIN_BL32:rk3588s = "rk35/rk3588_bl32_v*.bin"
RKBIN_BL32_INSTALLED:rk3588s = "tee-rk3588.bin"RKBIN_BL32:rk3308 = "rk33/rk3308_bl32_v*.bin"
RKBIN_BL32_INSTALLED:rk3308 = "tee-rk3308.bin"RKBIN_DDR:rk3588s = "rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin" RKBIN_DDR_INSTALLED:rk3588s = "ddr-rk3588.bin"
RKBIN_DDR:rk3308 = "rk33/rk3308_ddr_589MHz_uart4_m0_v*.bin" RKBIN_DDR_INSTALLED:rk3308 = "ddr-rk3308.bin"
do_deploy() { # Prebuilt TF-A install -m 644 ${S}/bin/${RKBIN_BL31} ${DEPLOYDIR}/${RKBIN_BL31_INSTALLED} # Prebuilt OPTEE-OS install -m 644 ${S}/bin/${RKBIN_BL32} ${DEPLOYDIR}/${RKBIN_BL32_INSTALLED} # Prebuilt U-Boot TPL (DDR init) install -m 644 ${S}/bin/${RKBIN_DDR} ${DEPLOYDIR}/${RKBIN_DDR_INSTALLED} }"""
we could also simplify it by doing some educated guess:
"""
# In rkbin, rk3588s uses rk3588-prefixed binaries SOC_FAMILY:rk3588s = "rk3588"
SHORT_SOC_FAMILY= "${@d.getVar("SOC_FAMILY")[:2]}"
RKBIN_BL31= "${SHORT_SOC_FAMILY}/${SOC_FAMILY}_bl31_v*.elf"RKBIN_BL31_INSTALLED= "bl31-${SOC_FAMILY}.elf"RKBIN_BL32= "${SHORT_SOC_FAMILY}/${SOC_FAMILY}_bl32_v*.bin"RKBIN_BL32_INSTALLED= "tee-${SOC_FAMILY}.bin"RKBIN_DDR_INSTALLED= "ddr-${SOC_FAMILY}.bin"# We only want one match of this glob and they are difficult to guess based on SoC only
RKBIN_DDR:rk3308 = "rk3308_ddr_589MHz_uart4_m0_v*.bin" RKBIN_DDR:rk3588s = "rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v*.bin"do_deploy() { # Prebuilt TF-A install -m 644 ${S}/bin/${SHORT_SOC_FAMILY}/${RKBIN_BL31} ${DEPLOYDIR}/${RKBIN_BL31_INSTALLED} # Prebuilt OPTEE-OS install -m 644 ${S}/bin/${SHORT_SOC_FAMILY}/${RKBIN_BL32} ${DEPLOYDIR}/${RKBIN_BL32_INSTALLED} # Prebuilt U-Boot TPL (DDR init) install -m 644 ${S}/bin/${SHORT_SOC_FAMILY}/${RKBIN_DDR}${DEPLOYDIR}/${RKBIN_DDR_INSTALLED}
}"""
Cheers,
Quentin
Hi Trevor,
Quoted 21 lines · Trevor Woerner
Quoted 20 lines · Quentin Schulz
Hi Trevor,
Looking good :) Thanks for looking into it, will be helpful to me in the upcoming weeks/months :)
Quoted 13 lines · Trevor Woerner via lists.yoctoproject.org
Add support for the Radxa Rock 5B
https://wiki.radxa.com/Rock5/5bThe 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).
The Trusted Firmware A project (TF-A
git://git.trustedfirmware.org/TF-A)
does not currently support the rk3588, but patches are in review. For the time-being we're using the binary DDR/TPL initialization blob from
https://github.com/rockchip-linux/rkbin. Hopefully this can change if/when TF-A gains support for the rk3588.
Quoted 8 lines
Quoted 3 lines
Because it's closed source, I cannot tell if DDR binary is based off TF-A but I would say it's likely not? It's fine like this but not entirely sure it's true.
Does this sound like I believe the binary blob is based on TF-A? If so I'll need to reword. I'm literally trying to say the opposite. I.e. we can't use TF-A yet so we're stuck using the blob... for now.
I can suggest:
"""
The upstream Trusted Firmware A project (TF-A git://git.trustedfirmware.org/TF-A) does not currently support the rk3588, but patches are in review. Until it gains support, we are stuck with blob provided by Rockchip in <rockchip-rkbin link>. Similarly, U-Boot doesn't have support for DDR initialization on rk3588 yet and only a blob has been provided by Rockchip in <rockchip-rkbin link>, so we've no choice but use that one until proper DDR init is added to U-Boot upstream. """
what do you think?
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
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.
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
Signed-off-by Quentin Schulz <[email protected]>I may have improperly wrote this in the github commit I sent you, but my professional mail address is:
[email protected]
:)lol, I was wondering why that bounced.
Mystery solved :)
Quoted 120 lines
Quoted 103 lines
Quoted 45 lines
Signed-off-by Trevor Woerner <[email protected]>--- README | 1 + conf/machine/include/rk3588.inc | 8 ++ conf/machine/include/rk3588s-base.inc | 16 ++++ conf/machine/include/rk3588s.inc | 5 ++ conf/machine/rock5b.conf | 12 +++ recipes-bsp/rkbin/rockchip-rkbin_git.bb | 37 ++++++++ recipes-bsp/u-boot/u-boot%.bbappend | 5 ++ 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 + 12 files changed, 240 insertions(+)create mode 100644 conf/machine/include/rk3588.inc
create mode 100644 conf/machine/include/rk3588s-base.inc
create mode 100644 conf/machine/include/rk3588s.inc
create mode 100644conf/machine/rock5b.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.sccREADME +1
-0@@ -30,6 +30,7 @@ Status of supported boards: vyasa-rk3288 firefly-rk3288 nanopi-r4s + rock5b builds: marsboard-rk3066 radxarockconf/machine/include/rk3588.inc new file +0
-0conf/machine/include/rk3588.inc line 4
Quoted 4 lines
conf/machine/include/rk3588.inc new file +4
-0@@ -0,0 +1,8 @@ +# 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 +MACHINEOVERRIDES =. "rk3588:rk3588s:"This is incorrect, this makes rk3588s have precedence over rk3588, which is wrong for rk3588-based devices. Why not have MACHINEOVERRIDES for rk3588s in rk3588s-base.inc instead?
conf/machine/include/rk3588.inc line 8
Quoted 4 lines
conf/machine/include/rk3588.inc new file +4
-0+require conf/machine/include/rk3588s-base.inc + +SOC_FAMILY = "rk3588" +require conf/machine/include/soc-family.incThe two lines above actually do MACHINEOVERRIDES =. "rk3588" so we don't need to repeat it.
Quoted 28 lines
conf/machine/include/rk3588s-base.inc new file +16
-0@@ -0,0 +1,16 @@ +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:rk3588 = " 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/include/rk3588s.inc new file +0
-0conf/machine/include/rk3588s.inc line 1
Quoted 1 line
conf/machine/include/rk3588s.inc new file +1
-0@@ -0,0 +1,5 @@ +MACHINEOVERRIDES =. "rk3588s:"Maybe we could move this directly to the -base.inc so we don't add it in rk3588.inc and rk3588s.inc?
To verify the MACHINEOVERRIDES is correct, I highly suggest to run:
"""
bitbake-getvar MACHINEOVERRIDES
"""this variable is read from right to left, with the highest precedence on the right side.
Quoted 6 lines
So we should have something like:
"""
aarch64:rk3588s:rk3588:rock5b
aarch64:rk3588s:orangepi5
"""
for example.I spent quite a while checking MACHINEOVERRIDES and
SOC_FAMILYwith many variations until I was able to get exactly what you've just said we should be getting.MACHINE="rock5b"
$ meta-rockchip> bitbake core-image-base -e | grep "^MACHINEOVERRIDES=" MACHINEOVERRIDES="rk3588:aarch64:armv8-2a:cortexa76-cortexa55:rk3588:rk3588s:rock5b" $ meta-rockchip> bitbake core-image-base -e | grep "^SOC_FAMILY=" SOC_FAMILY="rk3588"
Quoted 5 lines
MACHINE="orangepi5"
$ meta-rockchip> bitbake core-image-base -e | grep "^MACHINEOVERRIDES=" MACHINEOVERRIDES="rk3588s:aarch64:armv8-2a:cortexa76-cortexa55:rk3588s:orangepi5" $ meta-rockchip> bitbake core-image-base -e | grep "^SOC_FAMILY=" SOC_FAMILY="rk3588s"
We're still not there yet
rk3588:aarch64:armv8-2a:cortexa76-cortexa55:rk3588:rk3588s:rock5b"
is incorrect
it should be
aarch64:armv8-2a:cortexa76-cortexa55:rk3588s:rk3588:rock5b
similarly for orangepi5 we should have
aarch64:armv8-2a:cortexa76-cortexa55:rk3588s:orangepi5
Could you run with bitbake-getvar so we have the whole history of the variable so we know when things are added and in which file? I remember I had to patch a qemu include in poky because it was incorrect maybe somehow some other layer have it messed up too (or maybe only meta-rockchip for now :) ).
Cheers,
QUentin
Quoted 18 lines · Trevor Woerner
Quoted 6 lines · Quentin Schulz
So we should have something like:
"""
aarch64:rk3588s:rk3588:rock5b
aarch64:rk3588s:orangepi5
"""
for example.I spent quite a while checking MACHINEOVERRIDES and
SOC_FAMILYwith many variations until I was able to get exactly what you've just said we should be getting.MACHINE="rock5b"
$ meta-rockchip> bitbake core-image-base -e | grep "^MACHINEOVERRIDES=" MACHINEOVERRIDES="rk3588:aarch64:armv8-2a:cortexa76-cortexa55:rk3588:rk3588s:rock5b" $ meta-rockchip> bitbake core-image-base -e | grep "^SOC_FAMILY=" SOC_FAMILY="rk3588"
Quoted 5 lines
MACHINE="orangepi5"
$ meta-rockchip> bitbake core-image-base -e | grep "^MACHINEOVERRIDES=" MACHINEOVERRIDES="rk3588s:aarch64:armv8-2a:cortexa76-cortexa55:rk3588s:orangepi5" $ meta-rockchip> bitbake core-image-base -e | grep "^SOC_FAMILY=" SOC_FAMILY="rk3588s"
Ah, ordering not just content.
Okay, I'll spin a v2.