-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·101 lines (92 loc) · 2.02 KB
/
build.sh
File metadata and controls
executable file
·101 lines (92 loc) · 2.02 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env bash
#
# Script to build kernel for apollo
# By Chirayu Desai (cdesai)
COMMAND=$1
TOP=${PWD}
CURRENT_DIR=`dirname $0`
KERNEL_SRC=${TOP}/kernel
KERNEL_DEFCONFIG=apollo_defconfig
OUT=${TOP}/out
KERNEL_OUT=${TOP}/out/kernel
# Common defines (Arch-dependent)
case `uname -s` in
Darwin)
txtrst='\033[0m' # Color off
txtred='\033[0;31m' # Red
txtgrn='\033[0;32m' # Green
txtylw='\033[0;33m' # Yellow
txtblu='\033[0;34m' # Blue
THREADS=`sysctl -an hw.logicalcpu`
;;
*)
txtrst='\e[0m' # Color off
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
THREADS=`cat /proc/cpuinfo | grep processor | wc -l`
;;
esac
if [ -z ${CROSS_COMPILE} ]; then
if [! -z ${ANDROID_BUILD_TOP} ]; then
CROSS_COMPILE=${ANDROID_BUILD_TOP}/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
else
CROSS_COMPILE=arm-eabi-
fi
fi
do_build()
{
mkdir -p ${OUT}
mkdir -p ${KERNEL_OUT}
make -j${THREADS} -C ${KERNEL_SRC} O=${KERNEL_OUT} ARCH=arm CROSS_COMPILE=${CROSS_COMPILE} ${KERNEL_DEFCONFIG}
echo "Building"
make -j${THREADS} -C ${KERNEL_SRC} O=${KERNEL_OUT} ARCH=arm CROSS_COMPILE=${CROSS_COMPILE}
echo "Building modules"
make -j${THREADS} -C ${KERNEL_SRC} O=${KERNEL_OUT} ARCH=arm CROSS_COMPILE=${CROSS_COMPILE} modules
echo "Copying kernel"
cp ${KERNEL_OUT}/arch/arm/boot/zImage ${OUT}/zImage
echo "Done. zImage can be found at ${OUT}/zImage"
}
do_clean()
{
echo "Cleaning"
rm -rf ${OUT}
}
show_help()
{
echo "Kernel buildscript"
echo "By Chirayu Desai"
echo
echo "Usage: $0 <command>"
echo "Supported commands:"
echo "build: builds the kernel"
echo "clean: removes all generated files"
echo "help: shows this help message"
echo "sync: syncs sources"
}
do_sync()
{
echo "Syncing sources"
repo sync
}
case ${COMMAND} in
build)
do_clean
do_build
;;
clean)
do_clean
;;
help)
show_help
;;
sync)
do_sync
;;
*)
echo "Y u no pass an argument"
echo
show_help
;;
esac