| #!/bin/bash |
| FAST_BUILD=${FAST_BUILD:-1} |
| INTERNAL_BUILD=${INTERNAL_BUILD:-0} |
| |
| BUILD_PARAMETERS+="--config=kirkwood_64 " |
| |
| if [[ "${FAST_BUILD}" == "1" ]]; then |
| BUILD_PARAMETERS+="--config=stamp --config=fast " |
| else |
| BUILD_PARAMETERS+="--config=android_ci --lto=full " |
| fi |
| |
| if [[ "${INTERNAL_BUILD}" == "1" ]]; then |
| BUILD_PARAMETERS+="--//kernel_device_modules-5.15:internal_build " |
| fi |
| |
| if [[ -n "${BUILD_KASAN}" ]]; then |
| BUILD_PARAMETERS+="--config=kasan " |
| elif [[ -n "${BUILD_KHWASAN}" ]]; then |
| BUILD_PARAMETERS+="--config=khwasan " |
| fi |
| |
| BASE_BAZELRC_FILE="kernel_device_modules-5.15/device.bazelrc" |
| |
| USE_GKI=`grep "^build --config=download_gki" $BASE_BAZELRC_FILE || true` |
| NO_USE_GKI=`grep "^build --config=no_download_gki" $BASE_BAZELRC_FILE || true` |
| GKI_BUILD_ID=`sed -n 's/.*gki_prebuilts=\([0-9]\+\).*/\1/p' $BASE_BAZELRC_FILE` |
| |
| if [[ -n "${NO_USE_GKI}" ]]; then |
| echo "--config=no_download_gki detected in device.bazelrc; building with core-kernel generated from kernel-5.15/ source tree" |
| elif [[ "${BUILD_GKI_KERNEL}" == 1 ]]; then |
| echo "BUILD_GKI_KERNEL=1 detected on the command line; building with core-kernel generated from kernel-5.15/ source tree" |
| BUILD_PARAMETERS+="--config=no_download_gki " |
| elif [[ -n "${GKI_BUILD_ID}" ]] && [[ -n "${USE_GKI}" ]]; then |
| echo "Building with GKI prebuilts from ab/$GKI_BUILD_ID - kernel_aarch64" |
| else |
| echo "Please check $BASE_BAZELRC_FILE" |
| echo -e " 1) If BUILD_GKI_KERNEL=1 or \"build --config=no_download_gki\" ----> core kernel generated from kernel-5.15/ source tree" |
| echo -e " 2) If \"build --config=download_gki\" ----> core-kernel based on GKI prebuilts" |
| exit 1 |
| fi |
| |
| tools/bazel run ${BUILD_PARAMETERS} //kernel_device_modules-5.15:kirkwood_64_dist |