blob: 2b75b3d947b608808ef12e84cc67bf4416d150c8 [file] [log] [blame]
Vishalcj17cfcfee22020-07-19 17:37:39 +05301#!/bin/bash
2#
3# Copyright (C) 2020 Paranoid Android
4#
5# SPDX-License-Identifier: Apache-2.0
6#
7
8set -e
9
10DEVICE=laurel_sprout
11VENDOR=xiaomi
12
13# Load extract_utils and do some sanity checks
14MY_DIR="${BASH_SOURCE%/*}"
15if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi
16
17PA_ROOT="${MY_DIR}/../../.."
18
19HELPER="${PA_ROOT}/vendor/pa/build/tools/extract_utils.sh"
20if [ ! -f "${HELPER}" ]; then
21 echo "Unable to find helper script at ${HELPER}"
22 exit 1
23fi
24source "${HELPER}"
25
26# Default to sanitizing the vendor folder before extraction
27CLEAN_VENDOR=true
28SECTION=
29KANG=
30
31while [ "$1" != "" ]; do
32 case "$1" in
33 -n | --no-cleanup ) CLEAN_VENDOR=false
34 ;;
35 -k | --kang) KANG="--kang"
36 ;;
37 -s | --section ) shift
38 SECTION="$1"
39 CLEAN_VENDOR=false
40 ;;
41 * ) SRC="$1"
42 ;;
43 esac
44 shift
45done
46
47if [ -z "${SRC}" ]; then
48 SRC=adb
49fi
50
51function blob_fixup() {
52 case "${1}" in
53 vendor/bin/hw/vendor.qti.hardware.scve.panorama@1.0-service | vendor/bin/hw/vendor.qti.hardware.scve.objecttracker@1.0-service | vendor/lib/hw/camera.trinket.so | lib64/libwfdnative.so | vendor/lib/vendor.qti.hardware.scve.objecttracker@1.0-halimpl.so | vendor/lib/vendor.qti.hardware.scve.panorama@1.0-halimpl.so | vendor/bin/hw/vendor.display.color@1.0-service )
54 sed -i "s/android.hidl.base@1.0.so/libhidlbase.so\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00/" "${2}"
55 ;;
56 esac
57}
58
59# Initialize the helper
60setup_vendor "${DEVICE}" "${VENDOR}" "${PA_ROOT}" false "${CLEAN_VENDOR}"
61
62extract "${MY_DIR}/proprietary-files.txt" "${SRC}" ${KANG} --section "${SECTION}"
63
64"${MY_DIR}/setup-makefiles.sh"