AK3+Backend: add preliminary KernelSU support
This commit is contained in:
3 files changed
+26
-4
No files matched your search
@@ -393,8 +393,8 @@ do_modules() {
|
||||
local block modcon moddir modtarget module slot umask;
|
||||
if [ "$(file_getprop anykernel.sh do.systemless)" == 1 ]; then
|
||||
cd $AKHOME/modules;
|
||||
ui_print " " "Creating kernel helper Magisk module...";
|
||||
if [ -d /data/adb/magisk -a -f $AKHOME/magisk_patched ]; then
|
||||
ui_print " " "Creating kernel helper systemless module...";
|
||||
if [ -d /data/adb/magisk -a -f $AKHOME/magisk_patched ] || [ -d /data/adb/ksu -a -f $AKHOME/kernelsu_patched ]; then
|
||||
umask=$(umask);
|
||||
umask 022;
|
||||
moddir=/data/adb/modules/ak3-helper;
|
||||
@@ -408,7 +408,7 @@ do_modules() {
|
||||
cp -f $AKHOME/vertmp $moddir/version;
|
||||
umask $umask;
|
||||
else
|
||||
ui_print "Magisk installation not found. Skipped!";
|
||||
ui_print "Magisk/KernelSU installation not found. Skipped!";
|
||||
fi;
|
||||
else
|
||||
cd $AKHOME/modules;
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
# Dummy file; update-binary is a shell script (DO NOT CHANGE)
|
||||
#
|
||||
#
|
||||
# AK_BASE_VERSION=20230605
|
||||
# AK_BASE_VERSION=20230704
|
||||
@@ -345,6 +345,28 @@ 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
|
||||
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;
|
||||
if [ $? != 0 -a "$comp" ] && $comp --help 2>/dev/null; then
|
||||
echo "Attempting kernel unpack with busybox $comp..." >&2;
|
||||
$comp -dc $kernel > kernel;
|
||||
fi;
|
||||
if strings kernel 2>/dev/null | grep -q -E '^/data/adb/ksud$'; then
|
||||
touch $home/kernelsu_patched;
|
||||
strings kernel 2>/dev/null | grep -E -m1 'Linux version.*#' > $home/vertmp;
|
||||
else
|
||||
ui_print " " "Warning: No KernelSU support detected in kernel!";
|
||||
fi;
|
||||
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;
|
||||
fi;
|
||||
else
|
||||
case $kernel in
|
||||
*-dtb) rm -f kernel_dtb;;
|
||||
|
||||
Reference in new issue
Block a user