Skip to content

Commit

Permalink
Fix decrypt and bootctl for Android O
Browse files Browse the repository at this point in the history
  • Loading branch information
Dees-Troy committed Oct 6, 2017
1 parent 387e7f8 commit 6cabca4
Show file tree
Hide file tree
Showing 124 changed files with 87 additions and 45 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 12 additions & 3 deletions device-common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,18 @@ PRODUCT_COPY_FILES += \
DEVICE_PACKAGE_OVERLAYS += device/google/marlin/overlay

PRODUCT_COPY_FILES += \
device/google/marlin/recovery/root/sbin/bootctrl.msm8996.so:recovery/root/sbin/bootctrl.msm8996.so \
device/google/marlin/recovery/root/sbin/pulldecryptfiles.sh:recovery/root/sbin/pulldecryptfiles.sh \
device/google/marlin/recovery/root/sbin/qseecomd:recovery/root/sbin/qseecomd
device/google/marlin/recovery/root/odm/lib64/hw/bootctrl.msm8996.so:recovery/root/odm/lib64/hw/bootctrl.msm8996.so \
device/google/marlin/recovery/root/sbin/libdiag.so:recovery/root/sbin/libdiag.so \
device/google/marlin/recovery/root/sbin/libdrmfs.so:recovery/root/sbin/libdrmfs.so \
device/google/marlin/recovery/root/sbin/libdrmtime.so:recovery/root/sbin/libdrmtime.so \
device/google/marlin/recovery/root/sbin/libQSEEComAPI.so:recovery/root/sbin/libQSEEComAPI.so \
device/google/marlin/recovery/root/sbin/librpmb.so:recovery/root/sbin/librpmb.so \
device/google/marlin/recovery/root/sbin/libssd.so:recovery/root/sbin/libssd.so \
device/google/marlin/recovery/root/sbin/librecovery_updater_msm8996.so:recovery/root/sbin/librecovery_updater_msm8996.so \
device/google/marlin/recovery/root/odm/lib64/hw/gatekeeper.msm8996.so:recovery/root/odm/lib64/hw/gatekeeper.msm8996.so \
device/google/marlin/recovery/root/odm/lib64/hw/keystore.msm8996.so:recovery/root/odm/lib64/hw/keystore.msm8996.so \
device/google/marlin/recovery/root/sbin/qseecomd:recovery/root/sbin/qseecomd \
device/google/marlin/recovery/root/init.recovery.usb.rc:root/init.recovery.usb.rc

# Input device files
PRODUCT_COPY_FILES += \
Expand Down
12 changes: 1 addition & 11 deletions init.recovery.common.rc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on fs
chown system system /dev/ion
start pulldecryptfiles
install_keyring
setprop ro.hardware.bootctrl msm8996

# separate copy needed to use /sbin/linker64 instead of /system/bin/linker64
service sbinqseecomd /sbin/qseecomd
Expand All @@ -15,16 +16,5 @@ service sbinqseecomd /sbin/qseecomd
group root
seclabel u:r:recovery:s0

service pulldecryptfiles /sbin/pulldecryptfiles.sh
oneshot
disabled
user root
group root
seclabel u:r:recovery:s0

on boot
start pulldecryptfiles
start sbinqseecomd

#on property:ro.crypto.state=encrypted
# start sbinqseecomd
1 change: 1 addition & 0 deletions marlin/BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,4 @@ TW_DEFAULT_BRIGHTNESS := "80"
TW_INCLUDE_CRYPTO := true
AB_OTA_UPDATER := true
TARGET_RECOVERY_UPDATER_LIBS := librecovery_updater_msm
TW_EXCLUDE_DEFAULT_USB_INIT := true
File renamed without changes.
8 changes: 4 additions & 4 deletions recovery/oem-recovery/oem-updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Value* DecryptFn(const char* name, State* state, int argc, Expr* argv[]) {
if (argc != 2)
return ErrorAbort(state, "%s expects 2 args, got %d", name, argc);

if (ReadArgs(state, argv, 2, &src_file, &dst_file))
//if (ReadArgs(state, argv, 2, &src_file, &dst_file))
return NULL;

rc = decrypt_image(src_file, dst_file);
Expand All @@ -61,7 +61,7 @@ Value* BootUpdateFn(const char* name, State* state, int argc, Expr* argv[])
if (argc != 1)
return ErrorAbort(state, "%s() expects 1 args, got %d", name, argc);

if (ReadArgs(state, argv, 1, &stageStr))
//if (ReadArgs(state, argv, 1, &stageStr))
return NULL;

if (!strcmp(stageStr, "main"))
Expand All @@ -84,6 +84,6 @@ Value* BootUpdateFn(const char* name, State* state, int argc, Expr* argv[])
}

