forked from omnirom/android_kernel_lge_hammerhead
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexport
executable file
·115 lines (112 loc) · 2.95 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
#!/bin/bash
# If you're using my script, all you need to do is edit the following lines to work for you.
# Final zip will exist in "build" as "furnace-1.0.0-aosp_hammerhead.zip" for example
# If you are using a non-appended dt.image, you will need to add "--dt path/to/dt.img" and
# the appropriate lines for dtbTool to compile it, if not prebuilt.
build=/home/savoca/downloads/furnace/hammerhead/aosp/
kernel="furnace"
version="1.2.2"
rom="aosp"
variant="hammerhead"
ramdisk=ramdisk
toolchain=/home/savoca/storage/toolchains/android-toolchain-eabi-4.8/bin/
toolchain2="arm-eabi-"
config="hammerhead_defconfig"
kerneltype="zImage-dtb"
jobcount="-j$(grep -c ^processor /proc/cpuinfo)"
ps=2048
base=0x00000000
ramdisk_offset=0x02900000
tags_offset=0x02700000
cmdline="console=ttyHSL0,115200,n8 androidboot.hardware=hammerhead user_debug=31 maxcpus=4 msm_watchdog_v2.enable=1"
rm -rf out
mkdir out
mkdir out/tmp
echo "Checking for build..."
if [ -f ozip/boot/"$kerneltype" ]; then
read -p "Previous build found, clean working directory..(y/n)? : " cchoice
case "$cchoice" in
y|Y )
export ARCH=arm
export CROSS_COMPILE=$toolchain/"$toolchain2"
echo " CLEAN ozip"
rm -rf ozip/boot/{"$kerneltype",ramdisk.gz}
rm -rf arch/arm/boot/"$kerneltype"
mkdir -p ozip/system/lib/modules
make clean && make mrproper
echo "Working directory cleaned...";;
n|N )
exit 0;;
* )
echo "Invalid...";;
esac
read -p "Begin build now..(y/n)? : " dchoice
case "$dchoice" in
y|Y)
make "$config"
make "$jobcount"
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" ozip/boot/
rm -rf ozip/system
mkdir -p ozip/system/lib/modules
find . -name "*.ko" -exec cp {} ozip/system/lib/modules \;
if [ -f ozip/system/lib/modules/*.ko ]; then
echo "Modules added - Add to updater-script if needed"
else
rm -rf ozip/system
fi
else
echo "Nothing has been made..."
read -p "Clean working directory..(y/n)? : " achoice
case "$achoice" in
y|Y )
export ARCH=arm
export CROSS_COMPILE=$toolchain/"$toolchain2"
if [ -f arch/arm/boot/"$kerneltype" ]; then
echo " CLEAN ozip"
fi
rm -rf ozip/boot/{"$kerneltype",ramdisk.gz}
rm -rf arch/arm/boot/"$kerneltype"
mkdir -p ozip/system/lib/modules
make clean && make mrproper
echo "Working directory cleaned...";;
n|N )
exit 0;;
* )
echo "Invalid...";;
esac
read -p "Begin build now..(y/n)? : " bchoice
case "$bchoice" in
y|Y)
make "$config"
make "$jobcount"
exit 0;;
n|N )
exit 0;;
* )
echo "Invalid...";;
esac
fi
echo "Making ramdisk..."
if [ -d $ramdisk ]; then
mkbootfs $ramdisk | gzip > ozip/boot/ramdisk.gz
else
echo "No ramdisk found..."
exit 0;
fi
echo "Zipping..."
cd ozip
zip -r ../"$kernel"-$version-"$rom"_"$variant".zip .
mv ../"$kernel"-$version-"$rom"_"$variant".zip $build
cd ..
rm -rf out ramdisk.gz ozip/system
echo "Done..."
# Export script by Savoca