From: Lucas Stach <l.stach@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>, barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] bootm: add support for booting compressed images
Date: Wed, 26 May 2021 11:58:35 +0200 [thread overview]
Message-ID: <ce90316cb8908dcbebee9bcf510611d244841153.camel@pengutronix.de> (raw)
In-Reply-To: <8389275f-beb6-2b85-d031-3407b571109c@pengutronix.de>
Am Mittwoch, dem 26.05.2021 um 11:41 +0200 schrieb Ahmad Fatoum:
> On 26.05.21 11:39, Lucas Stach wrote:
> > Hi Ahmad,
> >
> > Am Mittwoch, dem 26.05.2021 um 11:17 +0200 schrieb Ahmad Fatoum:
> > > Hello Lucas,
> > >
> > > On 25.05.21 20:37, Lucas Stach wrote:
> > > > ARM64 does not have a self extracting image format, but relies on the image
> > > > being externally compressed with one of the standard compression algorithms.
> > > >
> > > > Add support for decompressing the bootm OS image. It is added in common
> > > > code as it may also be useful for other images/architectures.
> > > >
> > > > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > > > ---
> > > > common/bootm.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++
> > > > 1 file changed, 92 insertions(+)
> > > >
> > > > diff --git a/common/bootm.c b/common/bootm.c
> > > > index 092116beb94a..2bfb5cb01593 100644
> > > > --- a/common/bootm.c
> > > > +++ b/common/bootm.c
> > > > @@ -12,6 +12,7 @@
> > > > #include <environment.h>
> > > > #include <linux/stat.h>
> > > > #include <magicvar.h>
> > > > +#include <uncompress.h>
> > > >
> > > > static LIST_HEAD(handler_list);
> > > >
> > > > @@ -808,6 +809,85 @@ err_out:
> > > > return ret;
> > > > }
> > > >
> > > > +static int do_bootm_compressed(struct image_data *img_data)
> > > > +{
> > > > + struct bootm_data bootm_data = {
> > > > + .oftree_file = img_data->oftree_file,
> > > > + .initrd_file = img_data->initrd_file,
> > > > + .tee_file = img_data->tee_file,
> > > > + .verbose = img_data->verbose,
> > > > + .verify = img_data->verify,
> > > > + .force = img_data->force,
> > > > + .dryrun = img_data->dryrun,
> > > > + .initrd_address = img_data->initrd_address,
> > > > + .os_address = img_data->os_address,
> > >
> > > I am wondering whether it makes sense to directly extract
> > > to os_address to avoid the extra copy. Depending on the subsequent
> > > bootm handler, the image may still need to be relocated, but if
> > > we choose a generous alignment here, the copy later on could
> > > be avoided.
> >
> > For the common case where we let Barebox/the bootm image handler decide
> > where to put the OS image, we don't know this address yet when
> > decompressing the image here. I don't think it makes sense to optimize
> > the special case where the OS address is already known.
>
> I see. A debug print for higher verbosity levels, just before invoking
> bootm_boot would be nice, so it's easy to find out how long the
> extraction took.
Actually due to the way this is implemented as nested bootm you kind of
get this naturally. The output when booting a compressed image looks
like this:
blspec: booting someboard from somewhere
Loading LZO compressed 'somewhere/Image.lzo'
Loading ARM aarch64 Linux image '/tmp/bootm-compressed-6504dc00'
Loading devicetree from 'somewhere/someboard.dtb'
Regards,
Lucas
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-05-26 12:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-25 18:37 [PATCH 1/2] uncompress: use read_full to fill decompression buffer Lucas Stach
2021-05-25 18:37 ` [PATCH 2/2] bootm: add support for booting compressed images Lucas Stach
2021-05-26 5:42 ` Sascha Hauer
2021-05-26 9:17 ` Ahmad Fatoum
2021-05-26 9:39 ` Lucas Stach
2021-05-26 9:41 ` Ahmad Fatoum
2021-05-26 9:58 ` Lucas Stach [this message]
2021-05-26 10:04 ` Ahmad Fatoum
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=ce90316cb8908dcbebee9bcf510611d244841153.camel@pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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