Today I will write about how to install the Linux Kernel:
Requirements:
1. Install Oracle VM virtual box. LINK
2. Create new virtual machine from "Ubuntu 10.0.4 Desktop".
3. Download "linux-2.6.9.tar.bz2" from Linux Kernel archives. LINK
To check the version of current installed Kernel on Ubuntu use following command:
uname -a
Now for installing this Kernel we need different version of gcc compiler. In Ubuntu 10.0.4 we have different version of gcc compiler which you can see by typing
gcc -v
We need gcc 3.4 version. For this download following files from this LINK:
- cpp-3.4_3.4.6-6ubuntu3_i386.deb
- gcc-3.4_3.4.6-6ubuntu3_i386.deb
- gcc-3.4-base _3.4.6-6ubuntu3_i386.deb
Use the following command to install these packages
sudo dpkg -i *.deb
Now we have two compilers on our system
gcc-4.4 and gcc-3.4
To use gcc-3.4 compiler you can use it as
gcc-3.4 foo.c -o foo.out
Once all the packages are installed now we need to change our default compiler to point to gcc-3.4 version. For this we need to be in "root" mode
sudo -s
Above command will take you in the root mode.
The command GCC it is actually a symbolic link to which ever version of GCC you are using. What this means is we can create a symbolic link from GCC to whichever version of GCC we want.
Now lets work on the tar we downloaded "linux-2.6.9.tar.bz2"
1. untar the archive file using following command:
tar -xjvf linux-2.6.9.tar.bz2
2. get into the folder that is created after above command lets say it is linux-2.6.9
../linux-2.6.9$
3. Now we need to install ncurses-dev use following command
../linux-2.6.9$> sudo apt-get install ncurses-dev
This will install all the dependencies that is required to compile the kernel
4. Install the following patch otherwise it will give assembly 'mov' problems
download linux-2.6-seg-5.patch from LINK
apply this patch using following command:
../linux-2.6.9$> sudo patch -p1 < ../linux-2.6-seg-5.patch
5. Now we are good to go and compile our kernel.
Follow the following steps to compile the kernel:
a) configure your kernel using the following command
../linux-2.6.9$>make menuconfig
Normally, you can also use “$> make xconfig” or “$> make gconfig” to configure your kernel.
f) you may modify the grub file at /boot/grub/menu.lst, which will decide what kernel
image should be used at the booting time. You should change the default value to the newly compiled
kernel. The number starts from 0.
Finally, you can reboot your virtual machine (do not power off, just reboot it).
To Test which kernel is booted you can type following command in terminal:
$> uname -a
This command will show you the exact version number. If it is “2.6.9somename”, you are ready to go.
Requirements:
1. Install Oracle VM virtual box. LINK
2. Create new virtual machine from "Ubuntu 10.0.4 Desktop".
3. Download "linux-2.6.9.tar.bz2" from Linux Kernel archives. LINK
To check the version of current installed Kernel on Ubuntu use following command:
uname -a
Now for installing this Kernel we need different version of gcc compiler. In Ubuntu 10.0.4 we have different version of gcc compiler which you can see by typing
gcc -v
We need gcc 3.4 version. For this download following files from this LINK:
- cpp-3.4_3.4.6-6ubuntu3_i386.deb
- gcc-3.4_3.4.6-6ubuntu3_i386.deb
- gcc-3.4-base _3.4.6-6ubuntu3_i386.deb
Use the following command to install these packages
sudo dpkg -i *.deb
Now we have two compilers on our system
gcc-4.4 and gcc-3.4
To use gcc-3.4 compiler you can use it as
gcc-3.4 foo.c -o foo.out
Once all the packages are installed now we need to change our default compiler to point to gcc-3.4 version. For this we need to be in "root" mode
sudo -s
Above command will take you in the root mode.
The command GCC it is actually a symbolic link to which ever version of GCC you are using. What this means is we can create a symbolic link from GCC to whichever version of GCC we want.
- You can see the symbolic link :
ls -la /usr/bin | grep gcc-4.4
- So what we need to do is remove the GCC symlink and the G++ symlink and then recreate them linked to GCC 3.4:
rm /usr/bin/gcc ln -s /usr/bin/gcc-3.4 /usr/bin/gcc
- Now if we check the symbolic links again we will see GCC & G++ are now linked to GCC 3.4:
ls -la /usr/bin/ | grep gcc
- Finally we can check our GCC -v again and make sure we are using the correct version:
Awesome, so we set the gcc 3.4 version as our default version.gcc -v
Now lets work on the tar we downloaded "linux-2.6.9.tar.bz2"
1. untar the archive file using following command:
tar -xjvf linux-2.6.9.tar.bz2
2. get into the folder that is created after above command lets say it is linux-2.6.9
../linux-2.6.9$
3. Now we need to install ncurses-dev use following command
../linux-2.6.9$> sudo apt-get install ncurses-dev
This will install all the dependencies that is required to compile the kernel
4. Install the following patch otherwise it will give assembly 'mov' problems
download linux-2.6-seg-5.patch from LINK
apply this patch using following command:
../linux-2.6.9$> sudo patch -p1 < ../linux-2.6-seg-5.patch
5. Now we are good to go and compile our kernel.
Follow the following steps to compile the kernel:
a) configure your kernel using the following command
../linux-2.6.9$>make menuconfig
Normally, you can also use “$> make xconfig” or “$> make gconfig” to configure your kernel.
When you configure the kernel according to your need try to browse all the component. Generally, for each component, you can choose one of the three options: [*] built-in, [ ] excluded, or <M> module. For built-in option, the component will be compiled and built into the kernel so that it will be in the kernel whenever the kernel boots up. For module option, the component will be compiled and can be dynamically loaded/unloaded into/from the running kernel. For excluded option, the component will not be compiled at all.
At the end of this configuration, the file will be saved as ./.config. In this configuration process, you need to select “excluded” for all the “Device Drivers” --> “SCSI device support” --> “Qlogic xxxxxxx support”. Otherwise, the compilation will fail. I am not sure what is the reason for it but I will find it and update this post.
You can change the name of kernel by modifying ./Makefile. You can append "somename" to the line “EXTRAVERSION=”.
b) Compile your kernel using
../linux-2.6.9$> make
c) compile kernel modules using
../linux-2.6.9$>make modules
d) Install your kernel modules using
../linux-2.6.9$> make modules_install
e) Then you can install the newly-compiled kernel using
../linux-2.6.9$> make install
which will install the kernel, the symbol file,and the boot image into /boot directory.
f) you may modify the grub file at /boot/grub/menu.lst, which will decide what kernel
image should be used at the booting time. You should change the default value to the newly compiled
kernel. The number starts from 0.
Finally, you can reboot your virtual machine (do not power off, just reboot it).
To Test which kernel is booted you can type following command in terminal:
$> uname -a
This command will show you the exact version number. If it is “2.6.9somename”, you are ready to go.
No comments:
Post a Comment