From 020ca6fddb27e86809a33bbcf88cf11737d11375 Mon Sep 17 00:00:00 2001 From: osm0sis Date: Fri, 11 Nov 2022 22:01:07 -0400 Subject: [PATCH] AK3: add support for simple init_boot + vendor_kernel_boot setup - starting with Pixel 7 series, boot_img_hdr_v4 is now even more complicated, adding 2 more new partitions (init_boot and vendor_kernel_boot) so let's attempt to keep it as simple as we can - if init_boot partition is detected split up flash files for boot (kernel), init_boot (ramdisk), and vendor_kernel_boot (dtb) - continue to support current practice of Image* and dtb in zip root by automatically creating a multi-partition AK3 zip setup from these files (ramdisk directory is for the init_boot partition since that's where Magisk and overlay.d will be) NOTE 1: anykernel.sh must still be setup for multi-parition patching - see the updated Example file for parts to uncomment NOTE 2: currently magiskboot still does not support unpack/repack of VNDRBOOT v4 multi-ramdisk format (i.e. vendor_boot v4 and vendor_kernel_boot) so if modifications are necessary in these ramdisks they will need to be prebuilt and flashed whole by including vendor_boot.img and/or vendor_kernel_boot.img in the zip root --- META-INF/com/google/android/updater-script | 2 +- tools/ak3-core.sh | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/META-INF/com/google/android/updater-script b/META-INF/com/google/android/updater-script index 19c310e..b267231 100644 --- a/META-INF/com/google/android/updater-script +++ b/META-INF/com/google/android/updater-script @@ -3,4 +3,4 @@ # Dummy file; update-binary is a shell script (DO NOT CHANGE) # # -# AK_BASE_VERSION=20221019 +# AK_BASE_VERSION=20221111 diff --git a/tools/ak3-core.sh b/tools/ak3-core.sh index b8d3678..70e1e09 100755 --- a/tools/ak3-core.sh +++ b/tools/ak3-core.sh @@ -786,8 +786,20 @@ setup_ak() { rm -f modules/system/lib/modules/placeholder patch/placeholder ramdisk/placeholder; rmdir -p modules patch ramdisk 2>/dev/null; - # automate simple multi-partition setup for boot_img_hdr_v3 + vendor_boot - if [ -e "/dev/block/bootdevice/by-name/vendor_boot$slot" -a ! -f vendor_setup ] && [ -f dtb -o -d vendor_ramdisk -o -d vendor_patch ]; then + # automate simple multi-partition setup for hdr_v4 boot + init_boot + vendor_kernel_boot (for dtb only until magiskboot supports hdr v4 vendor_ramdisk unpack/repack) + if [ -e "/dev/block/bootdevice/by-name/init_boot$slot" -a ! -f init_v4_setup ] && [ -f dtb -o -d vendor_ramdisk -o -d vendor_patch ]; then + echo "Setting up for simple automatic init_boot flashing..." >&2; + (mkdir boot-files; + mv -f Image* boot-files; + mkdir init_boot-files; + mv -f ramdisk patch init_boot-files; + mkdir vendor_kernel_boot-files; + mv -f dtb vendor_kernel_boot-files; + mv -f vendor_ramdisk vendor_kernel_boot-files/ramdisk; + mv -f vendor_patch vendor_kernel_boot-files/patch) 2>/dev/null; + touch init_v4_setup; + # automate simple multi-partition setup for hdr_v3+ boot + vendor_boot with dtb/dlkm (for v3 only until magiskboot supports hdr v4 vendor_ramdisk unpack/repack) + elif [ -e "/dev/block/bootdevice/by-name/vendor_boot$slot" -a ! -f vendor_v3_setup ] && [ -f dtb -o -d vendor_ramdisk -o -d vendor_patch ]; then echo "Setting up for simple automatic vendor_boot flashing..." >&2; (mkdir boot-files; mv -f Image* ramdisk patch boot-files; @@ -795,7 +807,7 @@ setup_ak() { mv -f dtb vendor_boot-files; mv -f vendor_ramdisk vendor_boot-files/ramdisk; mv -f vendor_patch vendor_boot-files/patch) 2>/dev/null; - touch vendor_setup; + touch vendor_v3_setup; fi; # allow multi-partition ramdisk modifying configurations (using reset_ak)