linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: "Mark A. Greer" <mgreer@mvista.com>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [RFC] [PATCH] PowerPC: add more than 4MB kernel image size support to bootwarapper
Date: Fri, 5 Oct 2007 12:25:54 +1000	[thread overview]
Message-ID: <20071005022554.GE25637@localhost.localdomain> (raw)
In-Reply-To: <20071005015849.GA9862@mag.az.mvista.com>

On Thu, Oct 04, 2007 at 06:58:49PM -0700, Mark A. Greer wrote:
> On Wed, Oct 03, 2007 at 03:50:05PM +1000, David Gibson wrote:
> > 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:
> 
> > > 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.
> 
> Having the link address jump around depending on the size of the kernel
> or zImage is wrong IMHO.  It just screams "weird can't boot issues."

Hrm.  Except we already have that - the zImage is linked at a fixed
location, and will just not work if the sizes are wrong.

> We need a way to specify exactly where we want the zImage linked no
> matter what the kernel or zImage size.
> 
> Also, being able to control the link address (that is, the download
> address with some firmwares) is not a u-boot specific issue and we
> shouldn't make a u-boot specific solution.
> 
> The more general problem is that some firmwares examine the ELF header
> and download the zImage to address it was linked at.  Some firmwares let
> you override this but some don't and those are the problem ones.
> 
> We talked about this a bit back in February,
> http://ozlabs.org/pipermail/linuxppc-dev/2007-February/031532.html
> 
> In that thread Geoff Levand suggested a config option and running it
> thru a preprocessor.  David Gibson suggested making a replaceable linker
> script.  I suggested passing the value of a config option to the wrapper
> script which would use objcopy/whatever to change the section addresses
> in the image (maybe this is what Geoff had in mind, I'm not sure).
> 
> I still like my idea best.  I haven't coded yet it so I don't have a patch
> but this is what I mean:
> 
> 1) add a config option (default 4MB) for the link address
> 2) add a parameter to the wrapper script thru which we pass the value in
>    the config option
> 3) the wrapper script changes the VMA/LMA to the address specified
>    (objcopy --change-addresses=<some math to get correct incr> ?).
> 
> I'll code it up in the next day or two unless someone doesn't like the idea.

A config option just doesn't seem right to me, except as a
special-circumstances hack.  The zImage is already hardware and
firmware specific; we should be able to figure out workable link and
load addresses for a specific zImage (which might need to be different
for different zImages produced by the same config).

Of course, the same objection would apply to CONFIG_DEVICE_TREE which
we have already.

-- 
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-05  2:25 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
2007-10-05  1:58       ` Mark A. Greer
2007-10-05  2:25         ` David Gibson [this message]
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=20071005022554.GE25637@localhost.localdomain \
    --to=david@gibson.dropbear.id.au \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mgreer@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 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).