From: Tom Rini <trini@konsulko.com>
To: Simon Glass <sjg@chromium.org>
Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>,
U-Boot Mailing List <u-boot@lists.denx.de>,
Marek Vasut <marex@denx.de>, Eddie James <eajames@linux.ibm.com>,
Heinrich Schuchardt <xypron.glpk@gmx.de>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Joe Hershberger <joe.hershberger@ni.com>,
Marc Kleine-Budde <mkl@pengutronix.de>,
Marek Vasut <marek.vasut+renesas@mailbox.org>,
Mattijs Korpershoek <mkorpershoek@baylibre.com>,
Ralph Siemsen <ralph.siemsen@linaro.org>,
Safae Ouajih <souajih@baylibre.com>,
Sean Anderson <sean.anderson@seco.com>,
Sean Anderson <seanga2@gmail.com>
Subject: Re: [PATCH 0/4] bootm: Handle compressed arm64 images with bootm
Date: Tue, 7 Nov 2023 08:49:46 -0500 [thread overview]
Message-ID: <20231107134946.GD6601@bill-the-cat> (raw)
In-Reply-To: <CAPnjgZ0jFTG-Rq0u5yaMjSxcxdQvr578W2P+nzFx0g0GbQHjNQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 5066 bytes --]
On Tue, Nov 07, 2023 at 06:31:15AM -0700, Simon Glass wrote:
> Hi Tom,
>
> On Tue, 7 Nov 2023 at 06:04, Tom Rini <trini@konsulko.com> wrote:
> >
> > On Tue, Nov 07, 2023 at 05:23:05AM -0700, Simon Glass wrote:
> > > Hi Rasmus,
> > >
> > > On Tue, 7 Nov 2023 at 02:56, Rasmus Villemoes
> > > <rasmus.villemoes@prevas.dk> wrote:
> > > >
> > > > On 05/11/2023 21.03, Simon Glass wrote:
> > > > > This little series corrects a problem I noticed with arm64 images,
> > > > > where the kernel is not recognised:
> > > >
> > > > The $subject is misleading, bootm works just fine with compressed arm64
> > > > images, with the type set to "kernel".
> > > >
> > > > > Type: Kernel Image (no loading done)
> > > > > Compression: gzip compressed
> > > >
> > > > Isn't that a non-sensical combination to begin with? Decompressing the
> > > > Image.gz kernel image to any location (however you determine that
> > > > destination) _is_ loading it.
> > >
> > > Yes, I agree.
> > >
> > > >
> > > > If you want XIP, obviously the image must be uncompressed in the FIT. I
> > > > don't understand what you're trying to do here.
> > >
> > > Hmmm, I think I have just got confused about all of this, perhaps
> > > because ChromeOS uses kernel_noload with compression. Is that an
> > > invalid combination?
> >
> > Yes, that sounds like an invalid combination.
> >
> > > But then how does loading actually work? We don't want to put the load
> > > address in the FIT, since we don't know what it is...we want to use
> > > the address provided by the board. Which is kernel_noload...so how
> > > should this be implemented?
> >
> > What do you mean, provided by the board? With kernel_noload we XIP the
> > payload, because the board provided (by loading us to) a safe place to
> > execute whatevers in there. In the olden days, that would mean (almost
> > certainly) the zImage which in turn was already compressed and
> > self-relocating. I know technically one could use the raw vmlinux
> > instead. With the Linux Kernel and ARCH=arm64 (and a few other arches
> > now too), they dropped the self-decompression part and the whole payload
> > must be decompressed. We handle this case in "booti" today by having to
> > have the board (via environment) say where to decompress to (and how
> > much space is available). Then we move it back to where we started from,
> > which is likely not necessary.
> >
> > Looking at
> > https://www.kernel.org/doc/html/latest/arch/arm64/booting.html and
> > https://www.kernel.org/doc/html/latest/riscv/boot-image-header.html
> > stating "we're just like arm64" we can do better than we do today for
> > this format of OS image. If aren't compressed, we only need to ensure
> > that we are correctly aligned and move (and tell the user) if not. We
> > can even put the 2MB check under some legacy kernel CONFIG option (3.17
> > is over 9 years old). With respect to automatic decompression, if we
> > don't have something telling us where a buffer is and we can't pull from
> > the environment, we should tell the user and stop?
>
> With the booti command, the kern_comp_addr_r and kern_comp_size vars
> are used. Perhaps I should update my patch to use those too?
As a fallback, perhaps? But what do we do today in a FIT to handle
compression = "gzip" to know where to uncompress things to?
> Do you understand what I am asking about, with bootm? It should be
> possible to ignore the load address. In fact, load addresses in FIT
> are mostly bad these days, IMO. If this is not kernel_noload, then
> what should we use?
Well, your use case needs to be valid. I don't think "kernel_noload" is
valid with anything other than 'compression = "none"' because that's our
just execute things in place option. It's very dangerous to use and I
do not recall right now if we fixed the case where it will just let the
device tree be badly aligned and break the kernel, or if we say "no
load, but still fix THAT alignment". And your use case isn't "ignore the
load address" it's "ignore the load address and decompress the
payload(s)". That needs _something_ to be known somehow. And I'm asking
how we do that today even, before saying we can or can't support
"kernel_noload" along with a compression of the payload.
> "provided by the board" means that the board knows the memory map, not
> the FIT, so only the board can provide the addresses to use for
> loading the kernel.
To be clearer, where does the board document that knowledge and provide
it to be used? I'm not a super fan of environment variables especially
since we aren't always consistent with '_' or just nothing between
"words" of the variable. We have much better documentation these days
(once again, thanks everyone) so we can document environment variables
used here, and also what CONFIG options are used (as
CONFIG_SYS_BOOTM_LEN is part of the equation here and badly named as
been said in other threads about issues wrt decomp and overlap).
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
next prev parent reply other threads:[~2023-11-07 13:49 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-05 20:03 [PATCH 0/4] bootm: Handle compressed arm64 images with bootm Simon Glass
2023-11-05 20:03 ` [PATCH 1/4] bootm: Allow ignoring the load address with kernel_noload Simon Glass
2023-11-05 21:19 ` Tom Rini
2023-11-06 17:25 ` Simon Glass
2023-11-06 18:30 ` Tom Rini
2023-11-06 19:58 ` Simon Glass
2023-11-06 20:15 ` Tom Rini
2023-11-07 1:09 ` Simon Glass
2023-11-05 20:03 ` [PATCH 2/4] bootm: Move arm64-image processing later Simon Glass
2023-11-05 21:20 ` Tom Rini
2023-11-06 17:25 ` Simon Glass
2023-11-05 20:03 ` [PATCH 3/4] image: Show the load address when decompressing Simon Glass
2023-11-05 20:03 ` [PATCH 4/4] image: Correct load_bug typo Simon Glass
2023-11-05 20:06 ` [PATCH 0/4] bootm: Handle compressed arm64 images with bootm Simon Glass
2023-11-07 9:56 ` Rasmus Villemoes
2023-11-07 12:23 ` Simon Glass
2023-11-07 13:04 ` Tom Rini
2023-11-07 13:31 ` Simon Glass
2023-11-07 13:49 ` Tom Rini [this message]
2023-11-07 14:30 ` Simon Glass
2023-11-07 19:04 ` Tom Rini
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=20231107134946.GD6601@bill-the-cat \
--to=trini@konsulko.com \
--cc=eajames@linux.ibm.com \
--cc=ilias.apalodimas@linaro.org \
--cc=joe.hershberger@ni.com \
--cc=marek.vasut+renesas@mailbox.org \
--cc=marex@denx.de \
--cc=mkl@pengutronix.de \
--cc=mkorpershoek@baylibre.com \
--cc=ralph.siemsen@linaro.org \
--cc=rasmus.villemoes@prevas.dk \
--cc=sean.anderson@seco.com \
--cc=seanga2@gmail.com \
--cc=sjg@chromium.org \
--cc=souajih@baylibre.com \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.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 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.