20090720

HOWTO build BusyBox package on Debian GNU/kFreeBSD

I assume you have Debian GNU/kFreeBSD i386 installed.
If you don't, please refer to the install notes.

Ensure that in your "/etc/apt/sources.list" you have these lines
deb http://ftp.debian.org/debian unstable main
deb-src http://ftp.debian.org/debian unstable main

Create a working dir.
$ mkdir sandbox

Download the sources of the BusyBox Debian package. From "sandbox"
$ apt-get source busybox
This will create a "busybox-1.13.3" dir (and others files).

Recursively download all the patches in d-i/people/slackydeb/kfreebsd/busybox/1.13/debian/ somewhere.

Copy all the patches (without the dir structure) to the "busybox-1.13.3" dir.

Apply all the patches. From "busybox-1.13.3"
$ for x in *.diff; do patch -p1 < $x; done

Build deb and static with the same config of udeb. From "busybox-1.13.3/debian/config"
$ cp udeb deb
$ cp udeb static

Build the package. From "busybox-1.13.3"
$ dpkg-buildpackage -tc

This will create some files; the most important are
* busybox_1.13.3-1_kfreebsd-i386.deb
* busybox-udeb_1.13.3-1_kfreebsd-i386.udeb

The udeb is useful in debian-installer (d-i).

The deb is useful to test BusyBox in a normal system, i.e. outside of d-i.
To install it
$ dpkg -i busybox_1.13.3-1_kfreebsd-i386.deb
To execute BusyBox binaries (instead of the normal one), call them as the first argument of "busybox"; e.g. to call BusyBox cat
$ busybox cat my_text_file.txt # NOT simply "cat"