From a9383dfa79744f76c7626840165aa80f4e07e004 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Wed, 30 Nov 2022 17:02:59 +0100 Subject: [PATCH] run/image/uboot: use gzip --fast by default By making the use of gzip's '--best' option configurable and disabling it by default, this patch noticably reduces the built-test cycle from 15 to 10 seconds when integrating the Sculpt system image for the PinePhone. Fixes #4693 --- tool/run/image/uboot | 21 ++++++++++++++++++++- tool/run/image/uboot_fit | 15 ++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/tool/run/image/uboot b/tool/run/image/uboot index 5cf5f1ed44..d17e21fa40 100644 --- a/tool/run/image/uboot +++ b/tool/run/image/uboot @@ -11,12 +11,31 @@ proc image_uboot_use_no_gzip { } { return [get_cmd_switch --image-uboot-no-gzip] } +## +# Make gzip compression more aggressive +# +# Using this option reduces the image size by circa 10%. But it comes at the +# cost of significantly slowing down the gzip step for large images (e.g., 6 +# seconds instead of 2 seconds for a image of 13 MiB). The option is suitable +# when building a release. But for quick build-test cycles, it is best keep +# it disabled. +# +proc image_uboot_gzip_opt { } { + if {[get_cmd_switch --image-uboot-gzip-best]} { + return "--best" + } else { + return "--fast" + } +} + + ## # Build U-boot bootloader specific uImage # # \param elf_img ELF binary to build uImage from # proc run_image {elf_img} { + # parse ELF entrypoint and load address set entrypoint [exec [cross_dev_prefix]readelf -h $elf_img | \ grep "Entry point address: " | \ @@ -34,7 +53,7 @@ proc run_image {elf_img} { # compress ELF if $use_gzip { - exec gzip --best --force $bin_img + exec gzip [image_uboot_gzip_opt] --force $bin_img set bin_ext .gz set compress_type gzip } diff --git a/tool/run/image/uboot_fit b/tool/run/image/uboot_fit index 801777a24f..51309cdc6c 100644 --- a/tool/run/image/uboot_fit +++ b/tool/run/image/uboot_fit @@ -10,6 +10,19 @@ # proc image_uboot_use_no_gzip { } { return [get_cmd_switch --image-uboot-no-gzip] } +## +# Make gzip compression more aggressive +# +# Please refer to the comment in run/image/uboot. +# +proc image_uboot_gzip_opt { } { + if {[get_cmd_switch --image-uboot-gzip-best]} { + return "--best" + } else { + return "--fast" + } +} + ## # Build U-boot bootloader specific image.itb @@ -34,7 +47,7 @@ proc run_image {elf_img} { # compress ELF if $use_gzip { - exec gzip --best --force $bin_img + exec gzip [image_uboot_gzip_opt] --force $bin_img set bin_ext .gz set compress_type gzip }