forked from Tk-Glitch/Glitch_Flo_AOSP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglitch.sh
More file actions
executable file
·161 lines (122 loc) · 3.74 KB
/
Copy pathglitch.sh
File metadata and controls
executable file
·161 lines (122 loc) · 3.74 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
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
#!/bin/bash
# Glitch kernel build-script
#
# clean : clean the build directory.
# cleank : clean the built kernel packages
# cm : build a cm compatible kernel
# CM repo path :
repo=~/android/system
# Toolchain :
export ARCH="arm"
#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/linaro_4.8.2-2013.09/bin/arm-gnueabi-"
export CROSS_PREFIX="$repo/prebuilts/gcc/linux-x86/arm/sabermod-androideabi-4.8/bin/arm-linux-androideabi-"
setup ()
{
if [ x = "x$repo" ] ; then
echo "Android build environment must be configured"
exit 1
fi
. "$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.8/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="$repo/kernel/Asus/.ccache"
export CCACHE_DIR CCACHE_COMPRESS CCACHE_BASEDIR
else
CCACHE=""
fi
}
build ()
{
local target=flo
echo "Building for N7"
local target_dir="$BUILD_DIR/N7"
local module
rm -fr "$target_dir"
mkdir -p "$target_dir"
mka -C "$KERNEL_DIR" O="$target_dir" 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/aroma/system/lib/modules/
cd $target_dir
find -name '*.ko' -exec cp -av {} $KERNEL_DIR/release/aroma/system/lib/modules/ \;
"$CROSS_PREFIX"strip --strip-unneeded $KERNEL_DIR/release/aroma/system/lib/modules/*
cd $KERNEL_DIR
mv $target_dir/arch/arm/boot/zImage $KERNEL_DIR/release/aroma/boot/glitch.zImage
echo "packaging it up"
cd release/aroma
. $KERNEL_DIR/../rev
if [ "$cm" = "y" ] ; then
mkdir -p $KERNEL_DIR/release/Flashable-flo-AOSP4CM
REL=Glitch-N7-r$counter-AOSP4CM.zip
zip -q -r ${REL} boot config META-INF system
#sha256sum ${REL} > ${REL}.sha256sum
mv ${REL}* $KERNEL_DIR/release/Flashable-flo-AOSP4CM/
else
counter=$((counter + 1))
mkdir -p $KERNEL_DIR/release/Flashable-flo-AOSP
REL=Glitch-N7-r$counter.zip
zip -q -r ${REL} boot config META-INF system
#sha256sum ${REL} > ${REL}.sha256sum
mv ${REL}* $KERNEL_DIR/release/Flashable-flo-AOSP/
echo counter=$counter > $KERNEL_DIR/../rev;
fi
rm boot/glitch.zImage
rm -r system/lib/modules/*
cd $KERNEL_DIR
echo ""
echo ${REL}
}
setup
if [ "$1" = clean ] ; then
rm -fr "$BUILD_DIR"/*
cd release
rm `find ./ -name '*.*~'` -rf
rm `find ./ -name '*~'` -rf
cd $KERNEL_DIR
echo ""
echo "Old build cleaned"
else
if [ "$1" = cleank ] ; then
rm -fr "$KERNEL_DIR"/release/Flashable-flo-AOSP/*
rm -fr "$KERNEL_DIR"/release/Flashable-flo-AOSP4CM/*
echo "Built kernels cleaned"
else
if [ "$1" = cm ] ; then
cm="y"
git apply ../AOSPpatch
echo "--------------------------------------------------------"
echo "--------------Patched tree for CM compat----------------"
echo "--------------------------------------------------------"
time {
build flo
}
git apply --reverse ../AOSPpatch
echo "--------------------------------------------------------"
echo "---------------Patched tree back to AOSP----------------"
echo "--------------------------------------------------------"
else
time {
build flo
}
fi
fi
fi