Pages

May 23, 2011

Linux:Building Kernel and installation process Part 2

Now lets see a breakdown of my earlier post 
http://subramanyaachar.blogspot.com/2011/05/linuxbuilding-kernel-and-installation.html
Lets download a linux package .
Get latest package from www.kernel.org
http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.tar.gz  [ or bz2]
In linux use 

  1. wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.tar.gz
  2. tar zxvf linux-2.6.39.tar.gz 

Once its unzipped u will get a directory linux-2.6.39 [or linux-2.x.x]
cd linux-2.6.39


If you already have a customized options for configuring your kernel use make oldconfig else use make menuconfig and select the required configuration.You can also use a graphical version make xconfig. [basically for wireless config,Networking....]
View of make menuconfig


After you have generated your .config file .
Tip
If something went wrong in .config
make mrproper -will delete the .config file


Its time proceed to dependencies
make dep 
Note: make dep just ensures whether all include files and other dependencies are in place
Tip
make clean-This removes all of the object files and some other things that an old version leaves behind.See this always help you when you are recompiling your kernel.


What we did till now ?
Downloaded the kernel ,made the required configuration which generated .config file later did make dep .


Major Part -Compiling Kernel
make bzImage
resulting kernel image will be in "arch/i386/boot/bzImage"


Lets proceed to building Modules
Remember just to compile a module you dont require the entire linux source tree.
Okie here we are worried about Linux Kernel building ...
So to build modules you can use make modules
make modules_install will copy the modules into the the kernel directory of lib.


Okie till now everything seems to be good.Lets Install the kernel now.
We have seen in my earlier post 
http://subramanyaachar.blogspot.com/2011/05/linuxboot-process.html
Kernel Image is termed as vmlinuz

image=/vmlinuz # Location of kernel.
Is it wrong?We have generated kernel here and its called "bzImage".Who kept vmlinuz now ??
Okie here is the answer

On most Linux systems, the kernels are stored in the /boot directory.So after generating the kernel bzImage we will copy it .

cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.39
Why as vmlinuz??
Its the usual convention followed .Check your bootloader config.While copying keep you can keep your name but accordingly change the configuration you are all set.
Releaved!!
So after you have copied the newly genereated bzImage as vmlinuz-2.6.39 copy the System.map as well in the /boot directory .[/boot/System.map]
System.map is generally used by syslogd and klogd for kernel logging
Further Reading
http://linuxmafia.com/faq/Kernel/systemmap.html


change the bootloader configuration file [LILO/GRUB] with the new name vmlinuz-2.6.39.
You are all set .


Kernel Get set Go!!!!!!!








No comments: