Android Recovery support adb shell
The recent development process noted that recovery does not support adb shell. For ease of debugging, decide to add this feature.
We started with the user version number system and entered recovery after entering the ADB shell command. Tip "Error:no devices/emulators found". We first confirm whether RECOVERY.IMG includes ADB, see if Out\debug\target\product\xxx\recovery\root\sbin has adb file (source \system\core\adb), and then check \ Bootable\recovery\etc\init.rc under About ADBD
Service Adbd/sbin/adbd--root_seclabel=u:r:su:s0--device_banner=recovery disabled socket ADBD Stream 660 System System Seclabel U:r:adbd:s0 # always start adbd on Userdebug and Engbuildson property:ro.debuggable=1 writ E/sys/class/android_usb/android0/enable 1 start adbd # Restart ADBD so it can run as Rooton property:service.adb.root =1 write/sys/class/android_usb/android0/enable 0 Restart Adbdwrite/sys/class/android_usb/android0/enable 1
From the above, the Init.rc ADBD is configured, disabled indicates that the boot does not start, such as Ro.debuggable is set to 1. Then the ADB will open, or service.adb.root set to 1, then restart ADBD.
ro.debuggable Assignment of content below \BUILD\CORE\MAIN.MK
Ifeq (true,$ (strip$ (enable_target_debugging))) #Target are more debuggable and adbd are on by default Additional_defaul T_properties + = ro.debuggable=1
Enable_target_debugging values below \BUILD\CORE\MAIN.MK:
# # User/userdebug # # User_variant: = $ (Filter useruserdebug,$ (target_build_variant)) Enable_target_debugging: = Truetags_to_install: =ifneq (, $ (user_variant)) #Target is secure in user builds. Additional_default_properties + = ro.secure=1 ifeq ($ (user_variant), userdebug) #Pick up some extra useful tools Tags_to_install + = Debug #Enable Dalvik lock contention logging for Userdebug builds. Additional_build_properties + = dalvik.vm.lockprof.threshold=500 else #Disable debugging in plain user builds. Enable_target_debugging: = #Add for testusbdebugging () additional_default_properties + = ro.adb.secure=1 Endif ... Endif
It is implied that enable_target_debugging: = True, based on the value of User_variant is assumed to be user. Then enable_target_debugging: =. This is also related to Target_build_variant, which corresponds to a value in variant_choices= (User Userdebug Eng). It is up to us to choose, the relevant reality is now in \build\envsetup.sh.
According to the above. The compile-time hypothesis is to choose Userdebug or Eng. The ro.debuggable=1. Below we choose ENG version number to compile recovery.img. After entering recovery, enter the ADB shell command. Tips:
Exec '/system/bin/sh ' failed:no such Fileor directory (2)
Represents the file without sh. Unable to enter the shell, check that the RAMDisk FileSystem system folder is (Out\debug\target\product\xxx\recovery\root\system) empty. But we know boot.img under is able to see \system\core\rootdir\init.rc check boot.img start init.rc about SH
Service console/system/bin/sh class core console disabled user Shell Group Shell log Seclabel u:r:shell:s0 on Property:ro.debuggable=1start console
This is the start of the SH console. So you need to add the appropriate content to the BOOTABLE\RECOVERY\ETC\INIT.RC:
Figure 1
We know that there is no Bin folder (and of course, SH) under Out\debug\target\product\xxx\recovery\root\system, so it needs to be created at compile time. Need to \build\core\makefile add Create folder and copy the/system/bin/sh under the Out folder to the Out/recovery/system/bin folder
Figure 2
But this still does not work, and later know that the recovery executable file is statically compiled. This is because there is no shared library in recovery mode and there is a lack of a dynamic link library loader (/system/bin/linker,android dynamic connector linker and static connector LD).
So \external\mksh\android.mk
Figure 3
References Link:
Android recovery.img support adb shell
http://blog.csdn.net/chituhuan/article/details/52383655
[Imx6q] [Android5.1] Porting notes---Recovery Mode's shell feature implementation (Sh+toolbox)
http://blog.csdn.net/kris_fei/article/details/50921384
Android Recovery Support Adb
Http://www.jianshu.com/p/a0bdcce0a5e1
Android Recovery support adb shell