diff --git a/templates/multi-device/common/extract-files.sh b/templates/multi-device/common/extract-files.sh index 510e636..e54127f 100755 --- a/templates/multi-device/common/extract-files.sh +++ b/templates/multi-device/common/extract-files.sh @@ -1,7 +1,7 @@ #!/bin/bash # # Copyright (C) 2016 The CyanogenMod Project -# Copyright (C) 2017-2020 The LineageOS Project +# Copyright (C) 2017-2023 The LineageOS Project # # SPDX-License-Identifier: Apache-2.0 # @@ -69,6 +69,18 @@ function blob_fixup() { esac } +function prepare_firmware() { + if [ "${SRC}" != "adb" ]; then + local STAR="${ANDROID_ROOT}"/lineage/scripts/motorola/star.sh + for IMAGE in bootloader radio; do + if [ -f "${SRC}/${IMAGE}.img" ]; then + echo "Extracting Motorola star image ${SRC}/${IMAGE}.img" + sh "${STAR}" "${SRC}/${IMAGE}.img" "${SRC}" + fi + done + fi +} + if [ -z "${ONLY_TARGET}" ]; then # Initialize the helper for common device setup_vendor "${DEVICE_COMMON}" "${VENDOR_COMMON:-$VENDOR}" "${ANDROID_ROOT}" true "${CLEAN_VENDOR}" @@ -82,6 +94,10 @@ if [ -z "${ONLY_COMMON}" ] && [ -s "${MY_DIR}/../../${VENDOR}/${DEVICE}/propriet setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}" extract "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}" + + if [ -z "${SECTION}" ] && [ -f "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-firmware.txt" ]; then + extract_firmware "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-firmware.txt" "${SRC}" + fi fi "${MY_DIR}/setup-makefiles.sh" diff --git a/templates/multi-device/common/setup-makefiles.sh b/templates/multi-device/common/setup-makefiles.sh index 867f888..f3a826e 100755 --- a/templates/multi-device/common/setup-makefiles.sh +++ b/templates/multi-device/common/setup-makefiles.sh @@ -1,7 +1,7 @@ #!/bin/bash # # Copyright (C) 2016 The CyanogenMod Project -# Copyright (C) 2017-2020 The LineageOS Project +# Copyright (C) 2017-2023 The LineageOS Project # # SPDX-License-Identifier: Apache-2.0 # @@ -43,6 +43,10 @@ if [ -s "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-files.txt" ]; then # The standard device blobs write_makefiles "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-files.txt" true + if [ -f "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-firmware.txt" ]; then + append_firmware_calls_to_makefiles "${MY_DIR}/../../${VENDOR}/${DEVICE}/proprietary-firmware.txt" + fi + # Finish write_footers fi diff --git a/templates/single-device/extract-files.sh b/templates/single-device/extract-files.sh index 6c27121..0945e7a 100755 --- a/templates/single-device/extract-files.sh +++ b/templates/single-device/extract-files.sh @@ -1,7 +1,7 @@ #!/bin/bash # # Copyright (C) 2016 The CyanogenMod Project -# Copyright (C) 2017-2020 The LineageOS Project +# Copyright (C) 2017-2023 The LineageOS Project # # SPDX-License-Identifier: Apache-2.0 # @@ -71,9 +71,25 @@ function blob_fixup() { esac } +function prepare_firmware() { + if [ "${SRC}" != "adb" ]; then + local STAR="${ANDROID_ROOT}"/lineage/scripts/motorola/star.sh + for IMAGE in bootloader radio; do + if [ -f "${SRC}/${IMAGE}.img" ]; then + echo "Extracting Motorola star image ${SRC}/${IMAGE}.img" + sh "${STAR}" "${SRC}/${IMAGE}.img" "${SRC}" + fi + done + fi +} + # Initialize the helper setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}" extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}" +if [ -z "${SECTION}" ]; then + extract_firmware "${MY_DIR}/proprietary-firmware.txt" "${SRC}" +fi + "${MY_DIR}/setup-makefiles.sh" diff --git a/templates/single-device/setup-makefiles.sh b/templates/single-device/setup-makefiles.sh index 671b408..5fbf801 100755 --- a/templates/single-device/setup-makefiles.sh +++ b/templates/single-device/setup-makefiles.sh @@ -1,7 +1,7 @@ #!/bin/bash # # Copyright (C) 2016 The CyanogenMod Project -# Copyright (C) 2017-2020 The LineageOS Project +# Copyright (C) 2017-2023 The LineageOS Project # # SPDX-License-Identifier: Apache-2.0 # @@ -32,5 +32,7 @@ write_headers write_makefiles "${MY_DIR}/proprietary-files.txt" true +append_firmware_calls_to_makefiles "${MY_DIR}/proprietary-firmware.txt" + # Finish write_footers