diff --git a/BoardConfig.mk b/BoardConfig.mk index eb09160..d467f4b 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -24,6 +24,8 @@ # components. TARGET_OTA_ASSERT_DEVICE := m6note,m6n,m1721,M1721,M6Note +RECOVERY_VARIANT := twrp +ALLOW_MISSING_DEPENDENCIES=true # Architecture TARGET_ARCH := arm64 @@ -52,13 +54,10 @@ TARGET_PREBUILT_KERNEL := device/meizu/m1721/prebuilt/zImage # Platform TARGET_BOARD_PLATFORM := msm8953 -TARGET_BOARD_PLATFORM_GPU := qcom-adreno506 - -# Encryption -TARGET_HW_DISK_ENCRYPTION := true +TARGET_BOARD_PLATFORM_GPU := qcom-adreno # Partitions -BOARD_BOOTIMAGE_PARTITION_SIZE := 33554432 +BOARD_BOOTIMAGE_PARTITION_SIZE := 67108864 BOARD_RECOVERYIMAGE_PARTITION_SIZE := 67108864 BOARD_SYSTEMIMAGE_PARTITION_SIZE := 4294967296 BOARD_USERDATAIMAGE_PARTITION_SIZE := 55276150784 @@ -80,7 +79,6 @@ TW_DEFAULT_BRIGHTNESS := 35 TW_EXCLUDE_DEFAULT_USB_INIT := true TW_EXCLUDE_SUPERSU := true TW_EXTRA_LANGUAGES := true -TW_INCLUDE_CRYPTO := true TW_INCLUDE_NTFS_3G := true TW_NO_USB_STORAGE := true TW_SCREEN_BLANK_ON_BOOT := true @@ -88,3 +86,16 @@ TW_THEME := portrait_hdpi TW_HAS_DOWNLOAD_MODE := true TW_INPUT_BLACKLIST := "hbtp_vm" TW_HAS_REBOOT_EDL := true +TARGET_USES_LOGD := true +TW_USE_NEW_MINADBD := true + +# Encryption +TARGET_HW_DISK_ENCRYPTION := true +TW_INCLUDE_CRYPTO := true +TW_CRYPTO_USE_SYSTEM_VOLD := true +TARGET_KEYMASTER_WAIT_FOR_QSEE := true + +# Logging +TWRP_INCLUDE_LOGCAT := true +TARGET_USES_LOGD := true + diff --git a/omni.dependencies b/omni.dependencies index 58228f4..0778b8b 100644 --- a/omni.dependencies +++ b/omni.dependencies @@ -6,3 +6,4 @@ "revision":"android-7.1" } ] + diff --git a/omni_m1721.mk b/omni_m1721.mk index ea10f50..802765d 100644 --- a/omni_m1721.mk +++ b/omni_m1721.mk @@ -23,8 +23,8 @@ $(call inherit-product, build/target/product/embedded.mk) $(call inherit-product, vendor/omni/config/common.mk) # Time Zone data for recovery -PRODUCT_COPY_FILES += \ - bionic/libc/zoneinfo/tzdata:recovery/root/system/usr/share/zoneinfo/tzdata +#PRODUCT_COPY_FILES += \ +# bionic/libc/zoneinfo/tzdata:recovery/root/system/usr/share/zoneinfo/tzdata ## Device identifier. This must come after all inclusions PRODUCT_NAME := omni_m1721 diff --git a/recovery.fstab b/recovery.fstab index 418923c..9121ab3 100644 --- a/recovery.fstab +++ b/recovery.fstab @@ -5,7 +5,9 @@ # Currently we dont have e2fsck compiled. So fs check would failed. # -/data ext4 /dev/block/bootdevice/by-name/userdata flags=encryptable=footer;length=-16384 + +/data ext4 /dev/block/bootdevice/by-name/userdata flags=encryptable=footer;length=-16384 +##/data ext4 /dev/block/bootdevice/by-name/userdata flags=encryptable=footer;length=-16384 /cache ext4 /dev/block/bootdevice/by-name/cache flags=backup=1;wipeingui;wipeduringfactoryreset /system ext4 /dev/block/bootdevice/by-name/system flags=backup=1;wipeingui /system_image emmc /dev/block/bootdevice/by-name/system flags=flashimg=1 diff --git a/recovery/root/fstab.qcom b/recovery/root/fstab.qcom new file mode 100644 index 0000000..2d16f70 --- /dev/null +++ b/recovery/root/fstab.qcom @@ -0,0 +1,14 @@ +# Android fstab file. +# The filesystem that contains the filesystem checker binary (typically /system) cannot +# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK + +#TODO: Add 'check' as fs_mgr_flags with data partition. +# Currently we dont have e2fsck compiled. So fs check would failed. + +# +/dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1,discard wait,verify +/dev/block/bootdevice/by-name/userdata /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard wait,resize,encryptable=footer +/devices/soc/7864900.sdhci/mmc_host* /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=sdcard1:auto,noemulatedsd,encryptable=footer +/dev/block/bootdevice/by-name/config /frp emmc defaults defaults +/devices/soc/7000000.ssusb/7000000.dwc3/xhci-hcd.0.auto* /storage/usbotg vfat nosuid,nodev wait,voldmanaged=usbotg:auto +/dev/block/bootdevice/by-name/misc /misc emmc defaults defaults diff --git a/recovery/root/init.recovery.qcom.rc b/recovery/root/init.recovery.qcom.rc index 0a1d215..77309d3 100644 --- a/recovery/root/init.recovery.qcom.rc +++ b/recovery/root/init.recovery.qcom.rc @@ -1,34 +1,75 @@ # needed to make qseecomd work in recovery -on init + +on fs + + wait /dev/block/platform/soc/${ro.boot.bootdevice} + symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice + + # needed to make qseecomd work in recovery chmod 0660 /dev/qseecom chown system drmrpc /dev/qseecom chmod 0664 /dev/ion chown system system /dev/ion -# separate copy needed to use /sbin/linker64 instead of /system/bin/linker64 -service sbinqseecomd /sbin/qseecomd +on property:ro.crypto.state=encrypted + chmod 0750 /sbin/qseecom.sh + start qseecom + +#on property:init.svc.recovery=running +# start fixyear + +service qseecom /sbin/sh /sbin/qseecom.sh oneshot disabled user root group root - seclabel u:r:recovery:s0 +seclabel u:r:recovery:s0 + -on property:ro.crypto.state=encrypted - start sbinqseecomd + +# wait /dev/block/platform/soc/7864900.sdhci +# symlink /dev/block/platform/soc/7864900.sdhci /dev/block/bootdevice +# chmod 0660 /dev/qseecom +# chown system drmrpc /dev/qseecom +# chmod 0664 /dev/ion +# chown system system /dev/ion +# install_keyring +# +# wait /dev/block/bootdevice/by-name/persist +# mount ext4 /dev/block/bootdevice/by-name/persist /persist nosuid nodev barrier=1 +# restorecon_recursive /persist +# mkdir /persist/data 0700 system system + + # wait /dev/block/bootdevice/by-name/modem + # mount vfat /dev/block/bootdevice/by-name/modem /firmware ro shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 + # symlink /firmware/image /vendor/firmware + + # setprop crypto.ready 1 + +# separate copy needed to use /sbin/linker64 instead of /system/bin/linker64 +#service sbinqseecomd /sbin/qseecomd +# oneshot +# disabled +# user root +# group root +# seclabel u:r:recovery:s0 + +#on property:ro.crypto.state=encrypted +# start sbinqseecomd # read ro.build.fingerprint from system, setprop it. for ota -service fingerprintid /init.fingerprintid.sh - oneshot - disabled - user root - group root - seclabel u:r:recovery:s0 +#service fingerprintid /init.fingerprintid.sh +# oneshot +# disabled +# user root +# group root +# seclabel u:r:recovery:s0 -on late-init - start fingerprintid - # Enable double-tap to wake - #write /proc/touchpanel/double_tap_enable 1 +#on late-init +# start fingerprintid +# # Enable double-tap to wake +# #write /proc/touchpanel/double_tap_enable 1 on boot diff --git a/recovery/root/init.recovery.service.rc b/recovery/root/init.recovery.service.rc deleted file mode 100644 index bb2853c..0000000 --- a/recovery/root/init.recovery.service.rc +++ /dev/null @@ -1,5 +0,0 @@ -on boot - -# For starting recovery on 5.0 and newer -service recovery /sbin/recovery - seclabel u:r:recovery:s0 diff --git a/recovery/root/init.recovery.vold_decrypt.qseecomd.rc b/recovery/root/init.recovery.vold_decrypt.qseecomd.rc deleted file mode 100644 index 31cffc2..0000000 --- a/recovery/root/init.recovery.vold_decrypt.qseecomd.rc +++ /dev/null @@ -1,28 +0,0 @@ -on fs - # needed to make qseecomd work in recovery - chmod 0660 /dev/qseecom - chown system drmrpc /dev/qseecom - chmod 0664 /dev/ion - chown system system /dev/ion - - -# Oreo has qseecomd in /vendor/bin so add the additional -# service. Only an existi both. - -service sys_qseecomd /system/bin/qseecomd - user root - group root - setenv PATH /system/bin:/system/vendor/bin:/vendor/bin - setenv LD_LIBRARY_PATH /system/lib64:/system/lib:/system/vendor/lib64:/system/vendor/lib:/vendor/lib64:/vendor/lib - disabled - oneshot - seclabel u:r:recovery:s0 - -service ven_qseecomd /vendor/bin/qseecomd - user root - group root - setenv PATH /vendor/bin:/system/bin:/system/vendor/bin - setenv LD_LIBRARY_PATH /vendor/lib64:/system/lib64:/vendor/lib:/system/lib:/system/vendor/lib64:/system/vendor/lib - disabled - oneshot - seclabel u:r:recovery:s0 diff --git a/recovery/root/init.recovery.vold_decrypt.rc b/recovery/root/init.recovery.vold_decrypt.rc deleted file mode 100644 index ba2b185..0000000 --- a/recovery/root/init.recovery.vold_decrypt.rc +++ /dev/null @@ -1,12 +0,0 @@ -import /init.recovery.vold_decrypt.qseecomd.rc - -service sys_vold /system/bin/vold \ - --blkid_context=u:r:blkid:s0 --blkid_untrusted_context=u:r:blkid_untrusted:s0 \ - --fsck_context=u:r:fsck:s0 --fsck_untrusted_context=u:r:fsck_untrusted:s0 - socket vold stream 0660 root mount - socket cryptd stream 0660 root mount - setenv PATH /system/bin:/system/vendor/bin - setenv LD_LIBRARY_PATH /system/lib64:/system/lib:/system/vendor/lib64:/system/vendor/lib - disabled - oneshot - seclabel u:r:recovery:s0 diff --git a/recovery/root/qseecom.sh b/recovery/root/qseecom.sh new file mode 100644 index 0000000..9072c35 --- /dev/null +++ b/recovery/root/qseecom.sh @@ -0,0 +1,43 @@ +#!/sbin/sh +while [ "$(getprop ro.crypto.fs_crypto_blkdev)" != "/dev/block/dm-0" ]; do +if [ ! -d /system/etc ]; then #mount system if not already mounted + mount /system -o ro +fi + if [ `blkid /dev/block/bootdevice/by-name/vendor | grep -c ext4` -lt 1 ]; then + if [ ! -L /vendor ]; then + ln -s /system/vendor /vendor #if no vendor partition symlink it + fi + else + if [ ! -d /vendor ]; then # create a /vendor directory to mount onto if not there + if [ -L /vendor ]; then #if it exists and isnt a directory get it out of the way + rm /vendor + fi + mkdir /vendor + fi + mount /dev/block/bootdevice/by-name/vendor /vendor -t ext4 -o ro + fi + if [ -f /system/bin/qseecomd ]; then +# start sys_qseecomd + if [ -z "$(pidof qseecomd)" ]; then #make sure it isnt already running + LD_LIBRARY_PATH='/system/lib64:/system/lib' PATH='/system/bin' /system/bin/qseecomd & + fi + else +# start ven_qseecomd + if [ -z "$(pidof qseecomd)" ]; then + LD_LIBRARY_PATH='/vendor/lib64:/system/lib64:/vendor/lib:/system/lib' PATH='/vendor/bin:/system/bin' /vendor/bin/qseecomd & + fi + fi +while [ ! -d /data/media ]; do +sleep 0.02 +if [ ! -d /system/etc ]; then #sometimes /system gets unmounted + mount /system -o ro +fi +done +if [ ! -z "$(pidof qseecomd)" ]; then + killall qseecomd +fi +if [ -d /system/etc ]; then +umount /system +fi +exec /sbin/sh /qseecom.sh +done diff --git a/recovery/root/sbin/qseecom.sh b/recovery/root/sbin/qseecom.sh new file mode 100644 index 0000000..3760e39 --- /dev/null +++ b/recovery/root/sbin/qseecom.sh @@ -0,0 +1,51 @@ +#!/sbin/sh + +while [ -z $cryptodone ]; do + if [ -z "`mount | grep -w /system`" ]; then + mount -o ro /system + fi + + if [ -n "`blkid /dev/block/bootdevice/by-name/vendor | grep ext4`" ] && [ -z "`mount | grep -w /vendor`" ]; then + if [ -L /vendor ]; then + rm /vendor + fi + if [ ! -d /vendor ]; then + mkdir /vendor + fi + mount -t ext4 -o ro /dev/block/bootdevice/by-name/vendor /vendor + fi + + if [ -z "`ls -A /vendor`" ]; then + if [ -n "`mount | grep -w /vendor`" ]; then + umount /vendor + fi + if [ -d /vendor ]; then + rmdir /vendor + fi + ln -sf /system/vendor /vendor + fi + + if [ -z "`pidof qseecomd`" ]; then + if [ -f /system/bin/qseecomd ]; then + LD_LIBRARY_PATH='/system/lib64:/system/lib' PATH='/system/bin' /system/bin/qseecomd & + else + LD_LIBRARY_PATH='/vendor/lib64:/system/lib64:/vendor/lib:/system/lib' PATH='/vendor/bin:/system/bin' /vendor/bin/qseecomd & + fi + fi + + case `getprop ro.crypto.fs_crypto_blkdev` in + /dev/block/dm-*) cryptodone=1 ;; + esac +done + +if [ -n $cryptodone ]; then + killall qseecomd +fi + +if [ -n "`mount | grep -w /system`" ]; then + umount /system +fi + +if [ -n "`mount | grep -w /vendor`" ]; then + umount /vendor +fi diff --git a/recovery/root/sbin/qseecomd b/recovery/root/sbin/qseecomd deleted file mode 100644 index 2b3a0cc..0000000 Binary files a/recovery/root/sbin/qseecomd and /dev/null differ diff --git a/recovery/root/sbin/rebootdownload.sh b/recovery/root/sbin/rebootdownload.sh deleted file mode 100644 index fa4da8d..0000000 --- a/recovery/root/sbin/rebootdownload.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/sbin/sh - -reboot edl diff --git a/recovery/root/vendor/lib64/hw/gatekeeper.msm8953.so b/recovery/root/vendor/lib64/hw/gatekeeper.msm8953.so deleted file mode 100644 index cf65dee..0000000 Binary files a/recovery/root/vendor/lib64/hw/gatekeeper.msm8953.so and /dev/null differ diff --git a/recovery/root/vendor/lib64/hw/keystore.msm8953.so b/recovery/root/vendor/lib64/hw/keystore.msm8953.so deleted file mode 100644 index fb60016..0000000 Binary files a/recovery/root/vendor/lib64/hw/keystore.msm8953.so and /dev/null differ diff --git a/recovery/root/vendor/lib64/lib-sec-disp.so b/recovery/root/vendor/lib64/lib-sec-disp.so deleted file mode 100644 index c6bb1fe..0000000 Binary files a/recovery/root/vendor/lib64/lib-sec-disp.so and /dev/null differ diff --git a/recovery/root/vendor/lib64/libGPreqcancel.so b/recovery/root/vendor/lib64/libGPreqcancel.so deleted file mode 100644 index 9d26720..0000000 Binary files a/recovery/root/vendor/lib64/libGPreqcancel.so and /dev/null differ diff --git a/recovery/root/vendor/lib64/libGPreqcancel_svc.so b/recovery/root/vendor/lib64/libGPreqcancel_svc.so deleted file mode 100644 index 6e11142..0000000 Binary files a/recovery/root/vendor/lib64/libGPreqcancel_svc.so and /dev/null differ diff --git a/recovery/root/vendor/lib64/libQSEEComAPI.so b/recovery/root/vendor/lib64/libQSEEComAPI.so deleted file mode 100644 index 5d6f128..0000000 Binary files a/recovery/root/vendor/lib64/libQSEEComAPI.so and /dev/null differ diff --git a/recovery/root/vendor/lib64/libSecureUILib.so b/recovery/root/vendor/lib64/libSecureUILib.so deleted file mode 100644 index ceac443..0000000 Binary files a/recovery/root/vendor/lib64/libSecureUILib.so and /dev/null differ diff --git a/recovery/root/vendor/lib64/libStDrvInt.so b/recovery/root/vendor/lib64/libStDrvInt.so deleted file mode 100644 index 08e0138..0000000 Binary files a/recovery/root/vendor/lib64/libStDrvInt.so and /dev/null differ diff --git a/recovery/root/vendor/lib64/libdiag.so b/recovery/root/vendor/lib64/libdiag.so deleted file mode 100644 index eebface..0000000 Binary files a/recovery/root/vendor/lib64/libdiag.so and /dev/null differ diff --git a/recovery/root/vendor/lib64/libdrmfs.so b/recovery/root/vendor/lib64/libdrmfs.so deleted file mode 100644 index e133266..0000000 Binary files a/recovery/root/vendor/lib64/libdrmfs.so and /dev/null differ diff --git a/recovery/root/vendor/lib64/libdrmtime.so b/recovery/root/vendor/lib64/libdrmtime.so deleted file mode 100644 index 1067d64..0000000 Binary files a/recovery/root/vendor/lib64/libdrmtime.so and /dev/null differ diff --git a/recovery/root/vendor/lib64/libqisl.so b/recovery/root/vendor/lib64/libqisl.so deleted file mode 100644 index 0d81cf2..0000000 Binary files a/recovery/root/vendor/lib64/libqisl.so and /dev/null differ diff --git a/recovery/root/vendor/lib64/librpmb.so b/recovery/root/vendor/lib64/librpmb.so deleted file mode 100644 index ac6dea0..0000000 Binary files a/recovery/root/vendor/lib64/librpmb.so and /dev/null differ diff --git a/recovery/root/vendor/lib64/libsecureui.so b/recovery/root/vendor/lib64/libsecureui.so deleted file mode 100644 index 74abdc2..0000000 Binary files a/recovery/root/vendor/lib64/libsecureui.so and /dev/null differ diff --git a/recovery/root/vendor/lib64/libsecureui_svcsock.so b/recovery/root/vendor/lib64/libsecureui_svcsock.so deleted file mode 100644 index 8a41a30..0000000 Binary files a/recovery/root/vendor/lib64/libsecureui_svcsock.so and /dev/null differ diff --git a/recovery/root/vendor/lib64/libssd.so b/recovery/root/vendor/lib64/libssd.so deleted file mode 100644 index eab409d..0000000 Binary files a/recovery/root/vendor/lib64/libssd.so and /dev/null differ diff --git a/recovery/root/vendor/lib64/libtime_genoff.so b/recovery/root/vendor/lib64/libtime_genoff.so deleted file mode 100644 index 284cdc9..0000000 Binary files a/recovery/root/vendor/lib64/libtime_genoff.so and /dev/null differ diff --git a/recovery/root/verity_key b/recovery/root/verity_key deleted file mode 100644 index 31982d9..0000000 Binary files a/recovery/root/verity_key and /dev/null differ