Skip to contentSkip to conversation

package: add rockchip-rkbin package

PATCH Superseded Andreas Ziegler 2 participants 8 messages Jul 2, 2023 1 message not in the archive Arm Rockchip

v2 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi Kilian,

some comments inline.

Quoted 40 lines · Kilian Zinnecker

Adds a package to fetch Rockchip specifig ATF binary blobs, which are needed to build u-boot for the Rockchip RK3588 SoC.

---
 package/Config.in                        |  1 +
 package/rockchip-rkbin/Config.in         | 19 +++++++++++++++++++
 package/rockchip-rkbin/rockchip-rkbin.mk | 19 +++++++++++++++++++
 3 files changed, 39 insertions(+)
 create mode 100644 package/rockchip-rkbin/Config.in
 create mode 100644 package/rockchip-rkbin/rockchip-rkbin.mk
package/Config.in +1 -0
index bff090a661..80221d0406 100644
@@ -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 +9 -0
new file mode 100644
index 0000000000..a877d4f1cf
@@ -0,0 +1,19 @@
+config BR2_PACKAGE_ROCKCHIP_RKBIN
+	bool "Rockchip RKBIN binary blobs"
+	depends on BR2_arm || BR2_aarch64
+	help
+	  Those packages provide binary blobs for the Rockchip RK
+          SoCs.
+
+if BR2_PACKAGE_ROCKCHIP_RKBIN
+choice

package/rockchip-rkbin/Config.in line 19

Quoted 10 lines
package/rockchip-rkbin/Config.in new file +10 -0
+	prompt "Rockchip RK platform"
+
+config BR2_PACKAGE_ROCKCHIP_RKBIN_PLATFORM_RK3588
+	bool "rk3588"
+endchoice
+
+config BR2_PACKAGE_ROCKCHIP_RKBIN_PLATFORM
+	string
+	default "RK3588" if BR2_PACKAGE_ROCKCHIP_RKBIN_PLATFORM_RK3588
+endif

Both BR2_PACKAGE_ROCKCHIP_RKBIN_PLATFORM* variables are never used, you might remove them.

If you intend to make the package reusable, just use the <choice> directive and add a section in rockchip-rkbin.mk to define the firmware file names:

ifeq ($(BR2_PACKAGE_ROCKCHIP_RKBIN_PLATFORM_RK3588),y) ROCKCHIP_RKBIN_DDRFW = rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin ROCKCHIP_RKBIN_EL3FW = rk35/rk3588_bl31_v1.38.elf
endif

to be used in INSTALL_STAGING_CMDS.

Quoted 8 lines
package/rockchip-rkbin/rockchip-rkbin.mk new file +2 -0
new file mode 100644
index 0000000000..51421769b4
@@ -0,0 +1,19 @@
+################################################################################
+#

package/rockchip-rkbin/rockchip-rkbin.mk line 12

Quoted 10 lines
package/rockchip-rkbin/rockchip-rkbin.mk new file +10 -0
+# 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

Technically not necessary, but to document that this package is not intended for the target, you might add:

ROCKCHIP_RKBIN_INSTALL_TARGET = NO

Quoted 10 lines
package/rockchip-rkbin/rockchip-rkbin.mk new file +3 -0
+
+define ROCKCHIP_RKBIN_INSTALL_STAGING_CMDS
+	cp $(@D)/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin 

$(BINARIES_DIR)/

package/rockchip-rkbin/rockchip-rkbin.mk new file +4 -1
+	cp $(@D)/bin/rk35/rk3588_bl31_v1.38.elf $(BINARIES_DIR)/
+endef
+
+$(eval $(generic-package))
--

2.34.1

Kind regards,
Andreas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Hello Andreas,

thanks for your feedback! I had a look at u-boot's documentation about Rockchip's support (https://source.denx.de/u-boot/u-boot/-/blob/master/doc/
board/rockchip/rockchip.rst):

Only boards with rk3588 SoC (e.g., Rock 5b) and boards with rk3568 SoC currently need Rockchip binary blobs from the rkbin repository. However, I don't see any defconfig in buildroot for any of the rk3568 based boards, listed in u-boot's documentation. Hence, I think that it currently does not make any sense to have a potential choice for other Rockchip SoCs. Hence, as you suggested, I removed the two variables and introduced two variables to select the actual binary names, as they may differ if someone uses another commit id for the rkbin git repository. See the new version of the rockchip-rkbin Config.in and rockchip-rkbin.mk, and the new defconfig.

