ewdi
29th November 2004, 08:41 PM
Just re-posting for ilja
Have you ever thought about compiling your Linux kernel and was afraid of the many commands that are to be typed ? Have you ever wanted to install your kernel just with rpm -ihv and to delete it with a rpm -e ?
I will show you, how you can make it in just a few steps.
1. Downloading the Kernel
go to http://www.kernel.org/ and see which kernel is the recent one. When I write this tutorial it is the Kernel 2.6.7. Then go to the the mirror-page (http://www.kernel.org/mirrors/) and choose a mirror near you. You can use the master-server, but it is mostly faster than the master server and also saves some traffic for kernel.org. There you need /pub/linux/ . Here you need kernel/ and the kernel version you want to download (so for me v2.6/). In the directory you can find a lot of different files, you need the one with the recent kernel number and .bz2. (You remember, I use 2.6.7). Download it to any location on you harddisk, where you can find it (e.g. you /~ directory.)
2.Unpacking the file.
unpack the file there are different possibilities and even a gui avalible, but this should work :
tar -xjvf <filename>.tar.bz2
go to the directory you unpacked it to.
3.Preparing the Kernel
make sure you have no stale .o files and dependencies lying around(2):
make mrproper
4.Configuring the Kernel
Now you have to configure you kernel. You can do it with a text-based assistent
make config
with an ANSI-menu (needs ncurses)
make menuconfig
with a X11-GUI (needs. QT ) (If you have problems with fonts follow this intstructions (http://www.webservertalk.com/message194869.html) thx @pigpen )
make xconfig
or X11-GUI based on GTK (needs GTK)
make gconfig
Here you can choose the options you want, please make sure, that the filesystem of you root partition is compiled and not just installed as a module ! It's mostly ext3, ext2 or reiserfs. You will need it later.
Take a lot of time for this step and make it carefully.
type
pwd
to show the directory you are at the moment.
5.Creating a RPM
So now comes the step, where you need to become root
su -
now change to the directory, where you were (remember the pwd, you made in the previous step)
Now type
make help | grep rpm
The output should be something like :
rpm - Build a kernel as an RPM package
If the output contains rpm , then type
make rpm
if the output contains rpm-pkg or rpm and rpm-pkg, then type
make rpm-pkg
look that it started and now you can go and have a cup of tea, because it can take several hours.
When it is ready it returns you something like:
Wrote: /usr/src/redhat/SRPMS/kernel-2.6.7-2.src.rpm
Wrote: /usr/src/redhat/RPMS/i386/kernel-2.6.7-2.i386.rpm
6.Installing the kernel
Install the kernel ( the second of the files above). Please use the option -i and not -U, or else the older kernel will be erased.
rpm -ihv /usr/src/redhat/RPMS/i386/kernel-2.6.7-2.i386.rpm
7. Configuring GRUB
new-kernel-pkg --mkinitrd --depmod --install <kernelnumber>
can be used to configure Grub
8.Final step
reboot your system and choose the new kernel in the grub menu.
This tutorial is based on linuxwiki.de (http://linuxwiki.de/LinuxKernel#head-93c15f8b759a9c8d3b88e3b214f0d158da53510d) and is inspired by this message (http://www.redhat.com/archives/fedora-de-list/2004-June/msg00168.html)
Please if you find any errors (content and especially language) report it to me.
]
(2) (http://www.de.kernel.org/pub/linux/kernel/)
(3) (http://www.linuxquestions.org/questions/showthread.php?s=&threadid=192459)
Thank you mhelios for your great advices.
Have you ever thought about compiling your Linux kernel and was afraid of the many commands that are to be typed ? Have you ever wanted to install your kernel just with rpm -ihv and to delete it with a rpm -e ?
I will show you, how you can make it in just a few steps.
1. Downloading the Kernel
go to http://www.kernel.org/ and see which kernel is the recent one. When I write this tutorial it is the Kernel 2.6.7. Then go to the the mirror-page (http://www.kernel.org/mirrors/) and choose a mirror near you. You can use the master-server, but it is mostly faster than the master server and also saves some traffic for kernel.org. There you need /pub/linux/ . Here you need kernel/ and the kernel version you want to download (so for me v2.6/). In the directory you can find a lot of different files, you need the one with the recent kernel number and .bz2. (You remember, I use 2.6.7). Download it to any location on you harddisk, where you can find it (e.g. you /~ directory.)
2.Unpacking the file.
unpack the file there are different possibilities and even a gui avalible, but this should work :
tar -xjvf <filename>.tar.bz2
go to the directory you unpacked it to.
3.Preparing the Kernel
make sure you have no stale .o files and dependencies lying around(2):
make mrproper
4.Configuring the Kernel
Now you have to configure you kernel. You can do it with a text-based assistent
make config
with an ANSI-menu (needs ncurses)
make menuconfig
with a X11-GUI (needs. QT ) (If you have problems with fonts follow this intstructions (http://www.webservertalk.com/message194869.html) thx @pigpen )
make xconfig
or X11-GUI based on GTK (needs GTK)
make gconfig
Here you can choose the options you want, please make sure, that the filesystem of you root partition is compiled and not just installed as a module ! It's mostly ext3, ext2 or reiserfs. You will need it later.
Take a lot of time for this step and make it carefully.
type
pwd
to show the directory you are at the moment.
5.Creating a RPM
So now comes the step, where you need to become root
su -
now change to the directory, where you were (remember the pwd, you made in the previous step)
Now type
make help | grep rpm
The output should be something like :
rpm - Build a kernel as an RPM package
If the output contains rpm , then type
make rpm
if the output contains rpm-pkg or rpm and rpm-pkg, then type
make rpm-pkg
look that it started and now you can go and have a cup of tea, because it can take several hours.
When it is ready it returns you something like:
Wrote: /usr/src/redhat/SRPMS/kernel-2.6.7-2.src.rpm
Wrote: /usr/src/redhat/RPMS/i386/kernel-2.6.7-2.i386.rpm
6.Installing the kernel
Install the kernel ( the second of the files above). Please use the option -i and not -U, or else the older kernel will be erased.
rpm -ihv /usr/src/redhat/RPMS/i386/kernel-2.6.7-2.i386.rpm
7. Configuring GRUB
new-kernel-pkg --mkinitrd --depmod --install <kernelnumber>
can be used to configure Grub
8.Final step
reboot your system and choose the new kernel in the grub menu.
This tutorial is based on linuxwiki.de (http://linuxwiki.de/LinuxKernel#head-93c15f8b759a9c8d3b88e3b214f0d158da53510d) and is inspired by this message (http://www.redhat.com/archives/fedora-de-list/2004-June/msg00168.html)
Please if you find any errors (content and especially language) report it to me.
]
(2) (http://www.de.kernel.org/pub/linux/kernel/)
(3) (http://www.linuxquestions.org/questions/showthread.php?s=&threadid=192459)
Thank you mhelios for your great advices.