From f2dbe60f635f1a59d6cbf99e9ef8be70b25da553 Mon Sep 17 00:00:00 2001 From: osm0sis Date: Sun, 23 Apr 2023 00:01:28 -0300 Subject: [PATCH] AK3: partial revert of d6e040c2 until issue with kernel_dtb is addressed - magiskboot split needs to be updated to not decompress so that if there's a patched kernel_dtb it can be properly appended to the restored unpatched compressed new kernel see: https://github.com/topjohnwu/Magisk/pull/6597#issuecomment-1518709863 --- tools/ak3-core.sh | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/tools/ak3-core.sh b/tools/ak3-core.sh index 1582038..767fff8 100755 --- a/tools/ak3-core.sh +++ b/tools/ak3-core.sh @@ -237,7 +237,7 @@ repack_ramdisk() { # flash_boot (build, sign and write image only) flash_boot() { - local varlist i kernel ramdisk fdt cmdline comp part0 part1 needskernelpatch nocompflag signfail pk8 cert avbtype; + local varlist i kernel ramdisk fdt cmdline comp part0 part1 nocompflag signfail pk8 cert avbtype; cd $split_img; if [ -f "$bin/mkimage" ]; then @@ -327,22 +327,17 @@ flash_boot() { $comp -dc $kernel > kernel; fi; # legacy SAR kernel string skip_initramfs -> want_initramfs - $bin/magiskboot hexpatch kernel 736B69705F696E697472616D6673 77616E745F696E697472616D6673 && needskernelpatch=1; + $bin/magiskboot hexpatch kernel 736B69705F696E697472616D6673 77616E745F696E697472616D6673; if [ "$(file_getprop $home/anykernel.sh do.systemless)" == 1 ]; then strings kernel 2>/dev/null | grep -E -m1 'Linux version.*#' > $home/vertmp; fi; - if [ "$needskernelpatch" ]; then - if [ "$comp" ]; then - $bin/magiskboot compress=$comp kernel kernel.$comp; - if [ $? != 0 ] && $comp --help 2>/dev/null; then - echo "Attempting kernel repack with busybox $comp..." >&2; - $comp -9c kernel > kernel.$comp; - fi; - mv -f kernel.$comp kernel; + if [ "$comp" ]; then + $bin/magiskboot compress=$comp kernel kernel.$comp; + if [ $? != 0 ] && $comp --help 2>/dev/null; then + echo "Attempting kernel repack with busybox $comp..." >&2; + $comp -9c kernel > kernel.$comp; fi; - else - echo "Restoring untouched new kernel since no patching required..." >&2; - cp -f $kernel kernel; + mv -f kernel.$comp kernel; fi; [ ! -f .magisk ] && $bin/magiskboot cpio ramdisk.cpio "extract .backup/.magisk .magisk"; export $(cat .magisk);