Package: uboot-mkimage
Version: 0.4
Severity: normal

Minor correction of the previous patch: with the previous patch, with the
switch on, it would have added one byte to the last file's size (if it's a
multiple of 4) without adding data to the image. This is not needed, and
possibly broken.



-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (120, 'unstable'), (105, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.34-rc5 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages uboot-mkimage depends on:
ii  libc6                         2.10.2-9   Embedded GNU C Library: Shared lib

uboot-mkimage recommends no packages.

uboot-mkimage suggests no packages.
diff -r 4281db2bcda6 mkimage.c
--- a/mkimage.c	Tue Jun 01 22:46:18 2010 +0200
+++ b/mkimage.c	Wed Jun 02 00:00:12 2010 +0200
@@ -170,6 +170,7 @@
 int lflag    = 0;
 int vflag    = 0;
 int xflag    = 0;
+int pflag    = 0;
 int opt_os   = IH_OS_LINUX;
 int opt_arch = IH_CPU_PPC;
 int opt_type = IH_TYPE_KERNEL;
@@ -254,6 +255,9 @@
 					usage ();
 				name = *++argv;
 				goto NXTARG;
+			case 'p':
+				pflag++;
+				break;
 			case 'v':
 				vflag++;
 				break;
@@ -408,6 +412,8 @@
 						cmdname, file, strerror(errno));
 					exit (EXIT_FAILURE);
 				}
+				if (pflag && sep && (sbuf.st_size % 4) == 0)
+					sbuf.st_size += 1;
 				size = htonl(sbuf.st_size);
 			} else {
 				size = 0;
@@ -584,7 +590,8 @@
 		exit (EXIT_FAILURE);
 	}
 
-	if (pad && ((tail = size % 4) != 0)) {
+	tail = size % 4;
+	if (pad && (pflag || tail != 0)) {
 
 		if (write(ifd, (char *)&zero, 4-tail) != 4-tail) {
 			fprintf (stderr, "%s: Write error on %s: %s\n",
@@ -613,6 +620,7 @@
 			 "          -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 (work around a bug in u-boot)\n"
 			 "          -x ==> set XIP (execute in place)\n"
 		);
 	exit (EXIT_FAILURE);

Reply via email to