Automatically re-sign ChromeOS images on repack

Instead of requiring scripts to detect ChromeOS images and sign them
after repacking, preallocate the vblock and append the kernel blob
trailer while repacking, then generate the vblock after all other
patching is done. The image is padded to its original size after
signing, same as other boot images.

The signer now only takes the kernel payload and returns the vblock,
hashing the kernel blob incrementally. The sign-chromeos action
streams its output to disk instead of building the whole signed
image in memory.

Since ChromeOS images no longer need special handling, unpack no
longer returns 2 for them, and all ChromeOS logic is removed from
the scripts.

Assisted-by: Claude Opus 5.5
This commit is contained in:
topjohnwu
2026-10-06 23:36:12 +00:00
parent da50b5586f
commit 43afdf16a8
7 changed files with 113 additions and 66 deletions
-11
View File
@@ -81,7 +81,6 @@ chmod -R 755 .
# Unpack
#########
CHROMEOS=false
VENDORBOOT=false
ui_print "- Unpacking boot image"
@@ -89,10 +88,6 @@ ui_print "- Unpacking boot image"
case $? in
0 ) ;;
2 )
ui_print "- ChromeOS boot image detected"
CHROMEOS=true
;;
3 )
ui_print "- Vendor boot image detected"
VENDORBOOT=true
@@ -255,12 +250,6 @@ fi
ui_print "- Repacking boot image"
./magiskboot repack "$BOOTIMAGE" || abort "! Unable to repack boot image"
# Sign chromeos boot
if $CHROMEOS; then
ui_print "- Signing ChromeOS boot image"
./magiskboot sign-chromeos new-boot.img || abort "! Unable to sign ChromeOS boot image"
fi
# Restore the original boot partition path
[ -e "$BOOTNAND" ] && BOOTIMAGE="$BOOTNAND"