forked from LineageOS/android_kernel_bq_msm8937
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild_kernel.sh
executable file
·39 lines (33 loc) · 1002 Bytes
/
build_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
#!/bin/bash
#
# Kernel Build Script
#
# Set variables
BUILD_KERNEL_OUT_DIR=KERNEL_OUT
BUILD_JOB_NUMBER=`grep processor /proc/cpuinfo | wc -l`
BUILD_KERNEL_LOG=kernel_log.txt
# Set Sub arch
BUILD_SUBARCH=$1
# Set toolchain
export ARCH=$BUILD_SUBARCH
if [ "$BUILD_SUBARCH" = "arm" ]; then
GCC_SUBARCH=arm
GCC_SUBDIR=arm-eabi
GCC_VERSION=4.8
elif [ "$BUILD_SUBARCH" = "arm64" ]; then
GCC_SUBARCH=aarch64
GCC_SUBDIR=aarch64-linux-android
GCC_VERSION=4.9
fi
export PATH=$(pwd)/../../../prebuilts/gcc/linux-x86/${GCC_SUBARCH}/${GCC_SUBDIR}-${GCC_VERSION}/bin:$PATH
export CROSS_COMPILE=${GCC_SUBDIR}-
# Set defconfig
DEFCONFIG_FILE=$2
if [ ! -e arch/$BUILD_SUBARCH/configs/$DEFCONFIG_FILE ]; then
echo "No such file : arch/$BUILD_SUBARCH/configs/$DEFCONFIG_FILE"
exit -1
fi
# Build kernel
mkdir -p ./$BUILD_KERNEL_OUT_DIR/
make O=./$BUILD_KERNEL_OUT_DIR/ ARCH=$BUILD_SUBARCH ${DEFCONFIG_FILE}
make O=./$BUILD_KERNEL_OUT_DIR/ ARCH=$BUILD_SUBARCH -j$BUILD_JOB_NUMBER 2>&1 | tee $BUILD_KERNEL_LOG