Bootsplash

Kevin E. Glosser keg at adelphia.net
Fri Aug 1 18:06:42 EDT 2003


On Fri, 2003-08-01 at 08:54, Cyber Source wrote:
> I would love to see a meeting (or 2) about kernel's the recompiling of
> them.

It sounds more intimidating than it is. The kernel howto is all you need
to attempt it. The most recent iteration of it is not as nicely worded
as previous versions I think, however.

http://www.linux.org/docs/ldp/howto/Kernel-HOWTO/index.html

Here is the way I would describe the procedure...

1) You get the kernel source, you unpack it. You change to the directory
where the source tree starts, usually something like /usr/src/linux.

2) Here, you want to consider if you are going to KEEP any config files
that may have already been on your system. This is the file that has a
list of the kernel options that were chosen on the last kernel compile.
This file may or may not exist. If it does, it should be in this
directory and it's called ".config". If you want to keep this, good idea
to make a copy of it and place it somewhere else. This is totally an
optional step. You can go to step 3, then AFTERWARDS copy the config
file back to this directory.

If you do this, the choices that were previously chosen will already be
selected for you when you config your kernel. Then you can modify as you
see fit.

This is opposed to starting with no config and having to choose EVERY
option for your computer. As I said, this is optional, not required
step, but it may save you some time.

3) While in "/usr/src/linux" (or equivalent) issue "make clean" "make
mrproper". These two commands clean up any files left from a previous
kernel compile. It is usually best to start with a fresh source tree. It
also will remove any config file that is in /usr/src/linux. So make sure
you have a copy before you issue them, if you want to keep it.

4) If you kept your ".config" file, make sure you copied it back before
doing...

This step, which is the selecting of kernel options. You have three ways
you can do it. You can do it in X Windows, or not. I prefer to do it
while I am in X. To do so, issue "make xconfig".

For those not wanting to use X, issue "make menuconfig". There is also
an older way, which I do not recommend. I think it was "make config".

Alright, this is the big step. This is the one, where you select what
GOES IN to your kernel and what DOES NOT.

You will have three options for everything that comes with this version
of the kernel. You can select to put it IN, OUT, or compile it as a
MODULE. Modules are parts of the kernel that can be dynamically loaded
when needed. This can happen automatically or you can initiate it.

If it's something you KNOW you are going to use, select to compile it
IN. If it's something you think you might use on occasion, choose to
compile it as a module. Just make sure you also choose module support.

Some of the choices do not effect inclusion of a certain feature/driver.
Some just prevent or allow further options from being displayed.

Every item, well, most items have a help topic that is supposed to
describe what it is. Unfortunately, some of these are kinda technical
and not obvious as to what they do. Some options have no help files. So,
when possible read the help topic if you don't know what the choice is
offering.

After making your selections choose save and exit. Now the ".config"
file has been updated with your choices.

5) Issue "make dep" to check for dependencies.

6) Assuming everything went alright, it's time to compile it. Issue
"make bzImage".

Depending on the speed of your computer, this could take a long time. Be
prepared to wait several minutes, or perhaps longer if you have a very
old CPU.

7) Time to make the modules. Issue "make modules" and "make
modules_install".

At this point, you have a compiled kernel, complete with modules. The
only problem is, it is NOT installed. Your old kernel is still running
the show, or it will if you rebooted. You need to configure your system
to run the new one...

8) Here you have to configure GRUB or LILO to point to the new kernel.

Basically, there are a couple files you want to copy to where your other
kernel is currently located. Your current kernel is probably located in
the directory "/boot". What you need to do is copy the new kernel there.
You could rename the current kernel. It is probably called something
like "vmlinuz" or "vmlinuz-2.4.20-19.9". Or there might be a symbolic
link pointing to it. Whatever the case, rename the old one. Copy the new
one from "/usr/src/linux/arch/i386/boot/". In that directory it is
currently called "bzImage". I would rename it to something appropriate
when you copy it to "/boot".

You also want to copy your "System.map" file which should be located in
"/usr/src/linux" to "/boot". Again, rename the old one first, then bring
in the new one.

If you are using an initial ram disk, create a new one of those. The man
page on "mkinitrd" is pretty straight forward. Most people likely do not
need this however. When I installed Redhat 9, the installer made one. I
decided not to keep it when I recompiled the kernel. Make sure you
update GRUB or Lilo correctly, if you get rid of it.

GRUB, if you haven't made any changes to file names, will likely work
without any reconfiguration. Lilo will want you to run it as a command
once you have the new kernel in place(issue "lilo").

9) Now it's time to take the plunge. Reboot and see what is working and
what is not. It's a good idea to keep the old kernel around, in case you
made some mistakes. You might have to put the old one back in, and
reconfigure. Also, a good idea to have the distribution CD that you used
to install your distro. There is likely a disaster recovery option that
will let you manipulate files in the "/boot" directory if you REALLY
screw up.

If you have never done it before, plan on NOT getting it right the first
time. There will likely be some device, that maybe you left it's driver
out of the kernel and it's not working. If so, start at step 4.

Kernel recompiling is time consuming. Don't try it, unless you have some
time on your hands.

************************************************************************

It is possible, that you may have some current module installed that
will not work after you recompile your new kernel. Especially, if it's a
newer version of the kernel...

Example, would be the Nvidia driver for 3D accelerated graphics cards.
If you downloaded it from nvidia's site and installed it, you will have
to reinstall it after a new kernel is in place. This can only be done
outside of X Windows. It's nice to have your machine boot into runlevel
3 (non X) so you can do this. If your machine boots into runlevel 5 (X)
automatically, X will fail after the new kernel has been added. Might
want to read the man page on "telinit".

To reinstall the driver just rerun the script like you did to install
it. Those not using Nvidia graphics cards or did not install the driver
from the site, need not worry.

KEG

I'm not responsible for any kernel related explosions that occur to your
house. :) The above was just meant to help anyone who uses the kernel
Howto.




More information about the nflug mailing list