Skip to content

Commit

Permalink
sdm845-common: 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 itz63c committed Apr 5, 2021
1 parent a8c2914 commit f9400c4
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 58 deletions.
75 changes: 36 additions & 39 deletions extract-files.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
#!/bin/bash
#
# Copyright (C) 2018-2019 The LineageOS Project
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017-2020 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 @@ -21,37 +12,31 @@ set -e
MY_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi

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

HELPER="${LINEAGE_ROOT}/vendor/lineage/build/tools/extract_utils.sh"
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}"

function blob_fixup() {
case "${1}" in
lib64/libwfdnative.so)
sed -i "s/[email protected]/libhidlbase.so\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00/" "${2}"
;;
product/lib/libdpmframework.so)
sed -i "s/libhidltransport.so/libcutils-v29.so\x00\x00\x00/" "${2}"
;;
product/lib64/libdpmframework.so)
sed -i "s/libhidltransport.so/libcutils-v29.so\x00\x00\x00/" "${2}"
;;
esac
}

# Default to sanitizing the vendor folder before extraction
CLEAN_VENDOR=true

SECTION=
ONLY_COMMON=
ONLY_TARGET=
KANG=
SECTION=

while [ "${#}" -gt 0 ]; do
case "${1}" in
--only-common )
ONLY_COMMON=true
;;
--only-target )
ONLY_TARGET=true
;;
-n | --no-cleanup )
CLEAN_VENDOR=false
;;
Expand All @@ -73,21 +58,33 @@ if [ -z "${SRC}" ]; then
SRC="adb"
fi

# Initialize the helper for common device
setup_vendor "${DEVICE_COMMON}" "${VENDOR}" "${LINEAGE_ROOT}" true "${CLEAN_VENDOR}"
function blob_fixup() {
case "${1}" in
lib64/libwfdnative.so)
sed -i "s/[email protected]/libhidlbase.so\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00/" "${2}"
;;
product/lib/libdpmframework.so)
sed -i "s/libhidltransport.so/libcutils-v29.so\x00\x00\x00/" "${2}"
;;
product/lib64/libdpmframework.so)
sed -i "s/libhidltransport.so/libcutils-v29.so\x00\x00\x00/" "${2}"
;;
esac
}

if [ -z "${ONLY_TARGET}" ]; then
# Initialize the helper for common device
setup_vendor "${DEVICE_COMMON}" "${VENDOR}" "${ANDROID_ROOT}" true "${CLEAN_VENDOR}"

extract "${MY_DIR}/proprietary-files.txt" "${SRC}" \
"${KANG}" --section "${SECTION}"
extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
fi

if [ -s "${MY_DIR}/../${DEVICE}/proprietary-files.txt" ]; then
if [ -z "${ONLY_COMMON}" ] && [ -s "${MY_DIR}/../${DEVICE}/proprietary-files.txt" ]; then
# Reinitialize the helper for device
source "${MY_DIR}/../${DEVICE}/extract-files.sh"
setup_vendor "${DEVICE}" "${VENDOR}" "${LINEAGE_ROOT}" false "${CLEAN_VENDOR}"
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}"

extract "${MY_DIR}/../${DEVICE}/proprietary-files.txt" "${SRC}" \
"${KANG}" --section "${SECTION}"
extract "${MY_DIR}/../${DEVICE}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
fi

COMMON_BLOB_ROOT="${LINEAGE_ROOT}/vendor/${VENDOR}/${DEVICE_COMMON}/proprietary"

"${MY_DIR}/setup-makefiles.sh"
28 changes: 9 additions & 19 deletions setup-makefiles.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
#!/bin/bash
#
# Copyright (C) 2018-2019 The LineageOS Project
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017-2020 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 @@ -21,19 +12,19 @@ set -e
MY_DIR="${BASH_SOURCE%/*}"
if [[ ! -d "${MY_DIR}" ]]; then MY_DIR="${PWD}"; fi

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

HELPER="${LINEAGE_ROOT}/vendor/statix/build/tools/extract_utils.sh"
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 for common
setup_vendor "${DEVICE_COMMON}" "${VENDOR}" "${LINEAGE_ROOT}" true
setup_vendor "${DEVICE_COMMON}" "${VENDOR}" "${ANDROID_ROOT}" true

# Copyright headers and guards
# Warning headers and guards
write_headers "enchilada fajita"

# The standard common blobs
Expand All @@ -44,10 +35,9 @@ write_footers

if [ -s "${MY_DIR}/../${DEVICE}/proprietary-files.txt" ]; then
# Reinitialize the helper for device
INITIAL_COPYRIGHT_YEAR="$DEVICE_BRINGUP_YEAR"
setup_vendor "${DEVICE}" "${VENDOR}" "${LINEAGE_ROOT}" false
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false

# Copyright headers and guards
# Warning headers and guards
write_headers

# The standard device blobs
Expand Down

0 comments on commit f9400c4

Please sign in to comment.