2010年5月16日 星期日

In my earlier write up i've showed how to Build a Root File System manually from the ground up base on the FHS, in fact there are a few system tools available to automate this building process systematically, one of this package is Buildroot.

Buildroot come with a set of Makefiles and patches to generate a cross-compilation toolchain and root filesystem using uclibc library mainly for embedded Linux system, targeted processor range from ARM, Power PC, MIPS and x86 and etc. It also help to generate system libraries and application packages simply by selecting the menu option similar to the kernel menuconfig compilation.

Here i will use Buildroot to create a basic rootfile system for mini2440, test run on it and further generate a simple madplay program to play MP3 music without worrying anything about autoconfig and compile process.

Note, i omit the 'Package Selection for the target' configuration until there is a working copy, i also skip many options like the uclibc C library, Binutils, gcc compiler, Busybox and etc, which Buildroot set by default which you can change to experiment as require.

At last, run the building process.

make

This will take a long time to complete, you can take a break now.

If all goes well, a directory output will be created in the top directory which contain all of the output files, a directory dl is also created consist all of the downloaded source files.

Reboot the device, if its working a final prompt message will show up, this is the result of a basic copy of root filesystem from Builroot, study the etc/inittab, etc/init.d, etc/network, etc/profile and understand the start up process.

In this section i will include additional library and program to show that it is easy to build a package if you know the name of the library/software, the objective function and its require dependency modules.

Below i add in a zlib library, a tslib touch screen module and include a command-line MP3 player program into our target image.

This is an interesting webcam library that will detect movement object on camera and start capturing the motion picture on mpeg format, there are other feature that allow capture video record into a database and also enable remote control of the webcam through xml-rpc.

The library dependencies is on SDL, ffmpeg, SDL is require because ffplay needs it and ffmpeg also require libz library to build it.

However, to make our target board as a client we have to configure our host as a router which allow network traffic to be redirected to access the internet gateway, this set up assume the target and host is connected via a hub with NFS service.

First create a virtual network interface, this interface is use as a bridge to our target as a logical subnet.

2010年3月4日 星期四

This build will create an initial RAM disk as a permanent root filesystem in NAND.

On kernel startup, the bootloader pass the load address of initrd image to the kernel to uncompress and copy the contents of the image into RAM, then frees the memory used and mount it as the initial root file system.

In addition jffs2 and cramfs is can also be used to write to the root filesystem.

This build will create a new Root File System using the NFS service in the host computer to expose the contents to the target system, there is other method which is build a initrd image and booting with an initial RAM disk.

This is by no means a full system setup but a simple process to boot up a Linux system on Mini2440 as a start, alternatively there are tools that will automate the cross compiling process to generate the filesystem and software packages easily - such as Buildroot, OpenEmbedded and etc. which is another stages of learning process.

Filesystem Hierarchy Standard

In order to build a Root File System i will follow the FHS rules to define the main directories and their layout content as below.