From cd4ca8caa755cb8e0949b8bef799057c5f0c08fb Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Thu, 17 Aug 2023 02:17:31 +0000 Subject: [PATCH] ANDROID: Prefer DTC from PATH. This reverts commit dc39b233fe84f42380c369aab733836edc914454, as well as fixing legacy usage from checkpatch_presbumit.sh. Reason for revert: relanding change This change deviates from 2a2cffe9e206 ("ANDROID: Use DTC from PATH.") to allow missing DTC because there may be usages that directly `source _setup_env.sh` without setting up PATH with Kleaf's hermetic tools. One such usage is the legacy checkpatch.sh and checkpatch_presubmit.sh. Below is the original commit message. ANDROID: Use DTC from PATH. Instead of using a hard-coded path to DTC, infer its path from PATH. This change removes the dependency on the ${BUILDTOOLS_PREBUILT_BIN}/dtc symlink, so the build infrastructure is free to reset PATH to a place where the actual DTC binary exists. This change is needed to set --incompatible_disable_hermetic_tools_symlink_source to true by default. Test: bazel run //common:db845c_dist Fixes: a71e480e82a7 ("ANDROID: build.config: Set DTC to absolute path") Fixes: 2a2cffe9e206 ("ANDROID: Use DTC from PATH.") Bug: 291816237 Bug: 296265825 Change-Id: Ibb1be6c2b8f2f9d8a09bdc2187d392925c082fe0 Signed-off-by: Yifan Hong --- build.config.common | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build.config.common b/build.config.common index 23bc83967a7f..df5a405cc2d4 100644 --- a/build.config.common +++ b/build.config.common @@ -4,7 +4,12 @@ LLVM=1 DEPMOD=depmod CLANG_PREBUILT_BIN=prebuilts/clang/host/linux-x86/clang-${CLANG_VERSION}/bin BUILDTOOLS_PREBUILT_BIN=build/kernel/build-tools/path/linux-x86 -DTC=${ROOT_DIR}/${BUILDTOOLS_PREBUILT_BIN}/dtc + +# TODO(b/296265825): Turn this into a proper error +DTC=$(command -v dtc || { echo "WARNING: $BUILD_CONFIG loaded without Kleaf hermetic tools. + This will become an error in the future." >&2; + echo "${ROOT_DIR}/${BUILDTOOLS_PREBUILT_BIN}/dtc"; +}) KCFLAGS="${KCFLAGS} -D__ANDROID_COMMON_KERNEL__" EXTRA_CMDS=''