Sign ChromeOS boot images with magiskboot

Port the `futility vbutil_kernel --pack` code path used to sign
ChromeOS boot images into magiskboot as a new `sign-chromeos` action.
The kernel keyblock and data key are embedded into the executable, and
all signing parameters previously passed in sign_chromeos are
hardcoded. The output is bit-for-bit identical to the reference tool.

Rename the existing `sign` action to `sign-avb1` to disambiguate.

Remove the prebuilt futility binary and stop shipping the chromeos
assets folder; scripts now call magiskboot directly.

Assisted-by: Claude Opus 5.5
This commit is contained in:
topjohnwu
2026-10-06 22:59:48 +00:00
parent 3e9b09f5d5
commit da50b5586f
12 changed files with 224 additions and 39 deletions
+4 -3
View File
@@ -22,8 +22,6 @@
# magiskboot binary A tool to manipulate boot images.
# init-ld binary The library that will be LD_PRELOAD of /init
# stub.apk binary The stub Magisk app to embed into ramdisk.
# chromeos folder This folder includes the utility and keys to sign
# (optional) chromeos boot images. Only used for Pixel C.
#
#######################################################################################
@@ -258,7 +256,10 @@ ui_print "- Repacking boot image"
./magiskboot repack "$BOOTIMAGE" || abort "! Unable to repack boot image"
# Sign chromeos boot
$CHROMEOS && sign_chromeos
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"
-1
View File
@@ -12,7 +12,6 @@ umask 022
OUTFD=$2
COMMONDIR=$INSTALLER/assets
CHROMEDIR=$INSTALLER/assets/chromeos
if [ ! -f $COMMONDIR/util_functions.sh ]; then
echo "! Unable to extract zip file!"
+4 -3
View File
@@ -12,7 +12,6 @@ umask 022
OUTFD=$2
COMMONDIR=$INSTALLER/assets
CHROMEDIR=$INSTALLER/assets/chromeos
if [ ! -f $COMMONDIR/util_functions.sh ]; then
echo "! Unable to extract zip file!"
@@ -54,7 +53,6 @@ BINDIR=$INSTALLER/lib/$ABI
cd $BINDIR
for file in lib*.so; do mv "$file" "${file:3:${#file}-6}"; done
cd /
cp -af $CHROMEDIR/. $BINDIR/chromeos
chmod -R 755 $BINDIR
############
@@ -130,7 +128,10 @@ case $((STATUS & 3)) in
fi
./magiskboot repack $BOOTIMAGE
# Sign chromeos boot
$CHROMEOS && sign_chromeos
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
-12
View File
@@ -451,18 +451,6 @@ install_magisk() {
run_migrations
}
sign_chromeos() {
ui_print "- Signing ChromeOS boot image"
echo > empty
./chromeos/futility vbutil_kernel --pack new-boot.img.signed \
--keyblock ./chromeos/kernel.keyblock --signprivate ./chromeos/kernel_data_key.vbprivk \
--version 1 --vmlinuz new-boot.img --config empty --arch arm --bootloader empty --flags 0x1
rm -f empty new-boot.img
mv new-boot.img.signed new-boot.img
}
remove_system_su() {
[ -d /postinstall/tmp ] && POSTINST=/postinstall
cd $POSTINST/system