Originally Posted by Robert.Thompson
The book, in section 4.2 talks about 'Selecting a Kernel'
I don't understand the 'why' of this section. Slackware is working, right? 'It talks about compiling a Kernal from source' - do I need to do this? Why?
Thanks for any guidance,
when I started with Linux I hadn't a clue what all this was about. Debian didn't help because the developers had already done the work for me. Only when I moved to Slackware did I begin to understand.
Here's one way to understand it:
let's say you have a Windows XP partition and a Slackware partition on your computer. If your Linux kernel hasn't been compiled with NTFS file system support then Slackware won't "see" or mount the Windows partition, meaning you won't be able to copy stuff from your Windows folders to your /home directory. So NTFS file system support must be compiled into the kernel if that's what you want to do. The huge kernel has NTFS compiled in, but the huge kernel has *everything* compiled in, just in case, including support for hardware devices you're unlikely to ever use. Compiling a kernel allows you to trim the huge kernel to your own needs. A generic kernel is usually a kernel where the trimming has been done for you and support for hardware and filesystems and suchlike is compiled in as modules, meaning it's not hard-coded into the kernel but compiled in in such a way that if the hardware is there the driver is loaded and if the hardware is not there then the driver is not loaded.
Here's what I do with kernels. I download the vanilla 2.6.37 kernel from kernel.org and extract it to /home/user/build as an ordinary user (it's a good idea to check the integrity of the download first but that's for another thread). Download the kernel (bz2) first and then in a terminal do the following:
mv linux-2.6.37.tar.bz2 /home/user/build
tar -xjvf linux-2.6.37.tar.bz2
For ease of use I then symlink (shortcut, in Windows-speak) the new linux-2.6.37 directory that has just been created:
ln -s linux-2.6.37 linux
Now I change into the new linux directory:
I then get my hands on a config file for the generic kernel. Use your browser to go to the following address:
The generic-smp config will do nicely. What this means is that I now have a configuration file for a generic linux-126.96.36.199 kernel which means most of the guesswork has already been done for me. I want to use that as a template to help me configure the newer 2.6.37 kernel.
Now I copy that config into the linux directory I created earlier:
cp /home/user/config-generic-smp-188.8.131.52-smp /home/user/build/linux/.config
Make sure you copy it as .config - the dot is important.
Now I start compiling my new kernel. I already have a 184.108.40.206 kernel config so I can *make oldconfig* to bring my config up to 2.6.37:
It's safe to accept the default answers here - there will be quite a lot so just keep pressing Enter as this is your first go.
Once that's finished you can go through the kernel config to see if it's to your liking. Make sure you're still doing all of this as a normal user, not as root:
Now you get a tree where you can make your changes - don't go too mad here but just have a look through it to see what's going on. Have a look at file systems for example and see if NTFS is compiled in. If it's hard-coded into the kernel it will have a star and if it's compiled in as a module it will have the letter M. A module is fine because your Slackware only needs NTFS on-demand. Your Slackware root filesystem is a different matter - if it is formatted as ext4 then you MUST compile the ext4 filesystem into your kernel so that the system boots. In other words, a star, not the letter M, beside ext4. If it's ext3, then a star beside ext3. If you don't know what your root filesystem is, go to another terminal and type this:
You will see what your / directory is mounted as. Make sure filesystem support for this and other partitions is compiled in - if in doubt, put a star beside ext4, ext3, xfs, and jfs. But you're intelligent enough to know by now what's going on eh?
As I say, don't go mad changing things here - look around and get comfortable with it first. One thing you can safely do is change your processor family under "Processor type and features" - Core 2/Xeon here. Take your pick. Use the spacebar to select. Now you will get the benefit of a kernel that understands all the intricacies of your processor. Beforehand you just had a kernel with generic processor support.
OK that's enough for now. Exit and save your new config.
Now you can *make* the new kernel. If you have a multicore CPU you can speed the *make* up a bit with the -j switch.
This will take a while.
When it's finished you need to *su* to root so that you can install your modules and then your kernel:
The last step will update your lilo so that the new kernel will be selected automatically at boot. The more experienced users here will probably tell me this is a bad way to go about kernel configuration because it leaves me with no backup if things go wrong, so it's important not to make any radical changes until you know what you're doing when you're configuring.
Now if you reboot you have a spanking new kernel, with support for your specific processor compiled in. It might not make a huge difference, but it will make a difference, so it's worth doing. Type the following in a terminal to make sure you've booted up with the new kernel:
Voila. You're good to go. Hope this helps.