Skip to contentSkip to conversation

tools: mkimage: Add Allwinner eGON support

PATCH New Andre Przywara 4 participants 11 messages Dec 22, 2018 – Jan 11, 2019

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

cover tools: mkimage: Add Allwinner eGON support

So far creating a bootable SPL image for Allwinner based boards uses the mksunxiboot tool. Most other platforms seemed to have integrated this kind of functionality into the common mkimage tool.

Since there is nothing special about the Allwinner image in this respect, just add support for the so-called "eGON" image type into mkimage. If there was a particular reason this hasn't been done before, please let me know.

This will eventually allow us to remove mksunxiboot, but I leave it around for now in case of regressions and since some people depend on it from external projects.

Patch 1/3 fixes a small annoyance in mkimage -T list.
Patch 2/3 adds the actually support to mkimage, patch 3/3 then switches the Makefile to use mkimage instead of mksunxiboot.

I tested all 144 Allwinner boards by building each sunxi-spl.bin and comparing it against the version created using mksunxiboot (using SOURCE_DATE_EPOCH and .scmversion to create reproducible builds). All files before and after were identical.

Cheers,
Andre

Andre Przywara (3):
tools: mkimage: Add missing names for imx8mimage and loadables
tools: mkimage: Add Allwinner eGON support
sunxi: Use mkimage -T sunxi_egon for SPL boot image generation

 common/image.c       |   3 ++
 include/image.h      |   1 +
 scripts/Makefile.spl |   8 +--
 tools/Makefile       |   1 +
 tools/sunxi_egon.c   | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 145 insertions(+), 4 deletions(-)
 create mode 100644 tools/sunxi_egon.c
Signature · 1 line
2.14.5
#1 lore raw

PATCH 1/3 tools: mkimage: Add missing names for imx8mimage and loadables

At the moment "mkimage -T list" starts with two unknown entries, because their IH_TYPE_ name is not listed in the uimage_type table.

Add those two entries to get an OCD-compatible image type listing.

---
 common/image.c | 2 ++
 1 file changed, 2 insertions(+)
