Linux-Noob Forums
10 easy steps to compiling your kernel - Printable Version

+- Linux-Noob Forums (https://www.linux-noob.com/forums)
+-- Forum: Linux Noob (https://www.linux-noob.com/forums/forum-3.html)
+--- Forum: Kernel Related (https://www.linux-noob.com/forums/forum-61.html)
+--- Thread: 10 easy steps to compiling your kernel (/thread-4048.html)



10 easy steps to compiling your kernel - P38 - 2003-12-12


This is NOT for 2.6.X. There is a README in /usr/src/linux that contains these instructions in much more detail. I am using using the 2.4.24 kernel as an example. If you have not already done so, download your kernel source and install it in /usr/src.

 

1. cd /usr/src/linux (if /usr/src/linux doesnt exist, create a link from /usr/src/linux-2.4.24 to /usr/src/linux with the command ln -s /usr/src/linux-2.4.24 /usr/src/linux )

 

2. make distclean (this sets the source package back to the default)

 

3. edit your makefile. change the EXTRAVERSION = on the forth line to an extension that will identify this new kernel build. ex. "EXTRAVERSION = -custom-1". if you are using pico or nano as your editor, be sure to include the "-w" option to turn off line wrap or you will trash your makefile.

 

If this is a stock kernel and you have never built a kernel before, Redhat supplies config files that match their precompiled kernels in /usr/src/linux/config. Pick the one that matches your hardware and copy the provided config into /usr/src/linux/.config. If you are not using Redhat, your going to have to wing it. :-)

 

4. make mrproper menuconfig use the menuconfig to set the options you want in your kernel. If you are reading this as a guide, then you are probably not very experienced in building kernels. A suggestion would be to make small changes, compile and install the kernel and make sure it works before you start making major changes.

 

5. make bzImage modules modules_install This will take some time to complete. Have a cup of coffee.

 

6. cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage-2.4.24-custom-1

 

7. cp /usr/src/linux/System.map /boot/System.map-2.4.24-custom-1

 

8. cp /usr/src/linux/.config /boot/config-2.4.24-custom-1 This is not required, but it is sometimes handy to be able to get back to the config you used to create a kernel. This puts it in a safe place and its name matches it to the kernel you just built.

 

cd /boot

 

9. mkinitrd initrd-2.4.24-custom-1 2.4.24-custom-1

 

10 edit /boot/grub/grub.conf (remember to use "-w" if you are using nano or pico)

create a new entry for your new kernel.

 

title=2.4.24-custom-1

root (hd0,0)

kernel (hd0,0)/bzImage-2.4.24-custom-1 ro root=/dev/hda6

initrd (hd0,0)/initrd-2.4.24-custom-1

 

NOTE: in this case, my /boot partition is /dev/hda1 and my / (root) partition is /dev/hda6. Yours is probably different. Look at the other entries in your grub.conf and make the entries look the same.

 

g'luck




10 easy steps to compiling your kernel - FluKex - 2004-02-27


What i dont get is, why do people still cp the bzImage over, when you dont have to.. if you do everything in this order

 

make menuconfig

make dep

make bzImage

make clean

make modules

make modules_install

make install

 

then, simply reboot. if you read the Makefile, you'll notice that "make install" copies everything into the right location, and if your using grub, it even fills out grub for you..

 

just a tip. :) i found P38's expanded way a bit more confusing for newer users.

 

FluKex




10 easy steps to compiling your kernel - FluKex - 2004-02-27


for 2.6, it was even easier....

 

 

 

make menuconfig (if you have a /boot/config-ver.sion and the version matches the current running kernel, make menuconfig will do most of the config for you)

 

then in menuconfig, change any specific options you want, save

 

then,

make

make modules

make modules_install

make install

 

DONE.

 

easy as pie,




10 easy steps to compiling your kernel - FluKex - 2004-02-27


oh, and after reading through the makefile, i suspect that when you run "make" you run

make bzImage

make modules

and make dep, all in one..

 

so,

 

make menuconfig

make

make modules_install

make install

 

4 steps :)




10 easy steps to compiling your kernel - TormentoR - 2004-04-09


Note: For kernel 2.4 -> 2.6 migration there is more needed then just compiling a new kernel...

There are serveral howto's on the www, just google for it.




10 easy steps to compiling your kernel - veritas366 - 2005-02-20


Would this be an appropriate place to ask about WHY you would compile your own kernel from source? I always wonder.

 

What are the advantages?

 

 

Are there things you can do during install that you can't otherwise?

 

What are some of those things?

 

Finally, if I ever try this, are there going to be some technical decisions to make as it is compiling that might be over my head or does it take care of itself once you've done the above?

 

Just curious.




10 easy steps to compiling your kernel - xDamox - 2005-02-20


Quote:Would this be an appropriate place to ask about WHY you would compile your own kernel from source? I always wonder.  

What are the advantages?

 

 

Are there things you can do during install that you can't otherwise?

 

What are some of those things?

 

Finally, if I ever try this, are there going to be some technical decisions to make as it is compiling that might be over my head or does it take care of itself once you've done the above?

 

Just curious.
 

Compiling your own kernel has many advantages. Compile a kernel from source

allows you to compile code for devices that currently are not in the precompiled kernels.

 

Compiling a kernel also allows you to select new feature from the kernel such

as loopback encryption, Also tools for monitoring your power supply and you can

enable in 2.6x kernel NTFS file writing :)