Android Recovery support adb shell

Source: Internet
Author: User

Android Recovery support adb shell

The recent development process has noted that recovery does not support ADB shell and has decided to increase this functionality for ease of debugging.

At first we adopted the user version of the system, enter the recovery after entering the ADB shell command, prompted "Error:no devices/emulators found", we first confirm whether the recovery.img contains ADB, see out\ Debug\target\product\xxx\recovery\root\sbin If there is an adb file (source code \system\core\adb), 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, 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 setting to 1, then restart ADBD.

Ro.debuggable the contents of the \build\core\main.mk below the value

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 the contents below the \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

The default is enable_target_debugging: = True, according to the value of user_variant if the user, then enable_target_debugging: =, this and target_build_ Variant, this variable corresponds to a value in variant_choices= (User Userdebug Eng), which is chosen by us, related to the implementation in \build\envsetup.sh.

According to the above, if you choose Userdebug or eng at compile time, then ro.debuggable=1, below we choose ENG version compiled recovery.img, enter recovery, enter the ADB shell command, prompt:

Exec '/system/bin/sh ' failed:no such Fileor directory (2)

Indicates that there is no sh this file, unable to enter the shell, check the RAMDisk file system directory for (Out\debug\target\product\xxx\recovery\root\system) empty, But we know boot.img under IS can, 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 in Bootable\recovery\etc\init.rc:

Figure 1

We know that there is no Bin folder under Out\debug\target\product\xxx\recovery\root\system (of course, there is no sh), so it needs to be created at compile time, need \build\core\ Makefile Add Create directory and copy/system/bin/sh from out directory to Out/recovery/system/bin directory

Figure 2

But this still does not work, and later know that the recovery executable is statically compiled, because there is no shared library in recovery mode and there is a lack of dynamic link insecure library carrier (/system/bin/linker, Android dynamic connector linker with static connector LD).

So \external\mksh\android.mk


Figure 3

Reference Links:

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.