Make Your Own Linux
Linux now become the platform of the developers.They now feeling very excited in their colorful life with Linux.Some of them are thinking Linux as their wife!They always spending with Linux.They can now explain themselves more significantly to the total developer's world with their Personal Linux.They generate the sense of the Linux as more powerful,reliable,flexiable and scalable in the total developer's world.......They make it too flexible to support for multitude of multiprocessor's architechture,hardware devices,graphical support and communication protocols.
Some days ago,I have done an experiment with my friend's old unused PC for our target project.Our targets were---------------------
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.
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.
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.
First download the Linux kernel from "www.kernel.org" (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
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-<version>".
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.
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 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/"
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
::restart : /sbin/init
::shutdown:/bin/unmount -a -r >/dev/null 2>&1
Thse script may be customizesd according to the target requirements.
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.
Now ,u need to edit 'etc/GRUB.conf as shown below:
#Assuming the Storage device will be installed as first
title MYPERSONAL LINUX
kernel /boot/bzImage ro root=/dev/hda1
Atlast,the GRUB should be compiled with our cross toolchain.
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.
(At the last,Give greatful thanks to LINUS TORVALD ).
Re: Make your own Linux
gotta try this instead of LFS :)
Re: Make Your Own Linux
Grub installation very good and great pleasure
|All times are GMT +5.5. The time now is 18:44.|