-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkernel.sh
executable file
·135 lines (119 loc) · 3.96 KB
/
kernel.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/bash
# Colors
RED="\033[1;31m" # For errors / warnings
GREEN="\033[1;32m" # For info
YELLOW="\033[1;33m" # For info
BLUE="\033[1;36m" # For info
NC="\033[0m" # reset color
printf "${GREEN}"
echo "
_ __ _ ____ _ _
| |/ /___ _ __ _ __ ___| | / ___| ___ _ __(_)_ __ | |_
| ' // _ \ '__| '_ \ / _ \ | \___ \ / __| '__| | '_ \| __|
| . \ __/ | | | | | __/ | ___) | (__| | | | |_) | |_
|_|\_\___|_| |_| |_|\___|_| |____/ \___|_| |_| .__/ \__|
|_|
"
echo -e "${GREEN} by @Prady${NC}"
cd /home/prady/derpfest/kernel/xiaomi/sdm660
export KERNEL_USE_CCACHE=1
export USE_CCACHE=1
export CCACHE_DIR=/home/prady/.ccache
export KBUILD_BUILD_USER=Prady;
export KBUILD_BUILD_HOST=potato-pc;
# Examine our compilation threads
# 2x of our available CPUs
# Kanged from @raphielscape
CPU="$(grep -c '^processor' /proc/cpuinfo)"
JOBS="$(( CPU * 2 ))"
# function
build(){
make O=out ARCH=arm64 wayne_defconfig
time (
PATH=/home/prady/proton-clang/bin:${PATH} \
make -j"${JOBS}" O=out \
ARCH=arm64 \
CC=ccache \
CC=clang \
AR=llvm-ar \
NM=llvm-nm \
OBJCOPY=llvm-objcopy \
OBJDUMP=llvm-objdump \
STRIP=llvm-strip \
CROSS_COMPILE_ARM32=arm-linux-gnueabi- \
CROSS_COMPILE=aarch64-linux-gnu- 2>&1 | tee ../compile.log ;
);
}
zip(){
echo -e "${RED}Zip it?${NC} ${BLUE}{y/n}${NC}"
read base
if [[ $base = 'y' ]];then
pwd && cd /home/prady/MyScripts && ./zip.sh
else
exit
fi
}
echo " "
echo -e " ${GREEN}1${NC} ${BLUE}Start building? ${NC}"
echo -e " ${GREEN}2${NC} ${BLUE}Open out dir ${NC}"
echo -e " ${GREEN}3${NC} ${BLUE}Flash karamel${NC}"
echo -e " ${GREEN}4${NC} ${BLUE}Update Wireguard${NC}"
read base
if [ $base = 1 ]
then
echo -e "${GREEN}Starting build...${NC}"
echo -en "${YELLOW}MAKE CLEAN? y/[${BLUE}n${YELLOW}]: ${NC}"
read clean
if [[ $clean = 'y' ]]; then
make mrproper O=out && make clean
build
zip
else
build
zip
fi
echo -e "${YELLOW}Done!${NC}"
fi
if [ $base = 2 ]
then
nemo out/arch/arm64/boot
fi
if [ $base = 4 ]
then
echo "Opening wireguard webpage..."
python -mwebbrowser https://git.zx2c4.com/wireguard-linux-compat/
USER_AGENT="WireGuard-AndroidROMBuild/0.3 ($(uname -a))"
read -p "Enter version: " VERSION
rm -rf net/wireguard
mkdir -p net/wireguard
curl -A "$USER_AGENT" -LsS --connect-timeout 30 "https://git.zx2c4.com/wireguard-linux-compat/snapshot/wireguard-linux-compat-$VERSION.tar.xz" | tar -C "net/wireguard" -xJf - --strip-components=2 "wireguard-linux-compat-$VERSION/src"
sed -i 's/tristate/bool/;s/default m/default y/;' net/wireguard/Kconfig
git add net/wireguard
git commit -s -m "net: wireguard: Update to $VERSION"
fi
# if [ $base = 1 ]
# then
# echo -e "${GREEN}Starting build...${NC}"
# time (
# PATH=/home/prady/clang/bin:/home/prady/aarch64-linux-android-4.9/bin:${PATH} \
# make -j8 O=out \
# ARCH=arm64 \
# CC=ccache \
# CC=clang \
# CLANG_TRIPLE=aarch64-linux-gnu- \
# CROSS_COMPILE=aarch64-linux-android- |tee ../compile.log ;
# echo -e "${RED}Zip it?${NC}"
# echo -e " ${GREEN}0${NC} ${BLUE}NO${NC}"
# echo -e " ${GREEN}1${NC} ${BLUE}YES${NC}"
# read base
# if [ $base = 1 ]
# then
# pwd && cd /home/prady/MyScripts && ./zip.sh
# fi
# if [ $base = 0 ]
# then
# exit
# fi
# )
# echo -e "${YELLOW}Done!${NC}"
# fi