add decryption support and cleanup

android-7.1
root 8 years ago
parent 7540cd0071
commit d324fdaad5

@ -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

@ -6,3 +6,4 @@
"revision":"android-7.1"
}
]

@ -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

@ -5,7 +5,9 @@
# Currently we dont have e2fsck compiled. So fs check would failed.
# <mount_point> <fstype> <device> <device2> <flags>
/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

@ -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.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
/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

@ -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

@ -1,5 +0,0 @@
on boot
# For starting recovery on 5.0 and newer
service recovery /sbin/recovery
seclabel u:r:recovery:s0

@ -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

@ -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

@ -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

@ -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

Binary file not shown.

@ -1,3 +0,0 @@
#!/sbin/sh
reboot edl

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save