-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcompile.sh
64 lines (48 loc) · 1.89 KB
/
compile.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
#!/bin/sh
# Clone clang from defined repo
curl -sL https://raw.githubusercontent.com/XSans0/WeebX-Clang/main/main/link.txt | xargs wget -O weebx-clang.tar.gz && \
mkdir clang && tar -xf weebx-clang.tar.gz -C clang && rm -rf weebx-clang.tar.gz
# Clone mvaisakh's arm64-gcc and arm32-gcc repo's
git clone --depth=1 https://github.com/mvaisakh/gcc-arm64 arm64-gcc
git clone --depth=1 https://github.com/mvaisakh/gcc-arm arm32-gcc
# Clone Kramflash
git clone --depth=1 https://github.com/Couchpotato-sauce/kramflash kramflash
# Export the PATH variable
export PATH="$(pwd)/clang/bin:/$(pwd)/arm32-gcc/bin:$(pwd)/arm64-gcc/bin:${PATH}"
# Clean up out
find out -delete
mkdir out
# Setup the build environment
source setup.sh
# Make config
mc
# Build the kernel
kmake
# Create payload dir under kramflash/rd
mkdir -p kramflash/rd/payload
# Concate the DTB and copy the concated DTB and Image.lz4 to kramflash/rd/payload
cat out/arch/arm64/boot/dts/google/*.dtb > dtb
cp dtb kramflash/rd/payload/dtb
cp out/arch/arm64/boot/Image.lz4 kramflash/rd/payload/Image.lz4
# Install pigz as its required to pack the image
apt install -y pigz
cd kramflash
# Pack the image containing the compiled kernel and a bootable alpine ramdisk used to flash the kernel
bash pack-img.sh
# Set some variables required to rename the image created by pack-image.sh
BUILD_TIME=$(date +"%d%m%Y-%H%M")
KERNEL_NAME=Sleepy-"${BUILD_TIME}"
# Rename the image created by pack-image.sh using above created variables
mv flash.img "$KERNEL_NAME".img
FILE="$KERNEL_NAME".img
if [ -f "$FILE" ]; then
echo "The kernel has successfully been compiled and can be found in $(pwd)/"$KERNEL_NAME".img"
FILE_CI="$KERNEL_NAME".img
if [ -f "$FILE_CI" ]; then
curl --connect-timeout 10 -T "$FILE_CI" https://oshi.at
echo " "
fi
else
echo "The kernel has failed to compile. Please check the terminal output for further details."
exit 1
fi