forked from Tk-Glitch/Glitch_Flo_CAF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglitch.sh
executable file
·128 lines (91 loc) · 2.88 KB
/
glitch.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
#!/bin/bash
# CM10 repo path :
repo=~/android/system
# Choose Android 4.1.x or 4.2.x initrd :
#init="4.1"
init="4.3"
# Glitch kernel build-script parameters :
#
# "device" : build for a supported device (Flo).
# You can list all devices you want to build, separated by a space.
#
# clean : clean the build directory.
export CM_REPO=$repo
# Toolchain :
export ARCH="arm"
#export CROSS_PREFIX="$repo/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8-linaro/bin/arm-eabi-"
#export CROSS_PREFIX="$repo/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-"
export CROSS_PREFIX="$repo/prebuilts/gcc/linux-x86/arm/sabermod-androideabi-4.8/bin/arm-linux-androideabi-"
#export CROSS_PREFIX="$repo/prebuilts/gcc/linux-x86/arm/linaro_4.8.2-2013.09/bin/arm-gnueabi-"
setup ()
{
if [ x = "x$CM_REPO" ] ; then
echo "Android build environment must be configured"
exit 1
fi
. "$CM_REPO"/build/envsetup.sh
# Arch-dependent definitions
case `uname -s` in
Darwin)
KERNEL_DIR="$(dirname "$(greadlink -f "$0")")"
CROSS_PREFIX="$repo/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.6/bin/arm-eabi-"
;;
*)
KERNEL_DIR="$(dirname "$(readlink -f "$0")")"
CROSS_PREFIX="$CROSS_PREFIX"
;;
esac
BUILD_DIR="../glitch-build/kernel"
if [ x = "x$NO_CCACHE" ] && ccache -V &>/dev/null ; then
CCACHE=ccache
CCACHE_BASEDIR="$KERNEL_DIR"
CCACHE_COMPRESS=1
CCACHE_DIR="$CM_REPO/kernel/Asus/.ccache"
export CCACHE_DIR CCACHE_COMPRESS CCACHE_BASEDIR
else
CCACHE=""
fi
}
build ()
{
local target=flo
echo "Building for flo - Android $init.x"
local target_dir="$BUILD_DIR/flo"
local module
rm -fr "$target_dir"
mkdir -p "$target_dir"
mka -C "$KERNEL_DIR" O="$target_dir" cyanogen_flo_defconfig HOSTCC="$CCACHE gcc"
mka -C "$KERNEL_DIR" O="$target_dir" HOSTCC="$CCACHE gcc" CROSS_COMPILE="$CCACHE $CROSS_PREFIX" zImage modules
[[ -d release ]] || {
echo "must be in kernel root dir"
exit 1;
}
echo "copying modules and zImage"
mkdir -p $KERNEL_DIR/release/zimage/system/lib/modules/
cd $target_dir
find -name '*.ko' -exec cp -av {} $KERNEL_DIR/release/zimage/system/lib/modules/ \;
"$CROSS_PREFIX"strip --strip-unneeded $KERNEL_DIR/release/zimage/system/lib/modules/*
cd $KERNEL_DIR
mv $target_dir/arch/arm/boot/zImage $KERNEL_DIR/release/zimage/kernel/zImage
echo "packaging it up"
cd release/zimage && {
mkdir -p $KERNEL_DIR/release/Flashable-flo-CMfriendly
REL=CM10.2-flo-Glitch-$(date +%Y%m%d.%H%M).zip
zip -q -r ${REL} kernel META-INF system
sha256sum ${REL} > ${REL}.sha256sum
mv ${REL}* $KERNEL_DIR/release/Flashable-flo-CMfriendly/
rm kernel/zImage
rm -r system/lib/modules/*
}
cd $KERNEL_DIR
echo ${REL}
}
setup
if [ "$1" = clean ] ; then
rm -fr "$BUILD_DIR"/*
echo "Old build cleaned"
else
time {
build flo
}
fi