Gettin Busy with Busybox

I decided to look at Busybox for my first project, a program many call the “Swiss Army knife” version of Linux. It combines many common UNIX utilities into a small executable and provides minimalist replacements for most of the utilities you usually find in bzip2, coreutils, dhcp, diffutils, e2fsprogs, file, findutils, gawk, grep, ls, and a number of other popular commands. The utilities in Busybox often have fewer features than their full-featured cousins; however, the options that are available provide the expected functionality and behave very close to their larger counterparts.

Busybox has been written with size-optimization and limited resources in mind, both to produce small binaries and to reduce run-time memory usage. It’s extremely modular so commands can be included or excluded at compile time. This makes it easy to customize embedded systems; to create a working system, just add /dev, /etc, and a Linux kernel. Busybox (usually together with uClibc) has also been used as a component of “thin client” desktop systems, live-CD distributions, rescue disks, installers, and so on.

Busybox provides a relatively full featured environment for what it is and is used on everything from embedded systems to more traditional computing environments. While not thee yet, the developers of Busybox’ next major goals are to implement the full Single Unix Spec V3 as well as passing the Linux Test Project.

Busybox itself can be run in many ways. As a basic installation, it is run as a command that takes arguments of what would be normal Linux commands (e.g. $busybox grep “hello world!” xxx). It can also beinstalled as a standalone shell or as a hub for symlinks for all its compiled commands. Busybox is designed o be as portable as possible however the developers recommend only running on more recent versions of Linux (2.4 and up) and glibc (2.2 and up) as this is what they actively test on. It’s compiled with gcc and should run on any hardware that is supported by it, Big and Little Endian, and 32 and 64 bit.

Busybox comes with some powerful Makefile installation options, such as allowing the user to check for bloat. It does this by building two versions, one of which has extra information that can be read for analysis (not to be confused with debugging info), and the other as a baseline. It then uses a built in script to compare the two installations.*

As an invaluable tool, this is a prime candidate for portability to Arm64 and I look forward to exploring its depths!

*http://git.busybox.net/busybox/plain/README

Leave a comment