Commit | Line | Data |
---|---|---|
0ece9c09 JA |
1 | #!/bin/bash |
2 | # | |
81e4f80c | 3 | # Copyright (C) 2016 The CyanogenMod Project |
0ece9c09 JA |
4 | # Copyright (C) 2017-2020 The LineageOS Project |
5 | # | |
81e4f80c | 6 | # SPDX-License-Identifier: Apache-2.0 |
0ece9c09 JA |
7 | # |
8 | ||
9 | set -e | |
10 | ||
0ece9c09 | 11 | DEVICE_COMMON=exynos9610-common |
81e4f80c | 12 | VENDOR=motorola |
0ece9c09 JA |
13 | |
14 | # Load extract_utils and do some sanity checks | |
15 | MY_DIR="${BASH_SOURCE%/*}" | |
16 | if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi | |
17 | ||
81e4f80c | 18 | ANDROID_ROOT="${MY_DIR}/../../.." |
0ece9c09 | 19 | |
81e4f80c | 20 | HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh" |
0ece9c09 JA |
21 | if [ ! -f "${HELPER}" ]; then |
22 | echo "Unable to find helper script at ${HELPER}" | |
23 | exit 1 | |
24 | fi | |
25 | source "${HELPER}" | |
26 | ||
81e4f80c MB |
27 | # Default to sanitizing the vendor folder before extraction |
28 | CLEAN_VENDOR=true | |
29 | ||
0ece9c09 | 30 | KANG= |
81e4f80c | 31 | SECTION= |
0ece9c09 JA |
32 | |
33 | while [ "${#}" -gt 0 ]; do | |
34 | case "${1}" in | |
35 | -n | --no-cleanup ) | |
36 | CLEAN_VENDOR=false | |
37 | ;; | |
38 | -k | --kang ) | |
39 | KANG="--kang" | |
40 | ;; | |
41 | -s | --section ) | |
42 | SECTION="${2}"; shift | |
43 | CLEAN_VENDOR=false | |
44 | ;; | |
45 | * ) | |
46 | SRC="${1}" | |
47 | ;; | |
48 | esac | |
49 | shift | |
50 | done | |
51 | ||
52 | if [ -z "${SRC}" ]; then | |
53 | SRC="adb" | |
54 | fi | |
55 | ||
56 | # Initialize the helper | |
81e4f80c | 57 | setup_vendor "${DEVICE_COMMON}" "${VENDOR}" "${ANDROID_ROOT}" true "${CLEAN_VENDOR}" |
0ece9c09 | 58 | |
81e4f80c MB |
59 | extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}" |
60 | extract "${MY_DIR}/proprietary-files-vendor.txt" "${SRC}" "${KANG}" --section "${SECTION}" | |
b6ba0b29 | 61 | |
7ec08a55 | 62 | # Fix proprietary blobs |
74adaccc | 63 | BLOB_ROOT="${ANDROID_ROOT}"/vendor/"${VENDOR}"/"${DEVICE_COMMON}"/proprietary |
ade67098 | 64 | |
74adaccc | 65 | "${PATCHELF}" --replace-needed "libmedia.so" "libmedia_ims.so" "${BLOB_ROOT}"/lib64/libmediaadaptor.so |
ade67098 | 66 | |
74adaccc NJ |
67 | for LIBAUDIOPROXY_SHIM in $(grep -L "libaudioproxy_shim.so" "${BLOB_ROOT}"/vendor/lib/libaudioproxy.so); do |
68 | "${PATCHELF}" --add-needed libaudioproxy_shim.so "${LIBAUDIOPROXY_SHIM}" | |
ade67098 | 69 | done |
74adaccc NJ |
70 | for LIBMEMSET in $(grep -L "libmemset.so" "${BLOB_ROOT}"/vendor/bin/charge_only_mode); do |
71 | "${PATCHELF}" --add-needed "libmemset.so" "${LIBMEMSET}" | |
ade67098 | 72 | done |
74adaccc NJ |
73 | for LIBDEMANGLE in $(grep -L "libdemangle.so" "${BLOB_ROOT}"/vendor/lib/libhifills.so); do |
74 | "${PATCHELF}" --add-needed "libdemangle.so" "${LIBDEMANGLE}" | |
ade67098 | 75 | done |
74adaccc NJ |
76 | for LIBDEMANGLE64 in $(grep -L "libdemangle.so" "${BLOB_ROOT}"/vendor/lib64/libhifills.so); do |
77 | "${PATCHELF}" --add-needed "libdemangle.so" "${LIBDEMANGLE64}" | |
ade67098 | 78 | done |
7ec08a55 | 79 | |
dd26fd11 | 80 | # Remove libhidltransport dependency |
74adaccc NJ |
81 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/bin/hw/android.hardware.biometrics.fingerprint@2.1-service-rbs |
82 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/bin/hw/android.hardware.drm@1.2-service.widevine | |
83 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/bin/hw/android.hardware.secure_element@1.1-service-uicc | |
84 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/bin/hw/vendor.samsung.hardware.gnss@1.0-service | |
85 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib/hw/vendor.egistec.hardware.fingerprint@4.0-impl.so | |
86 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib/libGrallocWrapper.so | |
87 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib/libsitril-client.so | |
88 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib/libwvhidl.so | |
89 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib/vendor.egistec.hardware.fingerprint@4.0.so | |
90 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib/vendor.samsung_slsi.telephony.hardware.oemservice@1.0.so | |
91 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib/vendor.samsung_slsi.telephony.hardware.radio@1.0.so | |
92 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib/vendor.samsung_slsi.telephony.hardware.radio@1.1.so | |
93 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib/vendor.samsung_slsi.telephony.hardware.radioExternal@1.0.so | |
94 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib64/hw/android.hardware.gnss@1.0-impl.samsung.so | |
95 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib64/hw/android.hardware.gnss@1.1-impl.samsung.so | |
96 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib64/hw/android.hardware.gnss@2.0-impl.samsung.so | |
97 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib64/hw/vendor.egistec.hardware.fingerprint@4.0-impl.so | |
98 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib64/hw/vendor.samsung.hardware.gnss@1.0-impl.so | |
99 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib64/libGrallocWrapper.so | |
100 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib64/libsitril-client.so | |
101 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib64/vendor.egistec.hardware.fingerprint@4.0.so | |
102 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib64/vendor.samsung.hardware.gnss@1.0.so | |
103 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib64/vendor.samsung_slsi.telephony.hardware.oemservice@1.0.so | |
104 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib64/vendor.samsung_slsi.telephony.hardware.radio@1.0.so | |
105 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib64/vendor.samsung_slsi.telephony.hardware.radio@1.1.so | |
106 | "${PATCHELF}" --remove-needed "libhidltransport.so" "${BLOB_ROOT}"/vendor/lib64/vendor.samsung_slsi.telephony.hardware.radioExternal@1.0.so | |
dd26fd11 JA |
107 | |
108 | # Remove libhwbinder dependency | |
74adaccc NJ |
109 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/bin/hw/android.hardware.drm@1.2-service.widevine |
110 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/bin/hw/android.hardware.secure_element@1.1-service-uicc | |
111 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/lib/libsitril-client.so | |
112 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/lib/libwvhidl.so | |
113 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/lib/vendor.egistec.hardware.fingerprint@4.0.so | |
114 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/lib/vendor.samsung_slsi.telephony.hardware.oemservice@1.0.so | |
115 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/lib/vendor.samsung_slsi.telephony.hardware.radio@1.0.so | |
116 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/lib/vendor.samsung_slsi.telephony.hardware.radio@1.1.so | |
117 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/lib/vendor.samsung_slsi.telephony.hardware.radioExternal@1.0.so | |
118 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/lib64/hw/android.hardware.gnss@1.0-impl.samsung.so | |
119 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/lib64/hw/android.hardware.gnss@1.1-impl.samsung.so | |
120 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/lib64/hw/android.hardware.gnss@2.0-impl.samsung.so | |
121 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/lib64/hw/vendor.samsung.hardware.gnss@1.0-impl.so | |
122 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/lib64/libsitril-client.so | |
123 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/lib64/vendor.egistec.hardware.fingerprint@4.0.so | |
124 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/lib64/vendor.samsung.hardware.gnss@1.0.so | |
125 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/lib64/vendor.samsung_slsi.telephony.hardware.oemservice@1.0.so | |
126 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/lib64/vendor.samsung_slsi.telephony.hardware.radio@1.0.so | |
127 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/lib64/vendor.samsung_slsi.telephony.hardware.radio@1.1.so | |
128 | "${PATCHELF}" --remove-needed "libhwbinder.so" "${BLOB_ROOT}"/vendor/lib64/vendor.samsung_slsi.telephony.hardware.radioExternal@1.0.so | |
129 | ||
130 | "${PATCHELF}" --replace-needed libprotobuf-cpp-lite.so libprotobuf-cpp-lite-v29.so "${BLOB_ROOT}"/vendor/lib/libwvhidl.so | |
96e9b134 | 131 | |
0ece9c09 | 132 | "${MY_DIR}/setup-makefiles.sh" |