LinuxBIOS SDK, Building Root Filesystem Next Previous Contents

LinuxBIOS SDK

5. Building Root Filesystem


5.1 LinuxBIOS SDK Build Root Environment

LinuxBIOS SDK provides a build root environment to speed up the process to build a miniumal Linux from scratch. After linuxbios-sdk-xxx.i386.rpm is installed, it will create /usr/src/linuxbios/buildroot which contains all the essential tools to build a minimals root filesystem.

To reduce the size of the root filesystem, LinuxBIOS SDK uses uclibc as the C library. Since not all applications can be built under uclibc, there are 2 kinds of projects under LinuxBIOS SDK, uclibc and glibc. For those projects cannot be built under uclibc, they will be built with glibc and statically linked such that it can run under uclibc environment. However, it will increase the root filesystem size significantly.

5.2 Getting All Required Source Code

All the required tarballs are listed in the following tables. You can either have the Makefile to download all the tarballs during the make process or download one by one and then put them in /usr/src/linuxbios/buildroot/tarballs directory.

Package NameVersionWebsite
uClibc0.9.9http://www.uclibc.org
busybox0.60.2http://www.busybox.net
gpm1.19.3ftp://arcana.linux.it/pub/gpm
iptables1.2.5http://www.iptables.org
ppp2.4.1http://www.samba.org/ppp
squid2.4.STABLE3www.squid-cache.org
thttpd2.20chttp://www.acme.com/software/thttpd
tinylogin0.8.0http://tinylogin.busybox.net
openssl0.9.6chttp://www.openssl.org
zlib1.1.3http://www.zlib.org
flnx0.60.2ftp://ftp.viewml.com/pub/flnx
microwin0.84pre8http://www.microwindows.org
viewml0.21http://www.viewml.org
w3c-libwww5.3.2http://www.w3.org/Library
xmlrpc-c0.9.9http://www.xmlrpc.com

5.3 Buildroot File/Directory Structure

All files and directories are located in /usr/src/linuxbios/builroot.

File/DirectoryDescription
MakefileMakefile for the whole SDK project
$PROJECT/MakefileMakefile for individual project
Rule.makDefines different variable for Makefile
data/conf/Contains default config file for different projects
data/root/Default root filesystem structure
data/root/dev/mkdevScript to make all the essential device files
data/samples/Contains sample linuxBIOS images
tarballsPlace to store source code
patchesPlace to store patches

5.4 Default Root Filesystem Structure

The default root filesystem structure are stored in /usr/src/linuxbios/buildroot/data/root. It provides a basic root filesystem structure for most common applications. For custom application, new files and directories can also be added in here.

5.5 Basic System Configuration

5.5.1 Initscripts

All initscripts are located at /usr/src/linuxbios/buildroot/data/root/etc/init.d. The naming of initscripts are similar to other distribution. The first character is either S or K. S means service will start when booting up, and K means service will not start when boot up. The next 2 digit indicates the priority for starting services. 01 has the highest priority and 99 has the lowest. The last portion of the name is the service name.

For example, S01mount
It means mount service will start when system boots and it also has 01 priority.

5.5.2 Kernel modules to load at boot time

All kernel modules which are needed to load at boot time, can be added in /usr/src/linuxbios/buildroot/data/root/etc/init.d/S15modules. For example, when 8139too is needed to load at boot time, then added the following line to /usr/src/linuxbios/buildroot/data/root/etc/init.d/S15modules
.
modprobe 8139too

5.5.3 Network Settings

5.5.3.1 DNS Settings

All dns information are stored in /usr/src/linuxbios/buildroot/data/root/etc/resolv.conf. The format is as the same as Bind. For example,

domain cwlinux.com
nameserver 206.13.28.12
nameserver 202.60.252.8

5.5.3.2 Ethernet Settings

/usr/src/linuxbios/buildroot/data/root/etc/sysconfig/network contains all ethernet information. The following shows a sample network config file.

# /etc/sysconfig/network

export HOSTNAME="sis630.cwlinux.com"
export GATEWAY="192.168.1.254"

export LO_IPADDR="127.0.0.1"

export ETH0_IPADDR="192.168.1.180"
export ETH0_NETMASK="255.255.255.0"

5.5.4 Device files

Since each device file contains inode which uses disk space, default root filesystem only contains basic device files. All device files are generated by a script called mkdev.linuxbios which is located at /usr/src/linuxbios/buildroot/utils. To add extra device files, just add the new deivce files at the end of the file. For example,

mknod $1/st0 c 9 0

st0 device file will be created next time when mkdev.linuxbios runs.

5.6 Building Default Root Filesystem

Before building root filesystem, kernel modules are needed to install in build root directory,
$ cd /usr/src/linuxbios/linux
$ make INSTALL_MOD_PATH=/usr/src/linuxbios/buildroot/root modules_install

To build the default root filesystem, go to /usr/src/linuxbios/buildroot and
$ make

It will compile all packages and create a cramfs root image called rootfs.cramfs at /usr/src/linuxbios/buildroot.
Beside cramfs, LinuxBIOS SDK also supports ext2 and minix.

To build a ext2 root filesystem image,
$ make ext2

To build a minix root filesystem image,
$ make minix

LinuxBIOS SDK supports ext2, minix and cramfs. A basic understanding of the nature of each filesystem can help you to determine which filesystem fit your application. The following table shows the differences between ext2, minix and cramfs.

FilesystemAdvantageDisadvantage
ext2Compatiable with other Linux DistributionNo compression, large fs overhead
minixSmall foot print, read/writeNo compression
cramfsCompress fsread only

5.7 Selecting Packages

To select what packages to put in the root filesystem, edit Makefile.
Add or remove the package that you want to put in the root filesystem



Next Previous Contents