6. Install Development ToolChain on DiskOnChip

This section may be left out if the requirement is not to have a development environment on the DiskOnChip. The following steps will install the necessary libraries and tools that are required for developing and executing programs on DiskOnChip. This will completely eliminate the concept of having a host system and target system since now the complete application development can be done on the target system itself. For this purpose we will use uClibc which is a C library that has been developed primarily for embedded systems. Also since our root filesystem that was created in the previous section is bulky (35 MB) we will remove the unnecessary files and make it smaller, approximately 11MB.

We will use the Buildroot package from www.uclibc.org to replace the existing bulky root filesystem of DOC with a tiny filesystem and to install the necessary development ToolChain which includes uClibc library, gcc, g++, make, ncurses, busybox, GNU tar, GNU grep and the GNU coreutils . For more details on Buildroot refer to http://buildroot.uclinux.org/buildroot.html. The http://www.uclibc.org website provides a precompiled package containing all the tools, which can be downloaded and used. We will use the precompiled package, which is available as root_fs image. Refer to the uClibc FAQ for more details.

Follow these steps in order to get the software working on your DOS:

6.1. Step1: Obtain the latest copy of root_fs_i386.ext2

Download root_fs_i386.ext2.tar.gz from www.uclibc.org/downloads/root_fs_i386.ext2.tar.gz.

It is around 22MB in size. This actually gets decompressed to a 100MB size file.

Untar the file in /usr/src:

tar -xvzf root_fs_i386.ext2.tar.gz

This will create a file root_fs_i386.ext2.

We need to mount this file using a loopback device. Do the following steps:

mkdir root_fs

mount -o loop root_fs_i386.ext2 root_fs

Now you can access the content of the file root_fs_i386.ext2 through the root_fs directory. The root_fs directory contains a number of directories which makes the root filesystem, like bin, var, sbin, opt, root, home, etc, usr, lib, tmp, dev, and proc.

The usr and lib directories contain the development tools like gcc and g++.

6.2. Step2: Replace the root filesystem of the DiskOnChip

Replace the bin, var, sbin, etc, lib, usr, proc, mnt, home and opt directories of the DiskOnChip with the ones of the root_fs image.

WarningDo not replace boot and dev!
 

The boot directory of the DiskOnChip has to be kept intact since it contains the kernel image, initrd image and Map file that is used by LILO to load the kernel into memory.

The dev directory should also not be replaced since it contains the device nodes for DOC (The replacement task will take 5-10 minutes.)

6.3. Step3: Modify etc/fstab of DiskOnChip root file system

Open the newly replaced /mnt/doc/etc/fstab and edit the line where the mount point is /. Change that line to:


/dev/msys/fla1  /  ext2  rw.noauto 0 1

6.4. Step4: Reboot

Reboot from DiskOnChip and enjoy the uClibc development environment.

You will get the message


Welcome to the Erik.s uClibc development environment.

The entire root filesystem + boot directory + development tools take 84Mb of space.

mirror server hosted at Truenetwork, Russian Federation.