• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

S21 5G Exynos Custom Kernel Problems & Rebooting

Search This thread


New member
Sep 18, 2019
Samsung Galaxy S21
Hey everyone!
I've been trying to get a custom kernel working on my S21 Exynos. I am able to build but I cannot get it to be stable.
When the phone is in the lock screen, after a minute or so it will reboot and checking the log, there is a kernel panic.
Here's what I've done :

Got boot image from device with DD and extracted with AIK.
Built latest kernel with these settings (G991BXXU3AUIE) :

build_kernel.sh :

export ARCH=arm64
export LLVM=1
export CROSS_COMPILE=/home/kali/Projects/Toolchains/aarch64-linux-android-4.9/bin/aarch64-linux-android-
export CLANG_TRIPLE=aarch64-linux-gnu-

make ARCH=arm64 exynos2100-o1sxxx_defconfig
make ARCH=arm64 -j16

arch/arm64/configs/exynos2100-o1sxxx_defconfig modification (So I can set selinux permissive in runtime) :

security/selinux/Makefile modifcation (Allow selinux to be set to permissive) :
ccflags-y += -DCONFIG_ALWAYS_ENFORCE=false

Thats the only thing I have changed just so I can disable selinux for use with frida framework for memory hacking.

After replacing the stock image from extracted AIK with custom one, repacking with --origsize I tar it and flash with odin in download mode.
I then go into twrp, wipe cache and dalvik. (I have tried many full factory resets, just not worth the hassle when trying to figure out what is causing this)

I boot into my phone and things seem normal. Then I lock my phone or let it lock itself then after 30 seconds to a minute, the phone will reboot with a kernel panic and for the life of me I cannot figure out the cause.... Why isnt the samsung firmware working? All it has is the option to use setenforce.....

I have also tried to disable "panic on oops" but it doesn't seem to work, other than delay the inevitable.
Also every time I switch between stock and custom kernel, I be sure to delete the passcode and fingerprint lock to prevent weirdness.

Also reguardless if magisk is installed or not, it still happens. Same thing with having a passcode enabled, same thing will always eventually happen.

Can someone please try and make sense of my kernel log to see what is causing the error?
Im fairly new to kernels . . .

I have attached my last_kmsg.

Thank you in advance
Last edited: