-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_kernel.sh
executable file
·45 lines (34 loc) · 1.04 KB
/
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
40
41
42
43
44
45
#!/bin/bash
##
# Copyright (C) 2015, Samsung Electronics, Co., Ltd.
# Written by System S/W Group, S/W Platform R&D Team,
# Mobile Communication Division.
##
set -e -o pipefail
export CROSS_COMPILE=../PLATFORM/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-
export ARCH=arm
PLATFORM=sc8830
DEFCONFIG=j1minive3g-dt_defconfig
KERNEL_PATH=$(pwd)
MODULE_PATH=${KERNEL_PATH}/modules
EXTERNAL_MODULE_PATH=${KERNEL_PATH}/external_module
JOBS=`grep processor /proc/cpuinfo | wc -l`
function build_kernel() {
make ${DEFCONFIG}
make -j${JOBS}
make modules
make dtbs
make -C ${EXTERNAL_MODULE_PATH}/mali MALI_PLATFORM=${PLATFORM} BUILD=release KDIR=${KERNEL_PATH}
[ -d ${MODULE_PATH} ] && rm -rf ${MODULE_PATH}
mkdir -p ${MODULE_PATH}
find ${KERNEL_PATH}/drivers -name "*.ko" -exec cp -f {} ${MODULE_PATH} \;
find ${EXTERNAL_MODULE_PATH} -name "*.ko" -exec cp -f {} ${MODULE_PATH} \;
}
function clean() {
[ -d ${MODULE_PATH} ] && rm -rf ${MODULE_PATH}
make distclean
}
function main() {
[ "${1}" = "Clean" ] && clean || build_kernel
}
main $@