blob: 45e511a1d430b2e256451581574ef4d75112bb1e [file] [log] [blame]
Michael Bestas411537b2020-12-28 00:58:46 +02001#!/bin/bash
2#
3# Copyright (C) 2016 The CyanogenMod Project
Michael Bestasbfccf732022-02-22 19:22:26 +02004# Copyright (C) 2017-2023 The LineageOS Project
Michael Bestas411537b2020-12-28 00:58:46 +02005#
6# SPDX-License-Identifier: Apache-2.0
7#
8
9set -e
10
Michael Bestas10374532023-08-29 19:41:38 +030011DEVICE=FP5
merothhfb168c82022-01-02 18:18:04 +053012VENDOR=fairphone
Michael Bestas411537b2020-12-28 00:58:46 +020013
14# Load extract_utils and do some sanity checks
15MY_DIR="${BASH_SOURCE%/*}"
16if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi
17
18ANDROID_ROOT="${MY_DIR}/../../.."
19
20HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh"
21if [ ! -f "${HELPER}" ]; then
22 echo "Unable to find helper script at ${HELPER}"
23 exit 1
24fi
25source "${HELPER}"
26
27# Default to sanitizing the vendor folder before extraction
28CLEAN_VENDOR=true
29
30KANG=
31SECTION=
32
33while [ "${#}" -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
50done
51
52if [ -z "${SRC}" ]; then
53 SRC="adb"
54fi
55
56function blob_fixup() {
57 case "${1}" in
Michael Bestasc3ad1cd2023-10-03 15:27:40 +030058 system_ext/lib64/libwfdnative.so)
59 sed -i "s/android.hidl.base@1.0.so/libhidlbase.so\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00/" "${2}"
60 ;;
Rohit Sekhar28647462023-09-10 13:31:18 +053061 vendor/etc/libnfc-hal-st.conf)
62 sed -i 's|STNFC_HAL_LOGLEVEL=.*|STNFC_HAL_LOGLEVEL=0x12|g' "${2}"
63 ;;
Michael Bestas44ac4172022-03-23 23:38:31 +020064 vendor/lib64/vendor.qti.hardware.camera.postproc@1.0-service-impl.bitra.so)
65 "${SIGSCAN}" -p "13 0a 00 94" -P "1F 20 03 D5" -f "${2}"
Michael Bestas411537b2020-12-28 00:58:46 +020066 ;;
Rohit94dd9982023-04-14 13:07:34 +053067 vendor/lib64/hw/fingerprint.lito.so)
68 sed -i 's|fpsensor_fingerprint\x00|fingerprint\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|g' "${2}"
Michael Bestas83205722024-05-10 00:41:53 +030069 sed -i 's|persist.dev.fp_log_level|persist.odm.fp_log_level|g' "${2}"
Rohit94dd9982023-04-14 13:07:34 +053070 ;;
Michael Bestas411537b2020-12-28 00:58:46 +020071 esac
72}
73
74# Initialize the helper
75setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}"
76
77extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
78
Michael Bestasbfccf732022-02-22 19:22:26 +020079if [ -z "${SECTION}" ]; then
80 extract_firmware "${MY_DIR}/proprietary-firmware.txt" "${SRC}"
81fi
82
Michael Bestas411537b2020-12-28 00:58:46 +020083"${MY_DIR}/setup-makefiles.sh"