forked from ezio84/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_kernel.sh
executable file
·43 lines (34 loc) · 1.06 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
#!/bin/bash
# Colorize and add text parameters
grn=$(tput setaf 2) # green
txtbld=$(tput bold) # Bold
bldgrn=${txtbld}$(tput setaf 2) # green
bldblu=${txtbld}$(tput setaf 4) # blue
txtrst=$(tput sgr0) # Reset
DEVICE="$1"
USERDEBUG="$2"
# Time of build startup
res1=$(date +%s.%N)
# Setup environment
echo -e "${bldblu}Setting up build environment ${txtrst}"
. build/envsetup.sh
# Setup ccache
export USE_CCACHE=1
export CCACHE_DIR="/home/ezio/Android/ccache"
/usr/bin/ccache -M 25G
# Set the device
echo -e "Setting the device... ${txtrst}"
if [ "$USERDEBUG" == "debug" ]
then
breakfast "$DEVICE-userdebug"
else
breakfast "$DEVICE-user"
fi
# Start compilation and save a log
echo -e "${bldblu}Starting build kernel for $DEVICE and saving a build log file ${txtrst}"
mka bootimage 2>&1 | tee buildkernel.log;
# Get elapsed time
res2=$(date +%s.%N)
echo "${bldgrn}Total time elapsed: ${txtrst}${grn}$(echo "($res2 - $res1) / 60"|bc ) minutes ($(echo "$res2 - $res1"|bc ) seconds) ${txtrst}"
#kill java if it's hanging on
pkill java