first commit

slave
benbensy 2024-11-21 12:25:38 +08:00
commit 74673afa9f
60 changed files with 519 additions and 0 deletions

9
Android.bp Normal file
View File

@ -0,0 +1,9 @@
//
// Copyright (C) 2024 The Android Open Source Project
// Copyright (C) 2024 SebaUbuntu's TWRP device tree generator
//
// SPDX-License-Identifier: Apache-2.0
//
soong_namespace {
}

12
Android.mk Normal file
View File

@ -0,0 +1,12 @@
#
# Copyright (C) 2024 The Android Open Source Project
# Copyright (C) 2024 SebaUbuntu's TWRP device tree generator
#
# SPDX-License-Identifier: Apache-2.0
#
LOCAL_PATH := $(call my-dir)
ifeq ($(TARGET_DEVICE),haotian)
include $(call all-subdir-makefiles,$(LOCAL_PATH))
endif

14
AndroidProducts.mk Normal file
View File

@ -0,0 +1,14 @@
#
# Copyright (C) 2024 The Android Open Source Project
# Copyright (C) 2024 SebaUbuntu's TWRP device tree generator
#
# SPDX-License-Identifier: Apache-2.0
#
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/omni_haotian.mk
COMMON_LUNCH_CHOICES := \
omni_haotian-user \
omni_haotian-userdebug \
omni_haotian-eng

93
BoardConfig.mk Normal file
View File

@ -0,0 +1,93 @@
#
# Copyright (C) 2024 The Android Open Source Project
# Copyright (C) 2024 SebaUbuntu's TWRP device tree generator
#
# SPDX-License-Identifier: Apache-2.0
#
DEVICE_PATH := device/xiaomi/haotian
# For building with minimal manifest
ALLOW_MISSING_DEPENDENCIES := true
# A/B
AB_OTA_UPDATER := true
AB_OTA_PARTITIONS += \
product \
system_ext \
vendor \
odm \
system
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 := oryon
# APEX
DEXPREOPT_GENERATE_APEX_IMAGE := true
# Bootloader
TARGET_BOOTLOADER_BOARD_NAME := sun
TARGET_NO_BOOTLOADER := true
# Display
TARGET_USES_VULKAN := true
# Kernel
BOARD_BOOTIMG_HEADER_VERSION := 4
BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOTIMG_HEADER_VERSION)
BOARD_KERNEL_IMAGE_NAME := Image
TARGET_KERNEL_CONFIG := haotian_defconfig
TARGET_KERNEL_SOURCE := kernel/xiaomi/haotian
# 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 := xiaomi_dynamic_partitions
BOARD_XIAOMI_DYNAMIC_PARTITIONS_PARTITION_LIST := system system system_ext system_ext product product mi_ext mi_ext vendor vendor odm odm
BOARD_XIAOMI_DYNAMIC_PARTITIONS_SIZE := 9122611200 # TODO: Fix hardcoded value
# Platform
TARGET_BOARD_PLATFORM := sun
# 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

10
README.md Normal file
View File

@ -0,0 +1,10 @@
# Android device tree for Xiaomi 2410DPN6CC (haotian)
```
#
# Copyright (C) 2024 The Android Open Source Project
# Copyright (C) 2024 SebaUbuntu's TWRP device tree generator
#
# SPDX-License-Identifier: Apache-2.0
#
```

35
device.mk Normal file
View File

@ -0,0 +1,35 @@
#
# Copyright (C) 2024 The Android Open Source Project
# Copyright (C) 2024 SebaUbuntu's TWRP device tree generator
#
# SPDX-License-Identifier: Apache-2.0
#
LOCAL_PATH := device/xiaomi/haotian
# 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.sun
PRODUCT_STATIC_BOOT_CONTROL_HAL := \
bootctrl.sun \
libgptutils \
libz \
libcutils
PRODUCT_PACKAGES += \
otapreopt_script \
cppreopts.sh \
update_engine \
update_verifier \
update_engine_sideload

61
extract-files.sh Executable file
View File

@ -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=haotian
VENDOR=xiaomi
# 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"

29
omni_haotian.mk Normal file
View File

