You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Build Kernel For Samsung Galaxy S24 Series (Snapdragon)
Test on: Ubuntu 24.04 LTS
# rm -rf kernel_platform &
env_root=$(pwd)
kernel_root="kernel_platform/common"# ===Prepare===# Downlaod from https://opensource.samsung.com/uploadSearch?searchValue=SM-S92
tar -zxf Kernel.tar.gz
cd$kernel_root# Set up permissions for all files and directories
chmod 777 -R *cd$env_root# ===KernelSU Next===cd$kernel_root
curl -LSs "https://raw.githubusercontent.com/rifsxd/KernelSU-Next/next-susfs/kernel/setup.sh"| bash -s next-susfs-dev
cd$env_root# ===SuSFS===
branch="gki-android14-6.1"# # if you use KernelSU, also apply the patch for KernelSU# wget https://gitlab.com/simonpunk/susfs4ksu/-/raw/master/kernel_patches/KernelSU/10_enable_susfs_for_ksu.patch?ref_type=heads -O "$kernel_root/KernelSU-Next/10_enable_susfs_for_ksu.patch"# cd $kernel_root/KernelSU# patch -p1 < 10_enable_susfs_for_ksu.patch# cd $env_root# download the patches (maybe change to git clone later, hmm...)
wget https://gitlab.com/simonpunk/susfs4ksu/-/raw/$branch/kernel_patches/50_add_susfs_in_$branch.patch?ref_type=heads -O "$kernel_root/50_add_susfs_in_$branch.patch"
wget https://gitlab.com/simonpunk/susfs4ksu/-/raw/$branch/kernel_patches/fs/sus_su.c?ref_type=heads -O "$kernel_root/fs/sus_su.c"
wget https://gitlab.com/simonpunk/susfs4ksu/-/raw/$branch/kernel_patches/fs/susfs.c?ref_type=heads -O "$kernel_root/fs/susfs.c"
wget https://gitlab.com/simonpunk/susfs4ksu/-/raw/$branch/kernel_patches/include/linux/sus_su.h?ref_type=heads -O "$kernel_root/include/linux/sus_su.h"
wget https://gitlab.com/simonpunk/susfs4ksu/-/raw/$branch/kernel_patches/include/linux/susfs.h?ref_type=heads -O "$kernel_root/include/linux/susfs.h"
wget https://gitlab.com/simonpunk/susfs4ksu/-/raw/$branch/kernel_patches/include/linux/susfs_def.h?ref_type=heads -O "$kernel_root/include/linux/susfs_def.h"# apply the patchcd$kernel_root
patch -p1 < 50_add_susfs_in_$branch.patch
# read the output carefully, then you need to manually solve the conflicts if there are any reject filescd$env_root# ===Download Build Script===
wget https://github.com/ravindu644/Android-Kernel-Tutorials/raw/refs/heads/main/build_scripts/build_6.1.sh -O "$kernel_root/build.sh"# may refer to other build scripts, edit it by your self, ref to https://github.com/fei-ke/android_kernel_samsung_sm8550/blob/kernelsu/build.sh# ===Kernel Config===# if kptools-linux not exists, download itif [ !-f ./kptools-linux ];thenecho"kptools-linux not found, downloading..."
wget https://github.com/bmax121/KernelPatch/releases/latest/download/kptools-linux -O ./kptools-linux
chmod +x ./kptools-linux
fi# put official boot.img here# Where to get boot.img?# - Downlaod the samsung firmware match your phone, extract it, and extract the boot.img.lz4 from the `AP_...tar.md5`# then use lz4 to decompress it
lz4 -d boot.img.lz4 boot.img
# extract official kernel config from boot.img
./kptools-linux -i boot.img -f > boot.img.build.conf
# see the kernel version of official kernel
./kptools-linux -i boot.img -d | head
# copy the extracted kernel config to the kernel source and build using it
tail -n +2 boot.img.build.conf >"$kernel_root/arch/arm64/configs/gki_defconfig"# Disable Samsung Securities & Force Load Kernel Modules# otherwise you will get a bootloop phone# ref to: https://github.com/ravindu644/Android-Kernel-Tutorials/tree/main/samsung-rkp
cat <<EOF >> "$kernel_root/arch/arm64/configs/gki_defconfig"# Disable Samsung SecuritiesCONFIG_UH=nCONFIG_UH_RKP=nCONFIG_UH_LKMAUTH=nCONFIG_UH_LKM_BLOCK=nCONFIG_RKP_CFP_JOPP=nCONFIG_RKP_CFP=nCONFIG_SECURITY_DEFEX=nCONFIG_PROCA=nCONFIG_FIVE=n#Force Load Kernel ModulesCONFIG_MODULES=yCONFIG_MODULE_FORCE_LOAD=yCONFIG_MODULE_UNLOAD=yCONFIG_MODULE_FORCE_UNLOAD=yCONFIG_MODVERSIONS=yCONFIG_MODULE_SRCVERSION_ALL=nCONFIG_MODULE_SIG=nCONFIG_MODULE_COMPRESS=nCONFIG_TRIM_UNUSED_KSYMS=n# fix ksunCONFIG_KSU_SUSFS_SUS_SU=nEOF# ===Fix Other Issues===# Fix Driver Issues# - Disable CRC Checks # ref to: https://github.com/ravindu644/Android-Kernel-Tutorials/blob/main/patches/010.Disable-CRC-Checks.patch# edit these files# - drivers/mmc/core/core.c# - kernel/module/version.c# ===Build Kernel===# have a look at current kernel versionecho"Kernel Version:"
make kernelversion
cd$kernel_root# clean the kernel source
make clean
# run build script
./build.sh
About
Build Kernel For Samsung Galaxy S24 Series (Snapdragon) with KernelSU Next