On the occasion: What is the common practice, if someone does rework on a patch? Shall I then send it as email response (like I do now)? Or should I better send a "new" email and add a version to the subject line, e.g., "[Buildroot] [Patch v2 1/3] package: add rockchip-rkbin package"?

Also, is there a way to add a flag to the Config.in of uboot, which makes a "depends on rockchip-rkbin" if the BR2_TARGET_UBOOT_BOARD_DEFCONFIG equals "rock5b-rk3588", "evb-rk3588", or "neu6a-io-rk3588"? Or is it beneficial to a an option like BR2_TARGET_UBOOT_NEEDS_ROCKCHIP_RKBIN?

Best regards,
Kilian

============

From 2acbcb5d0e1fc92fc388fa99cb25923e5497b17d Mon Sep 17 00:00:00 2001
From: Kilian Zinnecker <[email protected]>
Date: Sun, 2 Jul 2023 14:41:41 +0200
Subject: [PATCH] Add rockchip-rkbin package and defconfig

---
 configs/rock5b_defconfig                 | 41 ++++++++++++++++++++++++
 package/Config.in                        |  1 +
 package/rockchip-rkbin/Config.in         | 18 +++++++++++
 package/rockchip-rkbin/rockchip-rkbin.mk | 19 +++++++++++
 4 files changed, 79 insertions(+)
 create mode 100644 configs/rock5b_defconfig
 create mode 100644 package/rockchip-rkbin/Config.in
 create mode 100644 package/rockchip-rkbin/rockchip-rkbin.mk
configs/rock5b_defconfig new file +34 -0
new file mode 100644
index 0000000000..3c814bf356
@@ -0,0 +1,41 @@
+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"
+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_CUSTOM_MAKEOPTS="BL31=$(BINARIES_DIR)/rk3588_bl31_v1.38.elf 

ROCKCHIP_TPL=$(BINARIES_DIR)/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.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

package/Config.in +1 -0
index bff090a661..80221d0406 100644
@@ -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 +18 -0
new file mode 100644
index 0000000000..4005fd25ce
@@ -0,0 +1,18 @@
+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.
+
+if BR2_PACKAGE_ROCKCHIP_RKBIN
+
+config BR2_PACKAGE_ROCKCHIP_RKBIN_RK3588_DDRFW
+	string
+	default "rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin"
+
+config BR2_PACKAGE_ROCKCHIP_RKBIN_RK3588_EL3FW
+	string
+	default "rk3588_bl31_v1.38.elf"
+
+endif
package/rockchip-rkbin/ renamed from package/rockchip-rkbin/rockchip-rkbin.mk +0 -0

rockchip-rkbin.mk
new file mode 100644
index 0000000000..a173dedad5

package/rockchip-rkbin/rockchip-rkbin.mk new file +15 -0
@@ -0,0 +1,19 @@
+################################################################################
+#
+# 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
+
+define ROCKCHIP_RKBIN_INSTALL_STAGING_CMDS
+	cp $(@D)/bin/rk35/$(BR2_PACKAGE_ROCKCHIP_RKBIN_RK3588_DDRFW) $

(BINARIES_DIR)/
+ cp $(@D)/bin/rk35/$(BR2_PACKAGE_ROCKCHIP_RKBIN_RK3588_EL3FW) $
(BINARIES_DIR)/
+endef
+
+$(eval $(generic-package))
--
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Hello Andreas,

I just saw that I sent the old defconfig again, whithout the change. Here is the change for the rock5b_defonfig:

============

From cb8212a41f9e41829de44dfe82cda1d5185985a6 Mon Sep 17 00:00:00 2001
From: Kilian Zinnecker <[email protected]>
Date: Sun, 2 Jul 2023 15:40:10 +0200
Subject: [PATCH] configs/rock5b_defconfig: Change uboot rkbin files

Use the BR2 variables to define the actual rkbin files which u-boot shall use during build. This way changes made via menuconfig in any of those files in the rockchip-rkbin package are properly propagated to the u-boot build.

