Skip to contentSkip to conversation

scripts: make_fit: propagate compressor failures

PATCH In review Hamdy Abou El Anein 2 participants 2 messages Nov 3 – Nov 5 arm64 fit support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts: make_fit: propagate compressor failures

From: Hamdy Abou El Anein <[email protected]>

compress_data() ignores the compressor exit status and marks the operation successful even if the tool wrote only partial output. build_fit() can then place that truncated data into a FIT image.

Use check_call() so compressor failures abort image generation. FileNotFoundError still allows trying the next supported executable.

Tested a compressor that writes partial output and exits with status 23: compression raises CalledProcessError and the CLI creates no FIT. Also generated uncompressed and gzip FIT images with a real DTB and ramdisk, and verified their payloads through libfdt and gzip.

AI assistance: ChatGPT/Codex identified the issue and prepared the change, commit message and executable regression tests.

Fixes 7a23b027ec17 ("arm64: boot: Support Flat Image Tree")
---
 scripts/make_fit.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/make_fit.py +1 -1
index 9bd35aa7211..1a63364388c 100755
@@ -214,7 +214,7 @@ def compress_data(inf, compress):
                     if tool in ('zstd', 'xz'):
                         cmd.extend(['-T0'])  # Use all available cores
                     cmd.append('-c')
-                    subprocess.call(cmd, stdin=inf, stdout=outf)
+                    subprocess.check_call(cmd, stdin=inf, stdout=outf)
                     done = True
                     break
                 except FileNotFoundError:
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Hamdy Abou El Anein

scripts: make_fit: propagate compressor failures

compress_data() ignores the compressor exit status and marks the operation successful even if the tool wrote only partial output. build_fit() can then place that truncated data into a FIT image.

Use check_call() so compressor failures abort image generation. FileNotFoundError still allows trying the next supported executable.

Tested a compressor that writes partial output and exits with status 23: compression raises CalledProcessError and the CLI creates no FIT. Also generated uncompressed and gzip FIT images with a real DTB and ramdisk, and verified their payloads through libfdt and gzip.

Quoted 8 lines

AI assistance: ChatGPT/Codex identified the issue and prepared the change, commit message and executable regression tests.

Fixes 7a23b027ec17 ("arm64: boot: Support Flat Image Tree")
 scripts/make_fit.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)