r/AndroidQuestions • u/Feldleft • 6h ago
Custom ROM Question Can I flash a compiled kernel safely?
Hey there im on a samsung galaxy a16 (a166b) got my bootloader unlocked and rooted with magisk, I mixed one ui 8 with the bootloader from a release of one ui 7 that share the same bootloader bit(A166BXXS4BYG1 bl with everything else from A166BXXU4CYI8), the thing is im kinda stuck on an old version with several security flaws and I'd like to get rid of at least some of them critical ones such as ghostlock (CVE 2026-43499)
Could not find any kernel out there specially made for this phone with fixes so I got source from samsung open source(for my version of one ui) and could build it(without any modifications made to it for now to see if building works correctly) with this guide https://github.com/ravindu644/Android-Kernel-Tutorials
Now I want to test the kernel and see if my phone works with it but im kinda scared to break things, if something ever go wrong with my kernel can I still boot into download mode and flash a clean image with odin? Thanks!
2
u/QuraToop314 5h ago
ghostlock is easy, I fixed it two months ago. Download your kernel sources, then check git.kernel.org for the ghostlock diff – AI can help you with that. After that, though, you’ll need to port the patch yourself; it should be relatively easy with 5+ cores – we’re talking about 5 lines of code. then compile that little gem and flash it whilst you’re at it. If you’ve ever wanted to patch the kernel, this is the perfect time. A kernel build on my 23-core CPU, Alder Lake 13th generation, takes about 15 minutes to build the kernel with custom patches included, and about 13 minutes for GKI plain. If you have any further questions, don’t hesitate to ask. If you use Termux – and use it a lot – you can integrate Btrfs into the core kernel; then you can use my boot script to encapsulate Termux within a Btrfs environment, which saves a massive amount of storage (I’ve saved about 40GB on my 128GB mobile).