commit bfa2b5071470a7fd4a29c9d02b5a463b09c6cd2b Author: Sebastiano Barezzi Date: Tue Apr 4 18:44:40 2023 +0200 hiphi: Initial TWRP device tree Made with SebaUbuntu's TWRP device tree generator Arch: arm64 Manufacturer: motorola Model: motorola edge 30 pro Script version: 3.0.0 diff --git a/Android.bp b/Android.bp new file mode 100644 index 0000000..b679fdb --- /dev/null +++ b/Android.bp @@ -0,0 +1,9 @@ +// +// Copyright (C) 2023 The Android Open Source Project +// Copyright (C) 2023 SebaUbuntu's TWRP device tree generator +// +// SPDX-License-Identifier: Apache-2.0 +// + +soong_namespace { +} diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..6bf9a03 --- /dev/null +++ b/Android.mk @@ -0,0 +1,12 @@ +# +# Copyright (C) 2023 The Android Open Source Project +# Copyright (C) 2023 SebaUbuntu's TWRP device tree generator +# +# SPDX-License-Identifier: Apache-2.0 +# + +LOCAL_PATH := $(call my-dir) + +ifeq ($(TARGET_DEVICE),hiphi) +include $(call all-subdir-makefiles,$(LOCAL_PATH)) +endif diff --git a/AndroidProducts.mk b/AndroidProducts.mk new file mode 100644 index 0000000..cf9020c --- /dev/null +++ b/AndroidProducts.mk @@ -0,0 +1,14 @@ +# +# Copyright (C) 2023 The Android Open Source Project +# Copyright (C) 2023 SebaUbuntu's TWRP device tree generator +# +# SPDX-License-Identifier: Apache-2.0 +# + +PRODUCT_MAKEFILES := \ + $(LOCAL_DIR)/omni_hiphi.mk + +COMMON_LUNCH_CHOICES := \ + omni_hiphi-user \ + omni_hiphi-userdebug \ + omni_hiphi-eng diff --git a/BoardConfig.mk b/BoardConfig.mk new file mode 100644 index 0000000..ce5e499 --- /dev/null +++ b/BoardConfig.mk @@ -0,0 +1,100 @@ +# +# Copyright (C) 2023 The Android Open Source Project +# Copyright (C) 2023 SebaUbuntu's TWRP device tree generator +# +# SPDX-License-Identifier: Apache-2.0 +# + +DEVICE_PATH := device/motorola/hiphi + +# For building with minimal manifest +ALLOW_MISSING_DEPENDENCIES := true + +# A/B +AB_OTA_UPDATER := true +AB_OTA_PARTITIONS += \ + system \ + system_ext \ + product \ + vendor \ + odm +BOARD_USES_RECOVERY_AS_BOOT := true + +# Architecture +TARGET_ARCH := arm64 +TARGET_ARCH_VARIANT := armv8-a +TARGET_CPU_ABI := arm64-v8a +TARGET_CPU_ABI2 := +TARGET_CPU_VARIANT := generic +TARGET_CPU_VARIANT_RUNTIME := kryo300 + +TARGET_2ND_ARCH := arm +TARGET_2ND_ARCH_VARIANT := armv7-a-neon +TARGET_2ND_CPU_ABI := armeabi-v7a +TARGET_2ND_CPU_ABI2 := armeabi +TARGET_2ND_CPU_VARIANT := generic +TARGET_2ND_CPU_VARIANT_RUNTIME := cortex-a75 + +# APEX +OVERRIDE_TARGET_FLATTEN_APEX := true + +# Bootloader +TARGET_BOOTLOADER_BOARD_NAME := hiphi +TARGET_NO_BOOTLOADER := true + +# Display +TARGET_SCREEN_DENSITY := 400 + +# Kernel +BOARD_BOOTIMG_HEADER_VERSION := 4 +BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOTIMG_HEADER_VERSION) +BOARD_KERNEL_IMAGE_NAME := Image +TARGET_KERNEL_CONFIG := hiphi_defconfig +TARGET_KERNEL_SOURCE := kernel/motorola/hiphi + +# Kernel - prebuilt +TARGET_FORCE_PREBUILT_KERNEL := true +ifeq ($(TARGET_FORCE_PREBUILT_KERNEL),true) +TARGET_PREBUILT_KERNEL := $(DEVICE_PATH)/prebuilt/kernel +endif + +# Partitions +BOARD_BOOTIMAGE_PARTITION_SIZE := 104857600 +BOARD_RECOVERYIMAGE_PARTITION_SIZE := 104857600 +BOARD_HAS_LARGE_FILESYSTEM := true +BOARD_SYSTEMIMAGE_PARTITION_TYPE := ext4 +BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := ext4 +BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 +TARGET_COPY_OUT_VENDOR := vendor +BOARD_SUPER_PARTITION_SIZE := 9126805504 # TODO: Fix hardcoded value +BOARD_SUPER_PARTITION_GROUPS := motorola_dynamic_partitions +BOARD_MOTOROLA_DYNAMIC_PARTITIONS_PARTITION_LIST := system system_ext product vendor odm +BOARD_MOTOROLA_DYNAMIC_PARTITIONS_SIZE := 9122611200 # TODO: Fix hardcoded value + +# Platform +TARGET_BOARD_PLATFORM := taro + +# Recovery +TARGET_RECOVERY_PIXEL_FORMAT := RGBX_8888 +TARGET_USERIMAGES_USE_EXT4 := true +TARGET_USERIMAGES_USE_F2FS := true + +# Security patch level +VENDOR_SECURITY_PATCH := 2021-08-01 + +# Verified Boot +BOARD_AVB_ENABLE := true +BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flags 3 + +# Hack: prevent anti rollback +PLATFORM_SECURITY_PATCH := 2099-12-31 +VENDOR_SECURITY_PATCH := 2099-12-31 +PLATFORM_VERSION := 16.1.0 + +# TWRP Configuration +TW_THEME := portrait_hdpi +TW_EXTRA_LANGUAGES := true +TW_SCREEN_BLANK_ON_BOOT := true +TW_INPUT_BLACKLIST := "hbtp_vm" +TW_USE_TOOLBOX := true +TW_INCLUDE_REPACKTOOLS := true diff --git a/README.md b/README.md new file mode 100644 index 0000000..869e866 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# Android device tree for motorola motorola edge 30 pro (hiphi) + +``` +# +# Copyright (C) 2023 The Android Open Source Project +# Copyright (C) 2023 SebaUbuntu's TWRP device tree generator +# +# SPDX-License-Identifier: Apache-2.0 +# +``` diff --git a/device.mk b/device.mk new file mode 100644 index 0000000..6fa5c8f --- /dev/null +++ b/device.mk @@ -0,0 +1,35 @@ +# +# Copyright (C) 2023 The Android Open Source Project +# Copyright (C) 2023 SebaUbuntu's TWRP device tree generator +# +# SPDX-License-Identifier: Apache-2.0 +# + +LOCAL_PATH := device/motorola/hiphi +# A/B +AB_OTA_POSTINSTALL_CONFIG += \ + RUN_POSTINSTALL_system=true \ + POSTINSTALL_PATH_system=system/bin/otapreopt_script \ + FILESYSTEM_TYPE_system=ext4 \ + POSTINSTALL_OPTIONAL_system=true + +# Boot control HAL +PRODUCT_PACKAGES += \ + android.hardware.boot@1.0-impl \ + android.hardware.boot@1.0-service + +PRODUCT_PACKAGES += \ + bootctrl.taro + +PRODUCT_STATIC_BOOT_CONTROL_HAL := \ + bootctrl.taro \ + libgptutils \ + libz \ + libcutils + +PRODUCT_PACKAGES += \ + otapreopt_script \ + cppreopts.sh \ + update_engine \ + update_verifier \ + update_engine_sideload diff --git a/extract-files.sh b/extract-files.sh new file mode 100755 index 0000000..6596178 --- /dev/null +++ b/extract-files.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# +# Copyright (C) 2016 The CyanogenMod Project +# Copyright (C) 2017-2020 The LineageOS Project +# +# SPDX-License-Identifier: Apache-2.0 +# + +set -e + +DEVICE=hiphi +VENDOR=motorola + +# 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 + +KANG= +SECTION= + +while [ "${#}" -gt 0 ]; do + case "${1}" in + -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 + +# Initialize the helper +setup_vendor "${DEVICE}" "${VENDOR}" "${ANDROID_ROOT}" false "${CLEAN_VENDOR}" + +extract "${MY_DIR}/proprietary-files.txt" "${SRC}" "${KANG}" --section "${SECTION}" + +"${MY_DIR}/setup-makefiles.sh" diff --git a/omni_hiphi.mk b/omni_hiphi.mk new file mode 100644 index 0000000..040cb98 --- /dev/null +++ b/omni_hiphi.mk @@ -0,0 +1,29 @@ +# +# Copyright (C) 2023 The Android Open Source Project +# Copyright (C) 2023 SebaUbuntu's TWRP device tree generator +# +# SPDX-License-Identifier: Apache-2.0 +# + +# Inherit from those products. Most specific first. +$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk) +$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk) + +# Inherit some common Omni stuff. +$(call inherit-product, vendor/omni/config/common.mk) + +# Inherit from hiphi device +$(call inherit-product, device/motorola/hiphi/device.mk) + +PRODUCT_DEVICE := hiphi +PRODUCT_NAME := omni_hiphi +PRODUCT_BRAND := motorola +PRODUCT_MODEL := motorola edge 30 pro +PRODUCT_MANUFACTURER := motorola + +PRODUCT_GMS_CLIENTID_BASE := android-motorola + +PRODUCT_BUILD_PROP_OVERRIDES += \ + PRIVATE_BUILD_DESC="hiphi-user 12 S3SHS32.12-42-11-5 bf0951 release-keys" + +BUILD_FINGERPRINT := motorola/hiphi/hiphi:12/S3SHS32.12-42-11-5/bf0951:user/release-keys diff --git a/prebuilt/kernel b/prebuilt/kernel new file mode 100644 index 0000000..e69de29 diff --git a/recovery.fstab b/recovery.fstab new file mode 100644 index 0000000..30571fc --- /dev/null +++ b/recovery.fstab @@ -0,0 +1,10 @@ +/system ext4 system flags=display=system;logical;slotselect +/system_ext ext4 system_ext flags=display=system_ext;logical;slotselect +/product ext4 product flags=display=product;logical;slotselect +/vendor ext4 vendor flags=display=vendor;logical;slotselect +/odm ext4 odm flags=display=odm;logical;slotselect +/metadata ext4 /dev/block/bootdevice/by-name/metadata flags=display=metadata +/data f2fs /dev/block/bootdevice/by-name/userdata flags=display=data +/sdcard vfat /dev/block/mmcblk0p1 flags=display=sdcard +/boot emmc /dev/block/bootdevice/by-name/boot flags=display=boot +/misc emmc /dev/block/bootdevice/by-name/misc flags=display=misc diff --git a/recovery/root/init.recovery.qcom.rc b/recovery/root/init.recovery.qcom.rc new file mode 100644 index 0000000..da9bb8a --- /dev/null +++ b/recovery/root/init.recovery.qcom.rc @@ -0,0 +1,81 @@ +# Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of The Linux Foundation nor +# the names of its contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +on init + mkdir /config + mount configfs none /config + mkdir /config/usb_gadget/g1 0770 shell shell + write /config/usb_gadget/g1/bcdUSB 0x0200 + write /config/usb_gadget/g1/idVendor 0x22b8 + write /config/usb_gadget/g1/idProduct 0x2e81 + mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell + write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno} + write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer} + write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model} + mkdir /config/usb_gadget/g1/functions/ffs.adb + mkdir /config/usb_gadget/g1/functions/ffs.fastboot + write /config/usb_gadget/g1/os_desc/use 1 + write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 + write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100" + mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell + symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 + mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell + setprop sys.usb.configfs 1 + +on property:ro.boot.usbcontroller=* + setprop sys.usb.controller ${ro.boot.usbcontroller} + wait /sys/bus/platform/devices/${ro.boot.usb.dwc3_msm:-a600000.ssusb}/mode + write /sys/bus/platform/devices/${ro.boot.usb.dwc3_msm:-a600000.ssusb}/mode peripheral + wait /sys/class/udc/${ro.boot.usbcontroller} 1 + +on property:sys.usb.config=adb && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/UDC "none" + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "Motorola Recovery ADB" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/idVendor 0x22b8 + write /config/usb_gadget/g1/idProduct 0x2e81 + symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on property:sys.usb.config=fastboot && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/UDC "none" + write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "Motorola Recovery Fastboot" + rm /config/usb_gadget/g1/configs/b.1/f1 + rm /config/usb_gadget/g1/configs/b.1/f2 + rm /config/usb_gadget/g1/configs/b.1/f3 + write /config/usb_gadget/g1/idVendor 0x22b8 + write /config/usb_gadget/g1/idProduct 0x2e80 + symlink /config/usb_gadget/g1/functions/ffs.fastboot /config/usb_gadget/g1/configs/b.1/f1 + write /config/usb_gadget/g1/UDC ${sys.usb.controller} + setprop sys.usb.state ${sys.usb.config} + +on fs + wait /dev/block/platform/soc/${ro.boot.bootdevice} + symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice diff --git a/recovery/root/snapuserd.rc b/recovery/root/snapuserd.rc new file mode 100644 index 0000000..4bf34a2 --- /dev/null +++ b/recovery/root/snapuserd.rc @@ -0,0 +1,7 @@ +service snapuserd /system/bin/snapuserd + socket snapuserd stream 0660 system system + oneshot + disabled + user root + group root system + seclabel u:r:snapuserd:s0 diff --git a/setup-makefiles.sh b/setup-makefiles.sh new file mode 100755 index 0000000..99811d1 --- /dev/null +++ b/setup-makefiles.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Copyright (C) 2016 The CyanogenMod Project +# Copyright (C) 2017-2020 The LineageOS Project +# +# SPDX-License-Identifier: Apache-2.0 +# + +set -e + +DEVICE=hiphi +VENDOR=motorola + +# 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 + +write_makefiles "${MY_DIR}/proprietary-files.txt" true + +# Finish +write_footers diff --git a/vendorsetup.sh b/vendorsetup.sh new file mode 100644 index 0000000..c335c6a --- /dev/null +++ b/vendorsetup.sh @@ -0,0 +1,10 @@ +# +# Copyright (C) 2023 The Android Open Source Project +# Copyright (C) 2023 SebaUbuntu's TWRP device tree generator +# +# SPDX-License-Identifier: Apache-2.0 +# + +add_lunch_combo omni_hiphi-user +add_lunch_combo omni_hiphi-userdebug +add_lunch_combo omni_hiphi-eng