Reprinted from: http://www.cnblogs.com/xiaowenji/archive/2011/03/12/1982309.html
Have you ever had this experience? input ADB shell in the command line and then use the command to operate your mobile phone or simulator. However, these commands are common Linux commands, which are not easy to use. Have you ever thought about using a complete shell on Android? Use busybox. You can use terminal emulator either by connecting to the device using the ADB command line or on your mobile phone.
1. What is busybox?
Busybox is a single executable implementation of standard Linux tools. Busybox contains some simple tools, such as CAT and ECHO, and some larger and more complex tools, such as grep, find, mount, and telnet. Some people refer to busybox as the Swiss army knife in the Linux tool. In short, busybox is like a big toolbox, which integrates many Linux tools and commands. (From Baidu encyclopedia)
2. Install busybox on Android
Preparation:
0. First, you need to give the mobile phone to the root user. The specific tutorial is not provided here. There are many online courses.
1. Download busybox's binary, open this address http://www.busybox.net/downloads/binaries, select the latest version, and then download the version corresponding to your device architecture, here I downloaded the busybox-armv6l, the following will take this file name as an example.
2. a command line environment is required. Use ADB on your computer or terminal emulator on your mobile phone.
3. Connect the phone and computer, set the USB mode of the phone to none (only charging), and enable the USB debugging mode.
Installation:
1. Rename busybox-armv6l to busybox
2. Pass busybox to the SD card of your mobile phone. You can use the following command or try another method.
Open terminal (Linux, Mac) or cmd (Windows)
adb push ~/Desktop/busybox /mnt/sdcard |
The ~ /Replace desktop with the correct path based on your own situation.
3. Enter the following command to write files in the/system directory
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 / system |
Use ls to check whether the/system contains the xbin directory. If not, enter mkdir xbin to create the directory. In this example, install busybox to/system/xbin.
4. Copy the busybox file to/system/xbin and assign it the "executable" permission
cp /mnt/sdcard/busybox / system /xbin |
5. Now you can use the busybox command. For example, if there is no clear screen command before, you only need to enter busybox clear to implement the clear screen function. To use the full ls, you only need to enter busybox ls.
However, adding a busybox before each installation is too troublesome, so we need to continue to complete the installation.
Enter
If you want to install it to another directory, replace the vertex with another path.
Now the installation is complete. Compare the original LS command with the LS command in busybox.
Common Errors:
1. If such an error occurs during installation,
Busybox:/bin/zcat: no such file or directory
Busybox:/sbin/zcip: Invalid cross-device link
The installation path is not entered. The correct example is busybox -- install/system/xbin.
2. If such an error occurs,
CP:/system/xbin/busybox: Read-Only File System
The mount command in step 3 is not entered correctly.
TIPS:
1. There are ash, hush, and sh shells in busybox. Enter ash or hush in the command line. You can select the command you just entered by pressing the up/down key as in bash.
2. the Android system itself has ls commands, and busybox also has ls. When LS is input, the android LS is called. Do you need to add a busybox to the front every time you want to use the LS of busybox? No. You can use the alias command.
Similarly, commands such as CP and MV can be done in this way. You can also modify/init. RC.
Reprinted from: http://www.cnblogs.com/xiaowenji/archive/2011/03/12/1982309.html
Have you ever had this experience? input ADB shell in the command line and then use the command to operate your mobile phone or simulator. However, these commands are common Linux commands, which are not easy to use. Have you ever thought about using a complete shell on Android? Use busybox. You can use terminal emulator either by connecting to the device using the ADB command line or on your mobile phone.
1. What is busybox?
Busybox is a single executable implementation of standard Linux tools. Busybox contains some simple tools, such as CAT and ECHO, and some larger and more complex tools, such as grep, find, mount, and telnet. Some people refer to busybox as the Swiss army knife in the Linux tool. In short, busybox is like a big toolbox, which integrates many Linux tools and commands. (From Baidu encyclopedia)
2. Install busybox on Android
Preparation:
0. First, you need to give the mobile phone to the root user. The specific tutorial is not provided here. There are many online courses.
1. Download busybox's binary, open this address http://www.busybox.net/downloads/binaries, select the latest version, and then download the version corresponding to your device architecture, here I downloaded the busybox-armv6l, the following will take this file name as an example.
2. a command line environment is required. Use ADB on your computer or terminal emulator on your mobile phone.
3. Connect the phone and computer, set the USB mode of the phone to none (only charging), and enable the USB debugging mode.
Installation:
1. Rename busybox-armv6l to busybox
2. Pass busybox to the SD card of your mobile phone. You can use the following command or try another method.
Open terminal (Linux, Mac) or cmd (Windows)
adb push ~/Desktop/busybox /mnt/sdcard |
The ~ /Replace desktop with the correct path based on your own situation.
3. Enter the following command to write files in the/system directory
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 / system |
Use ls to check whether the/system contains the xbin directory. If not, enter mkdir xbin to create the directory. In this example, install busybox to/system/xbin.
4. Copy the busybox file to/system/xbin and assign it the "executable" permission
cp /mnt/sdcard/busybox / system /xbin |
5. Now you can use the busybox command. For example, if there is no clear screen command before, you only need to enter busybox clear to implement the clear screen function. To use the full ls, you only need to enter busybox ls.
However, adding a busybox before each installation is too troublesome, so we need to continue to complete the installation.
Enter
If you want to install it to another directory, replace the vertex with another path.
Now the installation is complete. Compare the original LS command with the LS command in busybox.
Common Errors:
1. If such an error occurs during installation,
Busybox:/bin/zcat: no such file or directory
Busybox:/sbin/zcip: Invalid cross-device link
The installation path is not entered. The correct example is busybox -- install/system/xbin.
2. If such an error occurs,
CP:/system/xbin/busybox: Read-Only File System
The mount command in step 3 is not entered correctly.
TIPS:
1. There are ash, hush, and sh shells in busybox. Enter ash or hush in the command line. You can select the command you just entered by pressing the up/down key as in bash.
2. the Android system itself has ls commands, and busybox also has ls. When LS is input, the android LS is called. Do you need to add a busybox to the front every time you want to use the LS of busybox? No. You can use the alias command.
Similarly, commands such as CP and MV can be done in this way. You can also modify/init. RC.