[U-Boot] [PATCH v2 2/2] RISCV: image: Parse Image.gz support in booti.

Atish Patra atish.patra at wdc.com
Wed May 1 18:22:33 UTC 2019


On 5/1/19 3:34 AM, Marek Vasut wrote:
> On 5/1/19 12:06 AM, Atish Patra wrote:
>> On 4/30/19 2:42 PM, Marek Vasut wrote:
>>> On 4/30/19 10:38 PM, Atish Patra wrote:
>>>> On 4/30/19 12:11 PM, Marek Vasut wrote:
>>>>> 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 ?
>>>>>
>>>>
>>>> arm64 builds Image.gz but booti for arm64 doesn't use it. I guess
>>>> Image.gz can be used in FIT image for ARM64 but I am not sure which
>>>> platform actually uses it.
>>>>
>>>> This patch only enables support for RISC-V.
>>>
>>> Can't this be made generic ?
>>>
>>
>> I think so if I just move the gzip detection and decompression code to
>> cmd/booti.c.
>>
>> I will update the v3 patch with this.
> 
> Nice, thanks.
> 
> But since you're basically implementing file(1)-lite, I wonder whether
> there isn't similar code somewhere in u-boot already.
> 
I was hoping to find one as well. But I couldn't. I can add a generic gz 
detection function(same file(1)-lite approach) to a lib/gunzip.c

Regards,
Atish


More information about the U-Boot mailing list