forked from osm0sis/AnyKernel3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·106 lines (76 loc) · 2.4 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·106 lines (76 loc) · 2.4 KB
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
#!/bin/bash
set -e
# Set correct path
export PATH="$(realpath ../../../clang-r563880c/bin):$PATH"
which clang
clang --version
export KROOT="$(realpath ../)"
export OUT="${KROOT}/out"
export BUILD_OPTIONS=(
-C "${KROOT}"
O="${OUT}"
-j$(nproc --all)
ARCH=arm64
CC=clang
CROSS_COMPILE=aarch64-linux-gnu-
LLVM=1
LLVM_IAS=1
LD=ld.lld
AR=llvm-ar
NM=llvm-nm
OBJCOPY=llvm-objcopy
OBJDUMP=llvm-objdump
STRIP=llvm-strip
)
export KCFLAGS="-Wno-incompatible-function-pointer-types"
# This is required, audio will not work otherwise
export TARGET_PRODUCT=bangkk
configure() {
make "${BUILD_OPTIONS[@]}" \
vendor/holi-qgki_defconfig \
vendor/ext_config/lineage_moto-holi.config \
vendor/ext_config/moto-holi-bangkk.config
}
build_image() {
make "${BUILD_OPTIONS[@]}"
}
build_modules() {
make "${BUILD_OPTIONS[@]}" modules
}
modules_install() {
rm -rf "${OUT}/modules_install"
make "${BUILD_OPTIONS[@]}" modules_install INSTALL_MOD_PATH=modules_install
}
make_anykernel() {
rm -rf {Image,dtb,dtb.img,dtbo.img,modules/vendor/lib/modules,modules/system/lib/modules}
mkdir -p modules/{system,vendor}/lib/modules
cp "${OUT}/arch/arm64/boot/Image" Image
# python mkdtboimg.py create dtbo.img --page_size=4096 "${OUT}/arch/arm64/boot/dts/vendor/qcom/blair-bangkk-evb1-overlay.dtbo"
# cp "${OUT}/arch/arm64/boot/dts/vendor/qcom/blair-moto-bangkk-base.dtb" dtb
./place-modules.sh "${OUT}/modules_install/lib/modules"/* modules/vendor/lib/modules "/vendor/lib/modules"
# Stock OS expects the Wi-Fi driver as:
# qca_cld3_wlan.ko
# AOSP expects the Wi-Fi driver as:
# wlan.ko
if [ -f "modules/vendor/lib/modules/wlan.ko" ]; then
echo "Creating qca_cld3_wlan.ko ..."
cp -f \
"modules/vendor/lib/modules/wlan.ko" \
"modules/vendor/lib/modules/qca_cld3_wlan.ko"
else
echo "ERROR: wlan.ko not found!"
exit 1
fi
find modules -name "*.ko" -exec llvm-strip --strip-unneeded -g {} \;
rm -f "moto-$ZIPPREFIX-anykernel.zip"
zip -r "moto-$ZIPPREFIX-anykernel.zip" * -x *anykernel.zip place-modules.sh mkdtboimg.py .gitignore .build-placeholder *.txt
}
if [ ! -e .build-placeholder ]; then
echo "Be in anykernel dir"
exit 1
fi
configure
[ "$BUILD" = 1 ] && (build_image && build_modules && modules_install)
[ "$ANYKERNEL" = 1 ] && make_anykernel
# Build command
# BUILD=1 ANYKERNEL=1 ZIPPREFIX=test ./build.sh