public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 2/2] RISCV: image: Parse Image.gz support in booti.
Date: Tue, 30 Apr 2019 21:11:01 +0200	[thread overview]
Message-ID: <4db616d4-7b5c-9660-dbd0-b0e663da7e3d@gmail.com> (raw)
In-Reply-To: <e070ff83-afac-3b23-a393-ba6ac1c19319@wdc.com>

On 4/30/19 8:13 PM, Atish Patra wrote:
> On 4/30/19 2:52 AM, Marek Vasut wrote:
>> On 4/30/19 3:27 AM, Atish Patra wrote:
>>
>> [...]
>>
>>>>> Yes. FIT image parsing can be done in that way. However, the idea was
>>>>> here to load Image.gz directly. Image.gz is default compressed Linux
>>>>> kernel image format in RISC-V.
>>>>
>>>> Sigh, and the image header is compressed as well, so there's no way to
>>>> identify the image format, right ? And there's no decompressor, so the
>>>> dcompressing has to be done by bootloader, which would need some
>>>> sort of
>>>> very smart way of figuring out which exact compression method is used ?
>>>>
>>> Yes. Image.gz is always gunzip. So checking first two bytes is enough to
>>> confirm that it is a gz file.
>>
>> What happens once people start feeding it more exotic compression
>> methods, like LZ4 or LZO or LZMA for example ?
>>
> 
> booti command help will clearly state that it can only boot kernel from
> Image or Image.gz.
> 
> static char booti_help_text[] =
>      "[addr [initrd[:size]] [fdt]]\n"
> -    "    - boot arm64 Linux Image stored in memory\n"
> +    "    - boot arm64 Linux Image or riscv Linux Image/Image.gz stored
> in memory\n"

Obvious question -- does this Image.gz stuff apply to arm64 ?

> 
> (I will update the help text with Image.gz part)
> 
> Anything other than that, it will fail with following error.
> 
> "Bad Linux RISCV Image magic!"

Right, so we're implementing file(1)-lite here to detect the format.

>>> The tricky part is length of the compressed file. I took another look at
>>> the gunzip implementation in U-Boot. It looks like to me that compressed
>>> header length just to parse the header correctly. It doesn't actually
>>> use the "length" to decompress. In fact, it updates the length with
>>> uncompressed bytes after the decompression.
>>
>> That's possible.
>>
> 
> David suggested a better idea.
> 
> 1. User can supply kernel_size and we can store in environment variable.
> 2. If the size is empty or greater than CONFIG_SYS_BOOTM_LEN, booti
> fails with appropriate error message.

You can keep decompressing until you reach $bootm_len, sure .

> We will update the documents to add the additional step for Image.gz
> 
> I am fine with either approach. Any preference ?
> 
> Regards,
> Atish


-- 
Best regards,
Marek Vasut

  reply	other threads:[~2019-04-30 19:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-25 19:56 [U-Boot] [PATCH v2 1/2] RISCV: image: Add booti support Atish Patra
2019-04-25 19:56 ` [U-Boot] [PATCH v2 2/2] RISCV: image: Parse Image.gz support in booti Atish Patra
2019-04-26  1:43   ` Marek Vasut
2019-04-26 17:08     ` Atish Patra
2019-04-26 18:04       ` Marek Vasut
2019-04-30  1:27         ` Atish Patra
2019-04-30  9:52           ` Marek Vasut
2019-04-30 18:13             ` Atish Patra
2019-04-30 19:11               ` Marek Vasut [this message]
2019-04-30 20:38                 ` Atish Patra
2019-04-30 21:42                   ` Marek Vasut
2019-04-30 22:06                     ` Atish Patra
2019-05-01 10:34                       ` Marek Vasut
2019-05-01 18:22                         ` Atish Patra

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=4db616d4-7b5c-9660-dbd0-b0e663da7e3d@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=u-boot@lists.denx.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