blob: aa050aac32628ccb459ede1d910abb2ca6e3d197 [file] [log] [blame]
micky38718f07ac2019-06-10 00:40:50 +02001#!/bin/bash
2#
3# Copyright (C) 2016 The CyanogenMod Project
4# (C) 2018 The Omnirom Project
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
18
19set -e
20
micky38718765c82022-11-03 12:51:36 +010021DEVICE=zenfone9
micky38718f07ac2019-06-10 00:40:50 +020022VENDOR=asus
23
24# Load extractutils and do some sanity checks
25MY_DIR="${BASH_SOURCE%/*}"
26if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi
27
28CM_ROOT="$MY_DIR"/../../..
29
30HELPER="$CM_ROOT"/vendor/omni/build/tools/extract_utils.sh
31if [ ! -f "$HELPER" ]; then
32 echo "Unable to find helper script at $HELPER"
33 exit 1
34fi
35. "$HELPER"
36
37# Default to sanitizing the vendor folder before extraction
38CLEAN_VENDOR=true
39
40while [ "$1" != "" ]; do
41 case $1 in
42 -p | --path ) shift
43 SRC=$1
44 ;;
45 -s | --section ) shift
46 SECTION=$1
47 CLEAN_VENDOR=false
48 ;;
49 -n | --no-cleanup ) CLEAN_VENDOR=false
50 ;;
51 esac
52 shift
53done
54
55if [ -z "$SRC" ]; then
56 SRC=adb
57fi
58
micky3876e3fa0b2021-05-26 02:40:00 +020059function blob_fixup() {
60 case "${1}" in
61 # Fix xml version
62 system_ext/etc/permissions/vendor.qti.hardware.data.connection-V1.0-java.xml | system_ext/etc/permissions/vendor.qti.hardware.data.connection-V1.1-java.xml)
63 sed -i 's|product|system_ext|g' "${2}"
64 sed -i 's|xml version="2.0"|xml version="1.0"|g' "${2}"
micky387f68cb0f2023-01-04 11:57:42 +010065 ;;
Lucchettobe1d7a62022-08-19 10:39:47 +020066 vendor/lib64/libvendor.goodix.hardware.biometrics.fingerprint@2.1.so)
67 "${PATCHELF}" --remove-needed "libhidlbase.so" "${2}"
68 sed -i "s/libhidltransport.so/libhidlbase-v32.so\x00/" "${2}"
micky3876e3fa0b2021-05-26 02:40:00 +020069 ;;
Markus Ornik2fa56992023-11-01 22:17:38 +010070 vendor/bin/hw/android.hardware.security.keymint-service-qti)
71 "${PATCHELF}" --add-needed android.hardware.security.rkp-V1-ndk.so "${2}"
72 ;;
Anay Wadherad1eebba2023-02-20 19:50:21 -050073 vendor/lib64/libQnnGpu.so)
micky38759894702023-11-02 17:14:05 +010074 "${CM_ROOT}"/prebuilts/clang/host/linux-x86/clang-r487747c/bin/llvm-strip "${2}"
Anay Wadherad1eebba2023-02-20 19:50:21 -050075 ;;
micky3876e3fa0b2021-05-26 02:40:00 +020076 esac
77}
78
micky38718f07ac2019-06-10 00:40:50 +020079# Initialize the helper
80setup_vendor "$DEVICE" "$VENDOR" "$CM_ROOT" false "$CLEAN_VENDOR"
81
micky38712a59b72019-11-30 14:03:51 +010082extract "$MY_DIR"/proprietary-files-product.txt "$SRC" "$SECTION"
micky387009b31a2022-01-20 18:48:41 +010083extract "$MY_DIR"/proprietary-files-vendor.txt "$SRC" "$SECTION"
micky38718f07ac2019-06-10 00:40:50 +020084extract "$MY_DIR"/proprietary-files.txt "$SRC" "$SECTION"
85
86"$MY_DIR"/setup-makefiles.sh