This article focuses on the following two parts.
1. How to bring two PCs to an Android mobile phone for debugging.
2. How to Perfect the Root Android phone.
I have encountered such a problem. We all know that Android source code compilation usually requires Ubuntu Linux, therefore, Vmware ubuntu is installed on Mac OS X. So there is no problem. Connect the Android phone to the MBP, and the system will prompt you to connect to Mac OS X or Ubuntu. However, there is one problem, that is, ubuntu and mac OS x can only be connected at the same time. Due to some requirements, it is depressing to use Eclipse on Mac OS X to write Android applications and install them on the same Android phone, only one PC, including a virtual machine, can be connected through a USB cable ).
Technically, adb has the ability to connect an Android mobile phone to two PCs. However, most readers may use the ROM, Which is disabled for security purposes. If the reader uses the latest CM ROMcm10.1, the feature may also be available in the old version, which has not been tested yet ), you will find a "Network ADB debugging" added in the "Developer options ". 1. This is a sought-after function.
650) this. width = 650; "width =" 408 "height =" 679 "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131228/0A4225224-0.png "alt =" "/>
Figure 2
Select "Network ADB debugging. Remember the following ip address and port number. Connect to your mobile phone with a USB cable on a machine. The devices list of Eclipse shows that the mobile phone has been connected successfully. If you still use the current PC to connect to ADB through the network, you need to execute the following command that the PC and the mobile phone are in the same network segment ).
Adb kill-server
Adb connect 192.168.17.103: 5555
If everything is normal, it is connected. Open Eclipse and you will see the device 2 in the devices list.
650) this. width = 650; "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131228/0A4225338-1.png "alt =" "/>
Figure 2
In fact, the two devices are one, but the above is the mobile phone connected through the network, and the below is the mobile phone connected through the USB cable. Run the program now and you will still see the requirement to select the running device, as shown in 3.
650) this. width = 650; "border =" 0 "src =" http://www.bkjia.com/uploads/allimg/131228/0A4223402-2.png "alt =" "/>
Figure 3
You can choose either of them, because the two devices only connect to the PC in different ways.
If it is on a different PC or virtual machine), one goes through the USB cable, and the other goes through the network. Eclipse on the two machines can debug the program on the same mobile phone. Isn't that great!
If you want to disconnect the network adb, run the adb disconnect command.
Note that this operation is dangerous. Once you select "Network adb debugging", as long as other users in the same network segment know the IP address and port number, you can operate your mobile phone at will, and there will be no prompts. Even on the other end of the earth, as long as you are in the same network segment, including VPN ).
Now go to the second topic. If you get the ROM of your Android phone perfectly. Because we used CMROM and did not know what the cm rom is and checked it on the Internet), we still discuss the root process of cm rom here.
Readers who are new to Android mobile phones may feel that the root mobile phone is very complicated, but it is actually easy. The basic principle of Root is to place an su command in the/system/xbin directory of the Android system. Linux users who have used su know what su is and a command to extract root permissions. If the reader uses cm rom, the su command is available in the/system/xbin directory. In addition, you can directly enable the root permission in the lower version of the root permission cm in the settings), so you can use the cm rom to save this step. Of course, if you are not using the cm rom, that's fine. In the next cm rom compressed package, delete all the miscellaneous items in the package, including the kernel image boot. img), and only keep the su file in the system/xbin directory. You can also find a fuse on the Internet. Then, you 'd better click clockworkmod recovery. in this case, update.zip can be refreshed without signature verification. Then you can use the recoverytemplate to refresh update.zip. This update.zip file is not a complete ROM, but an upgrade package. The purpose is to put the su file in the/system/xbin directory. This directory is read-only without the root permission ). After the flash, enter the shelladb shell on the mobile phone), execute su, and find that the original $ is changed to #, which indicates that it is already root. Of course, some directories are still not writable. For example, to make the system and its subdirectories writable, You need to execute the following command again.
Mount-o rw, remount/system
Now there is another problem, that is, entering the shell through the adb Shell, the default is still $, which is a bit of trouble, because for programmers, You Need To debug the system program, use the adbremount command to change the/system/app directory to writable. Then, use the adb push command to directly upload the apk file to this directory. However, if it is not root by default, it is not allowed to execute the command ). So another thing we need to do is to modify the content of default. prop in the root directory of the Android system, which can be changed to the following content.
Ro. adb. secure = 0
Ro. secure = 0
Ro. allow. mock. location = 1
Ro. debuggable = 1
Persist. sys. usb. config = mass_storage, adb
Persist. service. adb. enable = 1
The biggest problem is that the default. prop is a memory file, and it is useless if it is changed. It will be restored once it is restarted, and only after the restart can it take effect as if it entered two difficult reasoning ). Therefore, you can modify the default. prop file directly by modifying the boot. imgfile. The file consists of zImage and ramdisk. img. ZImage is the binary file of the Linux kernel. Ramdisk. img is a memory disk image. The image contains the init program called the first running program of Android. The default. prop file is also included in the image. The android source code and Linux kernel source code are required below. We strongly recommend that you use the source code provided by CM. Because the CM team has made perfect adaptation for us, you only need to modify the business-related content. Now let's pay tribute to the CM team.
After the Android source code is compiled, a root directory is generated in the related sub-directories of the out directory. The contents in this directory are extracted from the ramdisk. imgfile. Now find the default. prop file and install the above content to modify it. Then use the following command to regenerate the ramdisk. imgfile.
Mkbootfs root | minigzip>/ramdisk. img
Next, use the following command to regenerate the boot. imgfile.
Mkbootimg -- kernel -- ramdisk. img-o boot. img
The kernel binary file is exactly the same as zImage. Only when compiling android source code, name it
OK, now you can enter the bootloader mode, and then re-Execute fastboot flash bootboot. img to brush the kernel image, and then restart the mobile phone. Now you can go to shell. OK, the default value is. Exit shell and execute adb remount. You can use adb push to upload files to other directories of the/system, such as/system/app.
This article is from the "Li Ning geek world" blog, please be sure to keep this source http://androidguy.blog.51cto.com/974126/1193467