@ -0,0 +1,29 @@
#
# Copyright (C) 2024 The Android Open Source Project
# Copyright (C) 2024 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 haotian device
$(call inherit-product, device/xiaomi/haotian/device.mk)
PRODUCT_DEVICE := haotian
PRODUCT_NAME := omni_haotian
PRODUCT_BRAND := Xiaomi
PRODUCT_MODEL := 2410DPN6CC
PRODUCT_MANUFACTURER := xiaomi
PRODUCT_GMS_CLIENTID_BASE := android-xiaomi
PRODUCT_BUILD_PROP_OVERRIDES += \
PRIVATE_BUILD_DESC="miodm_haotian-user 15 AQ3A.240812.002 OS2.0.20.0.VOBCNXM release-keys"
BUILD_FINGERPRINT := Xiaomi/haotian/haotian:15/AQ3A.240812.002/OS2.0.20.0.VOBCNXM:user/release-keys

20
recovery.fstab Normal file
View File

@ -0,0 +1,20 @@
/system ext4 system flags=display=system;logical;slotselect
/system erofs system flags=display=system;logical;slotselect
/system_ext ext4 system_ext flags=display=system_ext;logical;slotselect
/system_ext erofs system_ext flags=display=system_ext;logical;slotselect
/product ext4 product flags=display=product;logical;slotselect
/product erofs product flags=display=product;logical;slotselect
/mnt/vendor/mi_ext ext4 mi_ext flags=display=mi_ext;logical;slotselect
/mnt/vendor/mi_ext erofs mi_ext flags=display=mi_ext;logical;slotselect
/mi_ext ext4 /mnt/vendor/mi_ext flags=display=mi_ext
/mi_ext erofs /mnt/vendor/mi_ext flags=display=mi_ext
/vendor ext4 vendor flags=display=vendor;logical;slotselect
/vendor erofs vendor flags=display=vendor;logical;slotselect
/odm ext4 odm flags=display=odm;logical;slotselect
/odm erofs odm flags=display=odm;logical;slotselect
/metadata f2fs /dev/block/bootdevice/by-name/metadata flags=display=metadata
/data f2fs /dev/block/bootdevice/by-name/userdata flags=display=data
/sdcard vfat /dev/block/mmcblk1p1 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
/cache ext4 /dev/block/bootdevice/by-name/rescue flags=display=cache

View File

@ -0,0 +1,9 @@
# Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause-Clear
service vendor.boot-qti /system/bin/hw/android.hardware.boot-service.qti.recovery
class early_hal
user root
group root
seclabel u:r:hal_bootctl_default:s0
interface aidl android.hardware.boot.IBootControl/default

View File

@ -0,0 +1,6 @@
service vendor.fastboot-default /system/bin/hw/android.hardware.fastboot-service.example_recovery
class hal
seclabel u:r:hal_fastboot_default:s0
user system
group system
interface aidl android.hardware.fastboot.IFastboot/default

View File

@ -0,0 +1,7 @@
service vendor.health-recovery /system/bin/hw/android.hardware.health-service.qti_recovery
class hal
seclabel u:r:hal_health_default:s0
user system
group system
capabilities WAKE_ALARM BLOCK_SUSPEND
file /dev/kmsg w

View File

View File

@ -0,0 +1,57 @@
# MIUI ADD: Recovery_StabilityEnhance
# Copyright (c) 2017-2018,2020 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 early-init
insmod /vendor/lib/modules/q6_pdr_dlkm.ko
insmod /vendor/lib/modules/q6_notifier_dlkm.ko
insmod /vendor/lib/modules/snd_event_dlkm.ko
insmod /vendor/lib/modules/gpr_dlkm.ko
insmod /vendor/lib/modules/spf_core_dlkm.ko
insmod /vendor/lib/modules/adsp_loader_dlkm.ko
on init
write /sys/class/backlight/panel0-backlight/brightness 200
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 fs
wait /dev/block/platform/soc/${ro.boot.bootdevice}
symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice
write /proc/sys/kernel/firmware_config/force_sysfs_fallback 1
mkdir /vendor/firmware_mnt
mkdir /vendor/firmware
mount_all /vendor/etc/charger_fstab.qti --early
mount none /vendor/firmware_mnt/image /vendor/firmware bind rec
wait /sys/kernel/boot_adsp/ssr
write /sys/kernel/boot_adsp/ssr 1
wait /sys/class/power_supply/battery
# END Recovery_StabilityEnhance

39
recovery/root/logd.rc Normal file
View File

@ -0,0 +1,39 @@
service logd /system/bin/logd
socket logd stream 0666 logd logd
socket logdr seqpacket 0666 logd logd
socket logdw dgram+passcred 0222 logd logd
file /proc/kmsg r
file /dev/kmsg w
user logd
group logd system package_info readproc
capabilities SYSLOG AUDIT_CONTROL
priority 10
task_profiles ServiceCapacityLow
onrestart setprop logd.ready false
service logd-reinit /system/bin/logd --reinit
oneshot
disabled
user logd
group logd
task_profiles ServiceCapacityLow
# Limit SELinux denial generation, defaulting to 5/second
service logd-auditctl /system/bin/auditctl -r ${persist.logd.audit.rate:-5}
oneshot
disabled
user logd
group logd
capabilities AUDIT_CONTROL
on fs
write /dev/event-log-tags "# content owned by logd
"
chown logd logd /dev/event-log-tags
chmod 0644 /dev/event-log-tags
on property:sys.boot_completed=1
start logd-auditctl
on property:persist.logd.audit.rate=*
start logd-auditctl

View File

@ -0,0 +1,27 @@
on property:vold.miui=factoryreset
# debugfs
mount debugfs debugfs /sys/kernel/debug
chmod 0755 /sys/kernel/debug
# Create location for fs_mgr to store abbreviated output from filesystem
# checker programs.
mkdir /dev/fscklogs 0770 root system
wait /dev/block/bootdevice
mount_all miui.factoryreset.fstab
# We chown/chmod /data again so because mount is run as root + defaults
chown system system /data
chmod 0771 /data
# We restorecon /data in case the userdata partition has been reset.
restorecon /data
# for logcat
start logd
start factoryreset
service factoryreset /system/bin/recovery --wipe_data_skip_preinstall
class late_start
seclabel u:r:recovery:s0

View File

@ -0,0 +1,3 @@
on post-fs-data
mkdir /data/misc/recovery 0770 system log
exec_background - system log -- /system/bin/recovery-persist

View File

@ -0,0 +1,2 @@
on post-fs
exec_background - system log -- /system/bin/recovery-refresh

View File

@ -0,0 +1,6 @@
service servicemanager /system/bin/servicemanager
disabled
group system readproc
user root
onrestart setprop servicemanager.ready false
seclabel u:r:servicemanager:s0

36
setup-makefiles.sh Executable file
View File

@ -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=haotian
VENDOR=xiaomi
# 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

BIN
stock_files/boot.img Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
ffff8000

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
unknown

View File

@ -0,0 +1 @@
00008000

View File

@ -0,0 +1 @@
0

View File

@ -0,0 +1 @@
00008630

View File

@ -0,0 +1 @@
00008000

View File

@ -0,0 +1 @@
00008000

BIN
stock_files/init_boot.img Normal file

Binary file not shown.

View File

Binary file not shown.

View File

@ -0,0 +1 @@
0024df90

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
unknown

View File

@ -0,0 +1 @@
00008000

View File

@ -0,0 +1 @@
0

View File

@ -0,0 +1 @@
ffdb26a0

View File

@ -0,0 +1 @@
ffdb2070

View File

@ -0,0 +1 @@
ffdb2070

BIN
stock_files/recovery.img Normal file

Binary file not shown.

View File

Binary file not shown.

View File

@ -0,0 +1 @@
01afabfa

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
unknown

View File

@ -0,0 +1 @@
00008000

View File

@ -0,0 +1 @@
0

View File

@ -0,0 +1 @@
fe505a36

View File

@ -0,0 +1 @@
fe505406

View File

@ -0,0 +1 @@
fe505406

BIN
stock_files/vendor_boot.img Normal file

Binary file not shown.

View File

@ -0,0 +1,6 @@
androidboot.hardware=qcom
androidboot.memcg=1
androidboot.usbcontroller=a600000.dwc3
androidboot.load_modules_parallel=true
androidboot.hypervisor.protected_vm.supported=true
androidboot.vendor.qspa=true

Binary file not shown.

View File

@ -0,0 +1 @@
../vendor_ramdisk00

Binary file not shown.

10
vendorsetup.sh Normal file
View File

@ -0,0 +1,10 @@
#
# Copyright (C) 2024 The Android Open Source Project
# Copyright (C) 2024 SebaUbuntu's TWRP device tree generator
#
# SPDX-License-Identifier: Apache-2.0
#
add_lunch_combo omni_haotian-user
add_lunch_combo omni_haotian-userdebug
add_lunch_combo omni_haotian-eng