linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Niels Kristian Bech Jensen <nkbj@mail.tele.dk>
Cc: linuxppc-dev@ozlabs.org, Olaf Hering <olh@suse.de>
Subject: Re: booting with BootX corrupts memory
Date: Fri, 18 Aug 2006 14:02:12 +1000	[thread overview]
Message-ID: <1155873732.5803.16.camel@localhost.localdomain> (raw)
In-Reply-To: <1155096025.3813.6.camel@plutonium.opasia.dk>

On Wed, 2006-08-09 at 06:00 +0200, Niels Kristian Bech Jensen wrote:
>  On Tue, Aug  1, Olaf Hering wrote:
> 
> > Booting an old Mac with BootX corrupts memory, the kernel seldom gets
> > into init. Even the built-in initramfs archive gets corrupted. So far I
> > havent figured out where the corruption starts. The only data point so
> > far is that a passed initrd gets overwritten with stuff that looks like
> > part of the device-tree after the call to free_area_init_node() from
> > paging_init(). Perhaps the virtual/real address mapping isnt handled
> > correctly.
> 
> > This is broken since at least 2.6.15, 2.6.14 dies very early, 2.6.13 was
> > still ok.
> 
> > Symptoms differ, depending on used .config and wether an initrd is passed.
> 
> I think I've been hit by this bug on my beige G3 running Ubuntu Edgy.
> 
> When booting with initrd the boot process stops before any kernel output (CONFIG_BOOTX_TEXT is not enabled).
> Booting without initrd works fine - at least until it cannot find the root filesystem driver. ;-)

Does this patch helps ?

Index: linux-work/arch/powerpc/platforms/powermac/bootx_init.c
===================================================================
--- linux-work.orig/arch/powerpc/platforms/powermac/bootx_init.c	2006-08-17 16:16:03.000000000 +1000
+++ linux-work/arch/powerpc/platforms/powermac/bootx_init.c	2006-08-18 14:01:36.000000000 +1000
@@ -411,8 +411,15 @@
 	DBG("End of boot params: %x\n", mem_end);
 	rsvmap[0] = mem_start;
 	rsvmap[1] = mem_end;
-	rsvmap[2] = 0;
-	rsvmap[3] = 0;
+	if (bootx_info->ramDisk) {
+		rsvmap[2] = ((unsigned long)bootx_info) + bootx_info->ramDisk;
+		rsvmap[3] = rsvmap[2] + bootx_info->ramDiskSize;
+		rsvmap[4] = 0;
+		rsvmap[5] = 0;
+	} else {
+		rsvmap[2] = 0;
+		rsvmap[3] = 0;
+	}
 
 	return (unsigned long)hdr;
 }
@@ -543,12 +550,12 @@
 	 */
 	if (bi->version < 5) {
 		space = bi->deviceTreeOffset + bi->deviceTreeSize;
-		if (bi->ramDisk)
+		if (bi->ramDisk >= space)
 			space = bi->ramDisk + bi->ramDiskSize;
 	} else
 		space = bi->totalParamsSize;
 
-	bootx_printf("Total space used by parameters & ramdisk: %x \n", space);
+	bootx_printf("Total space used by parameters & ramdisk: 0x%x \n", space);
 
 	/* New BootX will have flushed all TLBs and enters kernel with
 	 * MMU switched OFF, so this should not be useful anymore.

  reply	other threads:[~2006-08-18  4:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-09  4:00 booting with BootX corrupts memory Niels Kristian Bech Jensen
2006-08-18  4:02 ` Benjamin Herrenschmidt [this message]
2006-08-18  7:01   ` Olaf Hering
2006-08-21 12:17     ` Olaf Hering
2006-08-21 21:31       ` Benjamin Herrenschmidt
2006-08-23 14:55         ` Olaf Hering
2006-08-18 12:10   ` Niels Kristian Bech Jensen
  -- strict thread matches above, loose matches on Subject: below --
2006-07-31 17:46 Olaf Hering

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=1155873732.5803.16.camel@localhost.localdomain \
    --to=benh@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=nkbj@mail.tele.dk \
    --cc=olh@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).