Current location - Quotes Website - Personality signature - The apk icon of Android system cannot be installed normally after being modified.
The apk icon of Android system cannot be installed normally after being modified.
Add busybox tool to Android. We can enter the console of Android in two ways:

1. Direct execution command simulator shell;

2. After starting the emulator, enter it through the command adb shell.

Then we can use some common commands under linux, such as ls, cat and so on. However, Android's own toolbox (located at /system/bin) is too simple, and some commands, such as find, are not supported or not supported by Android. The following will introduce how to add busybox tool to Android. By compiling a busybox tool that can run on Android, we can use many common linux commands, such as find and touch.

The steps are as follows:

1. First, go to the busybox homepage to download the latest version of busybox source code.

2. Download cross-compilation tool: GNU tool chain for ARM processor.

Download address:

The first option is ARM EABI or ARM GNU/Linux, and the second option is IA32 GNU/Linux TAR.

Finally, an arm-2007q3-51-arm-none-Linux-GNUEABI-I686-PC-Linux-gnu.tar.bz2 file is obtained.

Decompress the compressed package into a directory under linux, and set the environment variables so that it can find the cross-compiler tool with the prefix "arm-none-linux-gnueabi-".

3. Enter the busybox source directory.

First execute the make menuconfig command to configure the compilation process. The process is as follows:

Busybox settings-> Build options->

[*] You should choose to build busybox as a static binary (no shared library), because the compiled busyBox can run independently.

(/home/jo/tool/arm-2008q3/bin/arm-none-Linux-gnueabi-) cross compiler Prefex This is the "path+prefix" of the cross compiler, which should be set according to the specific situation.

Busybox settings-> Installation options->

[*] Don't compile with /usr. busybox will not be installed in the /usr directory of your host. Be sure to choose.

4 execute make to compile the source code. If there is an error that the header file cannot be found during compilation, you can specify the path where the header file used by the cross compiler is located. For example,

$ make-I ./home/jo/tool/arm-2008 Q3/arm-none-Linux-gnueabi/libc/usr/include/

After successful compilation, you will get an executable file named busybox.

6 Create a directory /data/busybox under the console of Android, and copy the file busybox into the directory by using the following command:

Adb pushes busybox /data/busybox

7 Enter the /data/busybox directory from the console of Android, and add the executable attribute: chmod +x busybox to the executable file busybox.

At this time, we can use the busybox tool. If we want to use bosybox directly in any directory, we need to export path/data/busybox to the path environment variable:

Export path =$PATH:/data/busybox

9 After setting the environment variable, enter busybox at the command line to see its usage, such as:

To find a file named init.rc in the current directory and its subdirectories, you can use the following command:

$busybox find。 -name init.rc

10 Install busybox.

By execution. /busybox-install-s, we will see some errors, because the root directory and /sbin directory of Android system are read-only. Therefore, we can't install some common commands into the /bin directory, and we can't modify the /init.rc file to set the PATH environment variable.

I'm not sure how to execute the default installation path of busybox-install-s command, which may be related to Makefile and the related settings of compiling busybox.

Although we can't install common commands in Android by executing the busybox-install-s command, we can install common commands in Android by another method.

The method is simple. You can first execute the make install command in the external linux system to extract related commands, and then copy these common commands to the Android system through the adbpush command. /_install/bin/data/busybox/bin。 Note: the path of the make install command can be set by executing make menuconfig, and the default path is in. /_ Installation directory.

So we don't have to add busybox to every command provided by busybox.

1 1 Modify the /init.rc file to set environment variables.

Please refer to the post: Further research on the startup process of Android.

Need to be reminded that when modifying the PATH environment variable, the path "/data/busybox/bin" of commonly used Android commands should be placed before the path "/system/bin", otherwise the command found first will not be busybox, so you can set it as follows:

Export path/data/busybox/bin:/sbin:/system/sbin:/system/bin:/system/xbin.

I hope I can help you!