void Register_librecovery_updater_msm() {
RegisterFunction("msm.decrypt", DecryptFn);
RegisterFunction("msm.boot_update", BootUpdateFn);
//RegisterFunction("msm.decrypt", DecryptFn);
//RegisterFunction("msm.boot_update", BootUpdateFn);
}
68 changes: 68 additions & 0 deletions recovery/root/init.recovery.usb.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
on init
write /sys/class/android_usb/android0/f_rndis/vendorID 18D1
write /sys/class/android_usb/android0/f_rndis/wceis 1

on boot
write /sys/class/android_usb/android0/iSerial ${ro.serialno}
write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
write /sys/class/android_usb/android0/iProduct ${ro.product.model}

write /sys/class/android_usb/f_mass_storage/lun/nofua 1

write /sys/class/android_usb/android0/f_rndis_qc/rndis_transports BAM2BAM_IPA
write /sys/module/g_android/parameters/mtp_tx_req_len 131072
write /sys/module/g_android/parameters/mtp_rx_req_len 131072
setprop sys.usb.ffs.max_write 524288
setprop sys.usb.ffs.max_read 524288
setprop sys.usb.mtp.device_type 3
setprop sys.usb.rps_mask 0

write /sys/class/android_usb/android0/f_ffs/aliases adb
mkdir /dev/usb-ffs 0775 shell shell
mkdir /dev/usb-ffs/adb 0770 shell shell
mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
mkdir /dev/usb-ffs/mtp 0770 mtp mtp
mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 18D1
write /sys/class/android_usb/android0/idProduct 4EE2
write /sys/class/android_usb/android0/bDeviceClass 0
write /sys/class/android_usb/android0/bDeviceSubClass 0
write /sys/class/android_usb/android0/bDeviceProtocol 0
write /sys/class/android_usb/android0/functions adb
write /sys/class/android_usb/android0/enable 1
start adbd

on property:sys.usb.config=none
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/bDeviceClass 0

on property:sys.usb.config=adb
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 18D1
write /sys/class/android_usb/android0/idProduct 4EE2
write /sys/class/android_usb/android0/bDeviceClass 0
write /sys/class/android_usb/android0/bDeviceSubClass 0
write /sys/class/android_usb/android0/bDeviceProtocol 0
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
start adbd
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=mtp,adb
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 18D1
write /sys/class/android_usb/android0/idProduct 4EE2
write /sys/class/android_usb/android0/bDeviceClass 0
write /sys/class/android_usb/android0/bDeviceSubClass 0
write /sys/class/android_usb/android0/bDeviceProtocol 0
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
start adbd
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=adb
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable ${service.adb.root}
start adbd
Binary file added recovery/root/odm/lib64/hw/bootctrl.msm8996.so
Binary file not shown.
Binary file added recovery/root/odm/lib64/hw/gatekeeper.msm8996.so
Binary file not shown.
Binary file added recovery/root/odm/lib64/hw/keystore.msm8996.so
Binary file not shown.
Binary file added recovery/root/sbin/libQSEEComAPI.so
Binary file not shown.
Binary file added recovery/root/sbin/libdiag.so
Binary file not shown.
Binary file added recovery/root/sbin/libdrmfs.so
Binary file not shown.
Binary file added recovery/root/sbin/libdrmtime.so
Binary file not shown.
Binary file not shown.
Binary file added recovery/root/sbin/librpmb.so
Binary file not shown.
Binary file added recovery/root/sbin/libssd.so
Binary file not shown.
27 changes: 0 additions & 27 deletions recovery/root/sbin/pulldecryptfiles.sh

This file was deleted.

1 change: 1 addition & 0 deletions sailfish/BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,4 @@ TW_DEFAULT_BRIGHTNESS := "80"
TW_INCLUDE_CRYPTO := true
AB_OTA_UPDATER := true
TARGET_RECOVERY_UPDATER_LIBS := librecovery_updater_msm
TW_EXCLUDE_DEFAULT_USB_INIT := true

0 comments on commit 6cabca4

Please sign in to comment.