This repository has been archived by the owner on Mar 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
build.sh
executable file
·78 lines (66 loc) · 2.29 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
#!/bin/bash
set -o errexit -o pipefail
[[ $# -eq 1 ]] || exit 1
DEVICE=$1
if [[ $DEVICE != blueline && $DEVICE != crosshatch && $DEVICE != bonito ]]; then
echo invalid device codename
exit 1
fi
ROOT_DIR=$(realpath ../../..)
PATH="$ROOT_DIR/prebuilts/build-tools/linux-x86/bin:$PATH"
PATH="$ROOT_DIR/prebuilts/build-tools/path/linux-x86:$PATH"
PATH="$ROOT_DIR/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin:$PATH"
PATH="$ROOT_DIR/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin:$PATH"
PATH="$ROOT_DIR/prebuilts/clang/host/linux-x86/clang-r416183b/bin:$PATH"
PATH="$ROOT_DIR/prebuilts/misc/linux-x86/lz4:$PATH"
PATH="$ROOT_DIR/prebuilts/misc/linux-x86/dtc:$PATH"
PATH="$ROOT_DIR/prebuilts/misc/linux-x86/libufdt:$PATH"
export LD_LIBRARY_PATH="$ROOT_DIR/prebuilts/clang/host/linux-x86/clang-r416183b/lib64:$LD_LIBRARY_PATH"
export KBUILD_BUILD_VERSION=1
export KBUILD_BUILD_USER=grapheneos
export KBUILD_BUILD_HOST=grapheneos
export KBUILD_BUILD_TIMESTAMP="$(date -ud "@$(git show -s --format=%ct)")"
chrt -bp 0 $$
make \
O=out \
ARCH=arm64 \
CC=clang \
AR=llvm-ar \
NM=llvm-nm \
OBJCOPY=llvm-objcopy \
OBJDUMP=llvm-objdump \
READELF=llvm-readelf \
OBJSIZE=llvm-size \
STRIP=llvm-strip \
HOSTCC=clang \
HOSTCXX=clang++ \
HOSTLD=ld.lld \
CLANG_TRIPLE=aarch64-linux-gnu- \
CROSS_COMPILE=aarch64-linux-android- \
CROSS_COMPILE_ARM32=arm-linux-androideabi- \
${DEVICE}_defconfig
make -j$(nproc) \
O=out \
ARCH=arm64 \
CC=clang \
AR=llvm-ar \
NM=llvm-nm \
OBJCOPY=llvm-objcopy \
OBJDUMP=llvm-objdump \
READELF=llvm-readelf \
OBJSIZE=llvm-size \
STRIP=llvm-strip \
HOSTCC=clang \
HOSTCXX=clang++ \
HOSTLD=ld.lld \
CLANG_TRIPLE=aarch64-linux-gnu- \
CROSS_COMPILE=aarch64-linux-android- \
CROSS_COMPILE_ARM32=arm-linux-androideabi-
mkdir -p "$ROOT_DIR/device/google/$DEVICE-kernel"
cp out/arch/arm64/boot/{dtbo.img,Image.lz4} "$ROOT_DIR/device/google/$DEVICE-kernel"
if [[ $DEVICE != bonito ]]; then
cp out/arch/arm64/boot/dts/qcom/sdm845-v2.1.dtb "$ROOT_DIR/device/google/$DEVICE-kernel"
cp out/arch/arm64/boot/dts/qcom/sdm845-v2.dtb "$ROOT_DIR/device/google/$DEVICE-kernel"
else
cp out/arch/arm64/boot/dts/qcom/sdm670.dtb "$ROOT_DIR/device/google/$DEVICE-kernel"
fi