board/radxa/rock5b: Add sdcard image scripts
Hi Kilian,
Quoted 65 lines · Kilian Zinnecker
This patch adds post image scripts, generating an sdcard.img file, which can be flashed on an SD card to boot the Radxa Rock 5B.
Signed-off-by Kilian Zinnecker <[email protected]>--- board/radxa/rock5b/genimage.cfg | 36 ++++++++++++++++++++++++ board/radxa/rock5b/post-image.sh | 24 ++++++++++++++++ board/radxa/rock5b/rock5b.its | 46 +++++++++++++++++++++++++++++++ board/radxa/rock5b/uboot.fragment | 3 ++ configs/rock5b_defconfig | 4 +++ 5 files changed, 113 insertions(+) create mode 100644 board/radxa/rock5b/genimage.cfg create mode 100755 board/radxa/rock5b/post-image.sh create mode 100644 board/radxa/rock5b/rock5b.its create mode 100644 board/radxa/rock5b/uboot.fragmentboard/radxa/rock5b/genimage.cfg new file +36
-0@@ -0,0 +1,36 @@ +# SD card image for Radxa Rock 5b + +image boot.vfat { + vfat { + file image.itb { + image = "image.itb" + } + } + size = 16M +} + +image sdcard.img { + hdimage { + partition-table-type = "hybrid" + } + + partition uboot { + in-partition-table = "false" + image = "u-boot-rockchip.bin" + offset = 32K + size = 12M + } + + partition boot { + partition-type = "0xC" + bootable = "true" + image = "boot.vfat" + offset = 64M + } + + partition rootfs { + partition-type = 0x83 + image = "rootfs.ext2" + offset = 96M + } +}board/radxa/rock5b/post-image.sh new file +0
-0
board/radxa/rock5b/post-image.sh line 8
Quoted 8 lines
board/radxa/rock5b/post-image.sh new file +8
-0@@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +GENIMAGE_CFG="$(dirname $0)/genimage.cfg" +GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" + +# genimage needs u-boot-rockchip.bin + +cp output/build/uboot-2023.07-rc4/u-boot-rockchip.bin ${BINARIES_DIR}/
^^^^^^^^^^^^
This should be $BUILD_DIR, otherwise the build fails in a BR2_EXTERNAL environment.
Quoted 104 lines
board/radxa/rock5b/post-image.sh new file +16
-0+ +gzip -fk ${BINARIES_DIR}/Image +cp board/radxa/rock5b/rock5b.its ${BINARIES_DIR} +(cd $BINARIES_DIR && mkimage -f rock5b.its image.itb) + +rm -rf "${GENIMAGE_TMP}" + +genimage \ + --rootpath "${TARGET_DIR}" \ + --tmppath "${GENIMAGE_TMP}" \ + --inputpath "${BINARIES_DIR}" \ + --outputpath "${BINARIES_DIR}" \ + --config "${GENIMAGE_CFG}" + +RET=${?} +exit ${RET}board/radxa/rock5b/rock5b.its new file +46
-0@@ -0,0 +1,46 @@ +/dts-v1/; + +/ { + description = "Rock 5B FIT Image"; + #address-cells = <1>; + + images { + kernel { + description = "Kernel"; + data = /incbin/("Image.gz"); + type = "kernel"; + arch = "arm64"; + os = "linux"; + compression = "gzip"; + load = <0x0a200000>; + entry = <0x0a200000>; + hash { + algo = "sha256"; + }; + }; + fdt { + description = "Device Tree"; + data = /incbin/("rk3588-rock-5b.dtb"); + type = "flat_dt"; + arch = "arm64"; + compression = "none"; + load = <0x0e000000>; + entry = <0x0e000000>; + hash { + algo = "sha256"; + }; + }; + }; + + configurations { + default = "standard"; + standard { + description = "Standard Boot"; + kernel = "kernel"; + fdt = "fdt"; + hash { + algo = "sha256"; + }; + }; + }; +};board/radxa/rock5b/uboot.fragment new file +2
-0@@ -0,0 +1,3 @@ +CONFIG_USE_BOOTARGS=y +CONFIG_BOOTARGS="root=/dev/mmcblk0p2 rw rootfstype=ext4clkin_hz=(25000000) earlycon
clk_ignore_unusedearlyprintk console=ttyS2,1500000n8 rootwait" +CONFIG_BOOTCOMMAND="fatload mmc 1:1 ${loadaddr} image.itb && bootm ${loadaddr}"configs/rock5b_defconfig +2
-0@@ -1,6 +1,8 @@ BR2_aarch64=y BR2_cortex_a76_a55=y BR2_KERNEL_HEADERS_5_10=y +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/radxa/rock5b/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="" BR2_TARGET_GENERIC_HOSTNAME="rock5b" BR2_TARGET_GENERIC_ISSUE="Rock 5b" BR2_SYSTEM_DHCP="eth0"@@ -32,7 +34,9 @@ BR2_TARGET_UBOOT_NEEDS_PYELFTOOLS=y BR2_TARGET_UBOOT_NEEDS_ROCKCHIP_RKBIN=y BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="BL31=bl31.bin ROCKCHIP_TPL=ddr.bin"BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/radxa/rock5b/uboot.fragment"
configs/rock5b_defconfig +2
-1+BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y BR2_PACKAGE_HOST_DOSFSTOOLS=y BR2_PACKAGE_HOST_DTC=y +BR2_PACKAGE_HOST_GENIMAGE=y BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_UBOOT_TOOLS=y --
Quoted 1 line
2.34.1
You should also add yourself to DEVELOPERS for rock5b_defconfig and rockchip-rkbin.
Kind regards,
Andreas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v3 1/3 package: add rockchip-rkbin package
This patch adds a package for the Rockchip ATF binary blobs. These binaries are currently needed if U-Boot is built for the Rockchip RK3588 SoC. In addition the uboot package is modified such, that it can depend on the rockchip-rkbin package and in that case automatically obtain the needed binary blobs.
--- DEVELOPERS | 3 +++ boot/uboot/Config.in | 9 +++++++++ boot/uboot/uboot.mk | 10 ++++++++++ package/Config.in | 1 + package/rockchip-rkbin/Config.in | 6 ++++++ package/rockchip-rkbin/rockchip-rkbin.mk | 23 +++++++++++++++++++++++ 6 files changed, 52 insertions(+) create mode 100644 package/rockchip-rkbin/Config.in create mode 100644 package/rockchip-rkbin/rockchip-rkbin.mk
DEVELOPERS +3 -0
@@ -1776,6 +1776,9 @@ F: package/ramsmp/ N: Kieran Bingham <[email protected]> F: package/libcamera/ +N: Kilian Zinnecker <[email protected]> +F: package/rockchip-rkbin/ + N: Klaus Heinrich Kiwi <[email protected]> F: package/wqy-zenhei/
boot/uboot/Config.in +9 -0
@@ -262,6 +262,15 @@ config BR2_TARGET_UBOOT_NEEDS_IMX_FIRMWARE This option makes sure that the i.MX firmwares are copied into the U-Boot source directory. +config BR2_TARGET_UBOOT_NEEDS_ROCKCHIP_RKBIN + bool "U-Boot needs rockchip-rkbin" + depends on BR2_PACKAGE_ROCKCHIP_RKBIN + help + U-Boot currently needs binary blobs during build for the + Rockchip RK3588 SoC. + This option makes sure that the needed binary blobs are copied + into the U-Boot source directory. + menu "U-Boot binary format" config BR2_TARGET_UBOOT_FORMAT_AIS
boot/uboot/uboot.mk +10 -0
@@ -207,6 +207,16 @@ endef UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_IMX_FW_FILES endif +ifeq ($(BR2_TARGET_UBOOT_NEEDS_ROCKCHIP_RKBIN),y) +UBOOT_DEPENDENCIES += rockchip-rkbin + +define UBOOT_COPY_RKBIN_FW_FILES + cp $(BINARIES_DIR)/bl31.bin $(@D) + cp $(BINARIES_DIR)/ddr.bin $(@D) +endef +UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_RKBIN_FW_FILES +endif + ifeq ($(BR2_TARGET_UBOOT_NEEDS_DTC),y) UBOOT_DEPENDENCIES += host-dtc endif
package/Config.in +1 -0
@@ -581,6 +581,7 @@ endmenu source "package/read-edid/Config.in" source "package/rng-tools/Config.in" source "package/rockchip-mali/Config.in" + source "package/rockchip-rkbin/Config.in" source "package/rpi-userland/Config.in" source "package/rs485conf/Config.in" source "package/rtc-tools/Config.in"
package/rockchip-rkbin/Config.in new file +6 -0
@@ -0,0 +1,6 @@ +config BR2_PACKAGE_ROCKCHIP_RKBIN + bool "Rockchip RKBIN binary blobs" + depends on BR2_arm || BR2_aarch64 + help + This package provides binary blobs, currently needed by + u-boot for the Rockchip RK3588 SoC.
package/rockchip-rkbin/rockchip-rkbin.mk new file +23 -0
@@ -0,0 +1,23 @@ +################################################################################ +# +# rockchip-rkbin +# +################################################################################ + + +ROCKCHIP_RKBIN_VERSION = d6ccfe401ca84a98ca3b85c12b9554a1a43a166c +ROCKCHIP_RKBIN_SITE = https://github.com/rockchip-linux/rkbin.git +ROCKCHIP_RKBIN_SITE_METHOD = git + +ROCKCHIP_RKBIN_INSTALL_STAGING = YES +ROCKCHIP_RKBIN_INSTALL_TARGET = NO + +RK3588_DDRFW = rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin +RK3588_BL3FW = rk3588_bl31_v1.38.elf + +define ROCKCHIP_RKBIN_INSTALL_STAGING_CMDS + cp $(@D)/bin/rk35/$(RK3588_BL3FW) $(BINARIES_DIR)/bl31.bin + cp $(@D)/bin/rk35/$(RK3588_DDRFW) $(BINARIES_DIR)/ddr.bin +endef + +$(eval $(generic-package))
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v3 2/3 configs: add rock5b/rock5b_defconfig
In reply to Andreas ZieglerThis patch adds the defconfig file needed to build u-boot, kernel and rootfs for the Rock 5B. In addition it adds a kernel config fragment file, which activates the needed ethernet driver support.
--- DEVELOPERS | 2 ++ board/radxa/rock5b/linux.fragment | 1 + configs/rock5b_defconfig | 37 +++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 board/radxa/rock5b/linux.fragment create mode 100644 configs/rock5b_defconfig
DEVELOPERS +2 -0
@@ -1778,6 +1778,8 @@ F: package/libcamera/ N: Kilian Zinnecker <[email protected]> F: package/rockchip-rkbin/ +F: configs/rock5b_defconfig +F: board/radxa/rock5b/ N: Klaus Heinrich Kiwi <[email protected]> F: package/wqy-zenhei/
board/radxa/rock5b/linux.fragment new file +1 -0
@@ -0,0 +1 @@ +CONFIG_R8169=y
configs/rock5b_defconfig new file +37 -0
@@ -0,0 +1,37 @@ +BR2_aarch64=y +BR2_cortex_a76_a55=y +BR2_KERNEL_HEADERS_5_10=y +BR2_TARGET_GENERIC_HOSTNAME="rock5b" +BR2_TARGET_GENERIC_ISSUE="Rock 5b" +BR2_SYSTEM_DHCP="eth0" +BR2_USE_WCHAR +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_GIT=y +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/radxa/kernel.git" +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="52f51a2b5ba178f331af62260d2da86d7472c14b" +BR2_LINUX_KERNEL_DEFCONFIG="rockchip_linux" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="rockchip/rk3588-rock-5b" +BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT=y +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/radxa/rock5b/linux.fragment" +BR2_PACKAGE_AVAHI=y +BR2_PACKAGE_AVAHI_DAEMON=y +BR2_PACKAGE_OPENSSH=y +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_4=y +BR2_TARGET_ROOTFS_EXT2_SIZE="250M" +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_VERSION=y +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2023.07-rc4" +BR2_PACKAGE_ROCKCHIP_RKBIN=y +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="rock5b-rk3588" +BR2_TARGET_UBOOT_NEEDS_PYLIBFDT=y +BR2_TARGET_UBOOT_NEEDS_OPENSSL=y +BR2_TARGET_UBOOT_NEEDS_PYELFTOOLS=y +BR2_TARGET_UBOOT_NEEDS_ROCKCHIP_RKBIN=y +BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="BL31=bl31.bin ROCKCHIP_TPL=ddr.bin" +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_DTC=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=y
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v3 3/3 board/radxa/rock5b: Add sdcard image scripts
In reply to Andreas ZieglerThis patch adds post image scripts for the Radxa Rock 5B. They generate an sdcard.img file, which can be flashed on an SD card to boot the board.
--- board/radxa/rock5b/genimage.cfg | 36 ++++++++++++++++++++++++ board/radxa/rock5b/post-image.sh | 24 ++++++++++++++++ board/radxa/rock5b/rock5b.its | 46 +++++++++++++++++++++++++++++++ board/radxa/rock5b/uboot.fragment | 3 ++ configs/rock5b_defconfig | 5 ++++ 5 files changed, 114 insertions(+) create mode 100644 board/radxa/rock5b/genimage.cfg create mode 100755 board/radxa/rock5b/post-image.sh create mode 100644 board/radxa/rock5b/rock5b.its create mode 100644 board/radxa/rock5b/uboot.fragment
board/radxa/rock5b/genimage.cfg new file +36 -0
@@ -0,0 +1,36 @@ +# SD card image for Radxa Rock 5b + +image boot.vfat { + vfat { + file image.itb { + image = "image.itb" + } + } + size = 16M +} + +image sdcard.img { + hdimage { + partition-table-type = "hybrid" + } + + partition uboot { + in-partition-table = "false" + image = "u-boot-rockchip.bin" + offset = 32K + size = 12M + } + + partition boot { + partition-type = "0xC" + bootable = "true" + image = "boot.vfat" + offset = 64M + } + + partition rootfs { + partition-type = 0x83 + image = "rootfs.ext2" + offset = 96M + } +}
board/radxa/rock5b/post-image.sh new file +24 -0
@@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +GENIMAGE_CFG="$(dirname $0)/genimage.cfg" +GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" + +# genimage needs u-boot-rockchip.bin + +cp ${BUILD_DIR}/uboot-2023.07-rc4/u-boot-rockchip.bin ${BINARIES_DIR}/ + +gzip -fk ${BINARIES_DIR}/Image +cp board/radxa/rock5b/rock5b.its ${BINARIES_DIR} +(cd $BINARIES_DIR && mkimage -f rock5b.its image.itb) + +rm -rf "${GENIMAGE_TMP}" + +genimage \ + --rootpath "${TARGET_DIR}" \ + --tmppath "${GENIMAGE_TMP}" \ + --inputpath "${BINARIES_DIR}" \ + --outputpath "${BINARIES_DIR}" \ + --config "${GENIMAGE_CFG}" + +RET=${?} +exit ${RET}
board/radxa/rock5b/rock5b.its new file +46 -0
46 lines not on this page · raw message
board/radxa/rock5b/uboot.fragment new file +3 -0
@@ -0,0 +1,3 @@ +CONFIG_USE_BOOTARGS=y +CONFIG_BOOTARGS="root=/dev/mmcblk0p2 rw rootfstype=ext4 clkin_hz=(25000000) earlycon clk_ignore_unused earlyprintk console=ttyS2,1500000n8 rootwait" +CONFIG_BOOTCOMMAND="fatload mmc 1:1 ${loadaddr} image.itb && bootm ${loadaddr}"
configs/rock5b_defconfig +5 -0
@@ -1,6 +1,8 @@ BR2_aarch64=y BR2_cortex_a76_a55=y BR2_KERNEL_HEADERS_5_10=y +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/radxa/rock5b/post-image.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="" BR2_TARGET_GENERIC_HOSTNAME="rock5b" BR2_TARGET_GENERIC_ISSUE="Rock 5b" BR2_SYSTEM_DHCP="eth0"
@@ -31,7 +33,10 @@ BR2_TARGET_UBOOT_NEEDS_OPENSSL=y BR2_TARGET_UBOOT_NEEDS_PYELFTOOLS=y BR2_TARGET_UBOOT_NEEDS_ROCKCHIP_RKBIN=y BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="BL31=bl31.bin ROCKCHIP_TPL=ddr.bin" +BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/radxa/rock5b/uboot.fragment" +BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y BR2_PACKAGE_HOST_DOSFSTOOLS=y BR2_PACKAGE_HOST_DTC=y +BR2_PACKAGE_HOST_GENIMAGE=y BR2_PACKAGE_HOST_MTOOLS=y BR2_PACKAGE_HOST_UBOOT_TOOLS=y
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v3 1/3] package: add rockchip-rkbin package
In reply to Kilian Zinnecker via buildrootHi Kilian, all
...
Quoted 1 line
Signed-off-by Kilian Zinnecker <[email protected]>
...
build test only, (l)ubuntu 22.04.02 LTS on qemu-system-x86_64
Kind regards,
Andreas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v3 1/3] package: add rockchip-rkbin package
In reply to Kilian Zinnecker via buildrootHi Kilian,
Thanks for the patch.
Quoted 37 lines · Kilian Zinnecker via buildroot
This patch adds a package for the Rockchip ATF binary blobs. These binaries are currently needed if U-Boot is built for the Rockchip RK3588 SoC. In addition the uboot package is modified such, that it can depend on the rockchip-rkbin package and in that case automatically obtain the needed binary blobs.
Signed-off-by Kilian Zinnecker <[email protected]>--- DEVELOPERS | 3 +++ boot/uboot/Config.in | 9 +++++++++ boot/uboot/uboot.mk | 10 ++++++++++ package/Config.in | 1 + package/rockchip-rkbin/Config.in | 6 ++++++ package/rockchip-rkbin/rockchip-rkbin.mk | 23 +++++++++++++++++++++++ 6 files changed, 52 insertions(+)create mode 100644 package/rockchip-rkbin/Config.in create mode 100644
package/rockchip-rkbin/rockchip-rkbin.mkDEVELOPERS +3
-0@@ -1776,6 +1776,9 @@ F: package/ramsmp/ N: Kieran Bingham <[email protected]> F: package/libcamera/ +N: Kilian Zinnecker <[email protected]> +F: package/rockchip-rkbin/ + N: Klaus Heinrich Kiwi <[email protected]> F: package/wqy-zenhei/boot/uboot/Config.in +0
-0
boot/uboot/Config.in config BR2_TARGET_UBOOT_NEEDS_IMX_FIRMWARE · line 270
Quoted 9 lines
boot/uboot/Config.in +6
-0@@ -262,6 +262,15 @@ config BR2_TARGET_UBOOT_NEEDS_IMX_FIRMWARE This option makes sure that the i.MX firmwares are copied into the U-Boot source directory. +config BR2_TARGET_UBOOT_NEEDS_ROCKCHIP_RKBIN + bool "U-Boot needs rockchip-rkbin" + depends on BR2_PACKAGE_ROCKCHIP_RKBIN + help + U-Boot currently needs binary blobs during build for the + Rockchip RK3588 SoC.
This isn't specific to RK3588. It is in fact how Rockchip starts with each of their new SoCs. This currently applies to RK3568 as well and since there is at least one Radxa board (Rock 3A if I'm not mistaken), I guess we're gonna see patches for this one soon?
Also, users can decide to use blobs instead of compiled-from-sources binaries for TF-A, OP-TEE OS and TPL for those SoCs like RK3399 which have upstream support.
I would suggest to just say that this provides binary blobs (such as DDR init (usually called TPL in U-Boot world), TF-A and OP-TEE OS) typically used for new SoCs designs until different upstream projects get support for the new SoCs.
Quoted 11 lines
boot/uboot/Config.in +3
-0+ This option makes sure that the needed binary blobs are copied + into the U-Boot source directory. + menu "U-Boot binary format" config BR2_TARGET_UBOOT_FORMAT_AISboot/uboot/uboot.mk +0
-0
boot/uboot/uboot.mk endef · line 215
Quoted 9 lines
boot/uboot/uboot.mk +6
-0@@ -207,6 +207,16 @@ endef UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_IMX_FW_FILES endif +ifeq ($(BR2_TARGET_UBOOT_NEEDS_ROCKCHIP_RKBIN),y) +UBOOT_DEPENDENCIES += rockchip-rkbin + +define UBOOT_COPY_RKBIN_FW_FILES + cp $(BINARIES_DIR)/bl31.bin $(@D) + cp $(BINARIES_DIR)/ddr.bin $(@D)
This is an issue with supporting multiple Rockchip SoCs with the same package since we would need to have an option in RKBIN package to select the original file to rename to bl31.bin and ddr.bin.
How bad of an idea is it to parse the BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS variable for BL31, ROCKCHIP_TPL and TEE variables to find out the exact name of the file to use?
Quoted 25 lines
boot/uboot/uboot.mk +4
-0+endef +UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_RKBIN_FW_FILES +endif + ifeq ($(BR2_TARGET_UBOOT_NEEDS_DTC),y) UBOOT_DEPENDENCIES += host-dtc endifpackage/Config.in +1
-0@@ -581,6 +581,7 @@ endmenu source "package/read-edid/Config.in" source "package/rng-tools/Config.in" source "package/rockchip-mali/Config.in" + source "package/rockchip-rkbin/Config.in" source "package/rpi-userland/Config.in" source "package/rs485conf/Config.in" source "package/rtc-tools/Config.in"package/rockchip-rkbin/Config.in new file +0
-0
package/rockchip-rkbin/Config.in line 6
Quoted 6 lines
package/rockchip-rkbin/Config.in new file +6
-0@@ -0,0 +1,6 @@ +config BR2_PACKAGE_ROCKCHIP_RKBIN + bool "Rockchip RKBIN binary blobs" + depends on BR2_arm || BR2_aarch64 + help + This package provides binary blobs, currently needed by + u-boot for the Rockchip RK3588 SoC.
Don't specify the Rockchip SoC part number, this is already not encompassing all SoCs that need RKBIN (such as RK3568). You can however say that this is typically needed by U-Boot for the U-Boot proper fitimage.
Quoted 15 lines
package/rockchip-rkbin/rockchip-rkbin.mk new file +9
-0@@ -0,0 +1,23 @@ +################################################################################ +# +# rockchip-rkbin +# +################################################################################ + + +ROCKCHIP_RKBIN_VERSION = d6ccfe401ca84a98ca3b85c12b9554a1a43a166c +ROCKCHIP_RKBIN_SITE = https://github.com/rockchip-linux/rkbin.git
package/rockchip-rkbin/rockchip-rkbin.mk line 19
Quoted 10 lines
package/rockchip-rkbin/rockchip-rkbin.mk new file +10
-0+ROCKCHIP_RKBIN_SITE_METHOD = git + +ROCKCHIP_RKBIN_INSTALL_STAGING = YES +ROCKCHIP_RKBIN_INSTALL_TARGET = NO + +RK3588_DDRFW = rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin +RK3588_BL3FW = rk3588_bl31_v1.38.elf + +define ROCKCHIP_RKBIN_INSTALL_STAGING_CMDS + cp $(@D)/bin/rk35/$(RK3588_BL3FW) $(BINARIES_DIR)/bl31.bin
I would highly recommend to keep the same file extension to not confuse people since the OP-TEE binary apparently has different formats which we can (more easily) distinguish from their file extension (though IIRC, reading the header may be enough).
package/rockchip-rkbin/rockchip-rkbin.mk line 20
Quoted 1 line
package/rockchip-rkbin/rockchip-rkbin.mk new file +1
-0+ cp $(@D)/bin/rk35/$(RK3588_DDRFW) $(BINARIES_DIR)/ddr.bin
I would highly recommend to not have a so common name which abstracts the SoC part number. I can think of two ways of doing this: create a subdir after each SoC part number in BINARIES_DIR (e.g. BINARIES_DIR/rk3588/bl31.elf) or have the part number in the filename (e.g. rk3588_bl31.elf).
This should allow to install the binary blobs from all SoC supported in RKBIN without having to deal with Kconfig options.
The rename to remove the possibly changing filename is a good idea though, so we don't need to update the BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS variable in the defconfig to reflect updates to RKBIN.
Also, OP-TEE OS is available as a blob in there (see bl32 file), maybe making it available would be good too?
Ok so another thought now...
In boot/u-boot.mk, we already have
```
ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31),y)
UBOOT_DEPENDENCIES += arm-trusted-firmware
ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF),y)
UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.elf
define UBOOT_COPY_ATF_FIRMWARE
cp $(BINARIES_DIR)/bl31.elf $(@D)/
endef
UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_ATF_FIRMWARE
else
UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.bin
define UBOOT_COPY_ATF_FIRMWARE
cp $(BINARIES_DIR)/bl31.bin $(@D)/
endef
UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_ATF_FIRMWARE
endif
endif
ifeq ($(BR2_TARGET_UBOOT_NEEDS_OPTEE_TEE),y)
UBOOT_DEPENDENCIES += optee-os
UBOOT_MAKE_OPTS += TEE=$(BINARIES_DIR)/tee.elf
endif
```which should set everything up correctly for bl31 and tee-os, without needing to add BL31 and TEE to BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS manually.
We would however probably need to go with a virtual package (or whatever the proper name for Buildroot would be for two packages providing the same functionality and have a selection mechanism in place in Kconfig for it) for TF-A and tee-os so that UBOOT_DEPENDENCIES picks up the correct dependency. RKBIN would be one of the possible provides for arm-trusted-firmware and optee-os for example.
Looking at the code above, if we want to keep it a bit automagical, maybe having the RKBIN binaries called bl31.bin and tee.elf and have a Kconfig option for the RKBIN package to select which SoC binary blobs to install would be best.
We would still however need a special case for the TPL coming from RKBIN package since there's no piping for this at the moment in boot/u-boot.mk.
I feel like RKBIN package should be able to handle multiple SoCs (either by providing all SoCs binary blobs at once, or have a Kconfig option for it) and we should make it not too error-prone on the user-side for the U-Boot configuration.
At the same time, I don't know if it's worth the added complexity.
Cheers,
Quentin
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v3 1/3] package: add rockchip-rkbin package
Hello Quentin, All,
Quoted 1 line
Thanks for the patch.
You're welcome and thanks for your feedback.
Quoted 11 lines
boot/uboot/Config.in config BR2_TARGET_UBOOT_NEEDS_IMX_FIRMWARE · line 270
Quoted 6 lines
boot/uboot/Config.in +6
-0+config BR2_TARGET_UBOOT_NEEDS_ROCKCHIP_RKBIN + bool "U-Boot needs rockchip-rkbin" + depends on BR2_PACKAGE_ROCKCHIP_RKBIN + help + U-Boot currently needs binary blobs during build for the + Rockchip RK3588 SoC.This isn't specific to RK3588. It is in fact how Rockchip starts with each of their new SoCs. This currently applies to RK3568 as well and since there is at least one Radxa board (Rock 3A if I'm not mistaken), I guess we're gonna see patches for this one soon?
Yes, correct. Do you refer to buildroot patches for support of further Radxa boards or to u-boot patches to support further Rockchip SoCs? Personally I currently don't have any plans to provide patches to bulidroot regarding board support of other Radxa boards. Still I think the concern is of course legit, i.e., that someone wants to use this rockchip-rkbin buildroot package for other Rockchip SoCs, but it (in its current form) does not provide functionality for that.
Quoted 3 lines
Also, users can decide to use blobs instead of compiled-from-sources binaries for TF-A, OP-TEE OS and TPL for those SoCs like RK3399 which have upstream support.
I agree.
Quoted 4 lines
I would suggest to just say that this provides binary blobs (such as DDR init (usually called TPL in U-Boot world), TF-A and OP-TEE OS) typically used for new SoCs designs until different upstream projects get support for the new SoCs.
Ok, I will change it.
Quoted 13 lines
boot/uboot/uboot.mk endef · line 215
Quoted 9 lines
UBOOT_PRE_BUILD_HOOKS+=UBOOT_COPY_IMX_FW_FILESendifboot/uboot/uboot.mk +6
-0+ifeq ($(BR2_TARGET_UBOOT_NEEDS_ROCKCHIP_RKBIN),y) +UBOOT_DEPENDENCIES += rockchip-rkbin + +define UBOOT_COPY_RKBIN_FW_FILES + cp $(BINARIES_DIR)/bl31.bin $(@D) + cp $(BINARIES_DIR)/ddr.bin $(@D)This is an issue with supporting multiple Rockchip SoCs with the same package since we would need to have an option in RKBIN package to select the original file to rename to bl31.bin and ddr.bin.
Yes, I agree. For my purpose (i.e., only support for Rock 5B) I guess it is ok this way, but if the rockchip-rkbin package should also be usable for other SoCs, some way to identify the particular binaries would be needed.
Quoted 3 lines
How bad of an idea is it to parse the
BR2_TARGET_UBOOT_CUSTOM_MAKEOPTSvariable for BL31,ROCKCHIP_TPLand TEE variables to find out the exact name of the file to use?
I guess this would work but I don't know if it is a good idea.
Quoted 10 lines
package/rockchip-rkbin/Config.in line 6
Quoted 6 lines
package/rockchip-rkbin/Config.in new file +6
-0+config BR2_PACKAGE_ROCKCHIP_RKBIN + bool "Rockchip RKBIN binary blobs" + depends on BR2_arm || BR2_aarch64 + help + This package provides binary blobs, currently needed by + u-boot for the Rockchip RK3588 SoC.Don't specify the Rockchip SoC part number, this is already not encompassing all SoCs that need RKBIN (such as RK3568). You can however say that this is typically needed by U-Boot for the U-Boot proper fitimage.
Ok.
Quoted 10 lines
package/rockchip-rkbin/rockchip-rkbin.mk line 19
Quoted 5 lines
package/rockchip-rkbin/rockchip-rkbin.mk new file +5
-0+RK3588_DDRFW = rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin +RK3588_BL3FW = rk3588_bl31_v1.38.elf + +define ROCKCHIP_RKBIN_INSTALL_STAGING_CMDS + cp $(@D)/bin/rk35/$(RK3588_BL3FW) $(BINARIES_DIR)/bl31.binI would highly recommend to keep the same file extension to not confuse people since the OP-TEE binary apparently has different formats which we can (more easily) distinguish from their file extension (though IIRC, reading the header may be enough).
Thanks.
Quoted 4 lines
package/rockchip-rkbin/rockchip-rkbin.mk line 20
Quoted 1 line
package/rockchip-rkbin/rockchip-rkbin.mk new file +1
-0+ cp $(@D)/bin/rk35/$(RK3588_DDRFW) $(BINARIES_DIR)/ddr.binI would highly recommend to not have a so common name which abstracts the SoC part number.
Why is the SoC part number so important to you?
Quoted 6 lines
I can think of two ways of doing this: create a
subdir after each SoC part number inBINARIES_DIR(e.g. BINARIES_DIR/rk3588/bl31.elf) or have the part number in the filename (e.g. rk3588_bl31.elf).
This should allow to install the binary blobs from all SoC supported in RKBIN without having to deal withKconfigoptions.
How so? Because we would then copy all blobs at once into the BINARIES_DIR everytime?
Quoted 3 lines
The rename to remove the possibly changing filename is a good idea though, so we don't need to update the
BR2_TARGET_UBOOT_CUSTOM_MAKEOPTSvariable in the defconfig to reflect updates to RKBIN.
I agree.
Quoted 2 lines
Also, OP-TEE OS is available as a blob in there (see bl32 file), maybe making it available would be good too?
Agreed.
Quoted 30 lines
Ok so another thought now...
In
boot/u-boot.mk, we already have``` ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31),y) UBOOT_DEPENDENCIES += arm-trusted-firmware ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF),y) UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.elf define UBOOT_COPY_ATF_FIRMWARE cp $(BINARIES_DIR)/bl31.elf $(@D)/ endef UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_ATF_FIRMWARE else UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.bin define UBOOT_COPY_ATF_FIRMWARE cp $(BINARIES_DIR)/bl31.bin $(@D)/ endef UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_ATF_FIRMWARE endif endif ifeq ($(BR2_TARGET_UBOOT_NEEDS_OPTEE_TEE),y) UBOOT_DEPENDENCIES += optee-os UBOOT_MAKE_OPTS += TEE=$(BINARIES_DIR)/tee.elf endif ```which should set everything up correctly for bl31 and tee-os, without needing to add BL31 and TEE to
BR2_TARGET_UBOOT_CUSTOM_MAKEOPTSmanually.
Quoted 6 lines
We would however probably need to go with a virtual package (or whatever the proper name for Buildroot would be for two packages providing the same functionality and have a selection mechanism in place in
Kconfigfor it) for TF-A and tee-os so thatUBOOT_DEPENDENCIESpicks up the correct dependency. RKBIN would be one of the possible provides for arm-trusted-firmware and optee-os for example.
Or I just add the UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.bin to the BR2_UBOOT_NEEDS_ROCKCHIP_RKBIN block?
Quoted 4 lines
Looking at the code above, if we want to keep it a bit automagical, maybe having the RKBIN binaries called bl31.bin and tee.elf and have a
Kconfigoption for the RKBIN package to select which SoC binary blobs to install would be best.
In the readme of the rkbin repository they present their file naming scheme. However, I don't think I like making use of it:
1. We introduce a lot of Kconfig code for some logic that adds choices and selects files within the rkbin repository. But in the end the user still has to make the decision, which files are to use, anyway. Then the user can also just directly specify the true filename in the board defconfig or .config.
2. We add a lot dependency: Rockchip may remove or rename files in their git reblobitory as they like. If we (or any other users) then want to use a newer commit of their reblobitory, e.g., to use newer blobs, and the file name / path scheme breaks, we have to fix that again.
Quoted 9 lines
We would still however need a special case for the TPL coming from RKBIN package since there's no piping for this at the moment in
boot/u-boot.mk.I feel like RKBIN package should be able to handle multiple SoCs (either by providing all SoCs binary blobs at once, or have a
Kconfigoption for it) and we should make it not too error-prone on the user-side for the U-Boot configuration.At the same time, I don't know if it's worth the added complexity.
Thinking out loud:
For the rockchip-rkbin package we could feature:
* custom git version option (then defconfigs could freeze the repo version)
* option to specify tpl file name
* option to specify bl31 file name
* option to specify op-tee file name
* logic, which copies the specified files to BINARIES_DIR, while renaming them to generic names (e.g., "bl31.elf")
For the u-boot package we could add BR2_TARGET_UBOOT_NEEDS_ROCKCHIP_RKBIN in uboot.mk: It adds the dependency for the package rockchip-rkbin and introduces code, which parses the rockchip-rkbin BR2 variables and adds the needed options to UBOOT_MAKE_OPTS accordingly. So it is very similar to BR2_TARGET_UBOOT_NEEDS_ATF_BL31, but knows from the sprecified rockchip-rkbin variables which uboot make opts to add (or not to add).
What do you think?
Best regards,
Kilian
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v3 1/3] package: add rockchip-rkbin package
Hi Kilian,
Quoted 18 lines · Kilian Zinnecker
Hello Quentin, All,
Quoted 1 line
Thanks for the patch.
You're welcome and thanks for your feedback.
Quoted 11 lines
boot/uboot/Config.in config BR2_TARGET_UBOOT_NEEDS_IMX_FIRMWARE · line 270
Quoted 6 lines
boot/uboot/Config.in +6
-0+config BR2_TARGET_UBOOT_NEEDS_ROCKCHIP_RKBIN + bool "U-Boot needs rockchip-rkbin" + depends on BR2_PACKAGE_ROCKCHIP_RKBIN + help + U-Boot currently needs binary blobs during build for the + Rockchip RK3588 SoC.This isn't specific to RK3588. It is in fact how Rockchip starts with each of their new SoCs. This currently applies to RK3568 as well and since there is at least one Radxa board (Rock 3A if I'm not mistaken), I guess we're gonna see patches for this one soon?
Quoted 8 lines
Yes, correct. Do you refer to buildroot patches for support of further Radxa boards or to u-boot patches to support further Rockchip SoCs? Personally I currently don't have any plans to provide patches to bulidroot regarding board support of other Radxa boards. Still I think the concern is of course legit, i.e., that someone wants to use this rockchip-rkbin buildroot package for other Rockchip SoCs, but it (in its current form) does not provide functionality for that.
U-Boot, for all RK3568 and RK3588 based boards, currently requires blobs from rkbin. Therefore, to build U-Boot properly, we need this package. Since there are publicly available boards based on RK3568, I assume we may eventually get support by someone (not necessarily you) for those. Therefore, I suggested we remove the mention to RK3588 as this is not specific to this SoC from Rockchip. No expectation from me on what you're going to do next :)
[...]
Quoted 11 lines
Quoted 10 lines
package/rockchip-rkbin/rockchip-rkbin.mk line 19
Quoted 5 lines
package/rockchip-rkbin/rockchip-rkbin.mk new file +5
-0+RK3588_DDRFW = rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin +RK3588_BL3FW = rk3588_bl31_v1.38.elf + +define ROCKCHIP_RKBIN_INSTALL_STAGING_CMDS + cp $(@D)/bin/rk35/$(RK3588_BL3FW) $(BINARIES_DIR)/bl31.binI would highly recommend to keep the same file extension to not confuse people since the OP-TEE binary apparently has different formats which we can (more easily) distinguish from their file extension (though IIRC, reading the header may be enough).
Quoted 2 lines
Thanks.
Just to make things a bit clearer here, I commented on bl31.bin file extension while saying something about OP-TEE binary, the former is TF-A blob while the latter is bl32.bin.
Also, I was wrong, the file extension isn't used for detecting the file format of OP-TEE OS blob, U-Boot tries to detect an ELF, if not, starts to parse the blob "header" to detect if it's v1 or v2 format.
But better keep the same file extension though :)
Quoted 14 lines
Quoted 4 lines
package/rockchip-rkbin/rockchip-rkbin.mk line 20
Quoted 1 line
package/rockchip-rkbin/rockchip-rkbin.mk new file +1
-0+ cp $(@D)/bin/rk35/$(RK3588_DDRFW) $(BINARIES_DIR)/ddr.binI would highly recommend to not have a so common name which abstracts the SoC part number.
Why is the SoC part number so important to you?
Quoted 6 lines
I can think of two ways of doing this: create a
subdir after each SoC part number inBINARIES_DIR(e.g. BINARIES_DIR/rk3588/bl31.elf) or have the part number in the filename (e.g. rk3588_bl31.elf).
This should allow to install the binary blobs from all SoC supported in RKBIN without having to deal withKconfigoptions.
Quoted 3 lines
How so? Because we would then copy all blobs at once into the
BINARIES_DIReverytime?
Indeed. Then we wouldn't need to care on the rkbin side which blobs to install in BINARIES_DIR. Inside u-boot.mk either, as I would pass the proper path as part of BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS like you did here?
[...]
Quoted 37 lines
Quoted 30 lines
Ok so another thought now...
In
boot/u-boot.mk, we already have``` ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31),y) UBOOT_DEPENDENCIES += arm-trusted-firmware ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF),y) UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.elf define UBOOT_COPY_ATF_FIRMWARE cp $(BINARIES_DIR)/bl31.elf $(@D)/ endef UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_ATF_FIRMWARE else UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.bin define UBOOT_COPY_ATF_FIRMWARE cp $(BINARIES_DIR)/bl31.bin $(@D)/ endef UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_ATF_FIRMWARE endif endif ifeq ($(BR2_TARGET_UBOOT_NEEDS_OPTEE_TEE),y) UBOOT_DEPENDENCIES += optee-os UBOOT_MAKE_OPTS += TEE=$(BINARIES_DIR)/tee.elf endif ```which should set everything up correctly for bl31 and tee-os, without needing to add BL31 and TEE to
BR2_TARGET_UBOOT_CUSTOM_MAKEOPTSmanually.Quoted 6 lines
We would however probably need to go with a virtual package (or whatever the proper name for Buildroot would be for two packages providing the same functionality and have a selection mechanism in place in
Kconfigfor it) for TF-A and tee-os so thatUBOOT_DEPENDENCIESpicks up the correct dependency. RKBIN would be one of the possible provides for arm-trusted-firmware and optee-os for example.
Quoted 3 lines
Or I just add the
UBOOT_MAKE_OPTS+= BL31=$(BINARIES_DIR)/bl31.bin to theBR2_UBOOT_NEEDS_ROCKCHIP_RKBINblock?
Yeah, but technically U-Boot does need BR2_TARGET_UBOOT_NEEDS_ATF_BL31 for Aarch64 platforms. If the user selects BR2_TARGET_UBOOT_NEEDS_ATF_BL31, it'll add trusted-firmware-arm as a a dependency, which is unnecessary since we only have a blob.
Quoted 5 lines
Quoted 4 lines
Looking at the code above, if we want to keep it a bit automagical, maybe having the RKBIN binaries called bl31.bin and tee.elf and have a
Kconfigoption for the RKBIN package to select which SoC binary blobs to install would be best.
Quoted 8 lines
In the readme of the rkbin repository they present their file naming scheme. However, I don't think I like making use of it:
1. We introduce a lot of
Kconfigcode for some logic that adds choices and selects files within the rkbin repository. But in the end the user still has to make the decision, which files are to use, anyway. Then the user can also just directly specify the true filename in the board defconfig or .config.
What I had in mind was to have a select Kconfig option:
choice
config BR2_RK3588
config BR2_RK3568
enchoide
and then in rockchip-rkbin (pseudo-code):
if BR2_RK3588
install bin/rk35/rk3588_bl31_v1.38.elf $(BINARIES_DIR)/bl31.elf
install bin/rk35/rk3588_bl32_v1.13.bin $(BINARIES_DIR)/tee.elf #add
support for tee.bin in U-Boot mk?
install bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin $(BINARIES_DIR)/ddr.bin
elif BR2_RK3568
....
fi
The important part would be for the destination filename to match what's expected in boot/u-boot/u-boot.mk:
UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.elf
[...]UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.bin
in that scenario, we wouldn't even need to adapt U-Boot makefile other than allowing to depend on rockchip-rkbin rather than trusted-firmware-arm.
Quoted 5 lines
2. We add a lot dependency: Rockchip may remove or rename files in their git reblobitory as they like. If we (or any other users) then want to use a newer commit of their reblobitory, e.g., to use newer blobs, and the file name / path scheme breaks, we have to fix that again.
This is the responsibility of the package maintainer, like for any other package. I do agree though that the name of the installed binaries should stay consistent between new versions, so that we only need to update rockchip-rkbin and not any other package that depends on it.
Quoted 10 lines
Quoted 9 lines
We would still however need a special case for the TPL coming from RKBIN package since there's no piping for this at the moment in
boot/u-boot.mk.I feel like RKBIN package should be able to handle multiple SoCs (either by providing all SoCs binary blobs at once, or have a
Kconfigoption for it) and we should make it not too error-prone on the user-side for the U-Boot configuration.At the same time, I don't know if it's worth the added complexity.
Quoted 8 lines
Thinking out loud:
For the rockchip-rkbin package we could feature:
* custom git version option (then defconfigs could freeze the repo version)
* option to specify tpl file name
* option to specify bl31 file name
* option to specify op-tee file name
Well.. that's one thing I completely forgot about. Maybe people don't want to update rockchip-rkbin for their boards... SO yeah, I guess those 4 options actually make more sense than trying to be smart and have a select for each SoC.
Quoted 10 lines
* logic, which copies the specified files to
BINARIES_DIR, while renaming them to generic names (e.g., "bl31.elf")For the u-boot package we could add
BR2_TARGET_UBOOT_NEEDS_ROCKCHIP_RKBINin uboot.mk: It adds the dependency for the package rockchip-rkbin and introduces code, which parses the rockchip-rkbin BR2 variables and adds the needed options toUBOOT_MAKE_OPTSaccordingly. So it is very similar toBR2_TARGET_UBOOT_NEEDS_ATF_BL31, but knows from the sprecified rockchip-rkbin variables which uboot make opts to add (or not to add).
The thing I wanted to suggest was to reuse the code written for handling trusted-firmware-arm and optee-os dependencies on Buildroot level + environment variable setting for U-Boot building. The issue is that BR2_TARGET_UBOOT_NEEDS_ATF_BL31 depends on BR2_TARGET_ARM_TRUSTED_FIRMWARE so it'll bring unnecessary packages. If we give the user the choice of the ATF provider (from source, from blob, if blob from which package), then we can remove this dependency on trusted-firmware-arm package.
```
ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31),y)
UBOOT_DEPENDENCIES += arm-trusted-firmware-provider # TODO add virtual package
ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF),y)
UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.elf
define UBOOT_COPY_ATF_FIRMWARE
cp $(BINARIES_DIR)/bl31.elf $(@D)/
endef
UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_ATF_FIRMWARE
else
UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.bin
define UBOOT_COPY_ATF_FIRMWARE
cp $(BINARIES_DIR)/bl31.bin $(@D)/
endef
UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_ATF_FIRMWARE
endif
endif
ifeq ($(BR2_TARGET_UBOOT_NEEDS_OPTEE_TEE),y)
UBOOT_DEPENDENCIES += optee-os-provider # TODO add virtual package
UBOOT_MAKE_OPTS += TEE=$(BINARIES_DIR)/tee.elf
endif
```Then create optee-os-provider and trusted-firmware-arm-provider virtual packages the same way we do for openssl providers (libressl, libopenssl):
package/openssl/Config.inpackage/openssl/openssl.mk
Cheers,
Quentin
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v3 1/3] package: add rockchip-rkbin package
Hi Quentin,
Quoted 7 lines
U-Boot, for all RK3568 and RK3588 based boards, currently requires blobs from rkbin. Therefore, to build U-Boot properly, we need this package. Since there are publicly available boards based on RK3568, I assume we may eventually get support by someone (not necessarily you) for those. Therefore, I suggested we remove the mention to RK3588 as this is not specific to this SoC from Rockchip. No expectation from me on what you're going to do next :)
I think we agree here and as you know the rockchip-rkbin package is now able to also be used for other Rockchip SoCs.
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
I would highly recommend to keep the same file extension to not confuse people since the OP-TEE binary apparently has different formats which we can (more easily) distinguish from their file extension (though IIRC, reading the header may be enough).
Thanks.
Just to make things a bit clearer here, I commented on bl31.bin file extension while saying something about OP-TEE binary, the former is TF-A blob while the latter is bl32.bin.
Quoted 5 lines
Also, I was wrong, the file extension isn't used for detecting the file format of OP-TEE OS blob, U-Boot tries to detect an ELF, if not, starts to parse the blob "header" to detect if it's v1 or v2 format.
But better keep the same file extension though :)
Yes, I agree: it is still beneficial, if the true file extension is kept, even if it is technically not needed. In v6 of the patches I implemented it such, that the file extension is kept.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
I can think of two ways of doing this: create a
subdir after each SoC part number inBINARIES_DIR(e.g. BINARIES_DIR/rk3588/bl31.elf) or have the part number in the filename (e.g. rk3588_bl31.elf).
This should allow to install the binary blobs from all SoC supported in RKBIN without having to deal withKconfigoptions.
Quoted 6 lines
Quoted 2 lines
How so? Because we would then copy all blobs at once into the
BINARIES_DIReverytime?Indeed. Then we wouldn't need to care on the rkbin side which blobs to install in
BINARIES_DIR. Inside u-boot.mk either, as I would pass the proper path as part ofBR2_TARGET_UBOOT_CUSTOM_MAKEOPTSlike you did here?
I actually don't like copying ALL Rockchip blobs into BINARIES_DIR everytime:
Imagine this would become the common case for multiple packages. It would create a mess in my opinion. And it also is not needed: The package is now implemented such, that a user can optionally specify which blobs are needed and only those specified binaries are copied into BINARIES_DIR, with a generic name, while keeping the original file extension and also uboot now automatically identifies the binary, even so that the file extension can be different. What's not to like? ;)
Quoted 22 lines
Quoted 5 lines
Quoted 4 lines
Looking at the code above, if we want to keep it a bit automagical, maybe having the RKBIN binaries called bl31.bin and tee.elf and have a
Kconfigoption for the RKBIN package to select which SoC binary blobs to install would be best.Quoted 8 lines
In the readme of the rkbin repository they present their file naming scheme. However, I don't think I like making use of it:
1. We introduce a lot of
Kconfigcode for some logic that adds choices and selects files within the rkbin repository. But in the end the user still has to make the decision, which files are to use, anyway. Then the user can also just directly specify the true filename in the board defconfig or .config.What I had in mind was to have a select
Kconfigoption:
choice
configBR2_RK3588
configBR2_RK3568
enchoideand then in rockchip-rkbin (pseudo-code):
if
BR2_RK3588
Quoted 8 lines
install bin/rk35/rk3588_bl31_v1.38.elf $(BINARIES_DIR)/bl31.elf install bin/rk35/rk3588_bl32_v1.13.bin $(BINARIES_DIR)/tee.elf #add support for tee.bin in U-Boot mk? install bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin$(BINARIES_DIR)/ddr.bin
elifBR2_RK3568
....
fi
I don't like this: This would mean that we basically write down into the mk each binary for each SoC. If then rockchip decides to "update" a binary by simply renaming it (they have done this before, look at the git history), then the package is broken until some maintainer fixes it again. We would produce alot of code with imho no real benefit. In my oppinion: Whoever wants to use a blob from the repository should simply define which blob is the desired one.
Quoted 15 lines
The important part would be for the destination filename to match what's expected in
boot/u-boot/u-boot.mk:
UBOOT_MAKE_OPTS+= BL31=$(BINARIES_DIR)/bl31.elf
[...]UBOOT_MAKE_OPTS+= BL31=$(BINARIES_DIR)/bl31.binin that scenario, we wouldn't even need to adapt U-Boot makefile other than allowing to depend on rockchip-rkbin rather than trusted-firmware-arm.
Quoted 4 lines
2. We add a lot dependency: Rockchip may remove or rename files in their git reblobitory as they like. If we (or any other users) then want to use a newer commit of their reblobitory, e.g., to use newer blobs, and the file name / path scheme breaks, we have to fix that again.
Quoted 4 lines
This is the responsibility of the package maintainer, like for any other package. I do agree though that the name of the installed binaries should stay consistent between new versions, so that we only need to update rockchip-rkbin and not any other package that depends on it.
This takes unnecessary burden on the maintainer, and that is a bad thing in my opinion. I really think it is a huge plus, if a package is designed such, that it does not need much maintenance and that it is unlikely by design that it breaks due to external reasons (e.g., Rockchip unpredictably deciding to rename their blobs). After all, you never know, whether there is still a maintainer in the future who has time to maintain (or even wants to).
Quoted 11 lines
Quoted 10 lines
Thinking out loud:
For the rockchip-rkbin package we could feature:
* custom git version option (then defconfigs could freeze the repo version)
* option to specify tpl file name
* option to specify bl31 file name
* option to specify op-tee file name
Quoted 4 lines
Well.. that's one thing I completely forgot about. Maybe people don't want to update rockchip-rkbin for their boards... SO yeah, I guess those 4 options actually make more sense than trying to be smart and have a select for each SoC.
Yes, I like this, too. I implemented it like this in v6 (and v5).
Best regards,
Kilian
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot