From fb6b87d9e004fd14400020cb1b383d47cafc9242 Mon Sep 17 00:00:00 2001 From: Simon1511 Date: Sat, 14 Jan 2023 15:06:31 +0100 Subject: [PATCH] sm7125-common: Fully redo extract-files and setup-makesfiles scripts So that they actually extract the common blobs too... Change-Id: I73bd0e51b95f9dbb402b585d22cdc17c734d24cb --- extract-files.sh | 41 +++++++++++++++++++++++++++-------------- setup-makefiles.sh | 36 ++++++++++++++++++++---------------- 2 files changed, 47 insertions(+), 30 deletions(-) diff --git a/extract-files.sh b/extract-files.sh index 862341d..1fe6a80 100755 --- a/extract-files.sh +++ b/extract-files.sh @@ -1,18 +1,16 @@ #!/bin/bash # -# Copyright (C) 2018-2020 The LineageOS Project +# Copyright (C) 2016 The CyanogenMod Project +# Copyright (C) 2017-2020 The LineageOS Project # # SPDX-License-Identifier: Apache-2.0 # set -e -DEVICE_COMMON=sm7125-common -VENDOR=samsung - -# Load extractutils and do some sanity checks +# 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}/../../.." @@ -26,11 +24,19 @@ source "${HELPER}" # Default to sanitizing the vendor folder before extraction CLEAN_VENDOR=true +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 ;; @@ -52,14 +58,6 @@ if [ -z "${SRC}" ]; then SRC="adb" fi -# Initialize the helper -setup_vendor "${DEVICE_COMMON}" "${VENDOR}" "${ANDROID_ROOT}" true "${CLEAN_VENDOR}" - -extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}" - -# Fix proprietary blobs -BLOB_ROOT="$ANDROID_ROOT"/vendor/"$VENDOR"/"$DEVICE_COMMON"/proprietary - function blob_fixup() { case "${1}" in vendor/lib64/libsec-ril.so) @@ -75,4 +73,19 @@ function blob_fixup() { 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}" +fi + +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}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}" + + extract "${MY_DIR}/../${DEVICE}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}" +fi + "${MY_DIR}/setup-makefiles.sh" diff --git a/setup-makefiles.sh b/setup-makefiles.sh index c9b24d3..15989be 100755 --- a/setup-makefiles.sh +++ b/setup-makefiles.sh @@ -1,18 +1,16 @@ #!/bin/bash # -# Copyright (C) 2017-2021 The LineageOS Project +# Copyright (C) 2016 The CyanogenMod Project +# Copyright (C) 2017-2023 The LineageOS Project # # SPDX-License-Identifier: Apache-2.0 # set -e -DEVICE_COMMON=sm7125-common -VENDOR=samsung - -# Load extractutils and do some sanity checks +# 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}/../../.." @@ -23,22 +21,28 @@ if [ ! -f "${HELPER}" ]; then fi source "${HELPER}" -# Initialize the helper +# Initialize the helper for common setup_vendor "${DEVICE_COMMON}" "${VENDOR}" "${ANDROID_ROOT}" true # Warning headers and guards write_headers "a52q a72q" +# The standard common blobs write_makefiles "${MY_DIR}/proprietary-files.txt" true -################################################################################################### -# CUSTOM PART START # -################################################################################################### +# Finish +write_footers -OUTDIR=vendor/$VENDOR/$DEVICE_COMMON +if [ -s "${MY_DIR}/../${DEVICE}/proprietary-files.txt" ]; then + # Reinitialize the helper for device + setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false -################################################################################################### -# CUSTOM PART END # -################################################################################################### -# Done -write_footers + # Warning headers and guards + write_headers + + # The standard device blobs + write_makefiles "${MY_DIR}/../${DEVICE}/proprietary-files.txt" true + + # Finish + write_footers +fi