This is a small, quick guide I wrote a couple of years ago for a guy I was talking to on IRC who had some kernel build trouble. He found the document usefull and so I published it on linuxtux.org where I had an account at the time. The document got lost when I lost that account and didn't have a backup copy, but I recently found that Mr. Bruce Hill, Jr. had made a copy on his slackwarebox website that he had updated a bit. He even had the original (which is what you can read below) - thanks a lot Bruce. Here is a link to Bruce's updated version if you would like to read that one.
The original was a plain-text document. The version listed below has been slightly edited and given a light HTML markup to make it fit the site better.
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 homedir, example :
/home/universe/linux-2.6.16.22
cd into kernel source dir and run make menuconfig
Configure all kernel options to suit your needs.
If this is the first time you do this 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 menuconfig (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..
Then 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 use su to become root.
( note: if you have a configuration file from an older 2.6.x 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 ~/linux-2.6.16.22/.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 menuconfig" 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.22 ; ln -sf /boot/System.map-2.6.16.22 /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.22
Now, the new kernel is in place under the name /boot/vmlinuz-2.6.16.22 , 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.22 root = /dev/sda1 label = Slackware read-only # Non-UMSDOS filesystems should be mounted read-only for checking
That's my entry for my current 2.6.16.22 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 lilo.conf :
timeout = 50
that will give you a 5 second timeout
also, make sure there's a line like this :
prompt
that will cause lilo to show a menu with your kernel choices.
When you are done, save the file and run /sbin/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 then always use CD1 to boot the installed system with a command like this
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 HDD.
Good to know in case of no booting kernel :)
-----
And don't forget to read the README file in the top of the kernel source dir
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
kernels 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:
http://lkml.indiana.edu/hypermail/linux/kernel/0007.3/0587.html
Ohh, and don't touch /usr/src/linux - leave that exactely 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 dir.
-----
Also, check out http://www.chaosbits.net/ for more guides on Slackware stuff.