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

Message ID 20230725035101.281325-1-abbaraju.manojsai@amarulasolutions.com
Headers show
Series
  • support for booting the compressed U-boot binary on Rockchip based ARM64 SOC's
Related show

Message

Manoj Sai July 25, 2023, 3:50 a.m. UTC
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):
       Mark    Elapsed  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,307    298,938  eth_initialize
  5,478,484        177  main_loop
  5,478,641        157  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):
       Mark    Elapsed  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,250    298,936  eth_initialize
  6,246,427        177  main_loop
  6,246,585        158  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):
       Mark    Elapsed  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,873    298,616  eth_initialize
 10,025,049        176  main_loop
 10,025,208        159  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(-)

Comments

Jonas Karlman July 27, 2023, 11:21 a.m. UTC | #1
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):
>        Mark    Elapsed  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,307    298,938  eth_initialize
>   5,478,484        177  main_loop
>   5,478,641        157  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):
>        Mark    Elapsed  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,250    298,936  eth_initialize
>   6,246,427        177  main_loop
>   6,246,585        158  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):
>        Mark    Elapsed  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,873    298,616  eth_initialize
>  10,025,049        176  main_loop
>  10,025,208        159  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-jonas@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(-)
>
Manoj Sai Aug. 28, 2023, 4:44 a.m. UTC | #2
On Thu, Jul 27, 2023 at 4:51 PM Jonas Karlman <jonas@kwiboo.se> 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):
> >        Mark    Elapsed  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,307    298,938  eth_initialize
> >   5,478,484        177  main_loop
> >   5,478,641        157  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):
> >        Mark    Elapsed  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,250    298,936  eth_initialize
> >   6,246,427        177  main_loop
> >   6,246,585        158  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):
> >        Mark    Elapsed  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,873    298,616  eth_initialize
> >  10,025,049        176  main_loop
> >  10,025,208        159  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_decodeFrameHeader':
/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:666:
undefined reference to `xxh64_reset'
aarch64-linux-gnu-ld.bfd: lib/zstd/decompress/zstd_decompress.o: in
function `ZSTD_decompressFrame':
/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:888:
undefined reference to `xxh64_update'
aarch64-linux-gnu-ld.bfd:
/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:904:
undefined reference to `xxh64_digest'
make[1]: *** [scripts/Makefile.spl:527: spl/u-boot-spl] Error 1
make: *** [Makefile:2059: spl/u-boot-spl] Error 2

I'm missing anything to enable in configs ? any suggestions to these build error

Thanks and Regards ,
A.manojsai

> nit: patch 1 and 2 should come after patch 3 and 4.
>
> [1] https://patchwork.ozlabs.org/project/uboot/patch/20230702110055.3686457-1-jonas@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(-)
> >
>