-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·118 lines (90 loc) · 3.32 KB
/
build.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
#!/bin/bash
############################################################
### Build script for HolyDragon kernel ###
############################################################
# This is the full build script used to build the official kernel zip.
# Minimum requirements to build:
# Already working build environment :P
#
# In this script:
# You will need to change the 'Source path to kernel tree' to match your current path to this source.
# You will need to change the 'Compile Path to out' to match your current path to this source.
# You will also need to edit the '-j32' under 'Start Compile' section and adjust that to match the amount of cores you want to use to build.
#
# In Makefile:
# You will need to edit the 'CROSS_COMPILE=' line to match your current path to this source.
#
# Once those are done, you should be able to execute './build.sh' from terminal and receive a working zip.
############################################################
# Build Script Variables
############################################################
# Source defconfig used to build
dc=sd_defconfig
# Path to kernel source
k=/home/holyangel/android/Kernels/Shamu
# Path to clean out
co=$k/out
# Compile Path to out
o="O=/home/holyangel/android/Kernels/Shamu/out"
# Path to image.gz-dtb
i=$k/out/arch/arm/boot/zImage-dtb
# Destination Path for compiled modules
zm=$k/build/modules
# Destination path for compiled Image.gz-dtb
zi=$k/build/zImage
# Source path for building kernel zip
zp=$k/build/
# Destination Path for uploading kernel zip
zu=$k/upload/
# Kernel zip Name
kn=SDK_Shamu_V3.zip
##############################
############################################################
# Cleanup
############################################################
echo " Cleaning up out directory"
rm -Rf out/
echo " Out directory removed!"
############################################################
# Make out folder
############################################################
echo " Making new out directory"
mkdir -p "$co"
echo " Created new out directory"
############################################################
# Establish defconfig
############################################################
echo " Establishing build environment.."
make "$o" "$dc"
############################################################
# Start Compile
############################################################
echo " First pass started.."
make "$o" -j64
echo " First pass completed!"
echo " "
echo " Starting Second Pass.."
make "$o" -j64
echo " Second pass completed!"
############################################################
# Copy image.gz-dtb to /build
############################################################
echo " Copying kernel to zip directory"
cp "$i" "$zi"
find . -name "*.ko" -exec cp {} "$zm" \;
echo " Copying kernel completed!"
############################################################
# Generating Changelog to /build
############################################################
./changelog
############################################################
# Make zip and move to /upload
############################################################
echo " Making zip file.."
cd "$zp"
zip -r "$kn" *
echo " Moving zip to upload directory"
mv "$kn" "$zu"
echo " Completed build script!"
echo " Returning to start.."
cd "$k"