I wrote a blog titled adding busybox to Android. It provides four porting methods, but it is still not perfect.
Post-processing cannot solve all problems at once. The above patch is provided below, that is, the ultimate solution of Android busybox,
The procedure is as follows:
Step 1: Cross-compile busybox
Here you choose busybox-1.19.0, of course you can use a later version. Modify the MAKEFILE file as follows:
Arch? = Arm
Cross_compile? =/Opt/arm-2009q3/bin/ARM-None-Linux-gnueabi-
Note that the cross-compilation tool uses the same tool as the kernel. The path of arm-None-Linux-gnueabi-GCC must be declared in bashrc.
Run make menuconfig to configure busybox:
In busybox settings-> build options:
[*] Build busybox as a static binary (no shared libs)
In busybox settings-> busybox library tuning, make sure that the tab completion option is selected.
Tab extension key:
In busybox settings ---> Installation Options:
Then execute make, make install, then the busybox tool will be generated in the busybox-1.19.0 directory
Many Command tools are generated in the _ INSTALL \ bin directory.
Step 2: If busybox already exists on the Android platform, Delete the existing one, as shown in figure
Android_gingerbread/vendor/Samsung/smdkv210/WiFi/bin with busybox
Delete the file and copy all the four files CP, ls, and sh together to the following directory:
Android_gingerbread/vendor/Samsung/smdkv210/WiFi/bin
Modify/home/lqm/android_gingerbread/vendor/Samsung/smdkv210/device-vendor.mk file, modify part
As follows:
# WiFi
Product_copy_files + = \
Vendor/Samsung/smdkv210/WiFi/bin/busybox: System/busybox \
Vendor/Samsung/smdkv210/WiFi/bin/LS: System/busybox/ls \
Vendor/Samsung/smdkv210/WiFi/bin/CP: System/busybox/CP \
Vendor/Samsung/smdkv210/WiFi/bin/sh: System/busybox/sh \
This step copies the busybox, ls, CP, and sh files to the system/busybox directory by using the WiFi module.
You only need to implement this step elsewhere. There are a variety of methods.
Step 3: Modify the init. RC file, which is based on the x210 platform. The methods on other platforms are similar and will not be repeated.
Find the source of init. RC,
Android_gingerbread/device/Samsung/smdkv210/init_sdmmc.rc or
Android_gingerbread/device/Samsung/smdkv210/init. RC, SD card image is the former,
The NAND Flash image is the latter. Make the following changes in the environment variable declaration at the beginning:
# Setup the global environment
Export path/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin:/system/busybox
The declaration of/system/busybox is added here;
Create the/system/busybox directory:
# Create busybox directory
Mkdir/system/busybox
Change the original toolbox shell script to the busybox shell script:
# Service console/system/bin/sh
# Console
# Disabled
# Group log
# Lqm changed for busybox shell.
Service Console/system/busybox/SH
Console
Disabled
Group log
Step 4: recompile the system and Kernel
./MK-K-S-X-u
Note: Since init. RC is placed in Android. IMG. cpio, updating the Android system only has no effect. You need to update Android. IMG. cpio
Copy to the kernel root directory and compile the kernel to ensure that android. IMG. cpio is updated. To this end, we can modify the MK compilation script, As long as Android is compiled
The system automatically copies the Android. IMG. cpio generated in the out directory to the kernel root directory. If init. RC is updated and the kernel is updated, the init. RC
It automatically updates, and there is no need to manually copy Android. IMG. cpio. In addition, when compiling the Android system and kernel, you must first compile the Android system,
In order to ensure that the modified init. RC is valid, the modified MK section is as follows:
Build_system ()
{
......
CP-AV $ {target_dir}/installed-files.txt $ {release_dir}/| return 1;
CP-AV $ {target_dir}/installed-files.txt $ {release_dir}/| return 1;
CP-AV $ {target_dir}/Android. IMG. cpio $ {release_dir}/| return 1;
CP-AV $ {target_dir}/Android. IMG. cpio $ {kernel_dir}/| return 1;
......
}
......
If ["$ {system}" = Yes]; then
Build_system | Exit 1
Fi
If ["$ {kernel}" = Yes]; then http ://
Build_kernel | Exit 1
Fi
If ["$ {uboot}" = Yes]; then
Build_bootloader_uboot | Exit 1
Fi
If ["$ {xboot}" = Yes]; then
Build_bootloader_xboot | Exit 1
Fi
If ["$ {update}" = Yes]; then
Gen_update_bin | Exit 1
Fi
......
Step 5: update the file system and kernel. In fact, we only need to use the production card to Update. Bin.
After entering the system, we can see that you can use busybox, ls, CP, and,
The tab key, CTRL + C, and so on.
Note: If you need to download and compile the MK script or do not want to compile busybox by yourself, you can directly download the compiled busybox and go to the following link to download it:
Click Open Link