-
Notifications
You must be signed in to change notification settings - Fork 29
/
doBuild_dtb.sh
82 lines (72 loc) · 2.24 KB
/
doBuild_dtb.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
#!/usr/bin/env bash
# Copyright (C) 2020-2022 Oktapra Amtono <oktapra.amtono@gmail.com>
# Docker Kernel Build Script
# Kernel directory
KERNEL_DIR=$PWD
# Device name
if [[ "$*" =~ "a26x" ]]; then
DEVICE="a26x"
elif [[ "$*" =~ "lavender" ]]; then
DEVICE="lavender"
elif [[ "$*" =~ "tulip" ]]; then
DEVICE="tulip"
elif [[ "$*" =~ "whyred" ]]; then
DEVICE="whyred"
fi
# Setup environtment
export ARCH=arm64
export SUBARCH=arm64
AK3_DIR=$KERNEL_DIR/ak3-$DEVICE
KERNEL_IMG=$KERNEL_DIR/out/arch/arm64/boot/Image.gz
# Telegram setup
push_message() {
curl -s -X POST \
https://api.telegram.org/bot"{$TG_BOT_TOKEN}"/sendMessage \
-d chat_id="${TG_CHAT_ID}" \
-d text="$1" \
-d "parse_mode=html" \
-d "disable_web_page_preview=true"
}
push_document() {
curl -s -X POST \
https://api.telegram.org/bot"{$TG_BOT_TOKEN}"/sendDocument \
-F chat_id="${TG_CHAT_ID}" \
-F document=@"$1" \
-F caption="$2" \
-F "parse_mode=html" \
-F "disable_web_page_preview=true"
}
# Export defconfig
make O=out mystic-"$DEVICE"-oldcam_defconfig
# Start compile
if [[ "$*" =~ "clang" ]]; then
export PATH="$KERNEL_DIR/clang/bin:$PATH"
make -j"$(nproc --all)" O=out \
CC=clang \
AR=llvm-ar \
NM=llvm-nm \
OBJCOPY=llvm-objcopy \
OBJDUMP=llvm-objdump \
STRIP=llvm-strip \
CROSS_COMPILE=aarch64-linux-gnu- \
CROSS_COMPILE_ARM32=arm-linux-gnueabi-
elif [[ "$*" =~ "gcc" ]]; then
export CROSS_COMPILE="$KERNEL_DIR/arm64/bin/aarch64-elf-"
export CROSS_COMPILE_ARM32="$KERNEL_DIR/arm32/bin/arm-eabi-"
make -j"$(nproc --all)" O=out ARCH=arm64
fi
# Push message if build error
if ! [ -a "$KERNEL_IMG" ]; then
push_message "<b>Failed building dtbs for <code>$DEVICE</code> Please fix it...!</b>"
exit 1
fi
# Copy dtbs
if [[ "$*" =~ "qpnp" ]]; then
cp -r out/arch/arm64/boot/dts/qcom/sdm636-*.dtb "$AK3_DIR"/dtbs/qpnp/
cp -r out/arch/arm64/boot/dts/qcom/sdm660-*.dtb "$AK3_DIR"/dtbs/qpnp/
elif [[ "$*" =~ "qti" ]]; then
cp -r out/arch/arm64/boot/dts/qcom/sdm636-*.dtb "$AK3_DIR"/dtbs/qti/
cp -r out/arch/arm64/boot/dts/qcom/sdm660-*.dtb "$AK3_DIR"/dtbs/qti/
fi
rm -rf out/arch/arm64/boot/
rm -rf out/.version