Skip to content

Commit b5dc245

Browse files
committed
module: patch: dont patch if CONFIG_KALLSYM_ALL is not available in kernel and CONFIG_KPM is enabled in kernel
1 parent ad668c8 commit b5dc245

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

module/patch/boot_patch.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,16 @@ magiskboot unpack "$BOOTIMAGE" >/dev/null 2>&1
4545
fi
4646
fi
4747

48-
if [ ! $(kptools -i kernel -f | grep CONFIG_KALLSYMS=y) ]; then
48+
if kptools -i kernel -f | grep -q "CONFIG_KPM=y"; then
4949
echo "! Patcher has Aborted."
50-
echo "! APatch requires CONFIG_KALLSYMS to be Enabled."
50+
echo "! Detected built-in KPM (CONFIG_KPM=y)."
51+
echo "! KPatch-Next is not compatible alongside built-in KPM."
52+
exit 1
53+
fi
54+
55+
if [ ! $(kptools -i kernel -f | grep CONFIG_KALLSYMS_ALL=y) ]; then
56+
echo "! Patcher has Aborted."
57+
echo "! KPatch-Next requires CONFIG_KALLSYMS_ALL to be Enabled."
5158
echo "! But your kernel seems NOT enabled it."
5259
exit 1
5360
fi
@@ -74,12 +81,6 @@ fi
7481
echo "- Repacking boot image"
7582
magiskboot repack "$BOOTIMAGE" >/dev/null 2>&1
7683

77-
if [ ! $(kptools -i kernel.ori -f | grep CONFIG_KALLSYMS_ALL=y) ]; then
78-
echo "! Detected CONFIG_KALLSYMS_ALL is not set!"
79-
echo "! APatch has patched but maybe your device won't boot."
80-
echo "! Make sure you have original boot image backup."
81-
fi
82-
8384
if [ $? -ne 0 ]; then
8485
>&2 echo "! Repack error: $?"
8586
exit 1

0 commit comments

Comments
 (0)