2.3 The Post-compilation Stage
This is the important stuff.. you will now have to
include your new configuration as an option in your
bootmanager. The method I will describe is to add
a new kernel to LILO. This way, you have the option
of booting the new kernel, as well as booting the
old kernel, just in case there are any problems.
your newly compiled kernel is in /usr/src/linux/arch/*architecture*/boot/
where *architecture* is the type of computer you are
using. If its a plain vanilla pc (like mine), then
you can substitiute *architecture* with i386. The
kernel's name is bzImage (or if you used make zImage
during compile, it will be zImage).
You must also know where you keep your current kernel's.
On my system it is /boot but some people use their
root directory.
- So.. bearing in mind your specifics..
# cd /boot
# mv bzImage vmlinuz-2.2.9
- renames the old kernel so you dont overwrite it,
and you know what it is
# mv system.map systemp.map-2.2.9
- moves the old system map
# cp /usr/src/linux/arch/i386/boot/bzImage
/boot/ - copies the new kernel to the boot
directory
# cp /usr/src/linux/System.map /boot/
- copies the new system map to the boot directory
I will take moment here to discuss the System.map
file, and the organisation of this directory in general.
In the above example I have assumed that you have
a static System.map you want to replace, although
some systems have a symbolic link named system.map
pointing to a different file. I have assumed this
on the basis that most distributions install a static
system.map file, and so if you don't know whether
you have a static system.map file, or just a symbolic
link to another file, the odds are you have a static
one, and will be perfectly fine when following the
instructions given.
It is important to remember the differences and filenames
you've just changed, as they need to be reflected
in your lilo configuration file.
- Pull up /etc/lilo.conf with your favorite
editor
If you have only one kernel in here, and you have
no other OS on your system, their should only be one
stanza relating to kernel locations and names. Other
OS's you use will have identifiable labels. A stanza
with a label=windows should be left alone. You only
need to be concerned with your linux boot parameters.
- Find your old kernel's stanza.. an example of what
it may look like is shown below
image = /boot/bzImage
root = /dev/hda1
label = linux
As you remember I changed my old bzImage to vmlinuzold
so I need to edit that stanza to reflect the changes..
so it becomes
image = /boot/vmlinuzold
root = dev/hda1
label = old
- Then you need to add a new stanza for your new
kernel.. an example form my /etc/lilo.conf
is..
image = /boot/bzImage
root = /dev/hda1
label = new
- Now you need to save your lilo.conf and then run
the following to update LILO
# /sbin/lilo
- If lilo gives output of options without any errors..
well.. you've finished. All that remains is to reboot,
and at the LILO prompt (attained by pressing Shift
when the word LILO appears in the boot sequence) type
your new kernel label, which in my case is "new".
Obviously I'll leave out the inverted comma's :)
Once you've checked it, by booting (keeping that
boot floppy handy :)), and you are happy with it,
you can edit /etc/lilo.conf once more, to make your
new kernel the default kernel to boot. To do that,
just make your new kernel's stanza the first one in
the list of boot options. In my case, just switch
the vmlinuzold stanza with the bzImage stanza.
3. Patching a Kernel
The advantage of patching an existing kernel, over
downloading the next kernel release, is that people
with little time and/or bandwidth can keep their kernel's
up to date, just by applying a 20k (approx.) patch
file.
You need to download the patches you require, in
sequential order from the patchlevel of your current
kernel source, to the patchlevel you wish to upgrade
to.
For example, if I had kernel 2.2.6 and I wanted to
upgrade to kernel 2.2.11 i would need patches 2.2.7..
2.2.8.. 2.2.9 through to 2.2.11. Kernel patches follow
the same naming conventions as the kernel itself does.
i.e. patch-2.2.8 is he patch to upgrade from
2.2.7 to 2.2.8.
You do not have to store your kernel patches in any
specific location, rather it is the location where
you execute the patch command that is important. To
patch your kernel, you must do the following as root..
# cd /usr/src - You must execute your patch
command from this location
# gunzip -c patchfile | patch -p0
- Execute this command for every patch you have, where
patchfile is the name and location of
your patch
Note: You run the patch command above for each patchfile
in sequential order. Following the previous example,
if i had kernel 2.2.6 and wanted to patch up to 2.2.11
I would first apply patch 2.2.7, followed by 2.2.8,
2.2.9 through to 2.2.11
You cannot use any wildcards such as * either, as
this applies the patches in ASCII order, not numerical
order.
This is all you should need to do. To make sure all
the patches were applied successfully, issue the following
as root..
# find /usr/src/linux -follow -name "*.rej" -print
#find /usr/src/linux -follow -name "*#" -print
If either of the above two commands return any files,
then some parts of the patch process could not be
applied for some reason. If you are in doubt as to
what action should be taken to address such problems,
I would suggest you download a kernel source package,
and start from the beginning
If everything went cleanly, you have successfully
patched your kernel source, and are free to compile
a new up-to-date kernel.
4. Other Sources of Information
The documents in your kernel sources are the most
detailed.. You should find them here
the LDP
has a good selection of kernel
info
For those of you who want to download your kernels/patches,
find your local mirror here.
7DS
[-Previous
Page-]
|