Skip to contentSkip to conversation

tools: mkimage: Making genimg_print_size API global

PATCH New Prafulla Wadaskar 3 participants 14 messages Aug 24, 2009 – Sep 4, 2009 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 tools: mkimage: Making genimg_print_size API global

Currently it is used by image.c only
This API can be used by additional mkimage types supports for ex. kwbimage, to use it the API is made global

---
 common/image.c  |    3 +--
 include/image.h |    1 +
 2 files changed, 2 insertions(+), 2 deletions(-)
common/image.c +1 -2
index f3dd647..ca8205c 100644
@@ -158,7 +158,6 @@ static table_entry_t uimage_comp[] = {
 
 uint32_t crc32 (uint32_t, const unsigned char *, uint);
 uint32_t crc32_wd (uint32_t, const unsigned char *, uint, uint);
-static void genimg_print_size (uint32_t size);
 #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE) || defined(USE_HOSTCC)
 static void genimg_print_time (time_t timestamp);
 #endif
@@ -473,7 +472,7 @@ void memmove_wd (void *to, void *from, size_t len, ulong chunksz)
 }
 #endif /* !USE_HOSTCC */
 
-static void genimg_print_size (uint32_t size)
+void genimg_print_size (uint32_t size)
 {
 #ifndef USE_HOSTCC
 	printf ("%d Bytes = ", size);
include/image.h +1 -0
index a62669f..4a7bf78 100644
@@ -292,6 +292,7 @@ int genimg_get_os_id (const char *name);
 int genimg_get_arch_id (const char *name);
 int genimg_get_type_id (const char *name);
 int genimg_get_comp_id (const char *name);
+void genimg_print_size (uint32_t size);
 
 #ifndef USE_HOSTCC
 /* Image format types, returned by _get_format() routine */
Signature · 1 line
1.5.3.3
#1 lore raw

PATCH 2/4 tools: mkimage: Making table_entry code global

1. get_table_entry_id API made global
2. get_table_entry_name API made global
3. struct table_entry moved to image.h

Currently it is used by image.c only
These APIs are very usefull and can be used by other part of code

This patch makes these APIs and struct global

---
 common/image.c  |   10 ++--------
 include/image.h |   26 ++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 8 deletions(-)
common/image.c +2 -8
index ca8205c..e8ecfa5 100644
@@ -74,12 +74,6 @@ static const image_header_t* image_get_ramdisk (ulong rd_addr, uint8_t arch,
 #include <image.h>
 #endif /* !USE_HOSTCC*/
 
-typedef struct table_entry {
-	int	id;		/* as defined in image.h	*/
-	char	*sname;		/* short (input) name		*/
-	char	*lname;		/* long (output) name		*/
-} table_entry_t;
-
 static table_entry_t uimage_arch[] = {
 	{	IH_ARCH_INVALID,	NULL,		"Invalid ARCH",	},
 	{	IH_ARCH_ALPHA,		"alpha",	"Alpha",	},
@@ -514,7 +508,7 @@ static void genimg_print_time (time_t timestamp)
  *     long entry name if translation succeeds
  *     msg otherwise
  */
-static char *get_table_entry_name (table_entry_t *table, char *msg, int id)
+char *get_table_entry_name (table_entry_t *table, char *msg, int id)
 {
 	for (; table->id >= 0; ++table) {
 		if (table->id == id)
@@ -561,7 +555,7 @@ const char *genimg_get_comp_name (uint8_t comp)
  *     entry id if translation succeeds
  *     -1 otherwise
  */
-static int get_table_entry_id (table_entry_t *table,
+int get_table_entry_id (table_entry_t *table,
 		const char *table_name, const char *name)
 {
 	table_entry_t *t;
include/image.h +26 -0
index 4a7bf78..58f13f9 100644
@@ -284,6 +284,32 @@ typedef struct bootm_headers {
 #define uimage_to_cpu(x)		be32_to_cpu(x)
 #define cpu_to_uimage(x)		cpu_to_be32(x)
 
+/*
+ * Translation table for entries of a specific type
+ * This structue is used by the global functions get_table_entry_id,
+ * get_table_entry_name and these functions and this structure can also be
+ * referred by other part of code
+ */
+typedef struct table_entry {
+	int	id;
+	char	*sname;		/* name used to find table entry */
+	char	*lname;		/* name used to print for messages */
+} table_entry_t;
+
+/*
+ * get_table_entry_id() will go over translation table trying to find
+ * entry that matches given short name. If matching entry is found,
+ * its id returned to the caller.
+ */
+int get_table_entry_id (table_entry_t *table,
+		const char *table_name, const char *name);
+/*
+ * get_table_entry_name() will go over translation table trying to find
+ * entry that matches given id. If matching entry is found, its long
+ * name is returned to the caller.
+ */
+char *get_table_entry_name (table_entry_t *table, char *msg, int id);
+
 const char *genimg_get_os_name (uint8_t os);
 const char *genimg_get_arch_name (uint8_t arch);
 const char *genimg_get_type_name (uint8_t type);
Signature · 1 line
1.5.3.3
#2 lore raw

PATCH 3/4 Kirkwood: Sheevaplug: kwimage configuration

---
 board/Marvell/sheevaplug/config.mk    |    3 +
 board/Marvell/sheevaplug/kwbimage.cfg |  162 +++++++++++++++++++++++++++++++++
 2 files changed, 165 insertions(+), 0 deletions(-)
 create mode 100644 board/Marvell/sheevaplug/kwbimage.cfg
board/Marvell/sheevaplug/config.mk +3 -0
index a4ea769..2bd9f79 100644
@@ -23,3 +23,6 @@
 #
 
 TEXT_BASE = 0x00600000
+
+# Kirkwood Boot Image configuration file
+KWD_CONFIG = $(SRCTREE)/board/$(BOARDDIR)/kwbimage.cfg
board/Marvell/sheevaplug/kwbimage.cfg new file +162 -0

162 lines not on this page · raw message

Signature · 1 line
1.5.3.3
#3 lore raw

PATCH v3 4/4 tools: mkimage: Add: Kirkwood Boot Image support (kwbimage)

This patch adds type kwbimabe support for new mkimage core For more details refer docs/README.kwbimage

This patch is tested with Sheevaplug board

---
Change log:
v2: updated as per review comments for v1
added len checks in checksum functions
added printable strings for each valid table entry
use of sccanf not changed since it offers return value for failure

v3: resolved merge issues on mkimage branch

 Makefile            |    5 +
 common/image.c      |    1 +
 doc/README.kwbimage |   93 ++++++++++++
 include/image.h     |    1 +
 tools/Makefile      |    4 +
 tools/kwbimage.c    |  402 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/kwbimage.h    |  106 ++++++++++++++
 tools/mkimage.c     |    2 +
 8 files changed, 614 insertions(+), 0 deletions(-)
 create mode 100644 doc/README.kwbimage
 create mode 100644 tools/kwbimage.c
 create mode 100644 tools/kwbimage.h
Makefile +5 -0
index 02393b6..fcf7404 100644
@@ -322,6 +322,10 @@ $(obj)u-boot.img:	$(obj)u-boot.bin
 			sed -e 's/"[	 ]*$$/ for $(BOARD) board"/') \
 		-d $< $@
 
+$(obj)u-boot.kwb:       $(obj)u-boot.bin
+		$(obj)tools/mkimage -n $(KWD_CONFIG) -T kwbimage \
+		-a $(TEXT_BASE) -e $(TEXT_BASE) -d $< $@
+
 $(obj)u-boot.sha1:	$(obj)u-boot.bin
 		$(obj)tools/ubsha1 $(obj)u-boot.bin
 
@@ -3701,6 +3705,7 @@ clobber:	clean
 	@rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \
 		$(obj)cscope.* $(obj)*.*~
 	@rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
+	@rm -f $(obj)u-boot.kwb
 	@rm -f $(obj)tools/{env/crc32.c,inca-swap-bytes}
 	@rm -f $(obj)cpu/mpc824x/bedbug_603e.c
 	@rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
common/image.c +1 -0
index f3dd647..370acd0 100644
@@ -145,6 +145,7 @@ static table_entry_t uimage_type[] = {
 	{	IH_TYPE_SCRIPT,     "script",	  "Script",		},
 	{	IH_TYPE_STANDALONE, "standalone", "Standalone Program", },
 	{	IH_TYPE_FLATDT,     "flat_dt",    "Flat Device Tree",	},
+	{	IH_TYPE_KWBIMAGE,   "kwbimage",   "Kirkwood Boot Image",},
 	{	-1,		    "",		  "",			},
 };
 
doc/README.kwbimage new file +93 -0

93 lines not on this page · raw message

include/image.h +1 -0
index a62669f..50237b4 100644
@@ -155,6 +155,7 @@
 #define IH_TYPE_SCRIPT		6	/* Script file			*/
 #define IH_TYPE_FILESYSTEM	7	/* Filesystem Image (any type)	*/
 #define IH_TYPE_FLATDT		8	/* Binary Flat Device Tree Blob	*/
+#define IH_TYPE_KWBIMAGE	9	/* Kirkwood Boot Image		*/
 
 /*
  * Compression Types
tools/Makefile +4 -0
index 858b0e8..56551f7 100644
@@ -187,6 +187,7 @@ $(obj)mkimage$(SFX):	$(obj)crc32.o \
 			$(obj)default_image.o \
 			$(obj)fit_image.o \
 			$(obj)image.o \
+			$(obj)kwbimage.o \
 			$(obj)md5.o \
 			$(obj)mkimage.o \
 			$(obj)os_support.o \
@@ -216,6 +217,9 @@ $(obj)fit_image.o: $(SRCTREE)/tools/fit_image.c
 $(obj)image.o: $(SRCTREE)/common/image.c
 	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
+$(obj)kwbimage.o: $(SRCTREE)/tools/kwbimage.c
+	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+
 $(obj)mkimage.o: $(SRCTREE)/tools/mkimage.c
 	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
 
tools/kwbimage.c new file +402 -0

402 lines not on this page · raw message

tools/kwbimage.h new file +106 -0

106 lines not on this page · raw message

tools/mkimage.c +2 -0
index c43b207..ab6ea32 100644
@@ -148,6 +148,8 @@ main (int argc, char **argv)
 	int retval = 0;
 	struct image_type_params *tparams = NULL;
 
+	/* Init Kirkwood Boot image generation/list support */
+	init_kwb_image_type ();
 	/* Init FIT image generation/list support */
 	init_fit_image_type ();
 	/* Init Default image generation/list support */
Signature · 1 line
1.5.3.3
#4 lore raw

PATCH v3 4/4 tools: mkimage: Add: Kirkwood Boot Image support (kwbimage)

Quoted 16 lines

-----Original Message-----
From: Prafulla Wadaskar [mailto:prafulla at marvell.com]
Sent: Monday, August 24, 2009 11:04 PM
To: u-boot at lists.denx.de
Cc: Prabhanjan Sarnaik; Ashish Karkare; Prafulla Wadaskar
Subject: [PATCH v3 4/4] tools: mkimage: Add: Kirkwood Boot Image support (kwbimage)

This patch adds type kwbimabe support for new mkimage core For more details refer docs/README.kwbimage

This patch is tested with Sheevaplug board

Quoted 8 lines

---
Change log:
v2: updated as per review comments for v1
added len checks in checksum functions
added printable strings for each valid table entry
use of sccanf not changed since it offers return value for failure

v3: resolved merge issues on mkimage branch

Ping... (for this entire patch series)

Regards..
Prafulla . .

#5 lore raw

PATCH v3 4/4 tools: mkimage: Add: Kirkwood Boot Image support (kwbimage)

In reply to Prafulla Wadaskar
Quoted 6 lines · On Mon, 24 Aug 2009 23:03:59 +0530 Prafulla Wadaskar <[email protected]>…

This patch adds type kwbimabe support for new mkimage core For more details refer docs/README.kwbimage

doc/README.kwbimage new file +3 -0
+Command syntax:
+--------------
+./tools/mkimage -l <kwboot_file>

doc/README.kwbimage line 26

Quoted 10 lines
doc/README.kwbimage new file +10 -0
+		to list the kwb image file details
+
+./tools/mkimage -n <board specific configuration file> \
+                -T kwbimage -a <start address> -e <execution address> \
+		-d <input_raw_binary> <output_kwboot_file>
+
+for ex.
+./tools/mkimage -n ./board/Marvell/openrd_base/kwbimage.cfg \
+                -T kwbimage -a 0x00600000 -e 0x00600000 \
+		-d u-boot.bin u-boot.kwb

I think it could also be useful to be able to produce just the boot header without the U-boot image. For example if you want to place U-boot at some other location on the flash or (as a developer) frequently re-flash U-boot, but don't want to write to the first block all the time (you only need to rewrite it when moving U-boot).

Perhaps something like

doc/README.kwbimage line 63

Quoted 7 lines
doc/README.kwbimage new file +7 -0
+Typical example of kwimage.cfg file:
+-----------------------------------
+
+# Boot Media configurations
+BOOT_FROM	nand
+NAND_ECC_MODE	default
+NAND_PAGE_SIZE	0x0800

SOURCE_OFFSET 0x0 # Relative to the header or NAND start?

tools/kwbimage.c line 328

Quoted 6 lines
tools/kwbimage.c new file +5 -0
+static void kwbimage_set_header (void *ptr, struct stat *sbuf, int ifd,
+				struct mkimage_params *params)
+{
+	struct kwb_header *hdr = (struct kwb_header *)ptr;
[...]
+	mhdr->srcaddr = sizeof(struct kwb_header);

and this could then be changed to have this info.

// Simon

#6 lore raw

PATCH v3 4/4 tools: mkimage: Add: Kirkwood Boot Image support (kwbimage)

Quoted 24 lines

-----Original Message-----
From: Simon Kagstrom [mailto:simon.kagstrom at netinsight.net]
Sent: Thursday, September 03, 2009 5:30 PM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] [PATCH v3 4/4] tools: mkimage: Add:
Kirkwood Boot Image support (kwbimage)

doc/README.kwbimage

Quoted 10 lines · On Mon, 24 Aug 2009 23:03:59 +0530 Prafulla Wadaskar <[email protected]>…

This patch adds type kwbimabe support for new mkimage core For more details refer docs/README.kwbimage

doc/README.kwbimage new file +7 -0
+Command syntax:
+--------------
+./tools/mkimage -l <kwboot_file>
+		to list the kwb image file details
+
+./tools/mkimage -n <board specific configuration file> \
+                -T kwbimage -a <start address> -e 

<execution address> \

Quoted 12 lines

doc/README.kwbimage line 26

Quoted 6 lines
doc/README.kwbimage new file +6 -0
+		-d <input_raw_binary> <output_kwboot_file>
+
+for ex.
+./tools/mkimage -n ./board/Marvell/openrd_base/kwbimage.cfg \
+                -T kwbimage -a 0x00600000 -e 0x00600000 \
+		-d u-boot.bin u-boot.kwb

I think it could also be useful to be able to produce just the boot header without the U-boot image. For example if you want to place U-boot at some other location on the flash or (as a developer) frequently re-flash U-boot, but don't want to write to the first block all the time (you only need to rewrite it when moving U-boot).

Hi Simon
This is not possible.
Boot Header is a part of Kirkwood boot image,
Header contains u-boot imagesize so for this, first block need to be written each time. Secondly u-boot header is of 512bytes only whereas minimum sector size could be 4kbytes (typical), so rest part of first sector will be a waste.
Also at the end of boot image checksum need to be calculated on entire image including header.

If one need just header, just use only initial 512 byte I don't see any good use case for this at this moment.

Regards..
Prafulla . .

Quoted 25 lines

Perhaps something like

doc/README.kwbimage line 63

Quoted 7 lines
doc/README.kwbimage new file +7 -0
+Typical example of kwimage.cfg file:
+-----------------------------------
+
+# Boot Media configurations
+BOOT_FROM	nand
+NAND_ECC_MODE	default
+NAND_PAGE_SIZE	0x0800

SOURCE_OFFSET 0x0 # Relative to the header or NAND start?

Quoted 1 line

+static void kwbimage_set_header (void *ptr, struct stat

*sbuf, int ifd,

tools/kwbimage.c line 328

Quoted 5 lines
tools/kwbimage.c new file +4 -0
+				struct mkimage_params *params)
+{
+	struct kwb_header *hdr = (struct kwb_header *)ptr;
[...]
+	mhdr->srcaddr = sizeof(struct kwb_header);

and this could then be changed to have this info.

// Simon

#7 lore raw

PATCH v3 4/4 tools: mkimage: Add: Kirkwood Boot Image support (kwbimage)

Hi Prafulla!

I see the complications and understand that it might be difficult to get it running.

Quoted 9 lines · On Thu, 3 Sep 2009 07:15:48 -0700 Prafulla Wadaskar <[email protected]>…
Quoted 5 lines

I think it could also be useful to be able to produce just the boot header without the U-boot image. For example if you want to place U-boot at some other location on the flash or (as a developer) frequently re-flash U-boot, but don't want to write to the first block all the time (you only need to rewrite it when moving U-boot).

This is not possible.
Boot Header is a part of Kirkwood boot image,
Header contains u-boot imagesize so for this, first block need to be written each time.

Understandable. On the other hand, it should be possible to pad the U-boot image to some specific size to keep the size constant. Typically to the erase size.

Quoted 2 lines

Secondly u-boot header is of 512bytes only whereas minimum sector size could be 4kbytes (typical), so rest part of first sector will be a waste.

I'd be prepared to waste a couple of bytes :-)

Quoted 1 line

Also at the end of boot image checksum need to be calculated on entire image including header.

This is not how I read the documentation. I thought the 32-bit checksum is for the image only, not the headers? Anyway, if it does include the headers, then I see why this would be impossible.

Thanks for the explanation!

// Simon

#8 lore raw

PATCH v3 4/4 tools: mkimage: Add: Kirkwood Boot Image support (kwbimage)

Quoted 10 lines

-----Original Message-----
From: Simon Kagstrom [mailto:simon.kagstrom at netinsight.net]
Sent: Friday, September 04, 2009 12:00 PM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik
Subject: Re: [U-Boot] [PATCH v3 4/4] tools: mkimage: Add:
Kirkwood Boot Image support (kwbimage)

Quoted 4 lines

Hi Prafulla!

I see the complications and understand that it might be difficult to get it running.

Dear Simon
So we can keep this complex enhancement for future updates, keeping this patch simpler

Quoted 15 lines
Quoted 1 line · On Thu, 3 Sep 2009 07:15:48 -0700 Prafulla Wadaskar <[email protected]>…
Quoted 1 line

I think it could also be useful to be able to produce

just the boot

Quoted 3 lines
Quoted 3 lines

header without the U-boot image. For example if you want to place U-boot at some other location on the flash or (as a developer) frequently re-flash U-boot, but don't want to write to

the first block

Quoted 5 lines
Quoted 1 line

all the time (you only need to rewrite it when moving U-boot).

This is not possible.
Boot Header is a part of Kirkwood boot image, Header contains u-boot imagesize so for this, first block

Quoted 6 lines

need to be written each time.

Understandable. On the other hand, it should be possible to pad the U-boot image to some specific size to keep the size constant. Typically
to the erase size.

Again it would be problem it image size jumps over sector size boundary

Quoted 6 lines
Quoted 2 lines

Secondly u-boot header is of 512bytes only whereas minimum

sector size could be 4kbytes (typical),

Quoted 1 line

so rest part of first sector will be a waste.

I'd be prepared to waste a couple of bytes :-)

You will have to waste 128Kbytes-512bytes on sheevaplug :-) Finally you will waste one extra sector (u-boot.kwb size is ~160kb)

Quoted 8 lines
Quoted 2 lines

Also at the end of boot image checksum need to be

calculated on entire image including header.

This is not how I read the documentation. I thought the 32-bit checksum
is for the image only, not the headers? Anyway, if it does include the headers, then I see why this would be impossible.

Currently it is done in the way I explained with some reference, I will do some exercise with your suggestions and let you know.

Regards..
Prafulla . .

Quoted 6 lines

Thanks for the explanation!

// Simon

#9 lore raw

PATCH v3 4/4 tools: mkimage: Add: Kirkwood Boot Image support (kwbimage)

Quoted 4 lines · On Fri, 4 Sep 2009 00:17:57 -0700 Prafulla Wadaskar <[email protected]>…
Quoted 2 lines

I see the complications and understand that it might be difficult to get it running.

So we can keep this complex enhancement for future updates, keeping this patch simpler

I agree, let's merge this patch first before thinking of some enhancements.

// Simon

#10 lore raw

PATCH v3 4/4 tools: mkimage: Add: Kirkwood Boot Image support (kwbimage)

In reply to Simon Kagstrom

Dear Simon Kagstrom,

Quoted 4 lines · In message <[email protected]> you wrote:

Understandable. On the other hand, it should be possible to pad the U-boot image to some specific size to keep the size constant. Typically to the erase size.

This makes no sense. Why would such padding be needed? It only adds overhead everywhere where the image needs to be processed, stored, downloaded, programmed, etc.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Conceptual integrity in turn dictates that the  design  must  proceed
from  one  mind,  or  from  a  very small number of agreeing resonant
minds.               - Frederick Brooks Jr., "The Mythical Man Month" 
#11 lore raw

PATCH v3 4/4 tools: mkimage: Add: Kirkwood Boot Image support (kwbimage)

Quoted 11 lines · On Fri, 04 Sep 2009 10:24:38 +0200 Wolfgang Denk <[email protected]> wrote:

Dear Simon Kagstrom,

Quoted 4 lines · In message <[email protected]> you wrote:

Understandable. On the other hand, it should be possible to pad the U-boot image to some specific size to keep the size constant. Typically to the erase size.

This makes no sense. Why would such padding be needed? It only adds overhead everywhere where the image needs to be processed, stored, downloaded, programmed, etc.

In this case to have keep the kirkwood boot header unchanged, and to just update the U-boot image.

// Simon

#12 lore raw

PATCH v3 4/4 tools: mkimage: Add: Kirkwood Boot Image support (kwbimage)

Dear Simon Kagstrom,

Quoted 11 lines · In message <[email protected]> you wrote:
Quoted 8 lines
Quoted 4 lines

Understandable. On the other hand, it should be possible to pad the U-boot image to some specific size to keep the size constant. Typically to the erase size.

This makes no sense. Why would such padding be needed? It only adds overhead everywhere where the image needs to be processed, stored, downloaded, programmed, etc.

In this case to have keep the kirkwood boot header unchanged, and to just update the U-boot image.

Doesn't the header contain checksums and such? And what would that save you? Building the image with header is supposed to be a very cheap operation.

Best regards,

Wolfgang Denk

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-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"What if" is a trademark of Hewlett Packard, so stop using it in your
sentences without permission, or risk being sued.
#13 lore raw

PATCH v3 4/4 tools: mkimage: Add: Kirkwood Boot Image support (kwbimage)

Quoted 12 lines · On Fri, 04 Sep 2009 12:57:57 +0200 Wolfgang Denk <[email protected]> wrote:

Dear Simon Kagstrom,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 8 lines
Quoted 4 lines

Understandable. On the other hand, it should be possible to pad the U-boot image to some specific size to keep the size constant. Typically to the erase size.

This makes no sense. Why would such padding be needed? It only adds overhead everywhere where the image needs to be processed, stored, downloaded, programmed, etc.

Quoted 6 lines
Quoted 2 lines

In this case to have keep the kirkwood boot header unchanged, and to just update the U-boot image.

Doesn't the header contain checksums and such? And what would that save you? Building the image with header is supposed to be a very cheap operation.

I believe the checksums are for the header and the header extension - the image itself contains a checksum in the last 4 bytes.

The idea was to avoid having to rewrite the same block all the time. Anyway, Prafulla has explained why it's difficult (or maybe impossible) to use this method, so I think we can safely drop this subject for now.

// Simon