-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_medusa.sh
executable file
·86 lines (70 loc) · 2.46 KB
/
build_medusa.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
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
##############################################
# SebaUbuntu custom kernel build script #
##############################################
# Set defaults directory's
ROOT_DIR=$(pwd)
OUT_DIR=$ROOT_DIR/out
ANYKERNEL_DIR=$ROOT_DIR/anykernel3
KERNEL_DIR=$ROOT_DIR
DATE=$(date +"%m-%d-%y")
BUILD_START=$(date +"%s")
# Export ARCH and SUBARCH <arm, arm64, x86, x86_64>
export ARCH=arm
export SUBARCH=arm
# Set kernel name and defconfig
# export VERSION=
DEF=j4primelte_defconfig
export DEFCONFIG=$DEF
# Keep it as is
export LOCALVERSION=$VERSION
# Export Username and machine name
export KBUILD_BUILD_USER=Batu33TR
export KBUILD_BUILD_HOST=ProjectMedusa
# Color definition
red=`tput setaf 1`
green=`tput setaf 2`
yellow=`tput setaf 3`
blue=`tput setaf 4`
magenta=`tput setaf 5`
cyan=`tput setaf 6`
white=`tput setaf 7`
reset=`tput sgr0`
# Cross-compiler exporting
# Export ARM from the given directory
export CROSS_COMPILE=$(pwd)/gcc/bin/arm-linux-androideabi-
echo -e "*****************************************************"
echo " Compiling kernel using GCC "
echo -e "*****************************************************"
echo -e "-----------------------------------------------------"
echo " Architecture: $ARCH "
echo " Output directory: $OUT_DIR "
echo " Kernel version: $VERSION "
echo " Defconfig: $DEF "
echo " Build user: $KBUILD_BUILD_USER "
echo " Build machine: $KBUILD_BUILD_HOST "
echo " Build started on: $BUILD_START "
echo " Toolchain: GCC 4.9 Brillo-M10-Release "
echo -e "-----------------------------------------------------"
# Set kernel source workspace
cd $KERNEL_DIR
rm -rf out
# Make your device device_defconfig
make O=$OUT_DIR ARCH=$ARCH KCFLAGS=-mno-android $DEFCONFIG
DEFCONFIG_SUCCESS=$?
if [ $DEFCONFIG_SUCCESS != 0 ]
then
echo "$red Error: make $DEFCONFIG failed, specified a defconfig not present? $reset"
exit
fi
# Build Kernel
make O=$OUT_DIR ARCH=$ARCH KCFLAGS=-mno-android -j$(nproc --all)
# Find how much build has been long
BUILD_END=$(date +"%s")
DIFF=$(($BUILD_END - $BUILD_START))
BUILD_SUCCESS=$?
if [ $BUILD_SUCCESS != 0 ]
then
echo "$red Error: Build failed in $(($DIFF / 60)) minute(s) and $(($DIFF % 60)) seconds $reset"
exit
fi
echo -e "$green Build completed in $(($DIFF / 60)) minute(s) and $(($DIFF % 60)) seconds $reset"