mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Hubert Feurstein <h.feurstein@gmail.com>
Cc: barebox@lists.infradead.org, Lucas Stach <lst@pengutronix.de>
Subject: Re: bootm: booting of uncompressed uimages broken
Date: Tue, 23 Feb 2016 12:09:30 +0100	[thread overview]
Message-ID: <20160223110930.GF3939@pengutronix.de> (raw)
In-Reply-To: <CAFfN3gVQe42ymDjXDZntq_cR0mms9W2MPin0G7_-QWwgUJag5g@mail.gmail.com>

Hi Hubert,

On Tue, Feb 23, 2016 at 10:52:21AM +0100, Hubert Feurstein wrote:
> Hi,
> 
> booting of uncompressed uimages is broken since patch "ARM: bootm: fix
> default uImage placement" (0839e3f402ffc74202a1ca4fbeaffcadb4336ce1):
> 
> This is the change causing the issue:
> @@ -138,13 +144,10 @@ static int do_bootm_linux(struct image_data *data)
>   return ret;
> 
>   /*
> - * Put devicetree/initrd at maximum to 128MiB into RAM to not
> - * risk to put it outside of lowmem.
> + * put oftree/initrd close behind compressed kernel image to avoid
> + * placing it outside of the kernels lowmem.
>   */
> - if (mem_size > SZ_256M)
> - mem_free = mem_start + SZ_128M;
> - else
> - mem_free = PAGE_ALIGN(data->os_res->end + SZ_1M);
> + mem_free = PAGE_ALIGN(data->os_res->end + SZ_1M);
> 
>   return __do_bootm_linux(data, mem_free, 0);
>  }
> 
> System Info: iMX6S; 512MB RAM; LoadAddress 0x10008000; Barebox v2015.06.0

I assume what happens here is that due to 0839e3f40 barebox places the
device tree close behind the kernel image, the kernel then copies itself
out of the way so it won't overwrite itself while uncompressing, then it
uncompresses itself back to 0x10008000 and overwrites the device tree.

This behaviour is broken and should be fixed.

However, 0x10008000 is a poor choice for the load address. It's exactly
the place where the decompressor has to put the image to after
decompressing, so this address forces the decompressor to move the
compressed kernel somewhere else before decompressing it.

You could specify the load address to 0xffffffff. This allows barebox to
pick a good place for the kernel image. A bonus is a slightly faster
kernel startup because barebox will pick a place that does not force the
decompressor to move the kernel image.

We should probably finally fix the kernel decompressor so that it won't
overwrite the device tree.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2016-02-23 11:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-23  9:52 Hubert Feurstein
2016-02-23 11:09 ` Sascha Hauer [this message]
     [not found]   ` <CAFfN3gVK2BHq4wC9gTxN-pJ=-j6FHiikfuV+FdGfVwiOKG2a_Q@mail.gmail.com>
     [not found]     ` <20160223120404.GG3939@pengutronix.de>
2016-02-24 10:12       ` Hubert Feurstein

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=20160223110930.GF3939@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=h.feurstein@gmail.com \
    --cc=lst@pengutronix.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