-
Notifications
You must be signed in to change notification settings - Fork 2
/
buildKernel.sh
executable file
·155 lines (129 loc) · 4.1 KB
/
buildKernel.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
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
#!/bin/sh
# Copyright (C) 2011 Twisted Playground
# This script is designed by Twisted Playground for use on MacOSX 10.7 but can be modified for other distributions of Mac and Linux
KERNELDIR=`pwd`
HANDLE=TwistedZero
KERNELREPO=$DROPBOX_SERVER/TwistedServer/StarKissed/kernels
#TOOLCHAIN_PREFIX=/Volumes/android/android-toolchain-eabi-4.6/bin/arm-eabi-
TOOLCHAIN_PREFIX=/Volumes/android/android-tzb_ics4.0.1/prebuilt/darwin-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
GOOSERVER=upload.goo.im:public_html
PUNCHCARD=`date "+%m-%d-%Y_%H.%M"`
echo "1. Wifi"
echo "2. AT&T"
echo "3. VZW"
echo "4. All"
echo "Please Choose: "
read profile
case $profile in
1)
TYPE=wifi
;;
2)
TYPE=att
;;
3)
TYPE=vzw
;;
4)
zipfile=$HANDLE"_StarKissed-EKGC.zip"
KENRELZIP="StarKissed-EKGC_$PUNCHCARD.zip"
cp -R buildatt/boot.img starkissed/kernel/att
cp -R buildwifi/boot.img starkissed/kernel/wifi
cp -R buildvzw/boot.img starkissed/kernel/vzw
cd starkissed
rm *.zip
zip -r $zipfile *
cd ../
cp -R starkissed/$zipfile $KERNELREPO/$zipfile
if [ -e $KERNELREPO/$zipfile ]; then
cp -R $KERNELREPO/$zipfile ~/.goo/$KENRELZIP
scp -P 2222 ~/.goo/$KENRELZIP $GOOSERVER/galaxycam/kernel
rm -R ~/.goo/$KENRELZIP
fi
exit 1
;;
*)
exit 1
;;
esac
PROPER=`echo $TYPE | sed 's/\([a-z]\)\([a-zA-Z0-9]*\)/\u\1\2/g'`
MODULEOUT=build$TYPE/boot.img-ramdisk
IMAGEFILE=boot.$PUNCHCARD-$PROPER.img
KERNELFILE=boot.$PUNCHCARD-$PROPER.tar
# CPU_JOB_NUM=`grep processor /proc/cpuinfo|wc -l`
CORES=`sysctl -a | grep machdep.cpu | grep core_count | awk '{print $2}'`
THREADS=`sysctl -a | grep machdep.cpu | grep thread_count | awk '{print $2}'`
CPU_JOB_NUM=$((($CORES * $THREADS) / 2))
# Copy the passed config to default
cp -R config/$1_config arch/arm/configs/gc1pq_00_defconfig
if [ -e build$TYPE/boot.img ]; then
rm -R build$TYPE/boot.img
fi
if [ -e build$TYPE/newramdisk.cpio.gz ]; then
rm -R build$TYPE/newramdisk.cpio.gz
fi
if [ -e build$TYPE/zImage ]; then
rm -R build$TYPE/zImage
fi
make clean -j$CPU_JOB_NUM
make gc1pq_00_defconfig
make -j$CPU_JOB_NUM ARCH=arm CROSS_COMPILE=$TOOLCHAIN_PREFIX
if [ -e arch/arm/boot/zImage ]; then
if [ `find . -name "*.ko" | grep -c ko` > 0 ]; then
find . -name "*.ko" | xargs ${TOOLCHAIN_PREFIX}strip --strip-unneeded
if [ ! -d $MODULEOUT ]; then
mkdir $MODULEOUT
fi
if [ ! -d $MODULEOUT/lib ]; then
mkdir $MODULEOUT/lib
fi
if [ ! -d $MODULEOUT/lib/modules ]; then
mkdir $MODULEOUT/lib/modules
else
rm -r $MODULEOUT/lib/modules
mkdir $MODULEOUT/lib/modules
fi
for j in $(find . -name "*.ko"); do
cp -R "${j}" $MODULEOUT/lib/modules
done
fi
cp -R arch/arm/boot/zImage build$TYPE
cd build$TYPE
./img.sh
echo "building boot package"
cp -R boot.img ../output
cd ../
if [ -e output/boot.tar ]; then
rm -R output/boot.tar
fi
if [ -e output/boot.tar ]; then
rm -R output/boot.tar.md5
fi
if [ -e output/boot.tar ]; then
rm -R output/boot.tar.md5.gz
fi
cp -r output/boot.img $KERNELREPO/camera/boot-$PROPER.img
if cat /etc/issue | grep Ubuntu; then
tar -H ustar -c output/boot.img > output/boot.tar
else
tar --format ustar -c output/boot.img > output/boot.tar
fi
cp -r output/boot.tar $KERNELREPO/camera/boot-$PROPER.tar
cp -r output/boot.tar output/boot.tar.md5
if cat /etc/issue | grep Ubuntu; then
md5sum -t output/boot.tar.md5 >> output/boot.tar.md5
else
md5 -r output/boot.tar.md5 >> output/boot.tar.md5
fi
cp -r output/boot.tar.md5 $KERNELREPO/camera/boot-$PROPER.tar.md5
cp -r $KERNELREPO/camera/boot-$PROPER.img ~/.goo/$IMAGEFILE
scp ~/.goo/$IMAGEFILE $GOOSERVER/galaxycam/kernel
rm -R ~/.goo/$IMAGEFILE
cp -r $KERNELREPO/camera/boot-$PROPER.tar ~/.goo/$KERNELFILE
scp ~/.goo/$KERNELFILE $GOOSERVER/galaxycam/kernel
rm -R ~/.goo/$KERNELFILE
cp -r $KERNELREPO/camera/boot-$PROPER.tar.md5 ~/.goo/$KERNELFILE.md5
scp ~/.goo/$KERNELFILE.md5 $GOOSERVER/galaxycam/kernel
rm -R ~/.goo/$KERNELFILE.md5
fi
cd $KERNELDIR