From 8b711231dc84670e83c180b3a846f80a5d05219f Mon Sep 17 00:00:00 2001 From: therealmharc Date: Mon, 23 Jun 2025 11:59:34 +0000 Subject: [PATCH] sm6150-common: initialize Evolution-X 10.x - nuke dependencies (moved to device tree) - decommonize BUILD_BROKEN_VENDOR_PROPERTY_NAMESPACE - set EROFS for GMS builds and EXT4 for VANILLA builds - set TARGET_USES_MIUI_CAMERA to true and migrate it to soong_config_set - label bypass charging node Signed-off-by: therealmharc --- BoardConfigCommon.mk | 12 +- lineage.dependencies | 10 -- rootdir/etc/init.target.rc_ext4 | 210 ++++++++++++++++++++++++++++++++ sepolicy/vendor/init.te | 3 + sm6150.mk | 10 +- 5 files changed, 231 insertions(+), 14 deletions(-) delete mode 100644 lineage.dependencies create mode 100644 rootdir/etc/init.target.rc_ext4 diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk index 3c25a3a..520f6ce 100644 --- a/BoardConfigCommon.mk +++ b/BoardConfigCommon.mk @@ -19,9 +19,6 @@ COMMON_PATH := device/xiaomi/sm6150-common # Inherit from proprietary files include vendor/xiaomi/sm6150-common/BoardConfigVendor.mk -# Build broken -BUILD_BROKEN_VENDOR_PROPERTY_NAMESPACE := true - # Architecture TARGET_ARCH := arm64 TARGET_ARCH_VARIANT := armv8-2a-dotprod @@ -103,6 +100,8 @@ BOARD_SUPER_PARTITION_GROUPS := qti_dynamic_partitions BOARD_QTI_DYNAMIC_PARTITIONS_PARTITION_LIST := odm product system system_ext vendor BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4 + +ifeq ($(WITH_GMS),true) BOARD_ODMIMAGE_FILE_SYSTEM_TYPE := erofs BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := erofs BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE := erofs @@ -110,6 +109,13 @@ BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := erofs BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := erofs BOARD_EROFS_PCLUSTER_SIZE := 262144 BOARD_EROFS_COMPRESSOR := lz4 +else +BOARD_ODMIMAGE_FILE_SYSTEM_TYPE := ext4 +BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4 +BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE := ext4 +BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4 +BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 +endif BOARD_USES_METADATA_PARTITION := true diff --git a/lineage.dependencies b/lineage.dependencies deleted file mode 100644 index c9e0e39..0000000 --- a/lineage.dependencies +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "repository": "android_kernel_xiaomi_sm6150", - "target_path": "kernel/xiaomi/sm6150" - }, - { - "repository": "android_hardware_xiaomi", - "target_path": "hardware/xiaomi" - } -] diff --git a/rootdir/etc/init.target.rc_ext4 b/rootdir/etc/init.target.rc_ext4 new file mode 100644 index 0000000..3fae2c5 --- /dev/null +++ b/rootdir/etc/init.target.rc_ext4 @@ -0,0 +1,210 @@ +# Copyright (c) 2013-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 "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 + exec u:r:vendor_qti_init_shell:s0 -- /vendor/bin/init.qti.early_init.sh + setprop ro.boot.hardware.revision ${ro.boot.hwc}_${ro.boot.hwlevel}_${ro.boot.hwversion} + setprop ro.soc.model ${ro.vendor.qti.soc_model} + setprop vendor.usb.product_string ${ro.product.vendor.model} + +on init + # Goodix fingerprint + chmod 0666 /dev/goodix_fp + chown system system /dev/goodix_fp + chmod 0664 /dev/fortsense_fp + chown system system /dev/fortsense_fp + + wait /dev/block/platform/soc/${ro.boot.bootdevice} + symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice + + write /sys/module/qpnp_rtc/parameters/poweron_alarm 1 + + # Change permissions for /dev/diag + chmod 0666 /dev/diag + + # Setup permission for Power HAL + chown system system /dev/stune/top-app/schedtune.boost + chown system system /dev/stune/top-app/schedtune.prefer_high_cap + + chmod 0664 /dev/stune/top-app/schedtune.boost + chmod 0664 /dev/stune/top-app/schedtune.prefer_high_cap + +on fs + mount_all --early + + restorecon_recursive /mnt/vendor/persist + mkdir /mnt/vendor/persist/data 0700 system system + mkdir /mnt/vendor/persist/audio 0755 system system + mkdir /mnt/vendor/persist/alarm 0770 system system + mkdir /mnt/vendor/persist/time 0770 system system + mkdir /mnt/vendor/persist/camera 0777 root root + +on late-fs + mount_all --late + +on post-fs-data + mkdir /data/vendor/nnhal 0700 system system + mkdir /data/vendor/nfc 0770 nfc nfc + mkdir /data/vendor/thermal 0771 root system + mkdir /data/vendor/thermal/config 0771 root system + + # Create fingerprint related directory + mkdir /data/vendor/fortsense 0770 system system + mkdir /data/vendor/fpc 0770 system system + mkdir /data/vendor/goodix 0770 system system + mkdir /mnt/vendor/persist/fpc 0770 system system + mkdir /data/vendor/fpdump 0770 system system + + # Disable WiFi Aware feature. + mount none /dev/null /vendor/etc/permissions/android.hardware.wifi.aware.xml bind + +on boot + start rmt_storage + start rfs_access + + # Set thermal mode to evaluation + chmod 0664 /sys/class/power_supply/battery/dc_thermal_levels + chmod 0664 /sys/class/thermal/thermal_message/sconfig + chown system system /sys/class/thermal/thermal_message/sconfig + chmod 0664 /sys/class/thermal/thermal_message/balance_mode + chown system system /sys/class/thermal/thermal_message/balance_mode + chmod 0664 /sys/class/thermal/thermal_message/flash_state + write /sys/class/thermal/thermal_message/sconfig 10 + + # Set doze mode permissions + chown system system /sys/devices/platform/soc/soc:qcom,dsi-display/doze_mode + chmod 0660 /sys/devices/platform/soc/soc:qcom,dsi-display/doze_mode + + # Set xiaomi touch permissions + chown system system /dev/xiaomi-touch + chmod 0660 /dev/xiaomi-touch + + # Set fingerprint related permissions + chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/irq + chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/irq_enable + chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/wakeup_enable + chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/hw_reset + chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/device_prepare + chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/fingerdown_wait + chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/vendor + chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/request_vreg + chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/simulate_irq + chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/finger_irq + chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/request_vreg + chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/power_cfg + + chown system system /sys/bus/platform/devices/soc/soc:fpc1020/irq + chown system system /sys/bus/platform/devices/soc/soc:fpc1020/wakeup_enable + chown system system /sys/devices/platform/soc/soc:qcom,dsi-display/fod_ui + + # Create fingerprint related directory + mkdir /mnt/vendor/persist/goodix 0770 system system + mkdir /mnt/vendor/persist/fpc 0770 system system + + # Touchpanel + chmod 0664 /sys/devices/virtual/touch/touch_dev/double_tap + chown system system /sys/devices/virtual/touch/touch_dev/double_tap + + write /sys/block/sda/queue/wbt_lat_usec 75000 + +on property:sys.boot_completed=1 + # Stop Statsd + stop statsd + + # Enable suspend to RAM + write /sys/power/mem_sleep "deep" + + # Only owner can acces this node + chmod 440 /proc/net/unix + +service vendor.pd_mapper /vendor/bin/pd-mapper + class core + user system + group system + task_profiles ServiceCapacityLow + +service vendor.per_mgr /vendor/bin/pm-service + class core + user system + group system + ioprio rt 4 + task_profiles ServiceCapacityLow + +service vendor.per_proxy /vendor/bin/pm-proxy + class core + user system + group system + task_profiles ServiceCapacityLow + disabled + +on property:init.svc.vendor.per_mgr=running + start vendor.per_proxy + +on property:sys.shutdown.requested=* + stop vendor.per_proxy + +on charger + wait /dev/block/platform/soc/1da4000.ufshc/by-name/system + mount ext4 /dev/block/platform/soc/1da4000.ufshc/by-name/system / ro barrier=1 + + wait /dev/block/platform/soc/1da4000.ufshc/by-name/persist + mount ext4 /dev/block/bootdevice/by-name/persist /mnt/vendor/persist nosuid nodev barrier=1 + + start vendor.hvdcp_opti + start vendor.thermal-engine + start vendor.qcom-post-boot + start vendor.power_off_alarm + +service vendor.thermal-engine /vendor/bin/thermal-engine + class main + user root + socket thermal-send-client stream 0666 system system + socket thermal-recv-client stream 0660 system system + socket thermal-recv-passive-client stream 0666 system system + socket thermal-send-rule stream 0660 system system + group root + task_profiles ServiceCapacityLow + +service vendor.hvdcp_opti /vendor/bin/hvdcp_opti + class main + user root + group system wakelock + task_profiles ServiceCapacityLow + +service vendor.remosaic_daemon /vendor/bin/remosaic_daemon + class late_start + user camera + group camera + task_profiles ServiceCapacityLow + +service vendor.nv_mac /vendor/bin/nv_mac + class main + user system + group system inet net_admin wifi net_raw + oneshot diff --git a/sepolicy/vendor/init.te b/sepolicy/vendor/init.te index c4bbfec..2bc4070 100644 --- a/sepolicy/vendor/init.te +++ b/sepolicy/vendor/init.te @@ -3,3 +3,6 @@ dontaudit init firmware_file:filesystem getattr; allow init per_boot_file:file ioctl; allowxperm init per_boot_file:file ioctl { F2FS_IOC_SET_PIN_FILE }; + +# input_suspend label +allow init sysfs_battery_supply:file rw_file_perms; diff --git a/sm6150.mk b/sm6150.mk index 2952a59..73259f2 100644 --- a/sm6150.mk +++ b/sm6150.mk @@ -97,6 +97,7 @@ PRODUCT_PACKAGES += \ $(call soong_config_set,libcameraservice,ext_lib,//$(LOCAL_PATH):libcameraservice_extension.sm6150) $(call soong_config_set,camera,override_format_from_reserved,true) $(call soong_config_set,camera,package_name,com.android.camera) +$(call soong_config_set,camera,uses_miui_camera,true) PRODUCT_PACKAGES += \ android.hardware.camera.provider@2.4-impl \ @@ -200,8 +201,15 @@ PRODUCT_PACKAGES += \ # Init scripts PRODUCT_COPY_FILES += \ - $(LOCAL_PATH)/rootdir/etc/init.qcom.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.qcom.rc \ + $(LOCAL_PATH)/rootdir/etc/init.qcom.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.qcom.rc + +ifeq ($(WITH_GMS),true) +PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/rootdir/etc/init.target.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.target.rc +else +PRODUCT_COPY_FILES += \ + $(LOCAL_PATH)/rootdir/etc/init.target.rc_ext4:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.target.rc +endif PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/rootdir/bin/init.qcom.post_boot.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.qcom.post_boot.sh \