Re: [PATCH v2 0/4] support for booting the compressed U-boot binary on Rockchip based ARM64 SOC's

2023-08-27 Thread Manoj Sai
On Thu, Jul 27, 2023 at 4:51 PM Jonas Karlman  wrote:
>
> On 2023-07-25 05:50, Manoj Sai wrote:
> > This patchset adds the support on Rockchip based ARM64 SOC's that  compress 
> > the U-BOOT proper along with dtb
> > and ATF in FIT image format.Second stage bootloader(SPL) loads the 
> > compressed binaries, uncompress
> > them and  handover control to the next stage.
> >
> > Changes for V2 :-
> >
> > - Removed the need to create gzip and lzma compressed U-boot-nodtb files 
> > using Makefile  and added a changeset
> > that "compress" field to u-boot-nodtb node and "compression" field to  
> > u-boot Node in the FIT image, with the help
> > of this change binman will create the compressed Binaries.
> >
> > Size Comparision between compressed and uncompressed binaries :-
> >
> >   size of uncompressed binary :- 9.4 MB (94,26,432 bytes)
> >  manoj:u-boot$ ls -lb u-boot-rockchip.bin
> > -rw-rw-r-- 1 manoj manoj 9426432 Jul 25 07:42 u-boot-rockchip.bin
> >
> >size of GZIP compressed binary :- 9.0 MB (89,85,088 bytes)
> >  manoj:u-boot$ ls -lb u-boot-rockchip.bin
> >  -rw-rw-r-- 1 manoj manoj 8985088 Jul 25 07:42 u-boot-rockchip.bin
> >
> >size of LZMA compressed binary :- 9.0 MB (90,06,080 bytes)
> >  manoj:u-boot$ ls -lb u-boot-rockchip.bin
> >  -rw-rw-r-- 1 manoj manoj 9006080 Jul 25 07:47 u-boot-rockchip.bin
> >
> > - modified to use the CONFIG_SYS_LOAD_ADDR as the source RAM address to 
> > store the  compressed U-Boot binary which
> > will be defined in the machine defconfig file in place of creating a new 
> > RAM address for a specific board using Kconfig.
> > so patchset related to adding a new RAM address to store compressed binary 
> > has been removed in V2 patchset.
> >
> > - Removed the patchset related to adding  the u-boot-nodtb.bin.gz and 
> > u-boot-nodtb.bin.lzma as input binary to binman.
> >
> >
> > -- Test results of  Booting time using bootstage command in Uboot command 
> > prompt on roc-rk3399-pc board :-
> >
> > 1) Uncompressed U-BOOT : Total boot time ≈ 12.3 seconds
> > => bootstage  report
> > Timer summary in microseconds (10 records):
> >MarkElapsed  Stage
> >   0  0  reset
> >   1,824,330  1,824,330  board_init_f
> >   2,921,678  1,097,348  board_init_r
> >   5,179,369  2,257,691  eth_common_init
> >   5,478,307298,938  eth_initialize
> >   5,478,484177  main_loop
> >   5,478,641157  usb_start
> >  12,017,936  6,539,295  cli_loop
> >
> > Accumulated time:
> > 15,899  dm_r
> >694,371  dm_f
> >
> > 2) GZIP Compressed U-BOOT : Total boot time ≈ 13.5 seconds
> > =>  bootstage  report
> > Timer summary in microseconds (10 records):
> >MarkElapsed  Stage
> >   0  0  reset
> >   2,591,355  2,591,355  board_init_f
> >   3,689,407  1,098,052  board_init_r
> >   5,947,314  2,257,907  eth_common_init
> >   6,246,250298,936  eth_initialize
> >   6,246,427177  main_loop
> >   6,246,585158  usb_start
> >  12,785,936  6,539,351  cli_loop
> >
> > Accumulated time:
> > 15,902  dm_r
> >694,779  dm_f
> >
> > 2) LZMA Compressed U-BOOT : Total boot time ≈ 23.5 seconds
> > => bootstage report
> > Timer summary in microseconds (10 records):
> >MarkElapsed  Stage
> >   0  0  reset
> >   6,376,405  6,376,405  board_init_f
> >   7,471,967  1,095,562  board_init_r
> >   9,726,257  2,254,290  eth_common_init
> >  10,024,873298,616  eth_initialize
> >  10,025,049176  main_loop
> >  10,025,208159  usb_start
> >  16,564,906  6,539,698  cli_loop
> >
> > Accumulated time:
> > 15,851  dm_r
> >693,323  dm_f
> >
> >
> > Patch 1/4  generate a GZIP-compressed U-boot binary using binman if 
> > CONFIG_SPL_GZIP selected
> > Patch 2/4  generate a LZMA-compressed U-boot binary using binman if 
> > CONFIG_SPL_LZMA selected
> > Patch 3/4  uncompress the gzip U-BOOT binary and load the binaries if gzip 
> > compression supoort is enabled
> > Patch 4/4  uncompress the lzma U-BOOT binary and load the binaries if lzma 
> > compression supoort is enabled
>
> Boot times seem very slow with compression enabled, please try with
> caches enabled, see RFC patch at [1]. Enable caches have a huge impact
> for FIT checksum validation using CONFIG_SPL_FIT_SIGNATURE=y.
>
> Possible to also include ZSTD support?
>

