public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jagan Teki <jagan@amarulasolutions.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 9/9] rockchip: rk3399: Create single image using BINMAN
Date: Sun, 28 Apr 2019 14:39:13 +0530	[thread overview]
Message-ID: <20190428090913.10568-10-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20190428090913.10568-1-jagan@amarulasolutions.com>

RK3399 platform has two stage boot loaders like 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.

without this patch:
------------------
₹ sudo dd if=spl/u-boot-spl-rockchip.bin of=/dev/sdc seek=64
₹ sudo dd if=u-boot.itb of=/dev/sdc seek=16384

with this patch:
---------------
₹ sudo dd if=u-boot-rockchip-with-spl.bin of=/dev/sdc seek=64

This would easily extend if other rockchip family SoC's would
make use of single image creation.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 Makefile                                | 13 +++++++++++++
 arch/arm/dts/rk3399-ficus-u-boot.dtsi   |  1 +
 arch/arm/dts/rk3399-rock960-u-boot.dtsi |  1 +
 arch/arm/dts/rk3399-u-boot.dtsi         | 17 +++++++++++++++++
 arch/arm/mach-rockchip/Kconfig          |  1 +
 doc/README.rockchip                     |  8 ++------
 include/configs/rk3399_common.h         |  2 ++
 7 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 2471340c71..0fe7ac3cc0 100644
--- a/Makefile
+++ b/Makefile
@@ -851,6 +851,11 @@ ifeq ($(CONFIG_ARCH_SUNXI)$(CONFIG_SPL),yy)
 ALL-y += u-boot-sunxi-with-spl.bin
 endif
 
+# Build a combined spl + u-boot image for rockchip
+ifdef CONFIG_ROCKCHIP_RK3399
+ALL-$(CONFIG_ARCH_ROCKCHIP) += u-boot-rockchip-with-spl.bin
+endif
+
 # enable combined SPL/u-boot/dtb rules for tegra
 ifeq ($(CONFIG_TEGRA)$(CONFIG_SPL),yy)
 ALL-y += u-boot-tegra.bin u-boot-nodtb-tegra.bin
@@ -1366,6 +1371,11 @@ u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.itb FORCE
 endif
 endif
 
+ifeq ($(CONFIG_ROCKCHIP_RK3399),y)
+u-boot-rockchip-with-spl.bin: spl/u-boot-spl-rockchip.bin u-boot.itb FORCE
+	@$(call if_changed,binman)
+endif # CONFIG_ROCKCHIP_RK3399
+
 ifneq ($(CONFIG_TEGRA),)
 ifneq ($(CONFIG_BINMAN),)
 # Makes u-boot-dtb-tegra.bin u-boot-tegra.bin u-boot-nodtb-tegra.bin
@@ -1664,6 +1674,9 @@ spl/u-boot-spl: tools prepare \
 spl/sunxi-spl.bin: spl/u-boot-spl
 	@:
 
+spl/u-boot-spl-rockchip.bin: spl/u-boot-spl
+	@:
+
 spl/sunxi-spl-with-ecc.bin: spl/sunxi-spl.bin
 	@:
 
diff --git a/arch/arm/dts/rk3399-ficus-u-boot.dtsi b/arch/arm/dts/rk3399-ficus-u-boot.dtsi
index eab86bdb30..67b63a8352 100644
--- a/arch/arm/dts/rk3399-ficus-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-ficus-u-boot.dtsi
@@ -3,4 +3,5 @@
  * Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
  */
 
+#include "rk3399-u-boot.dtsi"
 #include "rk3399-sdram-ddr3-1600.dtsi"
diff --git a/arch/arm/dts/rk3399-rock960-u-boot.dtsi b/arch/arm/dts/rk3399-rock960-u-boot.dtsi
index 5256f6d3f2..7fb5072a9b 100644
--- a/arch/arm/dts/rk3399-rock960-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-rock960-u-boot.dtsi
@@ -3,4 +3,5 @@
  * Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
  */
 
+#include "rk3399-u-boot.dtsi"
 #include "rk3399-sdram-lpddr3-2GB-1600.dtsi"
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi
index 0786c1193a..abd0b091ab 100644
--- a/arch/arm/dts/rk3399-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-u-boot.dtsi
@@ -3,6 +3,23 @@
  * Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
  */
 
