How to run 970 of ADB with the root permission

Source: Internet
Author: User

: Make ADB (in fact, it is/sbin/adbd, that is, the server of ADB) run on the Root permission. After connecting to the computer in debug mode, ADB shell can directly modify the files in the system folder (the prompt is "#" instead of "$" after startup) without the need for Su to obtain the root permission.
For example, if a file in the/system/framework is modified, the system cannot be accessed after the file is restarted. If the mobile phone is in debugging mode, you can still enter the ADB shell.
The backup file in the/system/framework cannot be restored under the ADB without the root permission. At this time, the su command also loses its function and cannot obtain the root permission. You can only restore all system partitions in recovery mode.
If Adb is root after it is started, the backup file can be directly restored without the entire partition being restored.

Principle: whether ADB runs under normal or root permissions depends on the Ro. Secure attribute value defined in the default. Prop file in the root directory. Change the value to 0 to allow ADB to run under the root permission.
This file is generally read-only. It is only feasible to modify the image file boot. IMG.

Get boot. IMG: first, modify the full-outsourcing mode. To add a third-party recovery to the official full-Outsourcing Mode, see --bbs.gfan.com/android-3620422-1-1.html.
After the flash is complete, enter the recovery mode and back up the Rom. After the backup is complete, the boot. imgfile to be modified will be obtained in the/sdcard/clockworkmod/backup/# backup date # folder.

Modify required tools: unpackbootimg (used to decompress boot) provided in the Tools Folder of the patchrom project mentioned in the original tutorial. you can decompress the imgfile and recovery. imgfile), mkbootimg (re-package boot. IMG image file) and mkbootfs (package the modified root directory into an image)

Environment: Linux (I have not encountered any problems when operating on fedora14 in the original tutorial on Ubuntu)

Process:
Copy the boot. imgfile that was just backed up. Execute Command

  1. Tools/unpackbootimg-I boot. IMG-O out

Copy code

Get

  1. Boot. IMG-Base
  2. Boot. IMG-cmdline
  3. Boot. IMG-pagesize

Copy code

Three record files

  1. Boot.img-ramdisk.gz

Copy code

A root directory image and a kernel Image File

  1. Boot. IMG-zimage

Copy code

Mount the image file in the root directory as a partition and copy the content to a directory.

  1. CD out
  2. Mkdir ramdisk
  3. CD ramdisk
  4. Gzip-DC ../boo.img-ramdisk.gz | cpio-I

Copy code

At this time, you can find the default. Prop file in the out/ramdisk directory and open and modify default. Prop = 0 to save.

Repackage the root directory and enter the command

  1. CD ..
  2. Rm-F boo.img-ramdisk.gz
  3. ../Tools/mkbootfs./ramdisk | gzip> boo.img-ramdisk.gz

Copy code

Use mkbootimg to package kernel images and root directory images into boot. img

  1. Rm-f ../boot. img
  2. .. /Tools/mkbootimg -- cmdline' # boot. the value in the IMG-cmdline file. If it is null, The -- cmdline parameter # '-- kernel boot can be omitted. IMG-zimage -- ramdisk boo.img-ramdisk.gz -- Base 0x # boot. the value in the IMG-base file. Here it is 80000000. The value starting with 0x indicates hexadecimal # -- pagesize # file boot. the value in IMG-pagesize. Here is 2048 #-o .. /boot. IMG

Copy code

This allows ADB to run boot with the root permission. IMG made it (the original boot. the imgfile is 6 m, and only 4.4 m-m kernel image + M root directory image is generated. There is no additional space for the new image ).

Next generate MD5, enter

  1. CD ..
  2. Md5sum boot. img

Copy code

Then, take boot. IMG back to the SD card and modify the first line of nandroid. MD5 in the same directory (the line ending with boot. IMG) as the result of the hash image file.

Finally, flash the machine in recovery mode ...... Refresh the new image to your mobile phone.
PS: modifying boot. IMG is risky and may become real. Be careful. Even strictly following the steps, absolute security cannot be guaranteed. For more detailed principles and complete operations, see the original tutorial ......

After the phone is restarted, connect to the computer, enable debug mode, and enter ADB shell on the computer. Under normal circumstances, you should see the # prompt instead of the previous $.

PS: modified the full-outsourcing recovery. Sometimes, you will find that the available space of the system partition is only 30 + M (v20b of the Singapore version, and the recovery is not a touch screen version )...... You can also obtain a larger available space for the system partition by backing up the system after refreshing and then replying to the backup method.
The test shows that the available space of the system partition is 200 m + after the backup is restored.

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.