linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* bi_record and initrd
@ 2002-11-14 15:54 Magnus Damm
  2002-11-14 17:48 ` Tom Rini
  0 siblings, 1 reply; 11+ messages in thread
From: Magnus Damm @ 2002-11-14 15:54 UTC (permalink / raw)
  To: linuxppc-embedded


Hi all,

The 2.4.19 kernel and the current rsync kernel from
source.mvista.com::linuxppc_2_4 does not work with large initrds.

The bi_record setup code in linux/arch/ppc/boot/simple/misc-embedded.c
doesn't care about the initrd size. So, if you are using a initrd that
crosses a megabyte-boundary you will have your initrd overwritten with
the bi_record. This results in crc error when unpacking the initrd.

The quick fix is to add a offset to the boot-code and to
arch/ppc/kernel/setup.c.

So, what's the long term solution?
Passing a pointer to the kernel?

/ magnus

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 11+ messages in thread
* RE: bi_record and initrd
@ 2002-11-27 21:00 Richard Laing
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Laing @ 2002-11-27 21:00 UTC (permalink / raw)
  To: linuxppc-embedded


The following is a diff context patch for misc-embedded.c, it fixes a
problem where the initrd ramdisk image is corrupted during the boot process.
It is based on the untested patch from Tom Rini for misc-simple.c. The patch
corrects a bug in the Tom's original patch. The patch is against the current
linuxppc_2_4_devel branch. The only change from the original patch the
memcpy line

memcpy((void *)initrd_loc, &__ramdisk_begin, initrd_size);

I have tested this patch with my build and it works fine...

Cheers
Richard


*** arch/ppc/boot/simple/old.c	2002-11-28 09:00:08.000000000 +1300
--- arch/ppc/boot/simple/misc-embedded.c	2002-11-28
09:50:21.000000000 +1300
***************
*** 83,88 ****
--- 83,89 ----
  	char *cp, ch;
  	int timer = 0, zimage_size;
  	unsigned long initrd_size;
+ 	unsigned long initrd_loc;

  	/* First, capture the embedded board information.  Then
  	 * initialize the serial console port.
***************
*** 145,150 ****
--- 146,162 ----
  		puts("initrd at:     ");
  		puthex((unsigned long)(&__ramdisk_begin));
  		puts(" "); puthex((unsigned
long)(&__ramdisk_end));puts("\n");
+
+ 		if ((_ALIGN((unsigned long)(zimage_size) + (1 << 20) - 1,
+ 			(1 << 20))) <= (unsigned long)(&__ramdisk_end)) {
+ 			initrd_loc = _ALIGN((unsigned long)(initrd_size) +(2
<< 20) - 1, (2 << 20));
+ 			 memcpy((void *)initrd_loc, &__ramdisk_begin,
initrd_size);
+ 			 puts("relocated to:  "); puthex(initrd_loc);
+ 			 puts(" "); puthex(initrd_loc + initrd_size);
+ 			 puts("\n");
+ 		} else {
+ 			initrd_loc = (unsigned long)(&__ramdisk_begin);
+ 	        }
  	}

  	/*
***************
*** 225,231 ****

  		if ( initrd_size ) {
  			rec->tag = BI_INITRD;
! 			rec->data[0] = (unsigned long)(&__ramdisk_begin);
  			rec->data[1] = initrd_size;
  			rec->size = sizeof(struct bi_record) + 2 *
  				sizeof(unsigned long);
--- 237,243 ----

  		if ( initrd_size ) {
  			rec->tag = BI_INITRD;
! 			rec->data[0] = initrd_loc;
  			rec->data[1] = initrd_size;
  			rec->size = sizeof(struct bi_record) + 2 *
  				sizeof(unsigned long);


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2002-11-27 21:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-14 15:54 bi_record and initrd Magnus Damm
2002-11-14 17:48 ` Tom Rini
2002-11-15 12:02   ` Magnus Damm
2002-11-15 17:08     ` Cort Dougan
2002-11-18  8:19       ` Magnus Damm
2002-11-18 17:13         ` Tom Rini
2002-11-19  4:29         ` Murray Jensen
2002-11-18 14:19       ` Tom Rini
2002-11-19 18:11     ` Tom Rini
2002-11-19 18:19       ` Tom Rini
  -- strict thread matches above, loose matches on Subject: below --
2002-11-27 21:00 Richard Laing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).