Skip to content

Instantly share code, notes, and snippets.

@57op
Created July 4, 2025 20:57
Show Gist options
  • Save 57op/74c7c96cd9e948fb4970aa3ec2e825dc to your computer and use it in GitHub Desktop.
Save 57op/74c7c96cd9e948fb4970aa3ec2e825dc to your computer and use it in GitHub Desktop.
Helper bash script for building LineageOS miatoll kernel
#!/usr/bin/env bash
export CWD=$(dirname "$(readlink -f ${0})")
export GCC=${CWD}/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9
export CLANG=${CWD}/clang-r536225
export KERNEL=${CWD}/android_kernel_xiaomi_sm6250
export OUT=${CWD}/out
mkdir -p ${OUT}
case "${1}" in
clean)
make -C ${KERNEL} O=${OUT} distclean
;;
config)
make -C ${KERNEL} O=${OUT} ARCH=arm64 vendor/xiaomi/miatoll_ksn_defconfig #miatoll_defconfig #miatoll_ksn_defconfig
;;
Image)
make \
-C ${KERNEL} \
O=${OUT} \
PATH=${CLANG}/bin:${GCC}/bin:${PATH} \
LLVM=1 \
ARCH=arm64 \
LLVM_IAS=1 \
CROSS_COMPILE=${GCC}/bin/aarch64-linux-android- \
CLANG_TRIPLE=aarch64-linux-gnu- \
CC=clang \
NM=llvm-nm \
OBJCOPY=llvm-objcopy \
LD=ld.lld \
-j$(nproc) Image
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment