Android - How can I enable adbd during boot on Cyanogenmod?
Since Android 4.2.2, [USB debugging requires authentication], something that is not possible during boot. To disable this, set the following property in default.prop (inside initrd):
ro.adb.secure=0
Alternatively, copy ~/.android/adbkey.pub
into the initial ramdisk of the boot/recovery image at /adb_keys
. This preserves the secure feature while granting your key access.
This enables adbd for a short time. It seems that some process is setting sys.usb.config=mtp
. To work around that, I applied this patch (perhaps only the start adbd
part is necessary, I have only tested the below):
--- init.smdk4x12.usb.rc 2013-10-24 18:47:34.894857300 +0200
+++ init.smdk4x12.usb.rc 2013-10-24 18:47:40.775493943 +0200
@@ -12,10 +12,11 @@
on property:sys.usb.config=mtp
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 04e8
- write /sys/class/android_usb/android0/idProduct 685c
- write /sys/class/android_usb/android0/functions ${sys.usb.config}
+ write /sys/class/android_usb/android0/idProduct 6860
+ write /sys/class/android_usb/android0/functions ${sys.usb.config},adb
write /sys/class/android_usb/android0/enable 1
- setprop sys.usb.state ${sys.usb.config}
+ start adbd
+ setprop sys.usb.state ${sys.usb.config},adb
on property:sys.usb.config=mtp,adb
write /sys/class/android_usb/android0/enable 0
You won't be able to get root (su
) through this. For that, set:
ro.secure=0
Updating the initramfs block, the initramfs header field and the SHA1 ID (header) of the boot.img is not in the scope of this answer.