mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-04 19:10:47 -05:00
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:
@@ -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"
|
||||
|
||||
|
||||
@@ -61,8 +61,6 @@ chmod -R 755 $BINDIR
|
||||
|
||||
cd $BINDIR
|
||||
|
||||
CHROMEOS=false
|
||||
|
||||
ui_print "- Unpacking boot image"
|
||||
# Dump image for MTD/NAND character device boot partitions
|
||||
if [ -c $BOOTIMAGE ]; then
|
||||
@@ -76,10 +74,6 @@ case $? in
|
||||
1 )
|
||||
abort "! Unsupported/Unknown image format"
|
||||
;;
|
||||
2 )
|
||||
ui_print "- ChromeOS boot image detected"
|
||||
CHROMEOS=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# Restore the original boot partition path
|
||||
@@ -127,11 +121,6 @@ case $((STATUS & 3)) in
|
||||
rm -f ramdisk.cpio
|
||||
fi
|
||||
./magiskboot repack $BOOTIMAGE
|
||||
# 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
|
||||
ui_print "- Flashing restored boot image"
|
||||
flash_image new-boot.img $BOOTIMAGE || abort "! Insufficient partition size"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user