Not sure exactly what your question is. To compile a kernel you'll need to know about your hardware. Get the source from Kernel.org
then make a directory somewhere in your own home directory, such as mine:
bruce@silas:~/kernel$ ls -lh
-rwxr-xr-x 1 bruce users 5.1K 2006-02-25 06:47 2.6-kernel-build.txt*
-rw-r--r-- 1 bruce users 2.1K 2006-02-10 09:16 build_times
drwxr-xr-x 20 bruce users 1.3K 2006-03-09 17:29 linux-188.8.131.52/
-rw-r--r-- 1 bruce users 38M 2006-03-06 03:20 linux-184.108.40.206.tar.bz2
drwxr-xr-x 19 bruce users 856 2006-03-24 09:07 linux-2.6.16/
-rw-r--r-- 1 bruce users 39M 2006-03-20 14:22 linux-2.6.16.tar.bz2
It's sane to use /home/username/kernel then you can untar the source in there by issuing "tar xvjf linux-2.6.16.tar.bz2" for instance.
After that, you issue one of these:
- Alternate configuration commands are:
"make menuconfig" Text based color menus, radiolists & dialogs.
"make xconfig" X windows (Qt) based configuration tool.
"make gconfig" X windows (Gtk) based configuration tool.
"make oldconfig" Default all questions based on the contents of
your existing ./.config file.
Like above, but avoids cluttering the screen
with questions already answered.
I prefer "make xconfig" because everything is easy to read. So these are the steps to compile a 2.6.x.y kernel on Slackware:
$ make xconfig
# cp System.map /boot/System.map-2.6.16 ; ln -sf /boot/System.map-2.6.16 /boot/System.map
# make modules_install
# cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.16
# pico /etc/lilo.conf
and enjoy Slackware goodness with a shiny new kernel.
If you want details:
Super fast guide to building a 2.6 kernel the right way
(a few of the last bits are Slackware Linux specific)
-----[do all this as a regular user]-----
Extract kernel source in home directory, for example : /home/bruce/kernel/ then cd into kernel source directory and run "make xconfig" and configure all kernel options to suit your needs.
If this is the first time you've compiled a kernel, I'd recommend you read the help entries for all options. Yes, that will take ages, but it's valuable knowledge and will ensure you a better chance of getting a working kernel. Don't forget to build in support for the filesystem you use into the kernel, *not* as a module. Once all options are set as you want them, exit xconfig (don't forget to save your configuration).
Now it's time to build the kernel based on the config you just made. To do that just run "make" and it'll build the kernel and all modules (for stuff you chose to build as modules). Once it's done (hopefully without errors) it's time to install the new kernel and associated modules. To do that you need to be root, so issue "su" to become root.
If you have a configuration file from an older 2.6.x.y kernel that you
wish to reuse - or just use as defaults - then you can copy the old
configuration file to .config in your new kernel source dir - like so:
cp /path/to/old/.config ~/kernel/linux-2.6.16/.config
and then you can run "make oldconfig" to update it for the new
kernel version - it'll ask you to make choices about options that
are new or have changed, then overwrite .config with a new version
suitable for the new kernel version. Then you can run "make xconfig"
as usual and you'll get the settings from the old kernel as defaults
- or you can just run "make" at this point to build the kernel with
the same settings as you had in your old one.
Please do *NOT* use a configuration file from a 2.4 kernel as input
to "make oldconfig" for a 2.6 kernel source. The resulting
configuration file is most likely to be subtly broken and the kernel
build as a result will most likely not work correctly.
-----[do the following steps as root]-----
Copy the System.map file to /boot as System.map-kernel-version and update the /boot/System.map symlink - like so:
cp System.map /boot/System.map-2.6.16 ; ln -sf /boot/System.map-2.6.16 /boot/System.map
Install the modules by running "make modules_install"
Now, copy the kernel itself to /boot under some new name, like so:
cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.16
Now, the new kernel is in place under the name /boot/vmlinuz-2.6.16 , all that's left is to add it to your bootloader. To do that, edit /etc/lilo.conf and create a new section for your new kernel (leave the old one in place as a fallback option). Such an entry could look like this (will be different for you since you probably have different root partition, etc):
image = /boot/vmlinuz-2.6.16
root = /dev/sda7
label = Slack-2.6.16
read-only # Non-UMSDOS filesystems should be mounted read-only for checking
That's my entry for my current 2.6.16 kernel in lilo.conf. You'll also want to make sure LiLO has a timeout to allow you to pick the kernel you want to boot (btw, first one listed is the default one). To make sure there's a timeout ensure there's a line like this at the top of /etc/lilo.conf:
timeout = 50
(that will give you a 5 second timeout)
also, make sure there's a line like this:
(that will cause LiLO to show a menu with your kernel choices)
When you're done, save the file and run "lilo" to reinstall the LiLO bootloader.
Now you should be able to reboot and select either your old kernel or the new kernel; so, if the new one won't boot due to some error you made, you still have the old one. In case something goes badly wrong and neither your old nor new kernel will boot, you can always use CD1 to boot the previously installed system. At the very first prompt CD1 gives you enter:
"bare.i root=/dev/hda1 noinitrd ro"
You need to substitute bare.i with the kernel from the CD to use if bare.i doesn't work for you, of course, and /dev/hda1 should be whatever your actual root partition is that will then use the kernel from the CD, but will boot the installed system on the hard drive -- good to know in case of non-booting kernel
And don't forget to read the README file in the top of the kernel source directory for additional instructions. Also read Documentation/Changes for requirements, etc.
And for all of those of you who *still* wrongly think that you need your new kernel's header files in /usr/lib/include etc., please stop that. The kernel headers in that location and elsewhere should match your *glibc*, so leave the kernel headers your distribution put in place alone - and read the following link if you doubt me on this point:
Ohh, and don't touch /usr/src/linux - leave that exactly as your distribution made it. Again, if you don't believe me, read the link above as well as the README in the kernel source directory.
Adapted from Jesper Juhl's guide, whose link is no longer valid.