forked from Bakoubak/android_kernel_lenovo_x306x-10
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompile_kernel.sh
executable file
·48 lines (40 loc) · 1.62 KB
/
compile_kernel.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
#
# Copyright (c) 2023 - JMPFBMX
#
export LC_ALL=C
export ARCH=arm64
export KBUILD_BUILD_HOST=Arch-Linux
export KBUILD_BUILD_USER=FTS427
# Get the absolute paths for CLANG_PATH and GCC_PATH
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
KERNEL_OUT="${SCRIPT_DIR}/../KERNEL_OUT"
CLANG_PATH="${SCRIPT_DIR}/../prebuilt/clang/"
GCC_PATH="${SCRIPT_DIR}/../prebuilt/gcc-64/"
# Clone Toolchains if they don't exist
if [ ! -d "$CLANG_PATH" ]; then
git clone --depth=1 https://gh.llkk.cc/https://github.com/jmpfbmx/android_prebuilts_clang_kernel_linux-x86_clang-4691093.git "$CLANG_PATH"
fi
if [ ! -d "$GCC_PATH" ]; then
git clone --depth=1 https://gh.llkk.cc/https://github.com/jmpfbmx/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9.git "$GCC_PATH"
fi
# Clean previous build and create output directory
if [ -d "../KERNEL_OUT" ]; then
rm -rf "$KERNEL_OUT"
mkdir -p "$KERNEL_OUT"
fi
# Build the kernel
#make O="$KERNEL_OUT" ARCH=arm64
PATH="${CLANG_PATH}/bin:${PATH}:${GCC_PATH}/bin:${PATH}" \
make -j$(nproc --all) O="$KERNEL_OUT" \
ARCH=arm64 \
CC="ccache clang" \
CLANG_TRIPLE=aarch64-linux-gnu- \
CROSS_COMPILE="${GCC_PATH}/bin/aarch64-linux-android-" \
amar_row_lte_defconfig
PATH="${CLANG_PATH}/bin:${PATH}:${GCC_PATH}/bin:${PATH}" \
make -j$(nproc --all) O="$KERNEL_OUT" \
ARCH=arm64 \
CC="ccache clang" \
CLANG_TRIPLE=aarch64-linux-gnu- \
CROSS_COMPILE="${GCC_PATH}/bin/aarch64-linux-android-"