Skip to content

Latest commit

 

History

History
60 lines (56 loc) · 1.85 KB

File metadata and controls

60 lines (56 loc) · 1.85 KB

If you want to build your Snapdragon/Mediatek kernel with the proton clang, Just follow these steps


01. Clone Proton clang using this command :

cd ~
git clone https://github.com/kdrag0n/proton-clang.git --depth=1

Additional Notes ⚠️ :

  • Some devices don't support building kernels with "Clang version > 12". The default Proton Clang version is 13, so even if the kernel is built without any issues, it's not going to boot, especially on Samsung devices.
  • If you wanna clone the Proton Clang 12, you can use this command :
cd ~
git clone https://github.com/ravindu644/proton-12.git

02. Create a build script to compile with proton inside your Kernel source's root derectory.

touch build_proton.sh
chmod +x  build_proton.sh

03. Open build_proton.sh and enter this code :

#!/bin/bash
export ARCH=arm64
export PLATFORM_VERSION=13
export ANDROID_MAJOR_VERSION=t
ln -s /usr/bin/python2.7 $HOME/python
export PATH=$HOME/:$HOME/proton-clang/bin:$PATH #path to proton
mkdir out
clear

ARGS="
CC=clang
CROSS_COMPILE=aarch64-linux-gnu-
ARCH=arm64
LD=ld.lld
AR=llvm-ar
NM=llvm-nm
OBJCOPY=llvm-objcopy
OBJDUMP=llvm-objdump
READELF=llvm-readelf
OBJSIZE=llvm-size
STRIP=llvm-strip
LLVM_AR=llvm-ar
LLVM_DIS=llvm-dis
CROSS_COMPILE_ARM32=arm-linux-gnueabi-
"
make -j$(nproc) -C $(pwd) O=$(pwd)/out ${ARGS} clean && make -j8 -C $(pwd) O=$(pwd)/out ${ARGS} mrproper
make -j$(nproc) -C $(pwd) O=$(pwd)/out ${ARGS} YOUR_DEFCONFIG
make -j$(nproc) -C $(pwd) O=$(pwd)/out ${ARGS} menuconfig
make -j$(nproc) -C $(pwd) O=$(pwd)/out ${ARGS}

#to copy all the kernel modules (.ko) to "modules" folder.
mkdir -p modules
find . -type f -name "*.ko" -exec cp -n {} modules \;
echo "Module files copied to the 'modules' folder."

04. You don't need to edit any variable except the proton's path in the build_proton.sh. This is the common format.