[U-Boot] [PATCH] Makefile: Create single image for imx6 socs based boards

Shyam Saini shyam.saini at amarulasolutions.com
Tue Apr 30 10:33:53 UTC 2019


IMX6 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 of=/dev/mmcblk0 bs=1k seek=1
$ sudo dd if=u-boot-dtb.img of=/dev/mmcblk0 bs=1k seek=69

with this patch:
---------------
$ sudo dd if=u-boot-imx6-with-spl.bin of=/dev/mmcblk0 bs=1k seek=1

This would be easily extended to single image creation
for other imx6 soc boards.

This was tested on engicam imx6qdl and imx6ul boards

Reviewed-by: Jagan Teki <jagan at amarulasolutions.com>
Signed-off-by: Shyam Saini <shyam.saini at amarulasolutions.com>
---
 Makefile                             | 10 ++++++++++
 arch/arm/dts/imx6-u-boot-binman.dtsi | 16 ++++++++++++++++
 arch/arm/dts/imx6qdl-u-boot.dtsi     |  1 +
 arch/arm/dts/imx6ul-u-boot.dtsi      |  1 +
 arch/arm/mach-imx/mx6/Kconfig        |  2 ++
 doc/imx/common/imx6.txt              |  5 +++++
 6 files changed, 35 insertions(+)
 create mode 100644 arch/arm/dts/imx6-u-boot-binman.dtsi

diff --git a/Makefile b/Makefile
index f2c7bb6041..474271a1d0 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 imx6
+ifeq ($(filter y, $(CONFIG_MX6QDL) $(CONFIG_MX6UL))$(CONFIG_SPL)$(CONFIG_OF_CONTROL),yyy)
+ALL-$(CONFIG_ARCH_MX6) += u-boot-imx6-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
@@ -1364,6 +1369,11 @@ u-boot-br.bin: u-boot FORCE
 endif
 endif
 
+ifeq ($(filter y, $(CONFIG_MX6QDL) $(CONFIG_MX6UL))$(CONFIG_SPL)$(CONFIG_OF_CONTROL),yyy)
+u-boot-imx6-with-spl.bin: SPL u-boot-dtb.img FORCE
+	@$(call if_changed,binman)
+endif
+
 # x86 uses a large ROM. We fill it with 0xff, put the 16-bit stuff (including
 # reset vector) at the top, Intel ME descriptor at the bottom, and U-Boot in
 # the middle. This is handled by binman based on an image description in the
diff --git a/arch/arm/dts/imx6-u-boot-binman.dtsi b/arch/arm/dts/imx6-u-boot-binman.dtsi
new file mode 100644
index 0000000000..fa02d5f61f
--- /dev/null
+++ b/arch/arm/dts/imx6-u-boot-binman.dtsi
@@ -0,0 +1,16 @@
+#include <config.h>
+
+/ {
+	binman {
+		filename = "u-boot-imx6-with-spl.bin";
+		pad-byte = <0xff>;
+
+		blob {
+			filename = "SPL";
+		};
+
+		u-boot-img {
+			offset = <CONFIG_SPL_PAD_TO>;
+		};
+	};
+};
diff --git a/arch/arm/dts/imx6qdl-u-boot.dtsi b/arch/arm/dts/imx6qdl-u-boot.dtsi
index 0aa29e38b8..3dfa84dcac 100644
--- a/arch/arm/dts/imx6qdl-u-boot.dtsi
+++ b/arch/arm/dts/imx6qdl-u-boot.dtsi
@@ -2,6 +2,7 @@
 /*
  * Copyright (C) 2018 Jagan Teki <jagan at amarulasolutions.com>
  */
+#include "imx6-u-boot-binman.dtsi"
 
 / {
 	soc {
diff --git a/arch/arm/dts/imx6ul-u-boot.dtsi b/arch/arm/dts/imx6ul-u-boot.dtsi
index eb190cf8c8..4e769da0d5 100644
--- a/arch/arm/dts/imx6ul-u-boot.dtsi
+++ b/arch/arm/dts/imx6ul-u-boot.dtsi
@@ -2,6 +2,7 @@
 /*
  * Copyright (C) 2018 Jagan Teki <jagan at amarulasolutions.com>
  */
+#include "imx6-u-boot-binman.dtsi"
 
 / {
 	soc {
diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig
index e782859b1e..7de1a00935 100644
--- a/arch/arm/mach-imx/mx6/Kconfig
+++ b/arch/arm/mach-imx/mx6/Kconfig
@@ -34,6 +34,7 @@ config MX6QDL
 	bool
 	select HAS_CAAM
 	select MX6_SMP
+	select BINMAN if SPL && OF_CONTROL
 
 config MX6S
 	bool
@@ -57,6 +58,7 @@ config MX6UL
 	select ROM_UNIFIED_SECTIONS
 	select SYSCOUNTER_TIMER
 	select SYS_L2CACHE_OFF
+	select BINMAN if SPL && OF_CONTROL
 
 config MX6UL_LITESOM
 	bool
diff --git a/doc/imx/common/imx6.txt b/doc/imx/common/imx6.txt
index eab88353f6..5a10f94957 100644
--- a/doc/imx/common/imx6.txt
+++ b/doc/imx/common/imx6.txt
@@ -88,3 +88,8 @@ Reading bank 4:
 
 Word 0x00000002: 9f027772 00000004
 
+2. Single Boot Image
+---------------------
+Write your single imx6 uboot image as:
+
+$ sudo dd if=u-boot-imx6-with-spl.bin of=/dev/mmcblk0 bs=1k seek=1
-- 
2.11.0



More information about the U-Boot mailing list