Dev/Embedded/Rootfs/BusyBox

From Embeded Linux (and more) Wiki by Nathael
< Dev‎ | Embedded‎ | Rootfs
Revision as of 00:39, 17 October 2019 by Drizzt (talk | contribs) (Created page with "== Introduction == [https://busybox.net BusyBox] is "The Swiss Army Knife of Embedded Linux".<br /> BusyBox is a "multi-call" binary which combines tiny versions of many commo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

BusyBox is "The Swiss Army Knife of Embedded Linux".
BusyBox is a "multi-call" binary which combines tiny versions of many common UNIX utilities into a single small executable.

A simple description and a full list of embeddable commands and available options can be found here.

Most information can be found in the FAQ and all around the Busybow website, but here is a short "How-To".

Get the sources

Either use git (below) or download a version from here : Download BusyBox sources

git clone git://git.busybox.net/busybox

You can then extract a specific version if required.

Configure

BusyBox uses a menu equivalent to the Linux kernel's one which is accessible using :

make menuconfig

There's also a "defconfig" and an "allnoconfig" targets.
Tune to your needs and move on to the next steps :)

Compile

Still in the kernel path, cross-compilation is made using make with CROSS_COMPILE option set. For example for the armhf architecture with GNU libc, use

make CROSS_COMPILE=arm-linux-gnueabihf-

Most of the time, using BusyBox is a choice due to storage size constraints, and thus using uClibc instead of the GNU libc is a good idea.
Most information about using uClibc in a cross-compilation toolchain can be found on uClibc website.
You will then need to use the cross-compilation prefix of your toolchain to build BusyBox.

Install BusyBox

As stated previously Busybox is a "multi-call" binary. this means that there is a single binary called "busybox" and in order to use other commands the usual way one must create symlinks to this binary with the name of each command included in busybox binary.
Hopefully, this task is automated by the BusyBox build system :). Run :

make install

and you will get a directory called "_install" containing the base "bin" directories with all the links for the commands you configured.
Of course this does not make for a full system, but you already have all the binaries (or almost all depending on your needs).

Let's move to the next part of the rootfs.

Create the base of the rootfs