mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Lucas Stach <l.stach@pengutronix.de>, barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] bootm: add support for booting compressed images
Date: Wed, 26 May 2021 12:04:46 +0200	[thread overview]
Message-ID: <d9eed1a8-98aa-52e0-7390-291fa9558354@pengutronix.de> (raw)
In-Reply-To: <ce90316cb8908dcbebee9bcf510611d244841153.camel@pengutronix.de>



On 26.05.21 11:58, Lucas Stach wrote:
> 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'

Great! :-)

> 
> Regards,
> Lucas
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
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:[~2021-05-26 12:19 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
2021-05-26 10:04           ` Ahmad Fatoum [this message]

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=d9eed1a8-98aa-52e0-7390-291fa9558354@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=l.stach@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