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
- Download ARM Cross-Compiler
- Setup .config File
- Push BusyBox into Android
- Usage of BusyBox
You can get the source code from the BusyBox Official WebSite.
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.
$ 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
$ 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"
$ busybox ifconfig
Feb28











July 31, 2011 at 9:11 pm
perfect site and provide the latest information for the world community. please give comments to my site : http://aboutandroidapps.com/
thank’s
November 7, 2011 at 2:21 am
It was very much helpful .
I compiled the basybox using the cross-compiler from codesourcery.com.
But program compiled using “arm-linux-gnueabi-gcc” does not executes in android .It gives Illegal instruction error.If you know the options (arguments) for “arm-linux-gnueabi-gcc” to produce android compatible binary,Please post it
Thank you for this informative news
January 15, 2012 at 9:36 pm
[...] http://mobisocial.stanford.edu/news/2011/02/compile-busybox-on-android-os/ [...]
January 22, 2012 at 8:35 am
My tablets, Kindle fire & Playbook are dull. Where can I see an Android x86 netbook?
Glenn S (shnkr888 AT aol DOT com)
January 24, 2012 at 9:16 pm
Hi, I an trying with “arm-eabi-” toolchain and it is is giving lots of error. Would you tell me what configuration we have to set??
March 2, 2012 at 3:25 am
Thanks for the tutorial. I wish you could also create a tutorial using the NDK compiler which I think would be much easier to use. Thank you
May 11, 2012 at 11:30 am
When pushing it to my phone it says
‘adb’ is not recognized as an internal or external command,
operable program or batch file.
What is wrong?
June 8, 2012 at 10:43 am
Do you have all the android tools installed? If you have it installed, then probably you have not updated your env variable “PATH”.
July 14, 2012 at 2:01 am
I had the problem
scripts/kconfig/lxdialog/dialog.h:31:20: fatal error: curses.h: No such file or directory
So I had to install libncurses5-dev on ubuntu.
July 14, 2012 at 2:06 am
I had this problem:
mitch@ubuntu:~/Downloads/busybox-1.20.2$ make menuconfig
HOSTCC scripts/kconfig/lxdialog/checklist.o
HOSTCC scripts/kconfig/lxdialog/inputbox.o
HOSTCC scripts/kconfig/lxdialog/lxdialog.o
scripts/kconfig/lxdialog/lxdialog.c: In function ‘j_inputbox’:
scripts/kconfig/lxdialog/lxdialog.c:192:3: warning: format not a string literal and no format arguments [-Wformat-security]
HOSTCC scripts/kconfig/lxdialog/menubox.o
HOSTCC scripts/kconfig/lxdialog/msgbox.o
HOSTCC scripts/kconfig/lxdialog/textbox.o
HOSTCC scripts/kconfig/lxdialog/util.o
HOSTCC scripts/kconfig/lxdialog/yesno.o
HOSTLD scripts/kconfig/lxdialog/lxdialog
scripts/kconfig/mconf Config.in
#
# using defaults found in /dev/null
#
*** End of configuration.
*** Execute ‘make’ to build the project or try ‘make help’.
I solved it with:
sudo apt-get install libncurses5-dev
July 14, 2012 at 2:07 am
mitch@ubuntu:~/Downloads/busybox-1.20.2$ make menuconfig
HOSTCC scripts/kconfig/lxdialog/checklist.o
In file included from scripts/kconfig/lxdialog/checklist.c:24:0:
scripts/kconfig/lxdialog/dialog.h:31:20: fatal error: curses.h: No such file or directory
compilation terminated.
make[2]: *** [scripts/kconfig/lxdialog/checklist.o] Error 1
make[1]: *** [menuconfig] Error 2
make: *** [menuconfig] Error 2
February 5, 2013 at 2:43 pm
how about busybox for x86 phones
February 16, 2013 at 10:51 pm
[...] 参考文章:http://mobisocial.stanford.edu/news/2011/02/compile-busybox-on-android-os/ [...]
February 16, 2013 at 11:21 pm
[...] 参考文章:http://mobisocial.stanford.edu/news/2011/02/compile-busybox-on-android-os/ [...]