From 7f0c788e9cc23800dffd6a021cfbd3504d45d4ce Mon Sep 17 00:00:00 2001 From: Sebastiano Barezzi Date: Sun, 17 Jan 2021 02:26:08 +0100 Subject: [PATCH] extract_utils: Implement versioned patchelf and patchelf 0.8 * Result of patchelf v0.9: E dlopen failed: "/vendor/lib64/libvendor.goodix.hardware.fingerprint@1.0-service.so" loaded phdr 0x70d4cd6000 not in loadable segment * While searching up this issue, I found a LineageOS Gerrit change (Ibeb09b6ec37ef62b6a5abe40bae1e8bd8d92e7af) with the same error * Hamsi2k mentioned in the change that patchelf v0.8 is needed to fix the issue * Building patchelf v0.8 and trying to patch the blobs works * Implement versioned patchelf logic, allowing the script to both select the default patchelf and a specific patchelf version only for some files * Leave 0.9 as the default version to not change the default behaviour Change-Id: I6c0cbe76baf241233fdd125f5ed1eccbd5855124 --- extract_utils.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/extract_utils.sh b/extract_utils.sh index b531d4d..53d926f 100644 --- a/extract_utils.sh +++ b/extract_utils.sh @@ -94,8 +94,19 @@ function setup_vendor() { VENDOR_RADIO_STATE=0 fi + export BINARIES_LOCATION="$ANDROID_ROOT"/prebuilts/extract-tools/${HOST}-x86/bin + + for version in 0_8 0_9; do + export PATCHELF_${version}="$BINARIES_LOCATION"/patchelf-"${version}" + done + + if [ -z "$PATCHELF_VERSION" ]; then + export PATCHELF_VERSION=0_9 + fi + if [ -z "$PATCHELF" ]; then - export PATCHELF="$ANDROID_ROOT"/prebuilts/extract-tools/${HOST}-x86/bin/patchelf + local patchelf_variable="PATCHELF_${PATCHELF_VERSION}" + export PATCHELF=${!patchelf_variable} fi }