Skip to content

Commit

Permalink
hlte: Switch to standalone extract utils
Browse files Browse the repository at this point in the history
* Align with templates while we are at it

Change-Id: Ife50623a3d1b8733f5cc76995c982d8950d39ad4
  • Loading branch information
mikeNG authored and haggertk committed Feb 8, 2021
1 parent 7dcd3f8 commit a24e365
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 31 deletions.
62 changes: 44 additions & 18 deletions extract-files.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
#!/bin/bash
#
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017-2020 The LineageOS Project
# Copyright (C) 2017-2021 The LineageOS Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# SPDX-License-Identifier: Apache-2.0
#

set -e
Expand All @@ -22,14 +12,50 @@ export DEVICE=hlte
export DEVICE_COMMON=hlte-common
export VENDOR=samsung

./../$DEVICE_COMMON/extract-files.sh $@
function blob_fixup() {
case "${1}" in
vendor/lib/libsec-ril.*)
"${PATCHELF}" --replace-needed libcutils.so libcutils-v29.so "${2}"
;;
esac
}

# Load extract_utils and do some sanity checks
MY_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi
if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi

ANDROID_ROOT="${MY_DIR}/../../.."

HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh"
if [ ! -f "${HELPER}" ]; then
echo "Unable to find helper script at ${HELPER}"
exit 1
fi
source "${HELPER}"

CM_ROOT="$MY_DIR"/../../..
DEVICE_BLOB_ROOT="$CM_ROOT"/vendor/"$VENDOR"/"$DEVICE"/proprietary
if [ $# -eq 0 ]; then
SRC=adb
else
if [ $# -eq 1 ]; then
SRC=$1
else
echo "$0: bad number of arguments"
echo ""
echo "usage: $0 [PATH_TO_EXPANDED_ROM]"
echo ""
echo "If PATH_TO_EXPANDED_ROM is not specified, blobs will be extracted from"
echo "the device using adb pull."
exit 1
fi
fi
export SRC

for f in "$DEVICE_BLOB_ROOT"/vendor/lib/libsec-ril.*; do
patchelf --replace-needed libcutils.so libcutils-v29.so "$f"
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false

for BLOB_LIST in "${MY_DIR}"/device-proprietary-files*.txt; do
extract "${BLOB_LIST}" "${SRC}"
done

"./../../${VENDOR}/${DEVICE_COMMON}/extract-files.sh" "$@"

"${MY_DIR}/setup-makefiles.sh"
42 changes: 29 additions & 13 deletions setup-makefiles.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
#!/bin/bash
#
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017 The LineageOS Project
# Copyright (C) 2017-2021 The LineageOS Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# SPDX-License-Identifier: Apache-2.0
#

set -e
Expand All @@ -22,4 +12,30 @@ export DEVICE=hlte
export DEVICE_COMMON=hlte-common
export VENDOR=samsung

./../$DEVICE_COMMON/setup-makefiles.sh $@
# Load extract_utils and do some sanity checks
MY_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi

ANDROID_ROOT="${MY_DIR}/../../.."

HELPER="${ANDROID_ROOT}/tools/extract-utils/extract_utils.sh"
if [ ! -f "${HELPER}" ]; then
echo "Unable to find helper script at ${HELPER}"
exit 1
fi
source "${HELPER}"

# Initialize the helper
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}"

# Warning headers and guards
write_headers

for BLOB_LIST in "${MY_DIR}"/device-proprietary-files*.txt; do
write_makefiles "${BLOB_LIST}" true
done

# Finish
write_footers

"./../../${VENDOR}/${DEVICE_COMMON}/setup-makefiles.sh" "$@"

0 comments on commit a24e365

Please sign in to comment.