Welcome to Dream.In.Code
Getting Help is Easy!

Join 107,398 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,185 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Compiling your own Linux kernel

 
Reply to this topicStart new topic

> Compiling your own Linux kernel, Configure, compile, and install your very own Linux kernel!

no2pencil
Group Icon



post 11 Jul, 2007 - 09:21 PM
Post #1


Compiling your own kernel
(Configure, compile, and install your very own Linux kernel!)

Knowing your hardware:
Prior to doing this, you’ll need to gather as much information about your computer as you can. The processor, motherboard, audio card, network interface card, modem, or any other devices that will need specific modules loaded into the kernel.

Downloading the kernel source:
After a visit to kernel.org, you’ll be able to download the kernel from either ftp or http. A good place to download this file to is /home/*userid*/downloads or /downloads. A copy of it should also be placed in /usr/src. That is where we will be working from.

Unpacking the kernel:

Everything that we will be doing here will require that you have root privileges.
CODE

cd /usr/src
mv linux linux-2.4.6 (or whatever your current version is)
gunzip linux-2.6.22.1.tar.gz
tar –xvf linux-2.6.22.1.tar
ln –s linux-2.6.22.1 linux
cd linux


Assuring a back-out:
You want to leave your existing kernel in-tact, just in case you've made a mistake or your new kernel won't boot. We will do this by backing up a few files & directories shown below.

CODE

mv arch/i386/boot/bzImage /boot/vmlinuz
mv System.map /boot/System.map
mv /boot /boot_2.4


Pick your poison, making your menu:
Xwindows :
CODE
make xconfig

Terminal :
CODE
make menuconfig
* this is the one that I use.
Yes/no/module :
CODE
make config
* this takes forever!

Inside of the menu is where we will select of the modules to install for your devices.

What exactly is a kernel module?
Modules are pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel without the need to reboot the system. An example of one type of module is the device driver, which allows the kernel to access hardware connected to the system. The alternative to building a module, is compiling the code into the kernel, and add new functionality directly into the kernel image. Besides having larger kernels, this has the disadvantage of requiring us to rebuild and reboot the kernel every time we want new functionality. Obviously, this is one of the advantages over using MS Windows.

Compiling your kernel:
Now that we have selected which modules to install into our new kernel, we will now compile the kernel.
CODE

make dep
make clean (for older kernels)
make bzImage
make modules
make modules_install


Everyone needs a boot loader.
The two main boot loaders that you’ll find are lilo & grub. Lilo, stands for Line In Line Out. Unlike lilo, grub is a graphical boot loader. Both lilo & grub allow you to choose an Operating System to boot from a menu. This allows you to install Linux & MS Windows onto the same machine.

Reboot & enjoy:
Your new kernel should now be installed! & if all went well, issuing the reboot command should boot up your new kernel.

Go to the top of the page
+Quote Post


Register to Make This Ad Go Away!

k.sangeeth
**



post 2 Aug, 2007 - 09:49 PM
Post #2
great one
Go to the top of the page
+Quote Post


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 8/28/08 04:14PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month