---
 configs/rock5b_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configs/rock5b_defconfig +0 -1
index 3c814bf356..65893f7501 100644
@@ -31,7 +31,7 @@ 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_CUSTOM_MAKEOPTS="BL31=$(BINARIES_DIR)/rk3588_bl31_v1.38.elf 

ROCKCHIP_TPL=$(BINARIES_DIR)/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin" +BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="BL31=$(BINARIES_DIR)/$ (BR2_PACKAGE_ROCKCHIP_RKBIN_RK3588_EL3FW) ROCKCHIP_TPL=$(BINARIES_DIR)/$ (BR2_PACKAGE_ROCKCHIP_RKBIN_RK3588_DDRFW)"
BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/radxa/rock5b/uboot.fragment" BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y BR2_PACKAGE_HOST_DOSFSTOOLS=y

Signature · 12 lines
2.34.1

============

Best regards,
Kilian


_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw
In reply to Kilian Zinnecker via buildroot

Hi Kilian,

Quoted 16 lines · Kilian Zinnecker

Hello Andreas,

thanks for your feedback! I had a look at u-boot's documentation about Rockchip's support (https://source.denx.de/u-boot/u-boot/-/blob/master/doc/
board/rockchip/rockchip.rst):

Only boards with rk3588 SoC (e.g., Rock 5b) and boards with rk3568 SoC currently need Rockchip binary blobs from the rkbin repository. However, I don't see any defconfig in buildroot for any of the rk3568 based boards, listed in u-boot's documentation. Hence, I think that it currently does not make any sense to have a potential choice for other Rockchip SoCs. Hence, as you suggested, I removed the two variables and introduced two variables to select the actual binary names, as they may differ if someone uses another commit id for the rkbin git repository. See the new version of the rockchip-rkbin Config.in and rockchip-rkbin.mk, and the new defconfig.

Quoted 4 lines

On the occasion: What is the common practice, if someone does rework on a patch? Shall I then send it as email response (like I do now)? Or should I better send a "new" email and add a version to the subject line, e.g., "[Buildroot] [Patch v2 1/3] package: add rockchip-rkbin package"?

Using an email program may or may not work. Sometimes the message is mangled in collaboration between email client and patchwork. Usually you send the mail from the command line, using git send-email. The information is buried somewhere in the manual [1].

Excerpt from 'Notes to myself':

(This is a staging tree, actual changes reside in a different place.)

In case of a revision, revert the last patch

# git reset --soft HEAD~1
# git restore --staged <relative-path-to-file>

Or checkout the relevant file(s) to overwrite the changes:

# git checkout <relative-path-to-file>

Make changes, add and commit

# git add <relative-path-to-file>
# git commit -m "commit message"

New patch references the last message on the buildroot list

# git format-patch -v2 -M -n -s -o outgoing origin/master --in-reply-to=<Message-ID>

Edit patch description, check if 'v2' in subject line exists. Add version information below triple dash (---).

Determine CC list

# utils/get-developers outgoing/*.patch
If that lists only the TO address, try additionally
# utils/get-developers -p <packagename>

Send patch

# git send-email --to [email protected] --cc <package developer> --cc <other interested party> outgoing/0001-<commit message>.patch
Quoted 4 lines

Also, is there a way to add a flag to the Config.in of uboot, which makes a "depends on rockchip-rkbin" if the BR2_TARGET_UBOOT_BOARD_DEFCONFIG equals "rock5b-rk3588", "evb-rk3588", or "neu6a-io-rk3588"? Or is it beneficial to a an option like BR2_TARGET_UBOOT_NEEDS_ROCKCHIP_RKBIN?

There is something comparable which handles BR2_TARGET_UBOOT_NEEDS_IMX_FIRMWARE. If it works like it is, just keep it.

Quoted 97 lines

Best regards,
Kilian

============

From 2acbcb5d0e1fc92fc388fa99cb25923e5497b17d Mon Sep 17 00:00:00 2001
From: Kilian Zinnecker <[email protected]>
Date: Sun, 2 Jul 2023 14:41:41 +0200
Subject: [PATCH] Add rockchip-rkbin package and defconfig

