diff mbox series

[v2,1/3] package: add rockchip-rkbin package

Message ID 20230702205224.50568-1-kilian.zinnecker@mail.de
State Superseded
Headers show
Series [v2,1/3] package: add rockchip-rkbin package | expand

Commit Message

Kilian Zinnecker July 2, 2023, 8:52 p.m. UTC
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.

Signed-off-by: Kilian Zinnecker <kilian.zinnecker@mail.de>
---
 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
diff mbox series

Patch

diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
index 085397d03d..8ec095a735 100644
--- a/boot/uboot/Config.in
+++ b/boot/uboot/Config.in
@@ -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
diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index 4eae8e95c3..4ef0a7bc2a 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -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
diff --git a/package/Config.in b/package/Config.in
index bff090a661..80221d0406 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -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"
diff --git a/package/rockchip-rkbin/Config.in b/package/rockchip-rkbin/Config.in
new file mode 100644
index 0000000000..d8072002ca
--- /dev/null
+++ b/package/rockchip-rkbin/Config.in
@@ -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.
diff --git a/package/rockchip-rkbin/rockchip-rkbin.mk b/package/rockchip-rkbin/rockchip-rkbin.mk
new file mode 100644
index 0000000000..ac50c8931d
--- /dev/null
+++ b/package/rockchip-rkbin/rockchip-rkbin.mk
@@ -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))