forked from mrg666/android_kernel_mako
-
Notifications
You must be signed in to change notification settings - Fork 6
/
export
executable file
·174 lines (165 loc) · 4.6 KB
/
export
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#!/bin/bash
export ARCH=arm
if [ "$1" == "local" ]; then
echo "Local Build"
build=/home/kyle/Desktop/Unleashed
export CROSS_COMPILE=/media/Stuff/dev/linaro_toolchains_2014/arm-cortex_a15-linux-gnueabihf-linaro_4.9.3-2014.12/bin/arm-cortex_a15-linux-gnueabihf-
export ENABLE_GRAPHITE=true
else
echo "Remote Build"
build=/home/kyle/Desktop/Unleashed
export CROSS_COMPILE=/media/Stuff/dev/linaro_toolchains_2014/arm-cortex_a15-linux-gnueabihf-linaro_4.9.3-2014.12/bin/arm-cortex_a15-linux-gnueabihf-
export ENABLE_GRAPHITE=true
fi
kernel="defcon"
version="101u-unleashed"
rom="AOSP"
variant="mako"
ramdisk=ramdisk
#ramdisk=/home/defcon/Desktop/newboot/ramdisk
config="mako_defconfig"
kerneltype="zImage"
ps=2048
base=0x80200000
ramdisk_offset=0x02300000
tags_offset=0x00000100
cmdline="console=ttyHSL0,115200,n8 androidboot.hardware=mako lpj=67677 user_debug=31"
function cleanme {
if [ -f arch/arm/boot/"$kerneltype" ]; then
echo " CLEAN ozip"
fi
rm -rf ozip/boot.img
rm -rf ozip/system/lib/modules/*
rm -rf arch/arm/boot/"$kerneltype"
mkdir -p ozip/system/lib/modules
make clean && make mrproper
echo "Working directory cleaned..."
}
rm -rf out
echo "Checking for build..."
if [ -f ozip/boot.img ]; then
read -p "Previous build found, clean working directory..(y/n)? : " cchoice
case "$cchoice" in
y|Y )
cleanme;;
n|N )
exit 0;;
* )
echo "Invalid...";;
esac
read -p "Begin build now..(y/n)? : " dchoice
case "$dchoice" in
y|Y)
DATE_START=$(date +"%s")
make "$config"
make -j9
echo "-------------------------"
echo "Build Completed in:"
echo "-------------------------"
DATE_END=$(date +"%s")
DIFF=$(($DATE_END - $DATE_START))
echo "Time: $(($DIFF / 60)) minute(s) and $(($DIFF % 60)) seconds."
exit 0;;
n|N )
exit 0;;
* )
echo "Invalid...";;
esac
fi
echo "Extracting files..."
if [ -f arch/arm/boot/"$kerneltype" ]; then
cp arch/arm/boot/"$kerneltype" out
#rm -rf ozip/system/lib/modules/*
rm -rf AnyKernel/system/lib/modules/*
#mkdir -p ozip/system/lib/modules
mkdir -p AnyKernel/system/lib/modules
#find . -name "*.ko" -exec cp -f {} ozip/system/lib/modules \;
find . -name "*.ko" -exec cp -f {} AnyKernel/system/lib/modules \;
if [ -e ozip/system/lib/modules/*.ko ]; then
echo "Modules found."
else
echo "No modules"
ozip/system/lib/modules/*
fi
else
echo "Nothing has been made..."
read -p "Clean working directory..(y/n)? : " achoice
case "$achoice" in
y|Y )
cleanme;;
n|N )
exit 0;;
* )
echo "Invalid...";;
esac
read -p "Begin build now..(y/n)? : " bchoice
case "$bchoice" in
y|Y)
DATE_START=$(date +"%s")
make "$config"
make -j9
echo "-------------------------"
echo "Build Completed in:"
echo "-------------------------"
DATE_END=$(date +"%s")
DIFF=$(($DATE_END - $DATE_START))
echo "Time: $(($DIFF / 60)) minute(s) and $(($DIFF % 60)) seconds."
exit 0;;
n|N )
exit 0;;
* )
echo "Invalid...";;
esac
fi
#echo "Making ramdisk..."
#if [ -d $ramdisk ]; then
#/media/Extra/porting/buildtools/mkbootfs $ramdisk | /media/Extra/porting/buildtools/lz4demo -c stdin out/ramdisk.lz4
#else
# echo "No ramdisk found..."
# exit 0;
#fi
#echo "Making boot.img..."
#if [ -f out/"$kerneltype" ]; then
# /media/Extra/porting/buildtools/mkbootimg --kernel out/"$kerneltype" --ramdisk out/ramdisk.lz4 --cmdline "$cmdline" --base $base --pagesize $ps --ramdisk_offset $ramdisk_offset --tags_offset $tags_offset --output ozip/boot.img
#else
# echo "No $kerneltype found..."
# exit 0;
#fi
echo "Zipping AnyKernel..."
if [ -f arch/arm/boot/"$kerneltype" ]; then
#cd ozip
#zip -r9 ../"$kernel"-$version-"$rom"_"$variant".zip .
#mv ../"$kernel"-$version-"$rom"_"$variant".zip $build
#cd ..
#echo "cleaning up..."
#rm -rf ozip/system/lib/modules/*
#echo "Almost Done..."
cd AnyKernel
echo "Zipping up AnyKernel zip..."
rm ./kernel/"$kerneltype"
cp ../arch/arm/boot/"$kerneltype" ./kernel/
zip -r9 "$kernel"-$version-"$rom"_"$variant".zip *
mv "$kernel"-$version-"$rom"_"$variant".zip $build
#echo "Output zip: $build/$kernel-$version-$(echo $rom)_$variant.zip"
echo "AnyKernel Output zip: $build/$kernel-$version-"$rom"_$variant.zip"
echo "cleaning up..."
cd ..
rm "$kernel"-$version-"$rom"_"$variant".zip
rm -rf AnyKernel/system/lib/modules/*
rm ./kernel/"$kerneltype"
rm arch/arm/boot/"$kerneltype"
echo "Done..."
echo "Output zip: $build/$kernel-$version-"$rom"_$variant.zip"
read -p "Push to device (y/n)? : " cchoice
case "$cchoice" in
y|Y )
adb push $build/$kernel-$version-"$rom"_$variant.zip /sdcard/;;
n|N )
exit 0;;
* )
echo "Invalid...";;
esac
else
echo "No $kerneltype found..."
exit 0;
fi