BusyBox

BusyBox
The BUSYBOX Confusion
bb.png
The name sounds kinda cool. Nearly all custom Android ROMs include BusyBox, as do some custom kernels. But what it is? What it does? Is it something important and /or useful for most Android users? If you are a Linux enthusiast then you have some idea on this subject and you probably can answer with ease, but for Windows / average Android users these questions are not self-explanatory. So I decided to go on a search for as simple explanation of the BusyBox as I can find. This article is a result of my quest. After last lines on this matter I can say mission accomplished...

...but first some history of BusyBox

Originally written by Bruce Perens in 1995 and declared complete for his intended usage in 1996, BusyBox's original purpose was to put a complete bootable system on a single floppy that would be both a rescue disk and an installer for the Debian distribution. Since that time it has been extended to become the de facto standard core userspace toolset for embedded Linux devices and Linux distribution installers. Since each Linux executable requires several kilobytes of overhead, having the BusyBox program combine over two hundred programs together often saves substantial disk space and system memory.

BusyBox was maintained by Enrique Zanardi and focused on the needs of the Debian boot-floppies installer system until early 1998, when it was taken over by Dave Cinege for The Linux Router Project (LRP). Cinege made several additions, created a modularized build environment, and shifted BusyBox's focus into general high level embedded systems. As LRP development slowed down in 1999, Erik Andersen, then of Lineo, Inc., took over the project and was the official maintainer between December 1999 and March 2006. During this time the Linux embedded marketplace exploded in growth, and BusyBox matured greatly, expanding both its user base and functionality. Rob Landley became the maintainer in 2005 and continued for several years.
Denys Vlasenko is the current maintainer of BusyBox, as of May 2012.

busybox.png

BusyBox provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. BusyBox provides a fairly complete environment for any small or embedded system.
It aims to be the smallest and simplest correct implementation of the standard Linux command line tools. First and foremost, this means the smallest executable size possible. Maintainers / developers also want to have the simplest and cleanest implementation they can manage, be standards compliant, minimize run-time memory usage (heap and stack) and run fast. Busybox is like a swiss army knife: one thing with many functions. The BusyBox executable can act like many different programs depending on the name used to invoke it. Normal practice is to create a bunch of symlinks pointing to the Busybox binary, each of which triggers a different BusyBox function.
It is a multi-call binary. A multi-call binary is an executable program that performs the same job as more than one utility program. That means there is just a single BusyBox binary, but that single binary acts like a large number of utilities. The "one binary to rule them all" approach is primarily for size reasons: a single multi-purpose executable is smaller then many small files could be. This way BusyBox only has one set of ELF headers, it can easily share code between different apps even when statically linked, it has better packing efficiency by avoding gaps between files or compression dictionary resets, and so on.
BusyBox is also extremely modular so you can easily include or exclude commands (or features) at compile time. This makes it easy to customize your embedded systems. To create a working system, just add some device nodes in /dev, a few configuration files in /etc, and a Linux Kernel.

Final thoughts

You don`t need BusyBox to have root. But many root apps as well as settings in custom roms use BusyBox to run the scripts that make them work. So while you can root without it, BusyBox is still much needed to take advantage of that Rooting.
For majority of users this statement will be appropriate:˝Think of it as a background support software. It's not an "app" you use and interact with. Install once, update when necessary, and that's it.˝

by arawn
Jul 29, 2012
T!v@K, Robbie Hood and comnam90 like this.