[U-Boot] [PATCH v3 4/5] rockchip: Add Binman support
Jagan Teki
jagan at amarulasolutions.com
Thu Oct 17 19:07:09 UTC 2019
TPL-based rockchip platform like rk3288, rk3328, rk3368
and rk3399 has three stage boot loaders like TPL, SPL and
U-Boot proper. For each stage we need to burn the image
on to flash with respective offsets.
This patch create a single image using binman, so that
user can get rid of burning different stage boot images.
The new image called 'u-boot-rockchip-with-tpl-spl.bin'
which can burn into flash like:
₹ sudo dd if=u-boot-rockchip-with-tpl-spl.bin of=/dev/sda seek=64
This would easily extend if other rockchip family SoC's would
make use of single image creation.
Cc: Kever Yang <kever.yang at rock-chips.com>
Cc: Matwey V. Kornilov <matwey.kornilov at gmail.com>
Signed-off-by: Jagan Teki <jagan at amarulasolutions.com>
---
Makefile | 10 ++++++++++
arch/arm/Kconfig | 1 +
arch/arm/dts/rk3288-u-boot.dtsi | 2 ++
arch/arm/dts/rk3328-u-boot.dtsi | 2 ++
arch/arm/dts/rk3368-u-boot.dtsi | 2 ++
arch/arm/dts/rk3399-u-boot.dtsi | 2 ++
arch/arm/dts/rockchip-u-boot.dtsi | 21 +++++++++++++++++++++
include/configs/rockchip-common.h | 2 ++
8 files changed, 42 insertions(+)
create mode 100644 arch/arm/dts/rockchip-u-boot.dtsi
diff --git a/Makefile b/Makefile
index 918b5d53e0..049781e0ba 100644
--- a/Makefile
+++ b/Makefile
@@ -888,6 +888,7 @@ endif
ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL)$(CONFIG_TPL),yyy)
ALL-y += spl/u-boot-spl-rockchip.bin
+ALL-y += u-boot-rockchip-with-tpl-spl.bin
endif
LDFLAGS_u-boot += $(LDFLAGS_FINAL)
@@ -1346,6 +1347,15 @@ tpl/u-boot-tpl.img: tpl/u-boot-tpl.bin FORCE
$(call if_changed,mkimage)
spl/u-boot-spl-rockchip.bin: tpl/u-boot-tpl.img spl/u-boot-spl.bin FORCE
$(call if_changed,cat)
+
+ifdef CONFIG_SPL_LOAD_FIT
+ROCKCHIP_UBOOT_IMG := u-boot.itb
+else
+ROCKCHIP_UBOOT_IMG := u-boot.img
+endif
+
+u-boot-rockchip-with-tpl-spl.bin: spl/u-boot-spl-rockchip.bin $(ROCKCHIP_UBOOT_IMG) FORCE
+ $(call if_changed,binman)
endif
ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1df2aba3c2..87fa1f43f4 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1594,6 +1594,7 @@ config ARCH_STM32MP
config ARCH_ROCKCHIP
bool "Support Rockchip SoCs"
select BLK
+ select BINMAN if TPL && SPL
select DM
select DM_GPIO
select DM_I2C
diff --git a/arch/arm/dts/rk3288-u-boot.dtsi b/arch/arm/dts/rk3288-u-boot.dtsi
index 3f00a3b6d3..6d31735362 100644
--- a/arch/arm/dts/rk3288-u-boot.dtsi
+++ b/arch/arm/dts/rk3288-u-boot.dtsi
@@ -3,6 +3,8 @@
* Copyright (C) 2019 Rockchip Electronics Co., Ltd
*/
+#include "rockchip-u-boot.dtsi"
+
/ {
chosen {
u-boot,spl-boot-order = \
diff --git a/arch/arm/dts/rk3328-u-boot.dtsi b/arch/arm/dts/rk3328-u-boot.dtsi
index ffbd657e31..0c51a8dbfb 100644
--- a/arch/arm/dts/rk3328-u-boot.dtsi
+++ b/arch/arm/dts/rk3328-u-boot.dtsi
@@ -3,6 +3,8 @@
* (C) Copyright 2019 Rockchip Electronics Co., Ltd
*/
+#include "rockchip-u-boot.dtsi"
+
/ {
aliases {
mmc0 = &emmc;
diff --git a/arch/arm/dts/rk3368-u-boot.dtsi b/arch/arm/dts/rk3368-u-boot.dtsi
index 1e7d079315..41ac054b81 100644
--- a/arch/arm/dts/rk3368-u-boot.dtsi
+++ b/arch/arm/dts/rk3368-u-boot.dtsi
@@ -2,3 +2,5 @@
/*
* Copyright (C) 2019 Jagan Teki <jagan at amarulasolutions.com>
*/
+
+#include "rockchip-u-boot.dtsi"
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi
index 2738a3889e..fe8a73d653 100644
--- a/arch/arm/dts/rk3399-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-u-boot.dtsi
@@ -3,6 +3,8 @@
* Copyright (C) 2019 Jagan Teki <jagan at amarulasolutions.com>
*/
+#include "rockchip-u-boot.dtsi"
+
&pmu {
u-boot,dm-pre-reloc;
};
diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi
new file mode 100644
index 0000000000..c496107119
--- /dev/null
+++ b/arch/arm/dts/rockchip-u-boot.dtsi
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 Jagan Teki <jagan at amarulasolutions.com>
+ */
+
+#include <config.h>
+
+/ {
+ binman {
+ filename = "u-boot-rockchip-with-tpl-spl.bin";
+ pad-byte = <0xff>;
+
+ blob {
+ filename = "spl/u-boot-spl-rockchip.bin";
+ };
+
+ u-boot-img {
+ offset = <CONFIG_SPL_PAD_TO>;
+ };
+ };
+};
diff --git a/include/configs/rockchip-common.h b/include/configs/rockchip-common.h
index 68e1105a4b..d7f5ca9fa4 100644
--- a/include/configs/rockchip-common.h
+++ b/include/configs/rockchip-common.h
@@ -9,6 +9,8 @@
#define CONFIG_SYS_NS16550_MEM32
+#define CONFIG_SPL_PAD_TO 8355840
+
#ifndef CONFIG_SPL_BUILD
/* First try to boot from SD (index 0), then eMMC (index 1) */
--
2.18.0.321.gffc6fa0e3
More information about the U-Boot
mailing list