-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild_proton.sh
73 lines (65 loc) · 2.49 KB
/
build_proton.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
#!/bin/sh
# Defined path
MainPath="$(pwd)"
proton="$(pwd)/../proton"
Any="$(pwd)/../AnyKernel3"
# Make flashable zip
MakeZip() {
if [ ! -d $Any ]; then
git clone https://github.com/TeraaBytee/AnyKernel3 -b master $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-$HeadCommit test by $KBUILD_BUILD_USER/g" anykernel.sh
zip -r9 $MainPath/"[$Compiler][R-OSS]-$ZIP_KERNEL_VERSION-$KERNEL_NAME-$TIME.zip" * -x .git README.md *placeholder
cd $MainPath
}
# Clone compiler
if [ ! -d $proton ]; then
git clone --depth=1 https://github.com/kdrag0n/proton-clang $proton
fi
# Defined config
HeadCommit="$(git log --pretty=format:'%h' -1)"
export ARCH="arm64"
export SUBARCH="arm64"
export KBUILD_BUILD_USER="TeraaBytee"
export KBUILD_BUILD_HOST="GithubServer"
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')$(cat "$(pwd)/Makefile" | grep "EXTRAVERSION =" | sed 's/EXTRAVERSION = *//g')"
TIME=$(date +"%m%d%H%M")
# Start building
Compiler=Proton
MAKE="./makeparallel"
rm -rf out
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" \
LD_LIBRARY_PATH="$proton/lib:$LD_LIBRABRY_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-
if [ -e $MainPath/out/arch/arm64/boot/Image.gz-dtb ]; then
BUILD_END=$(date +"%s")
DIFF=$((BUILD_END - BUILD_START))
MakeZip
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