How to Make your own Linux

a)Develop a boot loader to run on the PowerON
b) configured linux kernel
c)A sweet file-system all with the necessary software.

Hardware Used:

I) A P2 machine
Iv) A AMD Athlon 64 2800+(1.8GHz)machine as a host for our development

Maintaining the development Environment:

In this case,the development process has done on the host system,taking the targeting system as the consideration,because of the high memory,advantage of the lower compile time of the host machine.Here,the concept of the "Cross-compilation "is needed.Because the CROSS_COMPILER is a system that runs on one type of processor,but compiles instructions for the another.

Setting up the HOST::

Though the presence of the different several processes I have used here "REMOVABLE STORAGE SETUP", where there are no direct physical link between the host and the target.Actually, a storage device is written by the host and is transferred into the target,which is used to boot the target system.

Preparation for the Host Environment::

1) Install a latest Linux edition of REDHAT,or other similar.
2) Format the target HDD with a suitable file system.(I prefer ext2).
3) The host system should have "Cross-Compiler toolchain" to build up the software for the target system.I have used GNU's cross Platform developent toolchain.I also used

i) Binary Utilities (Assembler,linker and Various Object file Utilities).
ii) The GCC compiler for GNU C,C++
iii) The C Library(like glibc,newlib etc.)

Binding up our personal Toolchaon::

Here , an alternative C library like "uClibc" is choosen for my personal system development.The "uClibc" is a C library optimized for embedded systems.

To build up our custom toolchain I have performed some steps as --------

With the open source Automation tools like "buildroot" I have configured the toolchain and installed it in "uClibc" version, "binutils" version, GCC version and so on. After the succesful toolchain compilation,it has installed in a specific PATH environment variable to the "bin" directory of the installed path.

Having the cross development platform ready,we need three components to build up a complete Linux environment for an embedded system.

A) The Kernel
B) The Root file System
C) The Boot Loader

Setting up the KERNEL:

First download the Linux kernel from "" (say as inux2.4.20.tar.bz2) and extract it and cd to the directory.Now ,feel the thrillings that U'r ready now to compile the chossen kernel with your new toolchain.So, edit the "makefile" to set up the "CROSSCOMPILE" prefix using

CROSSCOMPILE =i386-linux-uclibc

Then configure the kernel according to the embedded target device requirements using
make menuconfig
or make xconfig.

Then issue the "make dep" and "make bzImage" commands. The kernel image is now built in the "arch/i386/boot" directory. If the modules r enabled,implement "make modules",and " make modules-install" . The compiled modules will be installed in " /lib/modules/linux-".

Creating the Root File System::

I have created the root file system on the previous "ext2" formatted HDD.FIrst, we mount the partition as SUPER USER,by

#mount -t ext2 /dev/hdc1 /mnt/target

Now enter to the /mnt/target dir and create a standard Linux root directory structure
#mkdir bin boot dev etc etc/init.d proc sbin usr

Create "modules" directory in "lib" if modules were enabled.

#mkdir /lib/modules

Now set appropriate permissions for these directories.To set up various core linux utilities like sh,ls,cp,clear,mkdir.......Fortunately u can get a tool that combines all the utilities called " BUSYBOX".Busybox is highly configureable,and u can select only those utilities u want to for your platform.U can select also static or dynamic compilation.

Compile it with your new toolchain.

$ make
$ make PREFIX= /mnt/target install

This will populate bin,sbin,usr,usr directories with all symlinks to "busybox" binary in /mnt/target/bin directory.

Then,the boot directory needs to be generated with your previous compiled kernel image. U need to create the necessary device nodes appropriately in the "dev" directory using "mknod" utility; for example, the terminal devices like "tty", console , virtual terminal devices for VGA display,serial terminal devices,the ps mouse,null device etc.

Next set up the various startup scripts .Create a "rcS" script in " etc/init.d/"

#! /bin/sh
mount -a #Mount the default file system mentioned in /etc
/bin/sh #Invoke Busybox shell

Create "fstab " file in /etc directory
Create "inittab" file in /etc directory

#This is run as first script
:: sysinit : /etc/init.d/rcS
::askfirst :-/bin/sh
::restart : /sbin/init
::shutdown:/bin/unmount -a -r >/dev/null 2>&1

Thse script may be customizesd according to the target requirements.

Installing the Boot Loader::

To make first bootable Personal linux system u need to install the Boot Loader.Copy the Stage1 ,Stage2 dir.s of GRUB from the host machine into target's boot/GRUB directory.Install the GRUB on the target hard disk.

#GRUB> root(hd1,0)
#GRUB> setup(hd1)

Now ,u need to edit 'etc/GRUB.conf as shown below:

#Assuming the Storage device will be installed as first
kernel /boot/bzImage ro root=/dev/hda1

Atlast,the GRUB should be compiled with our cross toolchain.

Ready to Enjoy::

Shut down the host system.Remove the target HDD and install it on the target system.Power on this machine.See the GRUB menu.Select your choice.If choice the MYPERSONAL LINUX,your linux system get booted,and a Busybox shell promt should appear..

Now Start to enjoy........with Your Personal Linux System.

Article written by AUTHOR_NAME