lynx: switch to python extract-utils
Change-Id: Ia2d6a0235d9343d7de0ef69d4197cac7f276af84
This commit is contained in:
parent
47b30e7b1f
commit
0c68737899
13
extract-files.py
Executable file
13
extract-files.py
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2024 The LineageOS Project
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
MY_DIR="$(cd "$(dirname "${0}")"; pwd -P)"
|
||||
|
||||
pushd "${MY_DIR}/lynx"
|
||||
./extract-files.py $@
|
||||
popd
|
@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2016 The CyanogenMod Project
|
||||
# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
MY_DIR="$(cd "$(dirname "${0}")"; pwd -P)"
|
||||
|
||||
"${MY_DIR}/lynx/extract-files.sh" "$@"
|
108
lynx/extract-files.py
Executable file
108
lynx/extract-files.py
Executable file
@ -0,0 +1,108 @@
|
||||
#!/usr/bin/env -S PYTHONPATH=../../../../tools/extract-utils python3
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2024 The LineageOS Project
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
from extract_utils.extract import extract_fns_user_type
|
||||
from extract_utils.extract_pixel import (
|
||||
extract_pixel_factory_image,
|
||||
extract_pixel_firmware,
|
||||
pixel_factory_image_regex,
|
||||
pixel_firmware_regex,
|
||||
)
|
||||
from extract_utils.file import FileArgs, FileList
|
||||
from extract_utils.fixups_blob import (
|
||||
blob_fixup,
|
||||
blob_fixups_user_type,
|
||||
)
|
||||
from extract_utils.fixups_lib import (
|
||||
lib_fixup_remove,
|
||||
lib_fixups,
|
||||
lib_fixups_user_type,
|
||||
)
|
||||
from extract_utils.main import (
|
||||
ExtractUtils,
|
||||
ExtractUtilsModule,
|
||||
)
|
||||
|
||||
namespace_imports = [
|
||||
'device/google/lynx',
|
||||
'hardware/google/av',
|
||||
'hardware/google/gchips',
|
||||
'hardware/google/graphics/common',
|
||||
'hardware/google/interfaces',
|
||||
'hardware/google/pixel',
|
||||
'hardware/qcom/wlan/wcn6740',
|
||||
]
|
||||
|
||||
|
||||
def lib_fixup_vendor_suffix(lib: str, partition: str, *args, **kwargs):
|
||||
return f'{lib}_{partition}' if partition == 'vendor' else None
|
||||
|
||||
|
||||
lib_fixups: lib_fixups_user_type = {
|
||||
**lib_fixups,
|
||||
(
|
||||
'com.google.edgetpu_app_service-V3-ndk',
|
||||
'com.google.edgetpu_vendor_service-V2-ndk',
|
||||
): lib_fixup_vendor_suffix,
|
||||
'libwpa_client': lib_fixup_remove,
|
||||
}
|
||||
|
||||
blob_fixups: blob_fixups_user_type = {
|
||||
'product/etc/felica/common.cfg': blob_fixup()
|
||||
.patch_file('osaifu-keitai.patch'),
|
||||
'vendor/etc/init/init.modem_logging_control.rc': blob_fixup()
|
||||
.regex_replace(' && property:ro.debuggable=0', ''),
|
||||
} # fmt: skip
|
||||
|
||||
extract_fns: extract_fns_user_type = {
|
||||
pixel_factory_image_regex: extract_pixel_factory_image,
|
||||
pixel_firmware_regex: extract_pixel_firmware,
|
||||
}
|
||||
|
||||
module = ExtractUtilsModule(
|
||||
'lynx',
|
||||
'google',
|
||||
device_rel_path='device/google/lynx/lynx',
|
||||
blob_fixups=blob_fixups,
|
||||
lib_fixups=lib_fixups,
|
||||
namespace_imports=namespace_imports,
|
||||
add_generated_carriersettings_file=True,
|
||||
add_firmware_proprietary_file=True,
|
||||
extract_fns=extract_fns,
|
||||
)
|
||||
|
||||
|
||||
def fix_vendor_file_list(file_list: FileList):
|
||||
# flp.default & gps.default have incorrect SONAME
|
||||
# lowi-server depends on libwpa_client, which is a gnu makefile target
|
||||
disable_checkelf_file_paths = [
|
||||
'vendor/bin/lowi-server',
|
||||
'vendor/lib64/hw/flp.default.so',
|
||||
'vendor/lib64/hw/gps.default.so',
|
||||
]
|
||||
for file_path in disable_checkelf_file_paths:
|
||||
file_list.get_file(file_path).set_arg(FileArgs.DISABLE_CHECKELF, True)
|
||||
|
||||
module_suffix_file_paths = [
|
||||
'vendor/lib/com.google.edgetpu_app_service-V3-ndk.so',
|
||||
'vendor/lib64/com.google.edgetpu_app_service-V3-ndk.so',
|
||||
'vendor/lib64/com.google.edgetpu_vendor_service-V2-ndk.so',
|
||||
]
|
||||
|
||||
for file_path in module_suffix_file_paths:
|
||||
file_list.get_file(file_path).set_arg(FileArgs.MODULE_SUFFIX, '_vendor')
|
||||
|
||||
|
||||
module.add_generated_proprietary_file(
|
||||
'proprietary-files-vendor.txt',
|
||||
partition='vendor',
|
||||
skip_file_list_name='skip-files-vendor.txt',
|
||||
fix_file_list=fix_vendor_file_list,
|
||||
)
|
||||
|
||||
if __name__ == '__main__':
|
||||
utils = ExtractUtils.device(module)
|
||||
utils.run()
|
@ -1,120 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2016 The CyanogenMod Project
|
||||
# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
DEVICE=lynx
|
||||
VENDOR=google
|
||||
|
||||
# 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}"
|
||||
|
||||
# Default to sanitizing the vendor folder before extraction
|
||||
CLEAN_VENDOR=true
|
||||
|
||||
ONLY_FIRMWARE=
|
||||
KANG=
|
||||
SECTION=
|
||||
CARRIER_SKIP_FILES=()
|
||||
VENDOR_SKIP_FILES=()
|
||||
|
||||
while [ "${#}" -gt 0 ]; do
|
||||
case "${1}" in
|
||||
--only-firmware)
|
||||
ONLY_FIRMWARE=true
|
||||
;;
|
||||
-n | --no-cleanup)
|
||||
CLEAN_VENDOR=false
|
||||
;;
|
||||
-k | --kang)
|
||||
KANG="--kang"
|
||||
;;
|
||||
-s | --section)
|
||||
SECTION="${2}"
|
||||
shift
|
||||
CLEAN_VENDOR=false
|
||||
;;
|
||||
*)
|
||||
SRC="${1}"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -z "${SRC}" ]; then
|
||||
SRC="adb"
|
||||
fi
|
||||
|
||||
function blob_fixup() {
|
||||
case "${1}" in
|
||||
product/etc/felica/common.cfg)
|
||||
[ "$2" = "" ] && return 0
|
||||
sed -i -e '$a00000018,1' -e '/^00000014/d' -e '/^00000015/d' "${2}"
|
||||
;;
|
||||
vendor/etc/init/init.modem_logging_control.rc)
|
||||
[ "$2" = "" ] && return 0
|
||||
sed -i 's/ && property:ro.debuggable=0//' "${2}"
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function blob_fixup_dry() {
|
||||
blob_fixup "$1" ""
|
||||
}
|
||||
|
||||
function prepare_firmware() {
|
||||
if [ "${SRC}" != "adb" ]; then
|
||||
bash "${ANDROID_ROOT}"/lineage/scripts/pixel/prepare-firmware.sh "${DEVICE}" "${SRC}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Initialize the helper
|
||||
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}"
|
||||
|
||||
if [ -z "${ONLY_FIRMWARE}" ]; then
|
||||
extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}"
|
||||
|
||||
generate_prop_list_from_image "product.img" "${MY_DIR}/proprietary-files-carriersettings.txt" CARRIER_SKIP_FILES carriersettings
|
||||
extract "${MY_DIR}/proprietary-files-carriersettings.txt" "${SRC}" "${KANG}" --section "${SECTION}"
|
||||
|
||||
readarray -t VENDOR_SKIP_FILES < <(cat "${MY_DIR}/skip-files-vendor.txt" | sed -E "/^[[:blank:]]*(#|$)/d")
|
||||
VENDOR_TXT="${MY_DIR}/proprietary-files-vendor.txt"
|
||||
generate_prop_list_from_image "vendor.img" "${VENDOR_TXT}" VENDOR_SKIP_FILES
|
||||
|
||||
# flp.default & gps.default have incorrect SONAME
|
||||
# lowi-server depends on libwpa_client, which is a gnu makefile target
|
||||
set_disable_checkelf "vendor/bin/lowi-server" "${VENDOR_TXT}"
|
||||
set_disable_checkelf "vendor/lib64/hw/flp.default.so" "${VENDOR_TXT}"
|
||||
set_disable_checkelf "vendor/lib64/hw/gps.default.so" "${VENDOR_TXT}"
|
||||
|
||||
set_module_suffix "vendor/lib/com.google.edgetpu_app_service-V3-ndk.so" "-vendor" "${VENDOR_TXT}"
|
||||
set_module_suffix "vendor/lib64/com.google.edgetpu_app_service-V3-ndk.so" "-vendor" "${VENDOR_TXT}"
|
||||
set_module_suffix "vendor/lib64/com.google.edgetpu_vendor_service-V2-ndk.so" "-vendor" "${VENDOR_TXT}"
|
||||
|
||||
extract "${MY_DIR}/proprietary-files-vendor.txt" "${SRC}" "${KANG}" --section "${SECTION}"
|
||||
fi
|
||||
|
||||
if [ -z "${SECTION}" ]; then
|
||||
extract_firmware "${MY_DIR}/proprietary-firmware.txt" "${SRC}"
|
||||
fi
|
||||
|
||||
"${MY_DIR}/setup-makefiles.sh"
|
24
lynx/osaifu-keitai.patch
Normal file
24
lynx/osaifu-keitai.patch
Normal file
@ -0,0 +1,24 @@
|
||||
From aab255f2807cfc460c0dce40decd5554d49c0076 Mon Sep 17 00:00:00 2001
|
||||
From: jabashque <jabashque@gmail.com>
|
||||
Date: Mon, 5 Feb 2024 21:36:03 +0000
|
||||
Subject: [PATCH 1/1] Enable Osaifu-Keitai on non-Japanese SKUs
|
||||
|
||||
---
|
||||
common.cfg | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/common.cfg b/common.cfg
|
||||
index 3b78765..00f53cb 100644
|
||||
--- a/common.cfg
|
||||
+++ b/common.cfg
|
||||
@@ -11,6 +11,5 @@
|
||||
02030001,0
|
||||
02030002,0
|
||||
02030003,intent:#Intent;action=android.settings.NFC_SETTINGS;end
|
||||
-00000014,content://com.google.android.pixelnfc.provider.DeviceInfoContentProvider/isJapanSku
|
||||
-00000015,is_japan_sku
|
||||
00000016,0001
|
||||
+00000018,1
|
||||
--
|
||||
2.47.0
|
||||
|
@ -1474,7 +1474,7 @@ vendor/lib/audio_spk_35l41.so
|
||||
vendor/lib/audio_tunnel_aoc.so
|
||||
vendor/lib/audio_usb_aoc.so
|
||||
vendor/lib/audio_waves_aoc.so
|
||||
vendor/lib/com.google.edgetpu_app_service-V3-ndk.so;MODULE_SUFFIX=-vendor
|
||||
vendor/lib/com.google.edgetpu_app_service-V3-ndk.so;MODULE_SUFFIX=_vendor
|
||||
vendor/lib/com.google.pixel.modem.logmasklibrary-V1-ndk.so
|
||||
vendor/lib/egl/libGLES_mali.so
|
||||
vendor/lib/gxp_metrics_logger.so
|
||||
@ -1578,9 +1578,9 @@ vendor/lib64/audio_waves_aoc.so
|
||||
vendor/lib64/biometricsuez.so
|
||||
vendor/lib64/com.google.edgetpu.dba-V1-ndk.so
|
||||
vendor/lib64/com.google.edgetpu.tachyon-V1-ndk.so
|
||||
vendor/lib64/com.google.edgetpu_app_service-V3-ndk.so;MODULE_SUFFIX=-vendor
|
||||
vendor/lib64/com.google.edgetpu_app_service-V3-ndk.so;MODULE_SUFFIX=_vendor
|
||||
vendor/lib64/com.google.edgetpu_app_service-V4-ndk.so
|
||||
vendor/lib64/com.google.edgetpu_vendor_service-V2-ndk.so;MODULE_SUFFIX=-vendor
|
||||
vendor/lib64/com.google.edgetpu_vendor_service-V2-ndk.so;MODULE_SUFFIX=_vendor
|
||||
vendor/lib64/com.google.hardware.biometrics.fingerprint.fingerprint-ext-V1-ndk.so
|
||||
vendor/lib64/com.google.input-V2-ndk.so
|
||||
vendor/lib64/com.google.input-V3-ndk.so
|
||||
|
1
lynx/setup-makefiles.py
Executable file
1
lynx/setup-makefiles.py
Executable file
@ -0,0 +1 @@
|
||||
#!./extract-files.py --regenerate_makefiles
|
@ -1,80 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2016 The CyanogenMod Project
|
||||
# SPDX-FileCopyrightText: 2017-2024 The LineageOS Project
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
DEVICE=lynx
|
||||
VENDOR=google
|
||||
|
||||
# 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}"
|
||||
|
||||
function vendor_imports() {
|
||||
cat <<EOF >>"$1"
|
||||
"device/google/lynx",
|
||||
"hardware/google/av",
|
||||
"hardware/google/gchips",
|
||||
"hardware/google/graphics/common",
|
||||
"hardware/google/interfaces",
|
||||
"hardware/google/pixel",
|
||||
"hardware/qcom/wlan/wcn6740",
|
||||
EOF
|
||||
}
|
||||
|
||||
function lib_to_package_fixup_vendor_variants() {
|
||||
if [ "$2" != "vendor" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
com.google.edgetpu_app_service-V3-ndk | \
|
||||
com.google.edgetpu_vendor_service-V2-ndk)
|
||||
echo "$1-vendor"
|
||||
;;
|
||||
libprotobuf-cpp-full-21.12)
|
||||
echo "libprotobuf-cpp-full"
|
||||
;;
|
||||
libprotobuf-cpp-lite-21.12)
|
||||
echo "libprotobuf-cpp-lite"
|
||||
;;
|
||||
libwpa_client) ;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function lib_to_package_fixup() {
|
||||
lib_to_package_fixup_clang_rt_ubsan_standalone "$1" ||
|
||||
lib_to_package_fixup_proto_3_9_1 "$1" ||
|
||||
lib_to_package_fixup_vendor_variants "$@"
|
||||
}
|
||||
|
||||
# Initialize the helper
|
||||
setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}"
|
||||
|
||||
# Warning headers and guards
|
||||
write_headers
|
||||
|
||||
write_makefiles "${MY_DIR}/proprietary-files.txt"
|
||||
write_makefiles "${MY_DIR}/proprietary-files-carriersettings.txt"
|
||||
write_makefiles "${MY_DIR}/proprietary-files-vendor.txt"
|
||||
|
||||
append_firmware_calls_to_makefiles "${MY_DIR}/proprietary-firmware.txt"
|
||||
|
||||
# Finish
|
||||
write_footers
|
@ -1419,6 +1419,12 @@ lib/libui.so
|
||||
lib64/libevent.so
|
||||
lib64/libion.so
|
||||
|
||||
# Odex
|
||||
framework/oat/arm/com.google.android.camera.experimental2022.odex
|
||||
framework/oat/arm/com.google.android.camera.experimental2022.vdex
|
||||
framework/oat/arm64/com.google.android.camera.experimental2022.odex
|
||||
framework/oat/arm64/com.google.android.camera.experimental2022.vdex
|
||||
|
||||
# Completely skip files that are not required
|
||||
|
||||
# Edge TPU
|
||||
|
13
setup-makefiles.py
Executable file
13
setup-makefiles.py
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2024 The LineageOS Project
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
MY_DIR="$(cd "$(dirname "${0}")"; pwd -P)"
|
||||
|
||||
pushd "${MY_DIR}/lynx"
|
||||
./setup-makefiles.py
|
||||
popd
|
Loading…
Reference in New Issue
Block a user