Skip to contentSkip to conversation

Add Xilinx Zynq boot.bin support

PATCH New Nathan Rossi 2 participants 4 messages Nov 17, 2015 – Nov 19, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover Add Xilinx Zynq boot.bin support

This patch series adds support for the 'zynqimage' type to mkimage for the Xilinx Zynq platform. As well as adding make targets to generate the boot.bin image file containing SPL by default.

Changes in v2:
* Remove test code

Nathan Rossi (2):
tools: zynqimage: Add Xilinx Zynq boot header generation to mkimage
ARM: zynq: Add target for building bootable SPL image for Zynq

 Makefile             |   3 +
 common/image.c       |   1 +
 include/image.h      |   3 +-
 scripts/Makefile.spl |  11 +++
 tools/Makefile       |   1 +
 tools/zynqimage.c    | 257 +++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 275 insertions(+), 1 deletion(-)
 create mode 100644 tools/zynqimage.c
Signature · 1 line
2.6.2
#1 lore raw

PATCH v2 1/2 tools: zynqimage: Add Xilinx Zynq boot header generation to mkimage

As with other platforms vendors love to create their own boot header formats. Xilinx is no different and for the Zynq platform/SoC there exists the "boot.bin" which is read by the platforms bootrom. This format is described to a useful extent within the Xilinx Zynq TRM.

This implementation adds support for the 'zynqimage' to mkimage. The implementation only considers the most common boot header which is un-encrypted and packed directly after the boot header itself (no XIP, etc.). However this implementation does take into consideration the other fields of the header for image dumping use cases (vector table and register initialization).

---
Changes in v2:
* Remove code that was used for testing

---
 common/image.c    |   1 +
 include/image.h   |   3 +-
 tools/Makefile    |   1 +
 tools/zynqimage.c | 257 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 261 insertions(+), 1 deletion(-)
 create mode 100644 tools/zynqimage.c
common/image.c +1 -0
index 85c4f39..c36927f 100644
@@ -158,6 +158,7 @@ static const table_entry_t uimage_type[] = {
 	{	IH_TYPE_RKIMAGE,    "rkimage",    "Rockchip Boot Image" },
 	{	IH_TYPE_RKSD,       "rksd",       "Rockchip SD Boot Image" },
 	{	IH_TYPE_RKSPI,      "rkspi",      "Rockchip SPI Boot Image" },
+	{	IH_TYPE_ZYNQIMAGE,  "zynqimage",  "Xilinx Zynq Boot Image" },
 	{	-1,		    "",		  "",			},
 };
 
include/image.h +2 -1
index 08ae24a..299d6d2 100644
@@ -248,8 +248,9 @@ struct lmb;
 #define IH_TYPE_RKIMAGE		23	/* Rockchip Boot Image		*/
 #define IH_TYPE_RKSD		24	/* Rockchip SD card		*/
 #define IH_TYPE_RKSPI		25	/* Rockchip SPI image		*/
+#define IH_TYPE_ZYNQIMAGE	26	/* Xilinx Zynq Boot Image */
 
-#define IH_TYPE_COUNT		26	/* Number of image types */
+#define IH_TYPE_COUNT		27	/* Number of image types */
 
 /*
  * Compression Types
tools/Makefile +1 -0
index 9082bda..9cfd80b 100644
@@ -98,6 +98,7 @@ dumpimage-mkimage-objs := aisimage.o \
 			lib/sha256.o \
 			common/hash.o \
 			ublimage.o \
+			zynqimage.o \
 			$(LIBFDT_OBJS) \
 			$(RSA_OBJS-y)
 
tools/zynqimage.c new file +257 -0

257 lines not on this page · raw message

Signature · 1 line
2.6.2
#2 lore raw

PATCH v2 2/2 ARM: zynq: Add target for building bootable SPL image for Zynq

In reply to Nathan Rossi

Add a build target to generate 'boot.bin' which includes SPL. This is used by the platforms BootROM to load SPL directly.

This change also conditionally changes what the 'boot.bin' target generates depending on the SoC. Leaving the behaviour unchanged for the AT91 targets.

---
Changes in v2: None

---
 Makefile             |  3 +++
 scripts/Makefile.spl | 11 +++++++++++
 2 files changed, 14 insertions(+)
Makefile +3 -0
index 61050ad..b7da462 100644
@@ -1335,6 +1335,9 @@ spl/sunxi-spl.bin: spl/u-boot-spl
 spl/u-boot-spl-dtb.sfp: spl/u-boot-spl
 	@:
 
+spl/boot.bin: spl/u-boot-spl
+	@:
+
 tpl/u-boot-tpl.bin: tools prepare
 	$(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.spl all
 
scripts/Makefile.spl +11 -0
index dd235b9..b0d8551 100644
@@ -116,6 +116,7 @@ MKIMAGEFLAGS_MLO.byteswap = -T omapimage -n byteswap -a $(CONFIG_SPL_TEXT_BASE)
 MLO MLO.byteswap: $(obj)/u-boot-spl.bin
 	$(call if_changed,mkimage)
 
+ifeq ($(CONFIG_SYS_SOC),"at91")
 MKIMAGEFLAGS_boot.bin = -T atmelimage
 
 ifeq ($(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER),y)
@@ -126,6 +127,12 @@ endif
 
 boot.bin: $(obj)/u-boot-spl.bin
 	$(call if_changed,mkimage)
+else
+MKIMAGEFLAGS_boot.bin = -T zynqimage
+
+spl/boot.bin: $(obj)/u-boot-spl-dtb.bin
+	$(call if_changed,mkimage)
+endif
 
 ALL-y	+= $(obj)/$(SPL_BIN).bin $(obj)/$(SPL_BIN).cfg
 
@@ -149,6 +156,10 @@ ifeq ($(CONFIG_SYS_SOC),"at91")
 ALL-y	+= boot.bin
 endif
 
+ifdef CONFIG_ARCH_ZYNQ
+ALL-y	+= $(obj)/boot.bin
+endif
+
 all:	$(ALL-y)
 
 quiet_cmd_cat = CAT     $@
Signature · 1 line
2.6.2
#3 lore raw

v2 cover Add Xilinx Zynq boot.bin support

In reply to Nathan Rossi
Quoted 11 lines · Nathan Rossi

This patch series adds support for the 'zynqimage' type to mkimage for the Xilinx Zynq platform. As well as adding make targets to generate the boot.bin image file containing SPL by default.

Changes in v2:
* Remove test code

Nathan Rossi (2):
tools: zynqimage: Add Xilinx Zynq boot header generation to mkimage
ARM: zynq: Add target for building bootable SPL image for Zynq

Quoted 9 lines
 Makefile             |   3 +
 common/image.c       |   1 +
 include/image.h      |   3 +-
 scripts/Makefile.spl |  11 +++
 tools/Makefile       |   1 +
 tools/zynqimage.c    | 257 +++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 275 insertions(+), 1 deletion(-)
 create mode 100644 tools/zynqimage.c

Applied both.

Thanks,
Michal