Line 6: Line 6:
 
== BusyBox ==
 
== BusyBox ==
  
BusyBox can be built either as a single static executable requiring no external libraries, or built requiring GLIBC. I choose to build a
+
BusyBox can be built either as a single static executable requiring no external libraries, or built requiring GLIBC. I generally choose to build BusyBox to require GLIBC as it is likely you will want to run additional applications that will require GLIBC.
  
 
<PRE>
 
<PRE>
Line 19: Line 19:
  
 
== GLIBC ==
 
== GLIBC ==
 +
 +
Now build and install GLIBC:
  
 
<PRE>
 
<PRE>
Line 31: Line 33:
  
 
== Preparing RootFS ==
 
== Preparing RootFS ==
 +
 +
Once BusyBox and GLIBC has been cross compiled, you will want to create the remainder of the root file system. Start by creating the necessary directory structure:
  
 
<PRE>
 
<PRE>
Line 50: Line 54:
 
chmod +x etc/init.d/rcS  
 
chmod +x etc/init.d/rcS  
 
</PRE>
 
</PRE>
 +
 +
You should now have a basic, yet functional, BusyBox root file system.

Revision as of 14:25, 20 April 2014

Building a minimal RootFS with Busybox

BusyBox is a collection of cut down versions of common UNIX utilities compiled into a single small executable. This makes for an ideal base for resource constrained systems.

BusyBox

BusyBox can be built either as a single static executable requiring no external libraries, or built requiring GLIBC. I generally choose to build BusyBox to require GLIBC as it is likely you will want to run additional applications that will require GLIBC.

wget http://busybox.net/downloads/busybox-1.22.1.tar.bz2
tar -xjf busybox-1.22.1.tar.bz2
cd busybox-1.22.1/
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- 
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- install CONFIG_PREFIX=/home/export/rootfs

GLIBC

Now build and install GLIBC:

wget http://ftp.gnu.org/gnu/libc/glibc-2.19.tar.gz
tar -xzf glibc-2.19.tar.gz
mkdir glibc-build
cd glibc-build/
../glibc-2.19/configure arm-linux-gnueabi --target=arm-linux-gnueabi --prefix= --enable-add-ons
make
make install install_root=/home/export/rootfs 

Preparing RootFS

Once BusyBox and GLIBC has been cross compiled, you will want to create the remainder of the root file system. Start by creating the necessary directory structure:

mkdir proc sys dev etc etc/init.d

Create a file called etc/init.d/rcS and add:

#!bin/sh
mount -t proc none /proc
mount -t sysfs none /sys
/sbin/mdev -s

and make executable:

chmod +x etc/init.d/rcS 

You should now have a basic, yet functional, BusyBox root file system.