Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
10 easy steps to compiling your kernel
#1

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

Reply
#2

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

Reply
#3

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,

Reply
#4

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 :)

Reply
#5

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.

Reply
#6

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.

Reply
#7

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 :)

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)