Re: [PATCH 2/2] bootm: add support for booting compressed images

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
> > > > ---
> > > >  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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux