Subject: [PATCH][PPC32] mktree fix

From: Andre' Draszik <[email-masked]>
Date: Mon, 07 Feb 2005 05:34:36 +0100

This one fixes mktree. The image size stored in the header is pretty off without
this patch. (yes, it can make a difference of upto almost 64k)

Signed-off-by: Andre' Draszik <[email-masked]>

diff -urN linuxppc-2.5.orig/arch/ppc/boot/utils/mktree.c linuxppc-2.5/arch/ppc/boot/utils/mktree.c
--- linuxppc-2.5.orig/arch/ppc/boot/utils/mktree.c	2005-02-03 20:20:39.000000000 +0100
+++ linuxppc-2.5/arch/ppc/boot/utils/mktree.c	2005-02-06 03:13:27.000000000 +0100
@@ -113,7 +113,8 @@
  		exit(4);
  	}

-	nblks -= (64 * 1024) / IMGBLK;
+	nblks -= (64 * 1024 - sizeof (bt)) / IMGBLK;
+	bt.bb_num_512blocks = htonl(nblks + 1);

  	/* And away we go......
  	*/
@@ -122,7 +123,7 @@
  		exit(5);
  	}

-	while (nblks-- > 0) {
+	while (--nblks > 0) {
  		if (read(in_fd, tmpbuf, IMGBLK) < 0) {
  			perror("zImage read");
  			exit(5);