: 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
- Tools/unpackbootimg-I boot. IMG-O out
Copy code
Get
- Boot. IMG-Base
- Boot. IMG-cmdline
- Boot. IMG-pagesize
Copy code
Three record files
- Boot.img-ramdisk.gz
Copy code
A root directory image and a kernel Image File
- Boot. IMG-zimage
Copy code
Mount the image file in the root directory as a partition and copy the content to a directory.
- CD out
- Mkdir ramdisk
- CD ramdisk
- 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
- CD ..
- Rm-F boo.img-ramdisk.gz
- ../Tools/mkbootfs./ramdisk | gzip> boo.img-ramdisk.gz
Copy code
Use mkbootimg to package kernel images and root directory images into boot. img
- Rm-f ../boot. img
- .. /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
- CD ..
- 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.