public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Tom Rini <trini@kernel•crashing.org>
To: Magnus Damm <damm@opensource•se>
Cc: linuxppc-embedded@lists•linuxppc.org
Subject: Re: bi_record and initrd
Date: Tue, 19 Nov 2002 11:19:43 -0700	[thread overview]
Message-ID: <20021119181943.GE779@opus.bloom.county> (raw)
In-Reply-To: <20021119181107.GD779@opus.bloom.county>


On Tue, Nov 19, 2002 at 11:11:07AM -0700, Tom Rini wrote:

[snip]
> Yeah, I'm sure too.  Here's an untested patch vs current
> linuxppc_2_4_devel, which will relocate the initrd if needed.  The

And here it actually is.

===== arch/ppc/boot/common/misc-simple.c 1.24 vs edited =====
--- 1.24/arch/ppc/boot/common/misc-simple.c	Fri Oct 25 17:26:48 2002
+++ edited/arch/ppc/boot/common/misc-simple.c	Tue Nov 19 11:03:16 2002
@@ -82,6 +82,7 @@
 	char *cp, ch;
 	struct bi_record *rec, *birecs;
 	unsigned long TotalMemory = 0;
+	unsigned long initrd_loc;

 	serial_fixups();
 	com_port = serial_init(0, NULL);
@@ -145,6 +146,18 @@
 		puts("initrd at:     ");
 		puthex((unsigned long)(&__ramdisk_begin));
 		puts(" "); puthex((unsigned long)(&__ramdisk_end));puts("\n");
+		/* Make sure we don't put the bi_recs inside the initrd. */
+		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(&initrd_loc, &__ramdisk_end, initrd_size);
+			puts("relocated to:  "); puthex(initrd_loc);
+			puts(" "); puthex(initrd_loc + initrd_size);
+			puts("\n");
+		} else
+			initrd_loc = (unsigned long)(&__ramdisk_begin);
 	}

 	avail_ram = (char *)0x00400000;
@@ -234,7 +247,7 @@

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

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

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

  reply	other threads:[~2002-11-19 18:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-11-27 21:00 Richard Laing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021119181943.GE779@opus.bloom.county \
    --to=trini@kernel$(echo .)crashing.org \
    --cc=damm@opensource$(echo .)se \
    --cc=linuxppc-embedded@lists$(echo .)linuxppc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox