From f225404c6937376655f07884b5dd56acae2e5a29 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Mon, 4 Oct 2021 20:56:06 +0100 Subject: [PATCH] arm/hafnium: remove python symlink workaround Hafnium drops a python symlink into HOSTTOOLS_DIR, which is visible to all recipes, so building hafnium changes the build environment. Hafnium, since 6c63a26 (2.4 onwards), uses python3 in its own hashbangs. The prebuilt clang currently uses python hangbangs but this is fixed in git, and can be temporarily worked around with a patch instead. Signed-off-by: Ross Burton Signed-off-by: Jon Mason --- .../hafnium/hafnium/hashbang.patch | 34 +++++++++++++++++++ meta-arm/recipes-bsp/hafnium/hafnium_2.5.bb | 7 +--- 2 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 meta-arm/recipes-bsp/hafnium/hafnium/hashbang.patch diff --git a/meta-arm/recipes-bsp/hafnium/hafnium/hashbang.patch b/meta-arm/recipes-bsp/hafnium/hafnium/hashbang.patch new file mode 100644 index 00000000..af77e7c7 --- /dev/null +++ b/meta-arm/recipes-bsp/hafnium/hafnium/hashbang.patch @@ -0,0 +1,34 @@ +Update Clang hashbangs to call python3 instead of python, as that doesn't exist +in our hosttools. + +Upstream-Status: Backport [partial, fixed upstream] +Signed-off-by: Ross Burton + +diff --git a/linux-x64/clang/bin/clang b/prebuilts/linux-x64/clang/bin/clang +index 081cb20a..ce9cc267 100755 +--- a/prebuilts/linux-x64/clang/bin/clang ++++ b/prebuilts/linux-x64/clang/bin/clang +@@ -1 +1 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 +diff --git a/prebuilts/linux-x64/clang/bin/clang++ b/prebuilts/linux-x64/clang/bin/clang++ +index 081cb20a..ce9cc267 100755 +--- a/prebuilts/linux-x64/clang/bin/clang++ ++++ b/prebuilts/linux-x64/clang/bin/clang++ +@@ -1 +1 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 +diff --git a/prebuilts/linux-x64/clang/bin/clang-tidy b/prebuilts/linux-x64/clang/bin/clang-tidy +index 081cb20a..ce9cc267 100755 +--- a/prebuilts/linux-x64/clang/bin/clang-tidy ++++ b/prebuilts/linux-x64/clang/bin/clang-tidy +@@ -1 +1 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 +diff --git a/prebuilts/linux-x64/clang/bin/scan-view b/prebuilts/linux-x64/clang/bin/scan-view +index 6165432e..07effbca 100755 +--- a/prebuilts/linux-x64/clang/bin/scan-view ++++ b/prebuilts/linux-x64/clang/bin/scan-view +@@ -1 +1 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python3 diff --git a/meta-arm/recipes-bsp/hafnium/hafnium_2.5.bb b/meta-arm/recipes-bsp/hafnium/hafnium_2.5.bb index 9f05b725..595f53c9 100644 --- a/meta-arm/recipes-bsp/hafnium/hafnium_2.5.bb +++ b/meta-arm/recipes-bsp/hafnium/hafnium_2.5.bb @@ -8,6 +8,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" inherit deploy python3native pkgconfig SRC_URI = "gitsm://git.trustedfirmware.org/hafnium/hafnium.git;protocol=https \ + file://hashbang.patch \ file://pkg-config-native.patch" SRCREV = "3a149eb219467c0d9336467ea1fb9d3fb65da94b" S = "${WORKDIR}/git" @@ -33,12 +34,6 @@ DEPENDS = "bison-native bc-native openssl-native" # set project to build EXTRA_OEMAKE += "PROJECT=${HAFNIUM_PROJECT}" -do_compile:prepend() { - # Hafnium expects 'python'. Create symlink python to python3 - real=$(which ${PYTHON}) - ln -snf $real $(dirname $real)/python -} - do_install() { install -d -m 755 ${D}/firmware for bldfile in ${HAFNIUM_INSTALL_TARGET}; do