This repository contains a custom Linux kernel for the Samsung Galaxy A31 (SM-A315F/G/N), based on the official Samsung sources with integrated KernelSU support. KernelSU provides a modern, kernel-based root solution as an alternative to traditional tools like Magisk.
Disclaimer: Building and flashing custom kernels can void your warranty and potentially brick your device. Proceed at your own risk. Always back up your data and have a recovery plan (e.g., stock firmware via Odin).
- KernelSU Integration: Built-in support for root access via KernelSU. Install the KernelSU manager app after flashing to manage root permissions and modules.
- Based on LineageOS 19.1: Compatible with Android 12-based ROMs.
- MediaTek MT6768 Chipset Support: Optimized for the Helio P65 SoC in the Galaxy A31.
- Automated Builds: Use GitHub Actions to build the kernel and generate flashable ZIPs via AnyKernel3.
- Patches Applied: Includes
kernelsu.patchfor seamless KernelSU hooks in file system operations.
- Unlocked bootloader on your Samsung Galaxy A31.
- Custom recovery installed (e.g., TWRP or OrangeFox for A31).
- Familiarity with ADB, Fastboot, and Odin for recovery in case of issues.
- Head to the Releases page.
- Download the latest
KernelSU-A31-Flashable.zip. - Boot into recovery and flash the ZIP.
- Reboot and install the KernelSU Manager APK to enable root.
This repo uses GitHub Actions for automated builds, but you can build locally if preferred.
- Set up a Linux environment (e.g., Ubuntu 22.04) with dependencies:
sudo apt install git ccache bc bison build-essential curl flex libelf-dev libssl-dev lz4 ncurses-dev pahole python3 unzip wget xz-utils zstd clang lld - Clone the repo:
git clone https://github.com/Edhic1/KernelSU_kernel_samsung_a31 -b kernel_su cd KernelSU_kernel_samsung_a31 - Download toolchain (e.g., Proton-Clang):
mkdir toolchains && cd toolchains git clone https://github.com/kdrag0n/proton-clang --depth=1 export PATH="$PWD/bin:$PATH" cd .. - Build:
chmod +x buildKernel.sh ./buildKernel.sh - The output will be in
a31/arch/arm64/boot/(e.g.,Image.gz,mt6768.dtb).
- Fork this repo or use your existing fork.
- Go to the Actions tab.
- Select the "Build KernelSU Kernel" workflow and run it (optionally provide a release tag).
- Download artifacts from the run summary, including the flashable ZIP.
To create a flashable ZIP:
- Combine kernel files:
cat a31/arch/arm64/boot/Image.gz a31/arch/arm64/boot/mt6768.dtb > Image.gz-dtb - Clone and use the customized AnyKernel3 fork:
git clone https://github.com/Edhic1/AnyKernel3 -b Samsung_A31 cd AnyKernel3 cp ../Image.gz-dtb . zip -r9 KernelSU-A31-Flashable.zip * -x .git README.md *placeholder - Flash the resulting ZIP in recovery.
- DevZillion: Original KernelSU fork.
- KernelSU Team: For the KernelSU project.
- osm0sis: AnyKernel3 packaging tool.
- Samsung: For open-source kernel code.
- LineageOS: Base for the kernel configuration.
This kernel is licensed under the GPL-2.0. KernelSU modifications are under their respective licenses.
Pull requests are welcome for bug fixes, optimizations, or additional features. Please test thoroughly on a Galaxy A31 device.
For issues, open a GitHub issue here. For device-specific help, check XDA Developers forums for the Samsung Galaxy A31.
