-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·64 lines (55 loc) · 1.85 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
# SPDX-License-Identifier: GPL-2.0
#!/bin/bash
set -e
DEVICE_MODULES_DIR=$(basename $(dirname $0))
source "${DEVICE_MODULES_DIR}/kernel/kleaf/_setup_env.sh"
# run kleaf commands or legacy build.sh
result=$(echo ${KLEAF_SUPPORTED_PROJECTS} | grep -wo ${PROJECT}) || result=""
if [[ ${result} != "" ]]
then # run kleaf commands
build_scope=internal
if [ ! -d "vendor/mediatek/tests/kernel" ]
then
build_scope=customer
fi
if [ -z ${TARGET} ]
then
TARGET=${build_scope}_modules_install
KLEAF_BUILD_TARGET=//${DEVICE_MODULES_DIR}:${PROJECT}_${TARGET}.${MODE}
else
KLEAF_BUILD_TARGET=${TARGET}.${MODE}
fi
KLEAF_DIST_TARGET=//${DEVICE_MODULES_DIR}:${PROJECT}_${build_scope}_dist.${MODE}
KLEAF_OUT=("--output_user_root=${OUT_DIR} --output_base=${OUT_DIR}/bazel/output_user_root/output_base")
KLEAF_ARGS=("${DEBUG_ARGS} ${SANDBOX_ARGS} \
--experimental_writable_outputs \
--noenable_bzlmod \
--//build/bazel_mgk_rules:kernel_version=${KERNEL_VERSION_NUM}")
set -x
(
tools/bazel ${KLEAF_OUT} build ${KLEAF_ARGS} ${KLEAF_BUILD_TARGET}
tools/bazel ${KLEAF_OUT} run ${KLEAF_ARGS} \
--nokmi_symbol_list_violations_check ${KLEAF_DIST_TARGET} -- --dist_dir=${OUT_DIR}/dist
)
set +x
if [[ ${MODE} == "user" && ${KLEAF_GKI_CHECKER} != "no" ]]
then
KLEAF_GKI_CHECKER_COMMANDS=("${KLEAF_GKI_CHECKER_COMMANDS} \
-m ${OUT_DIR}/dist/${DEVICE_MODULES_DIR}/${PROJECT}_kernel_aarch64.${MODE}/vmlinux")
set -x
(
${KLEAF_GKI_CHECKER_COMMANDS} -o file
${KLEAF_GKI_CHECKER_COMMANDS} -o config
${KLEAF_GKI_CHECKER_COMMANDS} -o symbol
)
set +x
fi
else # run legacy build.sh
set -x
(
OUT_DIR=${OUT_DIR} python ${DEVICE_MODULES_DIR}/scripts/gen_build_config.py -p ${PROJECT} \
-o ${BUILD_CONFIG}.legacy -m ${MODE} --kernel-defconfig-overlays "${DEFCONFIG_OVERLAYS}"
OUT_DIR=${OUT_DIR} BUILD_CONFIG=${BUILD_CONFIG}.legacy CC_WRAPPER=${CC_WRAPPER} build/build.sh
)
set +x
fi