In this recipe, we'll download BusyBox and configure it using
BusyBox was designed for Linux in early 1996, originally as a Debian GNU/Linux installer and rescue system. With about 18 years of development, the latest 1.21.0 (at the time of this writing) release has more than 380 applets and about 100 projects claimed using it. The projects embrace Linux, Android, FreeBSD, and others.
It integrates a set of stripped-down Unix tools, including simple ones, such as
ls, as well as the larger ones, such as
modprobe and other functional utilities; for example,
wget, and even a tiny shell interpreter called
It is modular, and can be customized to meet different requirements. To discuss and demonstrate its configuration system, first download its source code. It is maintained at http://git.busybox.net/busybox/ and released with
.tar packages at http://busybox.net/downloads/. If you want a stable release, download the
.tar packages or clone the Git repository with the latest (but perhaps not stable) features. At the time of this writing, we used the stable version
busybox-1.21.0.tar.bz2; download it and decompress it.
$ wget http://busybox.net/downloads/busybox-1.20.0.tar.bz2 $ tar jxvf busybox-1.20.0.tar.bz2 $ cd busybox-1.20.0/
To simplify the command-line output, all command-line prompts in the desktop development system is prefixed with the
$ symbol; ones that need root permission will follow a
Before configuring, make sure the
ncurses library required by the graphic configurator is installed on the development system.
$ sudo apt-get install libncurses5-dev
The friendliest way to configure BusyBox will be using
make menuconfig. Issue the command to launch a graphic interface, configure the features, and exit to save them.
Issue the following command in a graphic configurator:
$ make menuconfig
It starts the graphic interface.
Configure the features with hotkeys. It allows us to enable, disable, exit, get help, and search with hotkeys. The primary hotkeys include:
<Enter> selects submenus
<Space> Switch <Y> and <N>
<Esc><Esc> to exit
<?> for Help
</> for Search
Most configuration options are Boolean type. Use the
ashshell applet as an example. Press Enter on the shell's submenu. Enable with Y and disable with N.
Shells ---> [*] ash
Some configuration options are strings and may require input. Use the cross-compiler
arm-linux-gnueabi-gcc(see the Compiling Busybox recipe) configuration as an example. Press Enter on
BusyBox Settingsand on
Build Optionsand then press Enter on
(arm-linux-gnueabi-) Cross Compiler prefix.
Busybox Settings ---> Build Options ---> (arm-linux-gnueabi-) Cross Compiler prefix
Save the configuration.
After configuring, Press Esc + Esc to exit, and the configuration will be saved to a file named
With the previous configuration, we should be able to start the compiling process in the next recipe, but we still need to learn more details about the principle and the other methods of configuration.
BusyBox can be flexibly customized; the main configurable features include
Busybox Settings and
Applets. The former allows us to configure build/compiling and installation features. The latter allows us to configure all of the built-in applets and their features. Both of them will be introduced in the following recipes.
To configure them in fine detail, the
Config.src files (for example,
networking/Config.src) provide configure options for the features, and every option should have a default setting.
Hotkeys are provided to enable, disable, or set the option; the option's value will be converted to symbols prefixed with
CONFIG_ and saved into the
.config file, and meanwhile some C headers will be generated.
Besides graphic configuration with
make menuconfig, some other configuration techniques you might want to run with the BusyBox
make tool include:
make config: Similar to
make menuconfig, this is a text-based interactive configurator. It does not contain the dependency of the
ncurseslibrary, and is not that friendly.
make oldconfig: Resolve any unresolved symbols and regenerate C header files with the old configuration,
.config; it is often executed after
make cleanallows us to delete temporary files created by an old configuration or building. It is often used to get a clean environment for a new configuration or building.
make xxx_defconfig: Some old configurations, such as
.configare renamed and saved to the
configs/directory of the BusyBox source code. To re-use them, just run
makewith their names; for example:
$ make android2_defconfig
make defconfig: It uses the option's default setting and generates
.configto the largest generic configuration. This is often used by a newcomer as the base of a new configuration. Based on this default configuration, disable the unnecessary features and reserve only the necessary features and get a minimal configuration eventually.
allnoconfig: They don't use the default settings, but rather enable or disable the features and generate a
.configfile accordingly. Some options may still be disabled even with
allyesconfig. If they conflict with the already enabled ones (for example, the
CONFIG_NOMMUconfigure option is enabled by default), the other features, such as
ash, will be disabled.
make allyesconfigwill generate the largest BusyBox binary. It should not be used to build a size-critical embedded system, but it may be a good configuration base for a rich-function system.
make allnoconfigprovides a clean configuration base. It may be good to get a clean configuration for a size-critical embedded system, but it requires a good understanding of the configuration options.
make randconfig: It generates a configuration with random settings. We don't need it since our real requirement is often deterministic, but BusyBox developers may need it for building tests.