common/image.c +2 -0
index 0659133fcc..3ff713a521 100644
@@ -140,7 +140,9 @@ static const table_entry_t uimage_type[] = {
 	{	IH_TYPE_KWBIMAGE,   "kwbimage",   "Kirkwood Boot Image",},
 	{	IH_TYPE_IMXIMAGE,   "imximage",   "Freescale i.MX Boot Image",},
 	{	IH_TYPE_IMX8IMAGE,  "imx8image",  "NXP i.MX8 Boot Image",},
+	{	IH_TYPE_IMX8MIMAGE, "imx8mimage", "NXP i.MX8M Boot Image",},
 	{	IH_TYPE_INVALID,    "invalid",	  "Invalid Image",	},
+	{	IH_TYPE_LOADABLE,   "loadable",	  "Typeless Image",	},
 	{	IH_TYPE_MULTI,	    "multi",	  "Multi-File Image",	},
 	{	IH_TYPE_OMAPIMAGE,  "omapimage",  "TI OMAP SPL With GP CH",},
 	{	IH_TYPE_PBLIMAGE,   "pblimage",   "Freescale PBL Boot Image",},
Signature · 1 line
2.14.5
#2 lore raw

PATCH 1/3 tools: mkimage: Add missing names for imx8mimage and loadables

Quoted 11 lines · Andre Przywara

At the moment "mkimage -T list" starts with two unknown entries, because their IH_TYPE_ name is not listed in the uimage_type table.

Add those two entries to get an OCD-compatible image type listing.

---
 common/image.c | 2 ++
 1 file changed, 2 insertions(+)

Would be good to have some tests for mkimage

#3 lore raw

PATCH 1/3 tools: mkimage: Add missing names for imx8mimage and loadables

In reply to Andre Przywara
Quoted 16 lines · Andre Przywara

At the moment "mkimage -T list" starts with two unknown entries, because their IH_TYPE_ name is not listed in the uimage_type table.

Add those two entries to get an OCD-compatible image type listing.

---
 common/image.c | 2 ++
 1 file changed, 2 insertions(+)
common/image.c +0 -0
index 0659133fcc..3ff713a521 100644

common/image.c static const table_entry_t uimage_type[] = { · line 143

Quoted 4 lines
common/image.c +1 -0
@@ -140,7 +140,9 @@ static const table_entry_t uimage_type[] = {
        {       IH_TYPE_KWBIMAGE,   "kwbimage",   "Kirkwood Boot Image",},
        {       IH_TYPE_IMXIMAGE,   "imximage",   "Freescale i.MX Boot Image",},
        {       IH_TYPE_IMX8IMAGE,  "imx8image",  "NXP i.MX8 Boot Image",},
+       {       IH_TYPE_IMX8MIMAGE, "imx8mimage", "NXP i.MX8M Boot Image",},

This change already in, 6609c2663c9c9699f3d279ccea599e5d18578b20

#4 lore raw

PATCH 2/3 tools: mkimage: Add Allwinner eGON support

In reply to Andre Przywara

So far we used the separate mksunxiboot tool for generating a bootable image for Allwinner SPLs, probably just for historical reasons.

Use the mkimage framework to generate a so called eGON image the Allwinner BROM expects.
The new image type is called "sunxi_egon", to differentiate it from the (still to be implemented) secure boot TOC0 image.

---
 common/image.c     |   1 +
 include/image.h    |   1 +
 tools/Makefile     |   1 +
 tools/sunxi_egon.c | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 139 insertions(+)
 create mode 100644 tools/sunxi_egon.c
common/image.c +1 -0
index 3ff713a521..17150093d6 100644
@@ -169,6 +169,7 @@ static const table_entry_t uimage_type[] = {
 	{       IH_TYPE_PMMC,        "pmmc",        "TI Power Management Micro-Controller Firmware",},
 	{	IH_TYPE_STM32IMAGE, "stm32image", "STMicroelectronics STM32 Image" },
 	{	IH_TYPE_MTKIMAGE,   "mtk_image",   "MediaTek BootROM loadable Image" },
+	{	IH_TYPE_SUNXI_EGON, "sunxi_egon",  "Allwinner eGON Boot Image" },
 	{	-1,		    "",		  "",			},
 };
 
include/image.h +1 -0
index 765ffecee0..35f43b3074 100644
@@ -284,6 +284,7 @@ enum {
 	IH_TYPE_MTKIMAGE,		/* MediaTek BootROM loadable Image */
 	IH_TYPE_IMX8MIMAGE,		/* Freescale IMX8MBoot Image	*/
 	IH_TYPE_IMX8IMAGE,		/* Freescale IMX8Boot Image	*/
+	IH_TYPE_SUNXI_EGON,		/* Allwinner eGON Boot Image */
 
 	IH_TYPE_COUNT,			/* Number of image types */
 };
tools/Makefile +1 -0
index 2c4d91f199..9f2533f048 100644
@@ -106,6 +106,7 @@ dumpimage-mkimage-objs := aisimage.o \
 			stm32image.o \
 			$(ROCKCHIP_OBS) \
 			socfpgaimage.o \
+			sunxi_egon.o \
 			lib/crc16.o \
 			lib/sha1.o \
 			lib/sha256.o \
tools/sunxi_egon.c new file +136 -0

136 lines not on this page · raw message

Signature · 1 line
2.14.5
#5 lore raw

PATCH 2/3 tools: mkimage: Add Allwinner eGON support

Quoted 9 lines · Andre Przywara

So far we used the separate mksunxiboot tool for generating a bootable image for Allwinner SPLs, probably just for historical reasons.

Use the mkimage framework to generate a so called eGON image the Allwinner BROM expects.
The new image type is called "sunxi_egon", to differentiate it from the (still to be implemented) secure boot TOC0 image.

Quoted 8 lines
---
 common/image.c     |   1 +
 include/image.h    |   1 +
 tools/Makefile     |   1 +
 tools/sunxi_egon.c | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 139 insertions(+)
 create mode 100644 tools/sunxi_egon.c

Good idea.

#6 lore raw

PATCH 2/3 tools: mkimage: Add Allwinner eGON support

In reply to Andre Przywara
Quoted 60 lines · Andre Przywara

So far we used the separate mksunxiboot tool for generating a bootable image for Allwinner SPLs, probably just for historical reasons.

Use the mkimage framework to generate a so called eGON image the Allwinner BROM expects.
The new image type is called "sunxi_egon", to differentiate it from the (still to be implemented) secure boot TOC0 image.

---
 common/image.c     |   1 +
 include/image.h    |   1 +
 tools/Makefile     |   1 +
 tools/sunxi_egon.c | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 139 insertions(+)
 create mode 100644 tools/sunxi_egon.c
common/image.c +1 -0
index 3ff713a521..17150093d6 100644
@@ -169,6 +169,7 @@ static const table_entry_t uimage_type[] = {
        {       IH_TYPE_PMMC,        "pmmc",        "TI Power Management Micro-Controller Firmware",},
        {       IH_TYPE_STM32IMAGE, "stm32image", "STMicroelectronics STM32 Image" },
        {       IH_TYPE_MTKIMAGE,   "mtk_image",   "MediaTek BootROM loadable Image" },
+       {       IH_TYPE_SUNXI_EGON, "sunxi_egon",  "Allwinner eGON Boot Image" },
        {       -1,                 "",           "",                   },
 };
 
include/image.h +1 -0
index 765ffecee0..35f43b3074 100644
@@ -284,6 +284,7 @@ enum {
        IH_TYPE_MTKIMAGE,               /* MediaTek BootROM loadable Image */
        IH_TYPE_IMX8MIMAGE,             /* Freescale IMX8MBoot Image    */
        IH_TYPE_IMX8IMAGE,              /* Freescale IMX8Boot Image     */
+       IH_TYPE_SUNXI_EGON,             /* Allwinner eGON Boot Image */
 
        IH_TYPE_COUNT,                  /* Number of image types */
 };
tools/Makefile +1 -0
index 2c4d91f199..9f2533f048 100644
@@ -106,6 +106,7 @@ dumpimage-mkimage-objs := aisimage.o \
                        stm32image.o \
                        $(ROCKCHIP_OBS) \
                        socfpgaimage.o \
+                       sunxi_egon.o \
                        lib/crc16.o \
                        lib/sha1.o \
                        lib/sha256.o \
tools/sunxi_egon.c new file +0 -0
new file mode 100644
index 0000000000..9b38149280

tools/sunxi_egon.c line 9

Quoted 9 lines
tools/sunxi_egon.c new file +9 -0
@@ -0,0 +1,136 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2018 Arm Ltd.
+ */
+
+#include "imagetool.h"
+#include <image.h>
+
+#include "../arch/arm/include/asm/arch-sunxi/spl.h"

This can be done as #include <asm/arch/spl.h>

#7 lore raw

PATCH 2/3 tools: mkimage: Add Allwinner eGON support

Quoted 64 lines · Jagan Teki
Quoted 63 lines · Andre Przywara

So far we used the separate mksunxiboot tool for generating a bootable image for Allwinner SPLs, probably just for historical reasons.

Use the mkimage framework to generate a so called eGON image the Allwinner BROM expects.
The new image type is called "sunxi_egon", to differentiate it from the (still to be implemented) secure boot TOC0 image.

---
 common/image.c     |   1 +
 include/image.h    |   1 +
 tools/Makefile     |   1 +
 tools/sunxi_egon.c | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 139 insertions(+)
 create mode 100644 tools/sunxi_egon.c
common/image.c +1 -0
index 3ff713a521..17150093d6 100644
@@ -169,6 +169,7 @@ static const table_entry_t uimage_type[] = {
        {       IH_TYPE_PMMC,        "pmmc",        "TI Power Management Micro-Controller Firmware",},
        {       IH_TYPE_STM32IMAGE, "stm32image", "STMicroelectronics STM32 Image" },
        {       IH_TYPE_MTKIMAGE,   "mtk_image",   "MediaTek BootROM loadable Image" },
+       {       IH_TYPE_SUNXI_EGON, "sunxi_egon",  "Allwinner eGON Boot Image" },
        {       -1,                 "",           "",                   },
 };
 
include/image.h +1 -0
index 765ffecee0..35f43b3074 100644
@@ -284,6 +284,7 @@ enum {
        IH_TYPE_MTKIMAGE,               /* MediaTek BootROM loadable Image */
        IH_TYPE_IMX8MIMAGE,             /* Freescale IMX8MBoot Image    */
        IH_TYPE_IMX8IMAGE,              /* Freescale IMX8Boot Image     */
+       IH_TYPE_SUNXI_EGON,             /* Allwinner eGON Boot Image */
 
        IH_TYPE_COUNT,                  /* Number of image types */
 };
tools/Makefile +1 -0
index 2c4d91f199..9f2533f048 100644
@@ -106,6 +106,7 @@ dumpimage-mkimage-objs := aisimage.o \
                        stm32image.o \
                        $(ROCKCHIP_OBS) \
                        socfpgaimage.o \
+                       sunxi_egon.o \
                        lib/crc16.o \
                        lib/sha1.o \
                        lib/sha256.o \
tools/sunxi_egon.c new file +3 -0
new file mode 100644
index 0000000000..9b38149280
@@ -0,0 +1,136 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2018 Arm Ltd.
Quoted 8 lines

tools/sunxi_egon.c line 9

Quoted 6 lines
tools/sunxi_egon.c new file +6 -0
+ */
+
+#include "imagetool.h"
+#include <image.h>
+
+#include "../arch/arm/include/asm/arch-sunxi/spl.h"

This can be done as #include <asm/arch/spl.h>

That would break host tools tho, no?

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190111/501b5307/attachment.sig>
#8 lore raw

PATCH 2/3 tools: mkimage: Add Allwinner eGON support

Quoted 75 lines · Tom Rini
Quoted 64 lines · Jagan Teki
Quoted 63 lines · Andre Przywara

So far we used the separate mksunxiboot tool for generating a bootable image for Allwinner SPLs, probably just for historical reasons.

Use the mkimage framework to generate a so called eGON image the Allwinner BROM expects.
The new image type is called "sunxi_egon", to differentiate it from the (still to be implemented) secure boot TOC0 image.

---
 common/image.c     |   1 +
 include/image.h    |   1 +
 tools/Makefile     |   1 +
 tools/sunxi_egon.c | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 139 insertions(+)
 create mode 100644 tools/sunxi_egon.c
common/image.c +1 -0
index 3ff713a521..17150093d6 100644
@@ -169,6 +169,7 @@ static const table_entry_t uimage_type[] = {
        {       IH_TYPE_PMMC,        "pmmc",        "TI Power Management Micro-Controller Firmware",},
        {       IH_TYPE_STM32IMAGE, "stm32image", "STMicroelectronics STM32 Image" },
        {       IH_TYPE_MTKIMAGE,   "mtk_image",   "MediaTek BootROM loadable Image" },
+       {       IH_TYPE_SUNXI_EGON, "sunxi_egon",  "Allwinner eGON Boot Image" },
        {       -1,                 "",           "",                   },
 };
 
include/image.h +1 -0
index 765ffecee0..35f43b3074 100644
@@ -284,6 +284,7 @@ enum {
        IH_TYPE_MTKIMAGE,               /* MediaTek BootROM loadable Image */
        IH_TYPE_IMX8MIMAGE,             /* Freescale IMX8MBoot Image    */
        IH_TYPE_IMX8IMAGE,              /* Freescale IMX8Boot Image     */
+       IH_TYPE_SUNXI_EGON,             /* Allwinner eGON Boot Image */
 
        IH_TYPE_COUNT,                  /* Number of image types */
 };
tools/Makefile +1 -0
index 2c4d91f199..9f2533f048 100644
@@ -106,6 +106,7 @@ dumpimage-mkimage-objs := aisimage.o \
                        stm32image.o \
                        $(ROCKCHIP_OBS) \
                        socfpgaimage.o \
+                       sunxi_egon.o \
                        lib/crc16.o \
                        lib/sha1.o \
                        lib/sha256.o \
tools/sunxi_egon.c new file +3 -0
new file mode 100644
index 0000000000..9b38149280
@@ -0,0 +1,136 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2018 Arm Ltd.
Quoted 8 lines

tools/sunxi_egon.c line 9

Quoted 6 lines
tools/sunxi_egon.c new file +6 -0
+ */
+
+#include "imagetool.h"
+#include <image.h>
+
+#include "../arch/arm/include/asm/arch-sunxi/spl.h"

This can be done as #include <asm/arch/spl.h>

Quoted 1 line

That would break host tools tho, no?

Didn't It still build the tools.

#9 lore raw

PATCH 3/3 sunxi: Use mkimage -T sunxi_egon for SPL boot image generation

In reply to Andre Przywara

Switch the SPL boot image generation from using mksunxiboot to the new sunxi_egon format of mkimage.

Verified to create identical results for all 144 Allwinner boards.

---
 scripts/Makefile.spl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/Makefile.spl +4 -4
index 2ef19bf005..9178599c4a 100644
@@ -336,11 +336,11 @@ endif
 $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE
 	$(call if_changed,mkimage)
 
-quiet_cmd_mksunxiboot = MKSUNXI $@
-cmd_mksunxiboot = $(objtree)/tools/mksunxiboot \
-			--default-dt $(CONFIG_DEFAULT_DEVICE_TREE) $< $@
+MKIMAGEFLAGS_sunxi-spl.bin = -T sunxi_egon \
+	-n $(CONFIG_DEFAULT_DEVICE_TREE)
+
 $(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin FORCE
-	$(call if_changed,mksunxiboot)
+	$(call if_changed,mkimage)
 
 quiet_cmd_sunxi_spl_image_builder = SUNXI_SPL_IMAGE_BUILDER $@
 cmd_sunxi_spl_image_builder = $(objtree)/tools/sunxi-spl-image-builder \
Signature · 1 line
2.14.5
#10 lore raw

PATCH 3/3 sunxi: Use mkimage -T sunxi_egon for SPL boot image generation

Quoted 10 lines · Andre Przywara

Switch the SPL boot image generation from using mksunxiboot to the new sunxi_egon format of mkimage.

Verified to create identical results for all 144 Allwinner boards.

---
 scripts/Makefile.spl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)