How to add busybox In the Android Simulator)

Source: Internet
Author: User

1. What is busybox?
BusyBox is a software integrated with more than one hundred common linux commands and tools. BusyBox contains some simple tools, such as ls, cat, and echo. It also contains some larger and more complex tools, such as grep, find, mount, and telnet. Some people call BusyBox the Swiss army knife in Linux. In short, BusyBox is like a big toolbox, which integrates many Linux tools and commands. It also contains the built-in shell Android system. Its official website is: http://www.busybox.net/


Why add busybox to Android?

Users who have used adb shell should know that by default, commands such as clear, grep, find, and vi cannot be used in adb shell, even the full function of automatic Tab link complementing cannot be used. For coders who are used to using these commands, This is a miserable thing. Fortunately, we have busybox!

 


2 download busybox
Open the download interface: http://www.busybox.net/downloads/binaries/, such:





Select the latest version: 1.19.0 and go to the next page:

Select the version suitable for your device to download, here we download the busybox-armv6l for Android module.
After downloading it, rename it busybox:


 

[Plain] $ mv busybox-armv6l busybox
$ Chmod 755 busybox
$ Mv busybox-armv6l busybox
$ Chmod 755 busybox


3. Enter the simulator.
First, use adb shell to enter the simulator, create a directory for busybox under the/data directory, and then put busybox in this directory.

[Plain] $ adb shell
# Cd/data
# Mkdir busybox
# Exit
$ Adb shell push busybox/data/busybox
$ Adb shell
# Cd/data
# Mkdir busybox
# Exit
$ Adb shell push busybox/data/busybox
For example:




 

4. Install and run the tool provided by busybox
Connect the simulator with the adb shell again, enter the/data/busybox directory, and enter

[Plain] #./busybox clear
#./Busybox clear. Can it take effect? Haha

However, this is still not very easy to use, because every time you use the busybox command, you have to add it before the command line. the/busybox prefix is very troublesome. Therefore, we need to install the commands provided by bosybox to the simulator to save the trouble.

Installation:

In the current directory of/data/busybox, enter:

[Plain] #./busybox -- install ./
#./Busybox -- install ./
-- Install. /indicates the installation to the current directory. The reason why the installation is to be installed to the current directory is that the installation to the/system/bin directory by default or the/system/xbin directory cannot be successful, because you do not have sufficient permissions.

Enter the following in the current directory:

[Plain] #./clear
#. /Clear: the clear command takes effect, which is a step ahead of the previous steps. however, it is still not very good, so the command to run busybox must enter the/data/busy directory or input in the command. /data/busybox/clear, such as these commands, is still relatively troublesome. Therefore, you need to modify the value of a PATH:

[Plain] # export PATH =/data/busybox: $ PATH
# Export PATH =/data/busybox: $ PATH
Then try to run clear in any directory and you can see that it is OK. Congratulations! You have finally installed busybox!

However, some things are not very convenient, but there are at least three shortcomings:

[Plain] The Automatic completion function of the 1 Tab key still does not work.
2 # The current path is not displayed before it, which makes it often unknown which layer has been entered into the directory.
3. log out of the adb shell and enter again. You must reset the PATH value to restore the access to the busybox tool.
1. The Automatic completion function of the Tab key still does not work.
2 # The current path is not displayed before it, which makes it often unknown which layer has been entered into the directory.
3. log out of the adb shell and enter again. You must reset the PATH value to restore the access to the busybox tool.
As for the preceding problem, there is actually an ash shell in busybox and runs it directly:

[Plain] # ash
# Ash, then we can try to see if the tab key auto-completion function also shows that the current path function is available. OK. The first two problems have been solved. The next time I use bosybox, run ash first. after this operation, the display without any color will become colorful, as shown in:




 

The last question is left. solution to the last problem: After the adb shell, there is an init under the root directory of the Android simulator. rc file. for example, open it with vi (vi is also a tool provided by busybox) and add the following command in the last line:

[Plain] # export PATH =/data/busybox: $ PATH
# Export PATH =/data/busybox: $ PATH and save it. The system prompts that the current file is a read-only file and cannot be saved. it seems that there is no write permission. You need to obtain sufficient permissions and then modify the file and save it to solve the third problem.

Unfortunately, this file is read-only. I tried to install z4root software to obtain the root permission, modify default. prop and many other methods, and failed to save the contents of modifying init. rc... It is estimated that it cannot be modified in adb. If anyone knows the method, please let us know!

Another method I know is to modify the init. rc file in the out directory of the source code, regenerate the image file, and restart the simulator. However, this method is equivalent to re-refreshing the image. There are some limitations.

 

 

From flying dreams to achieving the future
 

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.