All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [RFC][PATCH] mkimage: Add compatibility option for legacy Multi-File images
@ 2010-08-18 20:48 Thibaut Girka
  2010-08-30  9:29 ` Detlev Zundel
  2010-09-02 15:05 ` Wolfgang Denk
  0 siblings, 2 replies; 6+ messages in thread
From: Thibaut Girka @ 2010-08-18 20:48 UTC (permalink / raw)
  To: u-boot

During a few months, offsets of files in multi-file images were miscalculated,
this has been fixed by 02b9b22446e3d7ad6a6382be17a1ce79a7de589b,
but unfortunatly, some devices (I'm thinking of the Neo FreeRunner) are using
a broken version of U-Boot.

This problem can easily be worked around at image creation time by adding one
byte of junk at the end of the first (and optionnally second) file, if its
size is a multiple of 4.
It's not really clean, but it shouldn't cause any problem. At least, I haven't
encountered any using this patch.

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
---
 tools/mkimage.c |    9 ++++++++-
 tools/mkimage.h |    1 +
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/tools/mkimage.c b/tools/mkimage.c
index f5859d7..239c1f0 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -243,6 +243,9 @@ main (int argc, char **argv)
 					usage ();
 				params.imagename = *++argv;
 				goto NXTARG;
+			case 'p':
+				params.pflag++;
+				break;
 			case 'v':
 				params.vflag++;
 				break;
@@ -383,6 +386,8 @@ NXTARG:		;
 						params.cmdname, file, strerror(errno));
 					exit (EXIT_FAILURE);
 				}
+				if (params.pflag && sep && (sbuf.st_size % 4 == 0))
+					sbuf.st_size += 1;
 				size = cpu_to_uimage (sbuf.st_size);
 			} else {
 				size = 0;
@@ -556,7 +561,8 @@ copy_file (int ifd, const char *datafile, int pad)
 		exit (EXIT_FAILURE);
 	}
 
-	if (pad && ((tail = size % 4) != 0)) {
+	tail = size % 4;
+	if (pad && (params.pflag || tail != 0)) {
 
 		if (write(ifd, (char *)&zero, 4-tail) != 4-tail) {
 			fprintf (stderr, "%s: Write error on %s: %s\n",
@@ -586,6 +592,7 @@ usage ()
 			 "          -e ==> set entry point to 'ep' (hex)\n"
 			 "          -n ==> set image name to 'name'\n"
 			 "          -d ==> use image data from 'datafile'\n"
+			 "          -p ==> force padding in multi-file images\n"
 			 "          -x ==> set XIP (execute in place)\n",
 		params.cmdname);
 	fprintf (stderr, "       %s [-D dtc_options] -f fit-image.its fit-image\n",
diff --git a/tools/mkimage.h b/tools/mkimage.h
index 9033a7d..6e18750 100644
--- a/tools/mkimage.h
+++ b/tools/mkimage.h
@@ -58,6 +58,7 @@ struct mkimage_params {
 	int eflag;
 	int fflag;
 	int lflag;
+	int pflag;
 	int vflag;
 	int xflag;
 	int os;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [U-Boot] [RFC][PATCH] mkimage: Add compatibility option for legacy Multi-File images
@ 2010-08-29 13:05 Per Andersson
  0 siblings, 0 replies; 6+ messages in thread
From: Per Andersson @ 2010-08-29 13:05 UTC (permalink / raw)
  To: u-boot

Hi!

Do you want to apply the patch that Thibaut Girka posted earlier in mainline
U-Boot? [0]

We need it for Debian Installer when we make images for the Neo FreeRunner. The
patch is useful for use with devices that use broken U-Boot versions.


[0] http://lists.denx.de/pipermail/u-boot/2010-August/075823.html


Best,
Per

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-09-02 15:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-18 20:48 [U-Boot] [RFC][PATCH] mkimage: Add compatibility option for legacy Multi-File images Thibaut Girka
2010-08-30  9:29 ` Detlev Zundel
2010-08-31  6:50   ` Thibaut Girka
2010-09-01 15:04     ` Detlev Zundel
2010-09-02 15:05 ` Wolfgang Denk
2010-08-29 13:05 Per Andersson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.