Finnix uses BusyBox for its initrd, and that BusyBox installation requires a custom patch. In the past I’ve compiled BusyBox with uClibc to keep the size down: a full static BusyBox binary is about 700 KB when compiled against uClibc, and about 1.8 MB when compiled against glibc. For a LiveCD distribution which prides itself on its balance between size and features, 1.1 MB of unneeded bloat is a lot.

In the past, I’ve used a development Buildroot chroot to compile BusyBox, as the documentation recommends. However, the pre-built chroots on the Buildroot site are quite ancient, and I never had success in having buildroot compile an equivalently-featured chroot. On top of that, recently they deprecated building a target toolchain in the chroot itself.

See, it’s not just a matter of “build against uClibc”. The libc is tightly coupled to the toolchain, a set of utilities such as gcc, binutils, etc. In my case, I don’t care about cross-compilation and just wanted to build a native uClibc development toolchain chroot on each supported Finnix architecture (x86, amd64 and powerpc) for the purpose of building BusyBox.

As it turns out, I don’t need the full chroot, just the toolchain, and it’s rather easy to do, though a little time consuming and not immediately obvious.

Download and extract Buildroot and BusyBox. Here we’re assuming:

BUILDROOTDIR=/home/ryan/buildroot/buildroot-2013.11
BUSYBOXDIR=/home/ryan/buildroot/busybox-1.20.2

Configure Buildroot:

cd $BUILDROOTDIR
make menuconfig

Be sure to select the proper architecture information under “Target options”. Since Buildroot is primarily a cross-compilation tool, it defaults to i386, not the host target. Indeed, you can even use this method to cross-compile BusyBox.

Under “Toolchain”, enable the required uClibc options. In my case, my rather fully-featured BusyBox config required the following toolchain options:

[*] Enable large file (files > 2 GB) support
  [*] Enable IPv6 support
  [*] Enable RPC support

That should be it! You don’t need to bother with anything under “Target packages”, since we’re not actually going to be compiling the full target chroot, just the toolchain. Start the build:

make clean && time make toolchain

This will download a bunch of sources and will require some time to compile; on my relatively fast AMD64 build environment, the build portion takes about 10 minutes.

Once done, the uClibc toolchain is in output/host/. You may use this to compile BusyBox:

cd $BUSYBOXDIR
make menuconfig
export PATH=$BUILDROOTDIR/output/host/usr/bin:$PATH
make clean && time make CROSS_COMPILE=$(cd $BUILDROOTDIR/output/host/usr && ls -d -1 *-buildroot-linux-uclibc)- busybox

Note that the toolchain is not easily relocatable.