[U-Boot] Brotli Compression to Fit Image/bzImage

Hello,
I am working on an embedded project using Minnowboard Max with U-boot and customised Linux kernel.
To optimize boot time, currently I am comparing the different comparison algorithms and have read about Brotli compression, which seems to be good. So I have planned to test and see how good is Brotli compression for my use case? The current Linux kernel and U-boot doesn't support this compression, so I have to add this compression algorithm code.
I am seeing two ways of doing this,
1. In U-Boot
Fit Image creation from vmlinux. Adding Brotli compression to mkimage tool and decompressor to U-Boot. Here we are using mkimage tool to create the image.fit. I can do some changes in mkimage and add the decompressor to the U-boot code
2. In Linux Kernel
bzImage --> adding the Brotli compression and decompression to Linux Kernel
and change the default compression from gzip to brotli in the Linux kernel Configuration.
I don't know which way is comparably easier to implement, any suggestions on these topic will be of great help. Have any body tried this algorithm for the Linux Kernel??
Mit Freundlichen Grüßen VinothKumar +49 1798909072

Hi,
On 1 July 2016 at 00:13, vinoth eswaran evinoth1206@gmail.com wrote:
Hello,
I am working on an embedded project using Minnowboard Max with U-boot and customised Linux kernel.
To optimize boot time, currently I am comparing the different comparison algorithms and have read about Brotli compression, which seems to be good. So I have planned to test and see how good is Brotli compression for my use case? The current Linux kernel and U-boot doesn't support this compression, so I have to add this compression algorithm code.
I am seeing two ways of doing this,
- In U-Boot
Fit Image creation from vmlinux. Adding Brotli compression to mkimage tool and decompressor to U-Boot. Here we are using mkimage tool to create the image.fit. I can do some changes in mkimage and add the decompressor to the U-boot code
- In Linux Kernel
bzImage --> adding the Brotli compression and decompression to Linux Kernel
and change the default compression from gzip to brotli in the Linux kernel Configuration.
I don't know which way is comparably easier to implement, any suggestions on these topic will be of great help. Have any body tried this algorithm for the Linux Kernel??
I suggest going with option 1. U-Boot supports several algorithms so another one is pretty easy to add. The last one was IH_COMP_LZ4, so you can search for that in the code. The commit was:
027b728d Add support for LZ4 decompression algorithm
Regards, Simon

On Fri, Jul 1, 2016 at 6:40 PM, Simon Glass sjg@chromium.org wrote:
Hi,
On 1 July 2016 at 00:13, vinoth eswaran evinoth1206@gmail.com wrote:
Hello,
I am working on an embedded project using Minnowboard Max with U-boot and customised Linux kernel.
To optimize boot time, currently I am comparing the different comparison algorithms and have read about Brotli compression, which seems to be good. So I have planned to test and see how good is Brotli compression for my use case? The current Linux kernel and U-boot doesn't support this compression, so I have to add this compression algorithm code.
I am seeing two ways of doing this,
- In U-Boot
Fit Image creation from vmlinux. Adding Brotli compression to mkimage tool and decompressor to U-Boot. Here we are using mkimage tool to create the image.fit. I can do some changes in mkimage and add the decompressor to the U-boot code
- In Linux Kernel
bzImage --> adding the Brotli compression and decompression to Linux
Kernel
and change the default compression from gzip to brotli in the Linux kernel Configuration.
I don't know which way is comparably easier to implement, any suggestions on these topic will be of great help. Have any body tried this algorithm for the Linux Kernel??
I suggest going with option 1. U-Boot supports several algorithms so another one is pretty easy to add. The last one was IH_COMP_LZ4, so you can search for that in the code. The commit was:
027b728d Add support for LZ4 decompression algorithm
Thanks for your suggestion and I am currently working on checking the Brotlli compression/decompression algorithm with Fit image.
During decompression I am facing some issue with respect to memory allocation,
The Brotli decompression algorithm (dec.c) fails because it is not able to allocate(around 4MB) for its ring buffer -BrotliAllocateRingBuffer() Ring memory size:4194304 memory required :4194346
Not sure why this memory is not available in RAM , as currently we have only compressed image located at 0x02000000 with size of around 4.2MB and trying to extract the image to the location 0x01000000. The Minnow board turbot RAM size is 2 GB and not sure why this happening?? Is there any configuration where I can increase the heap size ??
I tried to allocate some memory by calling malloc with different sizes (1MB, 2MB, 3MB etc.,) and I am seeing that allocation greater than 1 MB returns NULL. I think we have enough memory in RAM , might be the heap size is less. Where can I check the heap configuration in U-Boot??
Thanks & Regards, Vinothkumar
Regards, Simon

Dear Vinoth,
In message CAJst-kE0op5JPYLfVoYURpXyfEAM_yrNa2Ny2tj1Dz4DvTHNgw@mail.gmail.com you wrote:
Where can I check the heap configuration in U-Boot??
The REAME says:
- CONFIG_SYS_MALLOC_LEN: Size of DRAM reserved for malloc() use.
Best regards,
Wolfgang Denk
participants (3)
-
Simon Glass
-
vinoth eswaran
-
Wolfgang Denk