build.config: Fixing legacy dtc build

When building with legacy build.sh, the host dtc tools are not
generated due to a faulty logic check.

Fix the logic check and make the build environment explicit.

Change-Id: Id4f58fd812f3135379f47a22025f3030ecf68b58
Signed-off-by: John Moon <quic_johmoo@quicinc.com>
This commit is contained in:
John Moon 2022-11-07 16:52:34 -08:00
parent 4579ad4b9d
commit 87e3484a2c
2 changed files with 16 additions and 2 deletions

View file

@ -18,11 +18,12 @@ CONFIG_TARGET=msm.${MSM_ARCH}
##
function compile_external_dtc() {
(
OUT_DIR=${COMMON_OUT_DIR}/external/dtc
if [ ! -d "$OUT_DIR" ]; then
# Bazel builds dtc with its own rule, so skip if building with Bazel
if [ -n "$BUILDING_WITH_BAZEL" ]; then
return
fi
OUT_DIR=${COMMON_OUT_DIR}/external/dtc
[ "${SKIP_MRPROPER}" != "1" ] && rm -rf ${OUT_DIR}
cd ${ROOT_DIR}/external/dtc
DTC_MAKE_ARGS=("CC=${HOSTCC}" "AR=${AR}")

View file

@ -39,6 +39,18 @@ def define_build_config(
variant: variant of kernel to build (e.g. "gki")
"""
# Top-level variables set in build.config
native.genrule(
name = "{}_top_level_config".format(target),
srcs = [],
outs = ["build.config.bazel.top.level.{}".format(target)],
cmd_bash = """
{
echo BUILDING_WITH_BAZEL=true
} > "$@"
"""
)
# Remove sourcing lines from build config since we're just concatenating fragments below
native.genrule(
name = "{}_build_config_common_without_source".format(target),
@ -93,6 +105,7 @@ EOF
name = "{}_build_config".format(target),
srcs = [
# do not sort
":{}_top_level_config".format(target),
"build.config.constants",
":{}_build_config_common_without_source".format(target),
"build.config.aarch64",