---
 configs/rock5b_defconfig                 | 41 ++++++++++++++++++++++++
 package/Config.in                        |  1 +
 package/rockchip-rkbin/Config.in         | 18 +++++++++++
 package/rockchip-rkbin/rockchip-rkbin.mk | 19 +++++++++++
 4 files changed, 79 insertions(+)
 create mode 100644 configs/rock5b_defconfig
 create mode 100644 package/rockchip-rkbin/Config.in
 create mode 100644 package/rockchip-rkbin/rockchip-rkbin.mk
configs/rock5b_defconfig new file +34 -0
new file mode 100644
index 0000000000..3c814bf356
@@ -0,0 +1,41 @@
+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"
+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_CUSTOM_MAKEOPTS="BL31=$(BINARIES_DIR)/rk3588_bl31_v1.38.elf

ROCKCHIP_TPL=$(BINARIES_DIR)/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin"

configs/rock5b_defconfig new file +7 -0
+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
package/Config.in +1 -0
index bff090a661..80221d0406 100644
@@ -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 +8 -0
new file mode 100644
index 0000000000..4005fd25ce
@@ -0,0 +1,18 @@
+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.
+
+if BR2_PACKAGE_ROCKCHIP_RKBIN

package/rockchip-rkbin/Config.in line 18

Quoted 10 lines
package/rockchip-rkbin/Config.in new file +10 -0
+
+config BR2_PACKAGE_ROCKCHIP_RKBIN_RK3588_DDRFW
+	string
+	default "rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin"
+
+config BR2_PACKAGE_ROCKCHIP_RKBIN_RK3588_EL3FW
+	string
+	default "rk3588_bl31_v1.38.elf"
+
+endif

This is highly unusual, normally definitions like these should go into the .mk file. And yes, I know you need them later in the defconfig. Tells me that the uboot configuration is highly convoluted ... Any chance to use generic names (e.g. ddr.bin, bl31.bin) in BINARIES_DIR, put them in clear text in Config.in and defconfig and perform the copying of rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin -> ddr.bin in the .mk file?

Any thoughts from others?

Quoted 29 lines
package/rockchip-rkbin/ renamed from package/rockchip-rkbin/rockchip-rkbin.mk +0 -0

rockchip-rkbin.mk
new file mode 100644
index 0000000000..a173dedad5

package/rockchip-rkbin/rockchip-rkbin.mk new file +15 -0
@@ -0,0 +1,19 @@
+################################################################################
+#
+# 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
+
+define ROCKCHIP_RKBIN_INSTALL_STAGING_CMDS
+	cp $(@D)/bin/rk35/$(BR2_PACKAGE_ROCKCHIP_RKBIN_RK3588_DDRFW) $

(BINARIES_DIR)/

package/rockchip-rkbin/rockchip-rkbin.mk new file +1 -0
+	cp $(@D)/bin/rk35/$(BR2_PACKAGE_ROCKCHIP_RKBIN_RK3588_EL3FW) $

(BINARIES_DIR)/

package/rockchip-rkbin/rockchip-rkbin.mk new file +3 -1
+endef
+
+$(eval $(generic-package))
--
Quoted 1 line

2.34.1

Kind regards,
Andreas

[1] https://buildroot.org/downloads/manual/manual.html#submitting-patches
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw

PATCH v2 1/3 package: add rockchip-rkbin package

This patch adds the 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.

---
 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 +++++++++++++++++++++++
 5 files changed, 49 insertions(+)
 create mode 100644 package/rockchip-rkbin/Config.in
 create mode 100644 package/rockchip-rkbin/rockchip-rkbin.mk
boot/uboot/Config.in +9 -0
index 085397d03d..8ec095a735 100644
@@ -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
index 4eae8e95c3..4ef0a7bc2a 100644
@@ -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
index bff090a661..80221d0406 100644
@@ -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
new file mode 100644
index 0000000000..d8072002ca
@@ -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
new file mode 100644
index 0000000000..ac50c8931d
@@ -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
#6 lore raw

PATCH v2 2/3 configs: add rock5b/rock5b_defconfig

In reply to Andreas Ziegler

This 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.

---
 board/radxa/rock5b/linux.fragment |  1 +
 configs/rock5b_defconfig          | 38 +++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)
 create mode 100644 board/radxa/rock5b/linux.fragment
 create mode 100644 configs/rock5b_defconfig
