-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·91 lines (80 loc) · 2.08 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
#!/bin/sh
# Copyright (C) 2018 Adesh Ikhar (Adesh15)
export TERM=xterm
source ~/mystuff/.creds
source ~/mystuff/common
onLogin
#TG send message function
export CHAT_ID="$MY_CHAT $CHAT_ID"
ROOT_PATH=$PWD
KERNEL_NAME="Feather"
DEVICE="mido"
export KBUILD_BUILD_USER=adesh15
export KBUILD_BUILD_HOST=reactor
export ARCH=arm64
export SUBARCH=arm64
IMAGE="${ROOT_PATH}/out/arch/${ARCH}/boot/Image.gz-dtb"
ZIPDIR="/home/adesikha15/zip"
clean()
{
echoText "Cleaning Up"
rm -rf $ZIPDIR/*.zip
rm -rf $ZIPDIR/Image*
}
defconfig()
{
export CLANG_PATH=/home/adesikha15/clang/clang-7.0.2/bin
export PATH=${CLANG_PATH}:${PATH}
export CLANG_TRIPLE=aarch64-linux-gnu-
export TCHAIN_PATH="/home/adesikha15/gcc-4.9/bin/aarch64-linux-android-"
export CROSS_COMPILE="${CCACHE} ${TCHAIN_PATH}"
export CLANG_TCHAIN="/home/adesikha15/clang/clang-7.0.2/bin/clang"
export KBUILD_COMPILER_STRING="$(${CLANG_TCHAIN} --version | head -n 1 | perl -pe 's/\(http.*?\)//gs' | sed -e 's/ */ /g')"
FINAL_VER="${KERNEL_NAME}-${DEVICE}-clang"
FINAL_ZIP="${FINAL_VER}-$(date +"%Y%m%d").zip"
if [ "$1" == "clean" ]
then
make clean O=out/
make mrproper O=out/
fi
echoText "Generating Defconfig"
make CC=clang mido_defconfig O=out/
}
compile()
{
echoText "Compiling Kernel"
tgm "Building \`${FINAL_VER}\`"
make CC=clang -j$(nproc --all) O=out/
}
zipit()
{
echo "Copying kernel image"
cd "${ZIPDIR}"
cp -v "${IMAGE}" "${ZIPDIR}"
cd "${ZIPDIR}"
zip -r9 "${FINAL_ZIP}" *
SIZE=$(du -sh $FINAL_ZIP | awk '{print $1}')
fileid=$(~/gdrive upload --parent ${KERNEL_BUILDS} ${FINAL_ZIP} | tail -1 | awk '{print $2}')
FILE="[${FINAL_ZIP}](https://drive.google.com/uc?id=$fileid&export=download)"
BUILD_INFO="
Download File:
$FILE
SIZE: $SIZE"
}
START=$(date +"%s")
clean
defconfig
compile
if [ ! -f "${IMAGE}" ]; then
reportError "Kernel compilation failed"
tgm "Build Failed @Adesh15"
else
reportSuccess "Build Successful"
zipit
END=$(date +"%s")
DIFF=$((END - START))
echoText "Build successfull in $((DIFF / 60)) minute(s) and $((DIFF % 60)) seconds."
tgm "Build successfull in $((DIFF / 60)) minute(s) and $((DIFF % 60)) seconds."
tgm "$BUILD_INFO"
fi
cd $ROOT_PATH