linuxgizmo
Tuesday, January 22, 2008
Kernel compilation.
In this topic we can discuss about complaining, installing and booting on the customized kernel.

Why do we need to compile a kernel ?

Some ppl will compile the kernel to enable NTFS (ro,rw) file system support. As this was not there enabled in default kernel.
Eg: Mounting the fat xx file system is easy and this has been added as a default feature.

=====================================
Disk /dev/sda: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 7 56196 de Dell Utility
/dev/sda2 * 8 5234 41985877+ 7 HPFS/NTFS
/dev/sda3 5235 8421 25599577+ c W95 FAT32 (LBA)
/dev/sda4 8422 9726 10482412+ 83 Linux
[root@blr-pc-120 ~]# mount /dev/sda3 /mnt/
/dev/sda3 on /mnt type vfat (rw)
=====================================

Now iam trying to mount the second NTFS partition:

=====================================
[root@blr-pc-120 mnt]# mount -tntfs /dev/sda2 /mnt/
mount: unknown filesystem type 'ntfs'
=====================================

And there are n number of features in compiling kernel. Another example is, you have a new system in the market and the sound card is not deducted by your Linux. Now you need to download the latest kernel where every new release will be updated in each kernel release. Need to compile it by selecting the modules. And after you install and boot it on that particular kernel the audio device will be recognized by the Linux as the module has been updated by the kernel.

Now lets see the step - by - step compilation, installation and Booting of the kernel.

Step a) Downloading:

You can download your kernel from kernel.org. As this site consists of latest kernel and the archive ones. Latest version of kernel is 2.6.23.14. Now i have download the same need to untar it.

Step b) Extracting:

Now we have downloaded the kernel first thing we need to untar it. Always put the kernel in this path:
/usr/src/kernels
As this is the default path of kernels. And untar it by:
tar -zxvf linux-2.6.23.14.tar.gz

Step c) mrproper:

The first command you need to run when compiling the kernel is make mrproper. This is not required if you are doing an fresh kernel compilation. As this command cleans up all the unwanted dir/files in the previous build.

Step d) config/xconfig/menuconfig/oldconfig:

In this step we must ask the kernel to give us the option of selecting the modules required for our Linux system. There are various methods to configure it they are listed below:

make config : An intractive text based configuration tool which displays all the modules.
make xconfig: An intractive xwindows based configuration program.
make menuconfig: An text mode menu driven program. (Recommended One)
make oldconfig: This will give the default setup of modules which come with shipment.

screen shot selecting NTFS rw support and selecting audio drivers, using make menuconfig:



This is How menu configuration looks like.












Here where I am enabling the NTFS RW and RO support.











Here I enable some of the sound modules.










Now I am saving the changes i have made. And to cum out of the any sub entry press esc key twice.









Note:
You will face some issue when you run the command make menuconfig/xconfig. Please check out the solved error section for fixing the same.

Setp e) Dependencies:

This option will look out for the dependencies for the selected modules. Now it has been ruled out.
make dep

Step f) Makefile:

Now you need to edit this file:
Makefile
In that you need to change the EXTRAVERSION = Enabled NTFS RW
As that is the mess i will receive on that kernel.

Step g) bzImage:

Now its time to build the bigImage. The command is:
make bzImage

After this command you can see this as output:
Root device is (8, 4)
Boot sector 512 bytes.
Setup is 7351 bytes.
System is 1748 kB
Kernel: arch/i386/boot/bzImage is ready (#1)


Step h) Building Modules:

After the creation of bzimage. We need to build the modules so need to run:
make modules

step i) Installing Modules:

Now all the compiled modules will start to install on the O/S. The command is:
make modules_install

Step j) Boot Loader:

This is the last step where the installed kernel and initrd image will be added in the boot loader configuration file.
make install

REBOOT THE MACHINE...
posted by Venkat Raman V @ 10:03 AM  
1 Comments:
Post a Comment
<< Home
 
Come Lets Share LINUX Info.
Select Topics
  • CORE LINUX
  • APACHE
  • Solved Errors
  • Scripts
Watz HOT