[go: up one dir, main page]

0% found this document useful (0 votes)
8 views3 pages

Linux Kernel Reference Guide-R1

The document provides a step-by-step guide for upgrading and patching the Linux kernel, including downloading the kernel, configuring it, compiling, and installing it. It emphasizes the importance of managing kernel versions and modules, as well as updating the boot configuration. Additionally, it includes instructions for applying patches to the kernel source.

Uploaded by

yodssubs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Linux Kernel Reference Guide-R1

The document provides a step-by-step guide for upgrading and patching the Linux kernel, including downloading the kernel, configuring it, compiling, and installing it. It emphasizes the importance of managing kernel versions and modules, as well as updating the boot configuration. Additionally, it includes instructions for applying patches to the kernel source.

Uploaded by

yodssubs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

Linux Kernel Reference Guide Revision 1

______________________________________________________________________________________

Upgrading Linux Kernel


a. Download the latest Linux Kernel from ftp://ftp.kernel.org ( linux-2.2.19.tar.gz ).
b. Untar the kernel source to /usr/src/linux:

# cd /usr/src/
# tar zxvf linux-2.2.19.tar.gz
# ln -s linux-2.2.19 linux
# cd /usr/src/linux

c. It is a good practice before compiling the kernel to change the EXTRAVERSION value to
something else like revision numbers to track how many times you compiled your kernel.

# vi /usr/src/linux/Makefile

You should see something similar to this:

VERSION = 2
PATCHLEVEL = 2
SUBLEVEL = 19
EXTRAVERSION = -1

; your kernel version will be 2.2.19-1. Neat right?

d. Let’s configure the kernel using the command:

# make menuconfig

; this command will bring up a menu-based configuration.

Now, an “*” symbol means… “to be compiled in the kernel” and “M” means “to be
compiled as loadable modules”.

Initially, compile the drivers you will always use like SCSI devices, network card drivers,
frequently used file system like ext2 but always remember that compiling all drivers to the
kernel is not a good idea since it will be slow and can cause potential security risk.
Compile the seldom-used drivers just in case you change hardware and/or needs to
access a file system like NTFS or FAT.

Don’t forget to save your configuration!

e. It will save the kernel configuration to /usr/src/linux/.config. Issue the following command
to insure that all of the dependencies, such the include files, are in place. It also removes
all of the object files and some other things that an old version leaves behind. In any
case, do not forget this step before attempting to recompile a kernel.

# make dep clean

f. Now our kernel configuration is ready to be compiled:

# make bzImage

______________________________________________________________________________________

Ferdinand P. Gatmaitan, RHCE 1


Linux Kernel Reference Guide Revision 1
______________________________________________________________________________________

; if all went well, it will create a file called “bzImage” in /usr/src/linux/arch/i386/boot


directory. What is this file? this is your new linux kernel.

If you selected some drivers to be compiled as modules, you would issue the command:

# make modules ; this will compile the kernel modules.

# make modules_install

; this will install the compiled kernel modules to /lib/modules/<kernel-version>

Having done that, the module dependencies need to be mapped out. This is done with
the following command:

# depmod -a

g. Now, we must install the new kernel.

cp /usr/src/linux/arch/i386/boot/bzImage /boot/vmlinuz-<kernel-version>
cp /usr/src/linux/System.map /boot/System.map-<kernel-version>
rm -f /boot/System.map
ln -s /boot/System.map-<kernel-version> /boot/System.map

h. The new kernel now needs to be inserted in the boot chain.

# vi /etc/lilo.conf

You should see something similar to this example:

boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=30

image=/boot/vmlinuz-<old-kernel-version>
root=/dev/hda2
read-only
label=linux-old

image=/boot/vmlinuz-<new-kernel-version>
root=/dev/hda2
read-only
label=linux

# lilo -v ; this will commit the changes to MBR.

# reboot ; cross your fingers!

______________________________________________________________________________________

Ferdinand P. Gatmaitan, RHCE 2


Linux Kernel Reference Guide Revision 1
______________________________________________________________________________________

Patching Linux Kernel


a. Download the latest Linux Kernel patch from ftp://ftp.kernel.org.
b. Patch the kernel source:

# cd /usr/src/linux/
# zcat patch-2.2.20.gz | patch -p0

______________________________________________________________________________________

Ferdinand P. Gatmaitan, RHCE 3

You might also like