+#include <config.h>
+
+/ {
+	binman {
+		filename = "u-boot-rockchip-with-spl.bin";
+		pad-byte = <0xff>;
+
+		blob {
+			filename = "spl/u-boot-spl-rockchip.bin";
+		};
+
+		u-boot-img {
+			offset = <CONFIG_SPL_PAD_TO>;
+		};
+	};
+};
+
 &sdmmc {
 	u-boot,dm-pre-reloc;
 };
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 286c870135..7ac0ee3c2d 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -130,6 +130,7 @@ endif
 config ROCKCHIP_RK3399
 	bool "Support Rockchip RK3399"
 	select ARM64
+	select BINMAN
 	select SUPPORT_SPL
 	select SPL
 	select SPL_ATF
diff --git a/doc/README.rockchip b/doc/README.rockchip
index ccbaaaa9a7..4ceb383bb7 100644
--- a/doc/README.rockchip
+++ b/doc/README.rockchip
@@ -422,13 +422,9 @@ Option 2: Package the image with SPL:
 
     => cd /path/to/u-boot
 
-  - Write prefixed SPL at 64th sector
+  - Write single spl + u-boot at 64th sector
 
-    => sudo dd if=spl/u-boot-spl-rockchip.bin of=/dev/sdc seek=64
-
-  - Write U-Boot proper at 16384 sector
-
-    => sudo dd if=u-boot.itb of=/dev/sdc seek=16384
+    => sudo dd if=u-boot-rockchip-with-spl.bin of=/dev/sdc seek=64
     => sync
 
 Put this SD (or micro-SD) card into your board and reset it. You should see
diff --git a/include/configs/rk3399_common.h b/include/configs/rk3399_common.h
index b412012582..a658f03ade 100644
--- a/include/configs/rk3399_common.h
+++ b/include/configs/rk3399_common.h
@@ -38,6 +38,8 @@
 #define CONFIG_SYS_SDRAM_BASE		0
 #define SDRAM_MAX_SIZE			0xf8000000
 
+#define CONFIG_SPL_PAD_TO		8355840
+
 #ifndef CONFIG_SPL_BUILD
 
 #define ENV_MEM_LAYOUT_SETTINGS \
-- 
2.18.0.321.gffc6fa0e3

      parent reply	other threads:[~2019-04-28  9:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-28  9:09 [U-Boot] [PATCH v2 0/9] rk3399: make u-boot-rockchip-with-spl.bin Jagan Teki
2019-04-28  9:09 ` [U-Boot] [PATCH v2 1/9] Makefile: clean image.map Jagan Teki
2019-04-28  9:09 ` [U-Boot] [PATCH v2 2/9] Makefile: clean bl31_*.bin Jagan Teki
2019-04-28  9:09 ` [U-Boot] [PATCH v2 3/9] travis.yml: Add pyelftools install entry Jagan Teki
2019-04-28  9:09 ` [U-Boot] [PATCH v2 4/9] rockchip: rk3399: Get bl31.elf via BL31 Jagan Teki
2019-04-28  9:09 ` [U-Boot] [PATCH v2 5/9] board: puma: Get bl31.bin via BL31 and rk3399m0.bin via PMUM0 Jagan Teki
2019-05-07  5:01   ` Kever Yang
2019-04-28  9:09 ` [U-Boot] [PATCH v2 6/9] Kconfig: Add u-boot.itb BUILD_TARGET for Rockchip Jagan Teki
2019-04-28  9:09 ` [U-Boot] [PATCH v2 7/9] Makefile.spl: Create u-boot-spl-rockchip.bin for rk3399 Jagan Teki
2019-05-07  6:34   ` Kever Yang
2019-05-07  6:44     ` Jagan Teki
2019-04-28  9:09 ` [U-Boot] [PATCH v2 8/9] dts: Makefile: Build rockchip dtbs based on SoC types Jagan Teki
2019-04-28  9:09 ` Jagan Teki [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190428090913.10568-10-jagan@amarulasolutions.com \
    --to=jagan@amarulasolutions.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox