Skip to contentSkip to conversation

ARM: mxs: tools: Add mkimage support for MXS bootstream

PATCH New Marek Vasut 2 participants 4 messages Aug 26, 2013 – Aug 31, 2013

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

PATCH v5 1/2 ARM: mxs: tools: Add mkimage support for MXS bootstream

Add mkimage support for generating and verifying MXS bootstream. The implementation here is mostly a glue code between MXSSB v0.4 and mkimage, but the long-term goal is to rectify this and merge MXSSB with mkimage more tightly. Once this code is properly in U-Boot, MXSSB shall be deprecated in favor of mkimage-mxsimage support.

Note that the mxsimage generator needs libcrypto from OpenSSL, I therefore enabled the libcrypto/libssl unconditionally.

MXSSB: http://git.denx.de/?p=mxssb.git;a=summary

The code is based on research presented at:
http://www.rockbox.org/wiki/SbFileFormat

Cc Tom Rini <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Otavio Salvador <[email protected]>
---
 arch/arm/cpu/arm926ejs/mxs/mxsimage.mx23.cfg |    6 +
 arch/arm/cpu/arm926ejs/mxs/mxsimage.mx28.cfg |    8 +
 common/image.c                               |    1 +
 config.mk                                    |    9 +
 doc/README.mxsimage                          |  165 ++
 include/image.h                              |    1 +
 tools/Makefile                               |    2 +
 tools/mkimage.c                              |    2 +
 tools/mkimage.h                              |    1 +
 tools/mxsimage.c                             | 2347 ++++++++++++++++++++++++++
 tools/mxsimage.h                             |  230 +++
 11 files changed, 2772 insertions(+)
 create mode 100644 arch/arm/cpu/arm926ejs/mxs/mxsimage.mx23.cfg
 create mode 100644 arch/arm/cpu/arm926ejs/mxs/mxsimage.mx28.cfg
 create mode 100644 doc/README.mxsimage
 create mode 100644 tools/mxsimage.c
 create mode 100644 tools/mxsimage.h

V2: Remove the time hack fixing timestamp at certain time
Enable -lssl and -lcrypto only if CONFIG_MX23/CONFIG_MX28 is set
V3: Checkpatch fixes for all but openssl
V4: Conditionally compile mxsimage support into mkimage by defining -DCONFIG_MXS
in HOSTCFLAGS and then in turn checking for this in the mxsimage.c
V5: Fix gcc 4.8 warning about ilen being uninitialized

arch/arm/cpu/arm926ejs/mxs/mxsimage.mx23.cfg new file +6 -0
new file mode 100644
index 0000000..8118767
@@ -0,0 +1,6 @@
+SECTION 0x0 BOOTABLE
+ TAG LAST
+ LOAD     0x0        spl/u-boot-spl.bin
+ CALL     0x14       0x0
+ LOAD     0x40000100 u-boot.bin
+ CALL     0x40000100 0x0
arch/arm/cpu/arm926ejs/mxs/mxsimage.mx28.cfg new file +8 -0
new file mode 100644
index 0000000..ea772f0
@@ -0,0 +1,8 @@
+SECTION 0x0 BOOTABLE
+ TAG LAST
+ LOAD     0x0        spl/u-boot-spl.bin
+ LOAD IVT 0x8000     0x14
+ CALL HAB 0x8000     0x0
+ LOAD     0x40000100 u-boot.bin
+ LOAD IVT 0x8000     0x40000100
+ CALL HAB 0x8000     0x0
common/image.c +1 -0
index 56a5a62..2c88091 100644
@@ -135,6 +135,7 @@ static const table_entry_t uimage_type[] = {
 	{	IH_TYPE_SCRIPT,     "script",	  "Script",		},
 	{	IH_TYPE_STANDALONE, "standalone", "Standalone Program", },
 	{	IH_TYPE_UBLIMAGE,   "ublimage",   "Davinci UBL image",},
+	{	IH_TYPE_MXSIMAGE,   "mxsimage",   "Freescale MXS Boot Image",},
 	{	-1,		    "",		  "",			},
 };
 
config.mk +9 -0
index 499eed1..3b92f56 100644
@@ -194,6 +194,15 @@ LDFLAGS_FINAL += --gc-sections
 endif
 
 # TODO(sjg at chromium.org): Is this correct on Mac OS?
+
+# MXSImage needs LibSSL
+ifneq ($(CONFIG_MX23)$(CONFIG_MX28),)
+HOSTLIBS	+= -lssl -lcrypto
+# Add CONFIG_MXS into host CFLAGS, so we can check whether or not register
+# the mxsimage support within tools/mxsimage.c .
+HOSTCFLAGS	+= -DCONFIG_MXS
+endif
+
 ifdef CONFIG_FIT_SIGNATURE
 HOSTLIBS	+= -lssl -lcrypto
 
doc/README.mxsimage new file +165 -0

165 lines not on this page · raw message

include/image.h +1 -0
index f93a393..ee6eb8d 100644
@@ -212,6 +212,7 @@ struct lmb;
 #define IH_TYPE_AISIMAGE	13	/* TI Davinci AIS Image		*/
 #define IH_TYPE_KERNEL_NOLOAD	14	/* OS Kernel Image, can run from any load address */
 #define IH_TYPE_PBLIMAGE	15	/* Freescale PBL Boot Image	*/
+#define IH_TYPE_MXSIMAGE	16	/* Freescale MXSBoot Image	*/
 
 /*
  * Compression Types
tools/Makefile +2 -0
index 33fad6b..bbae5a2 100644
@@ -83,6 +83,7 @@ NOPED_OBJ_FILES-y += aisimage.o
 NOPED_OBJ_FILES-y += kwbimage.o
 NOPED_OBJ_FILES-y += pblimage.o
 NOPED_OBJ_FILES-y += imximage.o
+NOPED_OBJ_FILES-y += mxsimage.o
 NOPED_OBJ_FILES-y += image-host.o
 NOPED_OBJ_FILES-y += omapimage.o
 NOPED_OBJ_FILES-y += mkenvimage.o
@@ -209,6 +210,7 @@ $(obj)mkimage$(SFX):	$(obj)aisimage.o \
 			$(obj)image-host.o \
 			$(FIT_SIG_OBJS) \
 			$(obj)imximage.o \
+			$(obj)mxsimage.o \
 			$(obj)kwbimage.o \
 			$(obj)pblimage.o \
 			$(obj)md5.o \
tools/mkimage.c +2 -0
index b700b9e..0e92a71 100644
@@ -144,6 +144,8 @@ main (int argc, char **argv)
 	init_kwb_image_type ();
 	/* Init Freescale imx Boot image generation/list support */
 	init_imx_image_type ();
+	/* Init Freescale mxs Boot image generation/list support */
+	init_mxs_image_type();
 	/* Init FIT image generation/list support */
 	init_fit_image_type ();
 	/* Init TI OMAP Boot image generation/list support */
tools/mkimage.h +1 -0
index 950e190..8f56584 100644
@@ -158,6 +158,7 @@ void init_pbl_image_type(void);
 void init_ais_image_type(void);
 void init_kwb_image_type (void);
 void init_imx_image_type (void);
+void init_mxs_image_type(void);
 void init_default_image_type (void);
 void init_fit_image_type (void);
 void init_ubl_image_type(void);
tools/mxsimage.c new file +2347 -0

2,347 lines not on this page · raw message

tools/mxsimage.h new file +230 -0

230 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/2 tools: Sort lists of files in Makefile

Fix the lists of files so they are in order again.

Cc Tom Rini <[email protected]>
Cc Stefano Babic <[email protected]>
---
 tools/Makefile |   44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)
tools/Makefile +22 -22
index bbae5a2..f4ca1cf 100644
@@ -70,32 +70,32 @@ EXT_OBJ_FILES-y += lib/md5.o
 EXT_OBJ_FILES-y += lib/sha1.o
 
 # Source files located in the tools directory
-OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o
-OBJ_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo.o
+NOPED_OBJ_FILES-y += aisimage.o
 NOPED_OBJ_FILES-y += default_image.o
-NOPED_OBJ_FILES-y += proftool.o
-OBJ_FILES-$(CONFIG_BUILD_ENVCRC) += envcrc.o
 NOPED_OBJ_FILES-y += fit_image.o
-OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o
-OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
-OBJ_FILES-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes.o
-NOPED_OBJ_FILES-y += aisimage.o
-NOPED_OBJ_FILES-y += kwbimage.o
-NOPED_OBJ_FILES-y += pblimage.o
-NOPED_OBJ_FILES-y += imximage.o
-NOPED_OBJ_FILES-y += mxsimage.o
 NOPED_OBJ_FILES-y += image-host.o
-NOPED_OBJ_FILES-y += omapimage.o
+NOPED_OBJ_FILES-y += imximage.o
+NOPED_OBJ_FILES-y += kwbimage.o
 NOPED_OBJ_FILES-y += mkenvimage.o
 NOPED_OBJ_FILES-y += mkimage.o
-OBJ_FILES-$(CONFIG_SMDK5250) += mkexynosspl.o
+NOPED_OBJ_FILES-y += mxsimage.o
+NOPED_OBJ_FILES-y += omapimage.o
+NOPED_OBJ_FILES-y += os_support.o
+NOPED_OBJ_FILES-y += pblimage.o
+NOPED_OBJ_FILES-y += proftool.o
+NOPED_OBJ_FILES-y += ublimage.o
+OBJ_FILES-$(CONFIG_BUILD_ENVCRC) += envcrc.o
+OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
+OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o
+OBJ_FILES-$(CONFIG_KIRKWOOD) += kwboot.o
+OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o
 OBJ_FILES-$(CONFIG_MX23) += mxsboot.o
 OBJ_FILES-$(CONFIG_MX28) += mxsboot.o
 OBJ_FILES-$(CONFIG_NETCONSOLE) += ncb.o
-NOPED_OBJ_FILES-y += os_support.o
 OBJ_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1.o
-NOPED_OBJ_FILES-y += ublimage.o
-OBJ_FILES-$(CONFIG_KIRKWOOD) += kwboot.o
+OBJ_FILES-$(CONFIG_SMDK5250) += mkexynosspl.o
+OBJ_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo.o
+OBJ_FILES-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes.o
 
 # Don't build by default
 #ifeq ($(ARCH),ppc)
@@ -202,21 +202,21 @@ $(obj)mkenvimage$(SFX):	$(obj)crc32.o $(obj)mkenvimage.o \
 	$(HOSTSTRIP) $@
 
 $(obj)mkimage$(SFX):	$(obj)aisimage.o \
+			$(FIT_SIG_OBJS) \
 			$(obj)crc32.o \
 			$(obj)default_image.o \
 			$(obj)fit_image.o \
 			$(obj)image-fit.o \
-			$(obj)image.o \
 			$(obj)image-host.o \
-			$(FIT_SIG_OBJS) \
+			$(obj)image.o \
 			$(obj)imximage.o \
-			$(obj)mxsimage.o \
 			$(obj)kwbimage.o \
-			$(obj)pblimage.o \
 			$(obj)md5.o \
 			$(obj)mkimage.o \
-			$(obj)os_support.o \
+			$(obj)mxsimage.o \
 			$(obj)omapimage.o \
+			$(obj)os_support.o \
+			$(obj)pblimage.o \
 			$(obj)sha1.o \
 			$(obj)ublimage.o \
 			$(LIBFDT_OBJS) \
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/2 tools: Sort lists of files in Makefile

Quoted 6 lines · Marek Vasut

Fix the lists of files so they are in order again.

Cc Tom Rini <[email protected]>
Cc Stefano Babic <[email protected]>

---

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#3 lore raw

PATCH v5 1/2 ARM: mxs: tools: Add mkimage support for MXS bootstream

In reply to Marek Vasut
Quoted 15 lines · Marek Vasut

Add mkimage support for generating and verifying MXS bootstream. The implementation here is mostly a glue code between MXSSB v0.4 and mkimage, but the long-term goal is to rectify this and merge MXSSB with mkimage more tightly. Once this code is properly in U-Boot, MXSSB shall be deprecated in favor of mkimage-mxsimage support.

Note that the mxsimage generator needs libcrypto from OpenSSL, I therefore enabled the libcrypto/libssl unconditionally.

MXSSB: http://git.denx.de/?p=mxssb.git;a=summary

The code is based on research presented at:
http://www.rockbox.org/wiki/SbFileFormat

Quoted 6 lines
Cc Tom Rini <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Otavio Salvador <[email protected]>

---

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================