AK3+Backend: helper module improvements and full KernelSU support

- only parse kernel strings when both do.modules=1 and do.systemless=1 are set
- support post-fs-data.sh in systemless kernel helper module (gets renamed and sourced from the built-in one)
- show systemless kernel helper module as an update pending reboot in module apps if flashed while booted
- add system_ext support to systemless kernel helper module
- show a warning during flash if systemless kernel helper module is configured but there's no decrypted /data access to be able to install it
- detect the installed KernelSU app as the indicator the user intends to use KernelSU, and install systemless kernel helper module to modules_update.img accordingly
- do KernelSU directory setup and create modules_update.img if this appears to be the initial KernelSU install
- set all systemless kernel helper module files to system_file context, since unlabeled files are not gracefully handled by KernelSU (they trigger a reboot and the module gets rejected)

NOTE: currently it appears KernelSU won't parse the modules_update.img on the first boot where it sets itself up from initial KernelSU install, but it will then do it after the following reboot. Hopefully this can be fixed by a future KernelSU release so that the systemless kernel helper module is active right away as this might be necessary to boot fully on some devices
This commit is contained in:
Chris Renshaw authored and GitHub committed 2023-07-16 16:33:47 -03:00
1 parent 0b37d0bfa4
commit 4030d36655
3 files changed
+42 -7

No files matched your search

+2 -2
View File
@@ -329,7 +329,7 @@ flash_boot() {
fi;
# legacy SAR kernel string skip_initramfs -> want_initramfs
$bin/magiskboot hexpatch kernel 736B69705F696E697472616D6673 77616E745F696E697472616D6673;
if [ "$(file_getprop $home/anykernel.sh do.systemless)" == 1 ]; then
if [ "$(file_getprop $home/anykernel.sh do.modules)" == 1 ] && [ "$(file_getprop $home/anykernel.sh do.systemless)" == 1 ]; then
strings kernel 2>/dev/null | grep -E -m1 'Linux version.*#' > $home/vertmp;
fi;
if [ "$comp" ]; then
@@ -345,7 +345,7 @@ flash_boot() {
for fdt in dtb extra kernel_dtb recovery_dtbo; do
[ -f $fdt ] && $bin/magiskboot dtb $fdt patch; # remove dtb verity/avb
done;
elif [ -d /data/adb/ksu -a -f /data/adb/ksu/modules.img ] && [ "$(file_getprop $home/anykernel.sh do.systemless)" == 1 ]; then
elif [ -d /data/data/me.weishu.kernelsu ] && [ "$(file_getprop $home/anykernel.sh do.modules)" == 1 ] && [ "$(file_getprop $home/anykernel.sh do.systemless)" == 1 ]; then
ui_print " " "KernelSU detected! Setting up for kernel helper module...";
comp=$($bin/magiskboot decompress kernel 2>&1 | grep -vE 'raw|zimage' | sed -n 's;.*\[\(.*\)\];\1;p');
($bin/magiskboot split $kernel || $bin/magiskboot decompress $kernel kernel) 2>/dev/null;