Hi Jonas ,
Enabled zstd support , facing build issues related to zstd . Had you
faced this build error , pasted below :

aarch64-linux-gnu-ld.bfd: lib/zstd/decompress/zstd_decompress.o: in
function `ZSTD_DDictHashSet_getIndex':
/media/manoj/7d4c36e9-ddbb-4e7a-bd1e-cb96766bde37/ssd-Workspace/libreCompTask/tasks/compression-Task/mainline-apply-Uboot-cmp-2023/testfldr/u-boot/lib/zstd/decompress/zstd_decompress.c:88:
undefined reference to `xxh64'
aarch64-linux-gnu-ld.bfd: lib/zstd/decompress/zstd_decompress.o: in
function `ZSTD_

Re: [PATCH v2 0/4] support for booting the compressed U-boot binary on Rockchip based ARM64 SOC's

2023-07-27 Thread Jonas Karlman
On 2023-07-25 05:50, Manoj Sai wrote:
> This patchset adds the support on Rockchip based ARM64 SOC's that  compress 
> the U-BOOT proper along with dtb 
> and ATF in FIT image format.Second stage bootloader(SPL) loads the compressed 
> binaries, uncompress 
> them and  handover control to the next stage.
> 
> Changes for V2 :-
> 
> - Removed the need to create gzip and lzma compressed U-boot-nodtb files 
> using Makefile  and added a changeset 
> that "compress" field to u-boot-nodtb node and "compression" field to  u-boot 
> Node in the FIT image, with the help 
> of this change binman will create the compressed Binaries.
>   
> Size Comparision between compressed and uncompressed binaries :-
>   
>   size of uncompressed binary :- 9.4 MB (94,26,432 bytes)
>  manoj:u-boot$ ls -lb u-boot-rockchip.bin 
> -rw-rw-r-- 1 manoj manoj 9426432 Jul 25 07:42 u-boot-rockchip.bin
> 
>size of GZIP compressed binary :- 9.0 MB (89,85,088 bytes)
>  manoj:u-boot$ ls -lb u-boot-rockchip.bin 
>  -rw-rw-r-- 1 manoj manoj 8985088 Jul 25 07:42 u-boot-rockchip.bin
> 
>size of LZMA compressed binary :- 9.0 MB (90,06,080 bytes)
>  manoj:u-boot$ ls -lb u-boot-rockchip.bin 
>  -rw-rw-r-- 1 manoj manoj 9006080 Jul 25 07:47 u-boot-rockchip.bin 
> 
> - modified to use the CONFIG_SYS_LOAD_ADDR as the source RAM address to store 
> the  compressed U-Boot binary which 
> will be defined in the machine defconfig file in place of creating a new RAM 
> address for a specific board using Kconfig.
> so patchset related to adding a new RAM address to store compressed binary 
> has been removed in V2 patchset. 
> 
> - Removed the patchset related to adding  the u-boot-nodtb.bin.gz and 
> u-boot-nodtb.bin.lzma as input binary to binman.
> 
> 
> -- Test results of  Booting time using bootstage command in Uboot command 
> prompt on roc-rk3399-pc board :-
> 
> 1) Uncompressed U-BOOT : Total boot time ≈ 12.3 seconds 
> => bootstage  report
> Timer summary in microseconds (10 records):
>MarkElapsed  Stage
>   0  0  reset
>   1,824,330  1,824,330  board_init_f
>   2,921,678  1,097,348  board_init_r
>   5,179,369  2,257,691  eth_common_init
>   5,478,307298,938  eth_initialize
>   5,478,484177  main_loop
>   5,478,641157  usb_start
>  12,017,936  6,539,295  cli_loop
> 
> Accumulated time:
> 15,899  dm_r
>694,371  dm_f
> 
> 2) GZIP Compressed U-BOOT : Total boot time ≈ 13.5 seconds 
> =>  bootstage  report
> Timer summary in microseconds (10 records):
>MarkElapsed  Stage
>   0  0  reset
>   2,591,355  2,591,355  board_init_f
>   3,689,407  1,098,052  board_init_r
>   5,947,314  2,257,907  eth_common_init
>   6,246,250298,936  eth_initialize
>   6,246,427177  main_loop
>   6,246,585158  usb_start
>  12,785,936  6,539,351  cli_loop
> 
> Accumulated time:
> 15,902  dm_r
>694,779  dm_f
> 
> 2) LZMA Compressed U-BOOT : Total boot time ≈ 23.5 seconds
> => bootstage report
> Timer summary in microseconds (10 records):
>MarkElapsed  Stage
>   0  0  reset
>   6,376,405  6,376,405  board_init_f
>   7,471,967  1,095,562  board_init_r
>   9,726,257  2,254,290  eth_common_init
>  10,024,873298,616  eth_initialize
>  10,025,049176  main_loop
>  10,025,208159  usb_start
>  16,564,906  6,539,698  cli_loop
>  
> Accumulated time:
> 15,851  dm_r
>693,323  dm_f
> 
> 
> Patch 1/4  generate a GZIP-compressed U-boot binary using binman if 
> CONFIG_SPL_GZIP selected
> Patch 2/4  generate a LZMA-compressed U-boot binary using binman if 
> CONFIG_SPL_LZMA selected 
> Patch 3/4  uncompress the gzip U-BOOT binary and load the binaries if gzip 
> compression supoort is enabled
> Patch 4/4  uncompress the lzma U-BOOT binary and load the binaries if lzma 
> compression supoort is enabled

Boot times seem very slow with compression enabled, please try with
caches enabled, see RFC patch at [1]. Enable caches have a huge impact
for FIT checksum validation using CONFIG_SPL_FIT_SIGNATURE=y.

Possible to also include ZSTD support?

nit: patch 1 and 2 should come after patch 3 and 4.

[1] 
https://patchwork.ozlabs.org/project/uboot/patch/20230702110055.3686457-1-jo...@kwiboo.se/

Regards,
Jonas

> 
> Manoj Sai (4):
>   rockchip: Add support to generate GZIP compressed U-boot binary
>   rockchip: Add support to generate LZMA compressed U-boot binary
>   spl: fit: support for booting a GZIP-compressed U-boot binary
>   spl: fit: support for booting a LZMA-compressed U-boot binary
> 
>  arch/arm/dts/rockchip-u-boot.dtsi | 11 +++
>  common/spl/spl_fit.c  | 21 +
>  include/spl.h | 10 ++
>  3 files changed, 38 insertions(+), 4 deletions(-)
> 



[PATCH v2 0/4] support for booting the compressed U-boot binary on Rockchip based ARM64 SOC's

2023-07-25 Thread Manoj Sai
This patchset adds the support on Rockchip based ARM64 SOC's that  compress the 
U-BOOT proper along with dtb 
and ATF in FIT image format.Second stage bootloader(SPL) loads the compressed 
binaries, uncompress 
them and  handover control to the next stage.

Changes for V2 :-

- Removed the need to create gzip and lzma compressed U-boot-nodtb files using 
Makefile  and added a changeset 
that "compress" field to u-boot-nodtb node and "compression" field to  u-boot 
Node in the FIT image, with the help 
of this change binman will create the compressed Binaries.
  
Size Comparision between compressed and uncompressed binaries :-
  
size of uncompressed binary :- 9.4??MB (94,26,432 bytes)
 manoj:u-boot$ ls -lb u-boot-rockchip.bin 
-rw-rw-r-- 1 manoj manoj 9426432 Jul 25 07:42 u-boot-rockchip.bin

   size of GZIP compressed binary :- 9.0??MB (89,85,088 bytes)
 manoj:u-boot$ ls -lb u-boot-rockchip.bin 
 -rw-rw-r-- 1 manoj manoj 8985088 Jul 25 07:42 u-boot-rockchip.bin

   size of LZMA compressed binary :- 9.0??MB (90,06,080 bytes)
 manoj:u-boot$ ls -lb u-boot-rockchip.bin 
 -rw-rw-r-- 1 manoj manoj 9006080 Jul 25 07:47 u-boot-rockchip.bin 

- modified to use the CONFIG_SYS_LOAD_ADDR as the source RAM address to store 
the  compressed U-Boot binary which 
will be defined in the machine defconfig file in place of creating a new RAM 
address for a specific board using Kconfig.
so patchset related to adding a new RAM address to store compressed binary has 
been removed in V2 patchset. 

- Removed the patchset related to adding  the u-boot-nodtb.bin.gz and 
u-boot-nodtb.bin.lzma as input binary to binman.


-- Test results of  Booting time using bootstage command in Uboot command 
prompt on roc-rk3399-pc board :-

1) Uncompressed U-BOOT : Total boot time ??? 12.3 seconds 
=> bootstage  report
Timer summary in microseconds (10 records):
   MarkElapsed  Stage
  0  0  reset
  1,824,330  1,824,330  board_init_f
  2,921,678  1,097,348  board_init_r
  5,179,369  2,257,691  eth_common_init
  5,478,307298,938  eth_initialize
  5,478,484177  main_loop
  5,478,641157  usb_start
 12,017,936  6,539,295  cli_loop

Accumulated time:
15,899  dm_r
   694,371  dm_f

2) GZIP Compressed U-BOOT : Total boot time ??? 13.5 seconds 
=>  bootstage  report
Timer summary in microseconds (10 records):
   MarkElapsed  Stage
  0  0  reset
  2,591,355  2,591,355  board_init_f
  3,689,407  1,098,052  board_init_r
  5,947,314  2,257,907  eth_common_init
  6,246,250298,936  eth_initialize
  6,246,427177  main_loop
  6,246,585158  usb_start
 12,785,936  6,539,351  cli_loop

Accumulated time:
15,902  dm_r
   694,779  dm_f

2) LZMA Compressed U-BOOT : Total boot time ??? 23.5 seconds
=> bootstage report
Timer summary in microseconds (10 records):
   MarkElapsed  Stage
  0  0  reset
  6,376,405  6,376,405  board_init_f
  7,471,967  1,095,562  board_init_r
  9,726,257  2,254,290  eth_common_init
 10,024,873298,616  eth_initialize
 10,025,049176  main_loop
 10,025,208159  usb_start
 16,564,906  6,539,698  cli_loop
 
Accumulated time:
15,851  dm_r
   693,323  dm_f


Patch 1/4  generate a GZIP-compressed U-boot binary using binman if 
CONFIG_SPL_GZIP selected
Patch 2/4  generate a LZMA-compressed U-boot binary using binman if 
CONFIG_SPL_LZMA selected 
Patch 3/4  uncompress the gzip U-BOOT binary and load the binaries if gzip 
compression supoort is enabled
Patch 4/4  uncompress the lzma U-BOOT binary and load the binaries if lzma 
compression supoort is enabled

Manoj Sai (4):
  rockchip: Add support to generate GZIP compressed U-boot binary
  rockchip: Add support to generate LZMA compressed U-boot binary
  spl: fit: support for booting a GZIP-compressed U-boot binary
  spl: fit: support for booting a LZMA-compressed U-boot binary

 arch/arm/dts/rockchip-u-boot.dtsi | 11 +++
 common/spl/spl_fit.c  | 21 +
 include/spl.h | 10 ++
 3 files changed, 38 insertions(+), 4 deletions(-)

-- 
2.25.1