board/radxa/rock5b/linux.fragment new file +1 -0
new file mode 100644
index 0000000000..811d42a79b
@@ -0,0 +1 @@
+CONFIG_R8169=y
configs/rock5b_defconfig new file +38 -0
new file mode 100644
index 0000000000..f300e5d080
@@ -0,0 +1,38 @@
+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_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/radxa/rock5b/uboot.fragment"
+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
#7 lore raw

PATCH v2 3/3 board/radxa/rock5b: Add sdcard image scripts

In reply to Andreas Ziegler

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.

---
 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.fragment
board/radxa/rock5b/genimage.cfg new file +36 -0
new file mode 100644
index 0000000000..88a4f1ee9e
@@ -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
new file mode 100755
index 0000000000..891f52201d
@@ -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}/
+
+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
new file mode 100644
index 0000000000..0613e0b772
@@ -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 +4 -0
index f300e5d080..fb8ecf07e2 100644
@@ -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"
+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
#8 lore raw
In reply to Andreas Ziegler

Hello Andreas,

Quoted 27 lines

Using an email program may or may not work. Sometimes the message is mangled in collaboration between email client and patchwork. Usually you send the mail from the command line, using git send-email. The information is buried somewhere in the manual [1].

Excerpt from 'Notes to myself':

(This is a staging tree, actual changes reside in a different place.)

In case of a revision, revert the last patch

# git reset --soft HEAD~1
# git restore --staged <relative-path-to-file>

Or checkout the relevant file(s) to overwrite the changes:

# git checkout <relative-path-to-file>

Make changes, add and commit

# git add <relative-path-to-file>
# git commit -m "commit message"

New patch references the last message on the buildroot list

# git format-patch -v2 -M -n -s -o outgoing origin/master
--in-reply-to=<Message-ID>

Edit patch description, check if 'v2' in subject line exists. Add version information below triple dash (---).

Quoted 8 lines

Determine CC list

# utils/get-developers outgoing/*.patch
If that lists only the TO address, try additionally
# utils/get-developers -p <packagename>

Send patch

# git send-email --to [email protected] --cc <package developer>
--cc <other interested party> outgoing/0001-<commit message>.patch

Thanks a lot! I just resend the new version of the patches, but I accidentally did not address them directly to you as well. They are on the mailing list.

Quoted 11 lines
Quoted 7 lines

Also, is there a way to add a flag to the Config.in of uboot, which makes a
"depends on rockchip-rkbin" if the BR2_TARGET_UBOOT_BOARD_DEFCONFIG equals
"rock5b-rk3588", "evb-rk3588", or "neu6a-io-rk3588"? Or is it beneficial to a
an option like BR2_TARGET_UBOOT_NEEDS_ROCKCHIP_RKBIN?

There is something comparable which handles BR2_TARGET_UBOOT_NEEDS_IMX_FIRMWARE. If it works like it is, just keep it.

I added a corresponding option for the rockchip-rkbin dependency.

Quoted 20 lines

package/rockchip-rkbin/Config.in line 18

Quoted 11 lines
package/rockchip-rkbin/Config.in new file +11 -0
+if BR2_PACKAGE_ROCKCHIP_RKBIN
+
+config BR2_PACKAGE_ROCKCHIP_RKBIN_RK3588_DDRFW
+	string
+	default "rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin"
+
+config BR2_PACKAGE_ROCKCHIP_RKBIN_RK3588_EL3FW
+	string
+	default "rk3588_bl31_v1.38.elf"
+
+endif

This is highly unusual, normally definitions like these should go into the .mk file. And yes, I know you need them later in the defconfig. Tells me that the uboot configuration is highly convoluted ... Any chance to use generic names (e.g. ddr.bin, bl31.bin) in BINARIES_DIR, put them in clear text in Config.in and defconfig and perform the copying of rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin -> ddr.bin in the .mk file?

Quoted 1 line

Any thoughts from others?

Since I "hard coded" the commit id of the git repository for rockchip-rkbin inside the .mk file anyway, I think it is only consistently to then also "hard code" the binary filenames into the .mk file as well: After all, the names only change, if someone changes the commit id inside the same .mk file.

Best regards,
Kilian

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot