All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Valentine Barshak <vbarshak@ru.mvista.com>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [RFC] [PATCH] PowerPC: add more than 4MB kernel image size support to bootwarapper
Date: Wed, 3 Oct 2007 15:50:05 +1000	[thread overview]
Message-ID: <20071003055005.GD18978@localhost.localdomain> (raw)
In-Reply-To: <46FD0E4D.30305@ru.mvista.com>

On Fri, Sep 28, 2007 at 06:23:09PM +0400, Valentine Barshak wrote:
> David Gibson wrote:
> > On Mon, Sep 24, 2007 at 03:36:27PM +0400, Valentine Barshak wrote:
> >> Currently zImage is linked at the 4MB base address.
> >> Some platforms (using cuboot, treeboot) need the zImage's
> >> entry point and base address. They place zImage exactly
> >> at the base address it's been linked to. Sometimes 4MB left
> >> at the start of the memory is simply not enough to unpack zImage.
> >> This could happen with initramfs enabled, since the kernel image
> >> packed along with initramfs.cpio could be over 5MB in size.
> >> This patch checks vmlinux image size and links zImage at
> >> the base address that is equal to the unpacked image size
> >> aligned to 4MB boundary. This way zImage base address is 4MB
> >> only if unpacked kernel image size is less then 4MB.
> > 
> > Good plan.  However..
> > 
> > [snip]
> >> diff -ruN linux-2.6.orig/arch/powerpc/boot/zImage.lds.S linux-2.6/arch/powerpc/boot/zImage.lds.S
> >> --- linux-2.6.orig/arch/powerpc/boot/zImage.lds.S	2007-09-22 00:48:08.000000000 +0400
> >> +++ linux-2.6/arch/powerpc/boot/zImage.lds.S	2007-09-22 04:03:58.000000000 +0400
> >> @@ -3,7 +3,7 @@
> >>  EXTERN(_zimage_start)
> >>  SECTIONS
> >>  {
> >> -  . = (4*1024*1024);
> >> +  . = ALIGN((_kend - _kstart), (4*1024*1024));
> > 
> > ..I don't see any reason to keep the 4MB granularity.  I would just
> > align the address to say a 64k boundary (64k because that's the
> > granularity used in the normal ABI).
> 
> Looking deeper at this I've found that currently u-boot thinks that 
> memory space over 8MB is not reached by Linux kernel (CFG_BOOTMAPSZ 
> defined as (8 << 20)), although all physical memory is identity mapped. 
> That's why it puts command line and board info structure as high as 
> possible within the first 8MB. This worked fine with uImage, since 
> u-boot always unpacked it to 0. Now, cuImage has to be unpacked higher 
> (we need space at the start of the memory to eventually put vmlinux 
> image there). So, if unpacked kernel image crosses 8MB boundary, it gets 
> damaged by u-boot when it prepares cmd_line and bdinfo. The possible 
> workaround for that is to always link zImage at >=8MB base or to have 
> 4MB granularity like this:
> 
> +  . = ALIGN((_kend - _kstart + 64*1024), (4*1024*1024));
> 
> Reserve at least 64K for u-boot cmd_line and bdinfo.

Ah.  Right.  That makes things a bit tricky.  Even this 4MB
granularity may not be enough (say, if the vmlinux is < 4MB, but the
zImage has a really big initrd and is > 4MB).

Except... it shouldn't really be the link address that matters.  The
zImage is relocatable, so it should only be the load address specified
in the uImage header which matters.  I think that's currently derived
from the link address, but it doesn't have to be.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

  reply	other threads:[~2007-10-03  5:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-24 11:36 [RFC] [PATCH] PowerPC: add more than 4MB kernel image size support to bootwarapper Valentine Barshak
2007-09-25  2:29 ` David Gibson
2007-09-28 14:23   ` Valentine Barshak
2007-10-03  5:50     ` David Gibson [this message]
2007-10-05  1:58       ` Mark A. Greer
2007-10-05  2:25         ` David Gibson
2007-10-05  2:59           ` Mark A. Greer
2007-10-05  3:08             ` Mark A. Greer
2007-10-05 17:30         ` Scott Wood
2007-10-05 21:03           ` Mark A. Greer
2007-10-08  1:31             ` Scott Wood
2007-10-12 21:53               ` Mark A. Greer

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=20071003055005.GD18978@localhost.localdomain \
    --to=david@gibson.dropbear.id.au \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=vbarshak@ru.mvista.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.