Compile BusyBox On Android OS
Filed under Guides
Busybox is a set of frequent-used unix tools, including awk, ifconfig, route, ip … etc.
If you would like to enjoy the shell in android ‘just like under unix’, busybox is a great tool to have on your android.
Here we provide some info on how to cross-compile busybox for android system.
- Download BusyBox Source Code
You can get the source code from the BusyBox Official WebSite.
- Download ARM Cross-Compiler
You can get the cross-compiler from codesourcery.com.
Note: I tried to use the arm-eabi-* compiler in android_ndk, but it seems to need a lot of configurations (such as sysroot, etc.). Thus, I choose to use arm-none-linux-gnueabi-* compiler, it will make the following steps a lot easier. - Setup .config File
$ make menuconfig
Select Busybox setting -> Build options -> select Build BusyBox as a static binary (no shared libs)
and Set Cross Compiler prefix as “arm-none-linux-gnueabi-”$ make
- Push BusyBox into Android
$ adb shell "mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system" $ adb shell "chmod 0777 /system/xbin" $ adb push busybox /system/xbin/ $ adb shell "chmod 755 /system/xbin/busybox" $ adb shell "chmod 0755 /system/xbin"
- Usage of BusyBox
$ busybox ifconfig