forked from nwsd99/android_kernel_motorola_msm8916
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·123 lines (117 loc) · 4.48 KB
/
build.sh
File metadata and controls
executable file
·123 lines (117 loc) · 4.48 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#
# Copyright � 2016, Sultan Qasim Khan <sultanqasim@gmail.com>
# Copyright � 2016, Zeeshan Hussain <zeeshanhussain12@gmail.com>
# Copyright � 2016, Varun Chitre <varun.chitre15@gmail.com>
# Copyright � 2016, Aman Kumar <firelord.xda@gmail.com>
# Copyright � 2016, Kartik Bhalla <kartikbhalla12@gmail.com>
# Custom build script
#
# This software is licensed under the terms of the GNU General Public
# License version 2, as published by the Free Software Foundation, and
# may be copied, distributed, and modified under those terms.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# Please maintain this if you use this script or any part of it
#
#!/bin/bash
KERNEL_DIR=~/android/kernel/motorola/msm8916
KERN_IMG=$KERNEL_DIR/arch/arm/boot/zImage
DTBTOOL=$KERNEL_DIR/tools/dtbToolCM
BUILD_START=$(date +"%s")
blue='\033[0;34m'
cyan='\033[0;36m'
yellow='\033[0;33m'
red='\033[0;31m'
nocol='\033[0m'
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=~/android/kernel/toolchain/uber-6.0/bin/arm-eabi-
export KBUILD_BUILD_USER="haha"
export KBUILD_BUILD_HOST="FireLord"
rm -f arch/arm/boot/dts/*.dtb
rm -f arch/arm/boot/dt.img
rm -f flash_zip/boot.img
compile_kernel ()
{
echo -e "$cyan***********************************************"
echo -e " Initializing defconfig "
echo -e "***********************************************$nocol"
make $dev-fk_defconfig
echo -e "$cyan***********************************************"
echo -e " Building kernel "
echo -e "***********************************************$nocol"
make -j12 zImage
if ! [ -a $KERN_IMG ];
then
echo -e "$red Kernel Compilation failed! Fix the errors! $nocol"
exit 1
fi
echo -e "$cyan***********************************************"
echo -e " Making DTB "
echo -e "***********************************************$nocol"
make -j12 dtbs
$DTBTOOL -2 -o $KERNEL_DIR/arch/arm/boot/dt.img -s 2048 -p $KERNEL_DIR/scripts/dtc/ $KERNEL_DIR/arch/arm/boot/dts/
echo -e "$cyan***********************************************"
echo -e " Building modules "
echo -e "***********************************************$nocol"
make -j12 modules
}
fire_kernel ()
{
echo -e "$cyan***********************************************"
echo " Compiling FireKernel kernel "
echo -e "***********************************************$nocol"
echo -e " "
echo -e " SELECT ONE OF THE FOLLOWING TYPES TO BUILD : "
echo -e " 1.DIRTY"
echo -e " 2.CLEAN"
echo -n " YOUR CHOICE : ? "
read ch
echo -n " VERSION : ? "
read ver
echo -n " OLD VERSION : ? "
read old
echo -n " Which device : ? "
read dev
echo -n " Which android mm or n : ? "
read anv
replace $old $ver -- $KERNEL_DIR/arch/arm/configs/$dev-fk_defconfig
replace $old $ver -- $KERNEL_DIR/flash_zip/META-INF/com/google/android/updater-script
case $ch in
1) echo -e "$cyan***********************************************"
echo -e " Dirty "
echo -e "***********************************************$nocol"
compile_kernel ;;
2) echo -e "$cyan***********************************************"
echo -e " Clean "
echo -e "***********************************************$nocol"
make clean
make mrproper
compile_kernel ;;
*) device ;;
esac
echo -e "$cyan***********************************************"
echo -e " Converting the output into a flashable zip"
echo -e "***********************************************$nocol"
rm -rf firekernel_install
mkdir -p firekernel_install
make -j4 modules_install INSTALL_MOD_PATH=firekernel_install INSTALL_MOD_STRIP=1
mkdir -p flash_zip/system/lib/modules/
find firekernel_install/ -name '*.ko' -type f -exec cp '{}' flash_zip/system/lib/modules/ \;
cp arch/arm/boot/zImage flash_zip/tools/
cp arch/arm/boot/dt.img flash_zip/tools/
mkdir -p ~/android/kernel/upload/$dev/
rm -f ~/android/kernel/upload/$dev/*
cd flash_zip
zip -r ../arch/arm/boot/fire_kernel.zip ./
today=$(date +"-%d%m%Y")
mv ~/android/kernel/motorola/msm8916/arch/arm/boot/fire_kernel.zip ~/android/kernel/upload/$dev/FireKernel-$anv-$dev-v$ver$today.zip
}
fire_kernel
BUILD_END=$(date +"%s")
DIFF=$(($BUILD_END - $BUILD_START))
echo -e "$yellow Build completed in $(($DIFF / 60)) minute(s) and $(($DIFF % 60)) seconds.$nocol"