[PATCH 2/2] scripts/make_fit: Add option to disable compression for DTBs

Chen-Yu Tsai wenst at chromium.org
Mon May 20 23:51:05 PDT 2024


Old bootloaders found on RK3399 and MT8173 based Chromebooks only
support compression for the kernel image in the FIT image, and not the
DTBs. While compression could be disabled, aforementioned bootloaders
also limit the kernel image size to 32 MiB, making compression necessary
for any practical setup.

Add an option to disable DTB compression to support this case.

Signed-off-by: Chen-Yu Tsai <wenst at chromium.org>
---
 scripts/Makefile.lib |  1 +
 scripts/make_fit.py  | 11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 9f06f6aaf7fc..84d9b0166cc0 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -522,6 +522,7 @@ quiet_cmd_fit = FIT     $@
       cmd_fit = $(MAKE_FIT) -o $@ --arch $(UIMAGE_ARCH) --os linux \
 		--name '$(UIMAGE_NAME)' \
 		$(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
+		$(if $(FIT_DISABLE_DTB_COMPRESSION),--no-dtb-compression) \
 		--compress $(FIT_COMPRESSION) -k $< @$(word 2,$^)
 
 # XZ
diff --git a/scripts/make_fit.py b/scripts/make_fit.py
index 263147df80a4..626cf3422079 100755
--- a/scripts/make_fit.py
+++ b/scripts/make_fit.py
@@ -22,6 +22,10 @@ the entire FIT.
 Use -c to compress the data, using bzip2, gzip, lz4, lzma, lzo and
 zstd algorithms.
 
+Use -C to disable compression for DTBs regardless of the setting of '-c'.
+This is intended for old bootloaders that support compression of the
+kernel image but not the devicetree blobs.
+
 The resulting FIT can be booted by bootloaders which support FIT, such
 as U-Boot, Linuxboot, Tianocore, etc.
 
@@ -64,6 +68,8 @@ def parse_args():
           help='Specifies the architecture')
     parser.add_argument('-c', '--compress', type=str, default='none',
           help='Specifies the compression')
+    parser.add_argument('-C', '--no-dtb-compression', action='store_true',
+                        help='Disables compression for included DTBs')
     parser.add_argument('-E', '--external', action='store_true',
           help='Convert the FIT to use external data')
     parser.add_argument('-n', '--name', type=str, required=True,
@@ -247,7 +253,10 @@ def build_fit(args):
         if os.path.splitext(fname)[1] == '.dtb':
             seq += 1
             size += os.path.getsize(fname)
-            model, compat = output_dtb(fsw, seq, fname, args.arch, args.compress)
+            compress = args.compress
+            if args.no_dtb_compression:
+                compress = 'none'
+            model, compat = output_dtb(fsw, seq, fname, args.arch, compress)
             entries.append([model, compat])
 
     finish_fit(fsw, entries)
-- 
2.45.0.215.g3402c0e53f-goog




More information about the linux-arm-kernel mailing list