-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
152 lines (126 loc) · 4.06 KB
/
build
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
#!/bin/bash
# Defined path
MainPath="$(pwd)"
Proton="$(pwd)/../Proton"
Azure="$(pwd)/../Azure"
Any="$(pwd)/../Any"
# Make flashable zip
MakeZip() {
if [ ! -d $Any ]; then
git clone https://github.com/Wahid7852/Anykernel.git $Any
cd $Any
else
cd $Any
git reset --hard
git checkout master
git fetch origin master
git reset --hard origin/master
fi
cp -af $MainPath/out/arch/arm64/boot/Image.gz-dtb $Any
sed -i "s/kernel.string=.*/kernel.string=$KERNEL_NAME by Abdul7852/g" anykernel.sh
zip -r9 $MainPath/"NoVA-Balance-$ZIP_KERNEL_VERSION.zip" * -x .git README.md *placeholder
cd $MainPath
}
# Clone compiler
Clone_Proton() {
if [ ! -d $Proton ]; then
git clone --depth=1 https://github.com/kdrag0n/proton-clang -b master $Proton
else
cd $Proton
git fetch origin master
git checkout FETCH_HEAD
git branch -D master
git branch master && git checkout master
cd $MainPath
fi
Proton_Version="$($Proton/bin/clang --version | grep clang)"
}
Clone_Azure() {
if [ ! -d $Azure ]; then
git clone --depth=1 https://gitlab.com/Panchajanya1999/azure-clang.git -b main $Azure
else
cd $Azure
git fetch origin main
git checkout FETCH_HEAD
git branch -D main
git branch main && git checkout main
cd $MainPath
fi
Azure_Version="$($Azure/bin/clang --version | grep clang)"
}
# Defined config
HeadCommit="$(git log --pretty=format:'%h' -1)"
export ARCH="arm64"
export SUBARCH="arm64"
export KBUILD_BUILD_USER="Abdul7852"
export KBUILD_BUILD_HOST="-Stable"
Defconfig="begonia_user_defconfig"
KERNEL_NAME=$(cat "$MainPath/arch/arm64/configs/$Defconfig" | grep "CONFIG_LOCALVERSION=" | sed 's/CONFIG_LOCALVERSION="-*//g' | sed 's/"*//g' )
ZIP_KERNEL_VERSION="4.14.$(cat "$MainPath/Makefile" | grep "SUBLEVEL =" | sed 's/SUBLEVEL = *//g')"
# Start building
Build_Proton() {
Compiler=Proton
rm -rf out
TIME=$(date +"%m%d%H%M")
BUILD_START=$(date +"%s")
make -j$(nproc --all) O=out ARCH=arm64 SUBARCH=arm64 $Defconfig
exec 2> >(tee -a out/error.log >&2)
make -j$(nproc --all) O=out \
PATH="$Proton/bin:/usr/bin:$PATH" \
CC=clang \
AS=llvm-as \
NM=llvm-nm \
OBJCOPY=llvm-objcopy \
OBJDUMP=llvm-objdump \
STRIP=llvm-strip \
LD=ld.lld \
CROSS_COMPILE=aarch64-linux-gnu- \
CROSS_COMPILE_ARM32=arm-linux-gnueabi-
}
Build_Azure() {
Compiler=Azure
rm -rf out
TIME=$(date +"%m%d%H%M")
BUILD_START=$(date +"%s")
make -j$(nproc --all) O=out ARCH=arm64 SUBARCH=arm64 $Defconfig
exec 2> >(tee -a out/error.log >&2)
make -j$(nproc --all) O=out \
PATH="$Azure/bin:/usr/bin:$PATH" \
CC=clang \
LLVM=1 \
LLVM_IAS=1 \
AR=llvm-ar\
NM=llvm-nm \
OBJCOPY=llvm-objcopy \
OBJDUMP=llvm-objdump \
STRIP=llvm-strip \
LD=ld.lld \
CROSS_COMPILE=aarch64-linux-gnu- \
CROSS_COMPILE_ARM32=arm-linux-gnueabi-
}
# End with success or fail
End() {
if [ -e $MainPath/out/arch/arm64/boot/Image.gz-dtb ]; then
BUILD_END=$(date +"%s")
DIFF=$((BUILD_END - BUILD_START))
MakeZip
ZIP=$(echo *$Compiler*$TIME*.zip)
echo "Build success in : $((DIFF / 60)) minute(s) and $((DIFF % 60)) second(s)"
else
BUILD_END=$(date +"%s")
DIFF=$((BUILD_END - BUILD_START))
echo "Build fail in : $((DIFF / 60)) minute(s) and $((DIFF % 60)) second(s)"
fi
}
Text="Start to build kernel"
# Build choices
Proton() {
Clone_Proton
Build_Proton
End
}
Azure() {
Clone_Azure
Build_Azure
End
}