[U-Boot-Users] [PATCH] Fix initrd length miscalculation in bootm command

Johns Daniel johns.daniel at gmail.com
Tue Mar 27 18:25:55 CEST 2007


On 3/23/07, Johns Daniel <johns.daniel at gmail.com> wrote:
> On 3/16/07, Timur Tabi <timur at freescale.com> wrote:
> > Timur Tabi wrote:
> >
> > > Now that I think about it, I guess that statement doesn't make any sense.  I was trying to
> > > say that I didn't *break* multi-images.  The patch fixes a problem with initrd + OF.  If
> > > you're not using an initrd, then my patch doesn't change anything, so I just wanted to
> > > make sure that things that worked before my patch still work after my patch.
> >
> > Wolfgang,
> >
> > I just wanted to make sure that you understood that this patch does indeed fix a real and
> > severe problem with U-Boot, and therefore should be applied.  I submitted this patch over
> > a month ago, and it's still not in your repository.  Without this patch, you cannot use an
> >   initrd on any ARCH=powerpc kernel.
>
> Just want to confirm that the booting of "arch/powerpc" kernels with
> an initrd is currently broken in u-boot 1.2.0. And, that Timur's patch
> fixes the issue.

One more note to add to that. The only part of Timur's patch that is
really important is this bit:
@@ -771,9 +767,8 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int fl

                       checksum = ntohl(hdr->ih_dcrc);
                       addr = (ulong)((uchar *)(hdr) + sizeof(image_header_t));
-                       len = ntohl(hdr->ih_size);

-                       if(checksum != crc32(0, (uchar *)addr, len)) {
+                       if(checksum != crc32(0, (uchar *)addr,
ntohl(hdr->ih_size))) {
                               printf("ERROR: Flat Device Tree
checksum is invalid\n");
                               return;
                       }

The "len" variable should not be used for the DTB image.

-- Johns




More information about the U-Boot mailing list