Installing busybox

Now that baselayout and system libraries are installed, let's install the standard unix shell commands.

Instead of installing a lot of different packages, that requires lot of space, we decided to use the busybox project (http://www.busybox.net/). BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. BusyBox provides a fairly complete environment for any small or embedded system.

In order to emerge busybox we need to emerge it before into the development_rootfs, and than install the binary package into the embedded_rootfs using ghe -K option:

	# emerge busybox
	# ROOT=/embedded_rootfs emerge -K busybox

The busybox ebuild doesn't create all the required symbolic links, you need to do this manually:

	# mkdir /embedded_rootfs/proc
	# mount -o bind /proc/ /embedded_rootfs/proc/
	# chroot /embedded_rootfs /bin/busybox --install -s
	# umount /embedded_rootfs/proc

The --install and -s options create all these links, to see if they was properly create, we use the this ls command:

	# ls -l /embedded_rootfs/bin/ | grep busybox
	lrwxrwxrwx  1 root root     12 Jul 26 20:54 [ -> /bin/busybox
	lrwxrwxrwx  1 root root     12 Jul 26 20:54 [[ -> /bin/busybox
	lrwxrwxrwx  1 root root     12 Jul 26 20:54 addgroup -> /bin/busybox
	lrwxrwxrwx  1 root root     12 Jul 26 20:54 adduser -> /bin/busybox
	lrwxrwxrwx  1 root root     12 Jul 26 20:54 ar -> /bin/busybox
	lrwxrwxrwx  1 root root     12 Jul 26 20:54 arping -> /bin/busybox
	lrwxrwxrwx  1 root root     12 Jul 26 20:54 ash -> /bin/busybox
	lrwxrwxrwx  1 root root     12 Jul 26 20:54 awk -> /bin/busybox
	lrwxrwxrwx  1 root root     12 Jul 26 20:54 basename -> /bin/busybox
	lrwxrwxrwx  1 root root     12 Jul 26 20:54 bunzip2 -> /bin/busybox
	-rwxr-xr-x  1 root root 632416 Jul 14 14:19 busybox
	lrwxrwxrwx  1 root root     12 Jul 26 20:54 bzcat -> /bin/busybox
	lrwxrwxrwx  1 root root     12 Jul 26 20:54 cal -> /bin/busybox
	lrwxrwxrwx  1 root root     12 Jul 26 20:54 cat -> /bin/busybox
	lrwxrwxrwx  1 root root     12 Jul 26 20:54 chgrp -> /bin/busybox
	lrwxrwxrwx  1 root root     12 Jul 26 20:54 chmod -> /bin/busybox
	lrwxrwxrwx  1 root root     12 Jul 26 20:54 chown -> /bin/busybox
	lrwxrwxrwx  1 root root     12 Jul 26 20:54 chvt -> /bin/busybox
	lrwxrwxrwx  1 root root     12 Jul 26 20:54 clear -> /bin/busybox
	.......
	.......
	.......
	[cut]