Kernel Upgrade III - Source
Summary:- Kernel Configuration
- Kernel Compilation And Installation
- System Configuration
- Configuring ~LiLo
- Configuring GNU GRUB
Kernel Configuration
(You have read the page about preparations, haven't you?) If you are compiling the original source archive from kernel.org, you are advised to leave '/usr/src/linux' alone and place and compile the sources somewhere in your home directory tree (which sports the added benefit of only needing to be 'root' during the installation phase). Runtar xfzC {kernel-source}.tar.gz
make mrproper
Copy the 'defconfig' file to your current working directory and rename it to '.config'. If you already have a '.config' file from previous builds, you can of course use that one instead, though you might want to create an backup of this file first.
You'll find three types of entries in this file, corresponding to three states possible for many entries (but not all1.1 ): 'build into the kernel', 'build as a kernel module' and 'not included':
{OPTION}=y
{OPTION}=m
# {OPTION} is not set
{OPTION}=m
{OPTION}=y
Edit and save and proceed to the next chapter. The second way uses one of the supplied kernel configuration interfaces. Being in the 'linux' directory, either issue
make config
make menuconfig
make xconfig
- Read the supplied online documentation.
- Be careful with including experimental stuff. It is experimental, they are not kidding.
- Modularize. The smaller the kernel the better, but make sure you don't accidentally throw out something you need at boot time. The available online help will give you tips on what to do.
- If you're not sure, don't change it. Interdependencies are sometimes delicate and hard to grasp. Better a kernel that is some kilobyte larger than strictly necessary than one that doesn't work at all.
Kernel Compilation And Installation
Next save your new configuration. Edit the 'Makefile' in your editor of choice and edit the value for 'EXTRAVERSION' to your liking (otherwise you might end up with two different kernels having the same name). Runmake dep && make clean && make bzImage && make modules
If the compilation finished successfully,
su
make modules_install && make install
- install the kernel to '/boot/vmlinuz-{Version}',
- generate an initrd image in '/boot' if necessary,
- add entries for the new kernel to '/etc/lilo.conf', '/boot/grub/menu.lst' or '/etc/yaboot.conf' (on PPC machines).
System Configuration
If everything went fine, you should have two new files in '/boot': 'System.map-{new version}' and 'vmlinuz-{new version}'.Check if there are files called 'System.map', 'vmlinuz' and (in older Mandrake releases) 'modules.info' in '/boot'. These 'files' are actually links. There are two things you can do with them:
- Leave them in place and trust M's init script to sort things out, i.e. to change these symlinks according to the kernel you are booting.
- Delete them and change your boot loader config file to reflect the exact kernel versions you are booting.
If you rather want to create an image by hand, you can do that with
mkinitrd /boot/{name of image} {new kernel version}Configuring ~LiLo
The 'installkernel' script will autodetect your boot loader and adjust their configuration files accordingly. If you are interested in how to do that by hand anyway, here's the scoop: Configuring ~LiLo is done by editing '/etc/lilo.conf', either by loading the file into an editor or (since 7.1) by using the '~DrakBoot' tool in the 'Mandrake Control Center' (aka '~DrakConf'). First change the entry for your old kernel:- change to the full name of the (old) kernel image. This is only necessary if you've deleted the 'vmlinuz' link in '/boot'.
image=/boot/vmlinuz
- change to something like
label=linux
. This will allow you to boot the old kernel by typinglabel=linold
at the boot prompt.linold
label=linux
You only need
initrd="/boot/{initrd image}"mkinitrd /boot/{initrd image} {new kernel version}initrd
lilo
Configuring GNU GRUB
If you are using the GNU GRUB boot loader, add an entry to '/boot/menu.lst' (or use '~DrakBoot' in the 'Mandrake Control Center') like this: title {menu entry} kernel (hd{x},{y})/boot/{kernel} root=/dev/{z}title
(hd0,0)
/boot/mynewkernel
Since 'init', the initial GNU/Linux boot process, also needs to know on which partition the kernel is, you need to tell it this in its own parlor
root=/dev/hda1
initrd /boot/{name of initrd image}
Note that if '/boot' is on the first logical partition of a drive (/dev/hda5), the entry has to read
(hd0,4)
defaultRelated Resources:
~MdkReference, 14The Linux Kernel HOWTO
~KernelTrap
Jeffrey Borg: Compiling a New Kernel Revision / Modified: Sep. 18, 2001 / Oct. 15, 2001
Author: Tom Berger Legal: This page is covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB and Mandrakesoft.
Kernel Upgrade III - Source
Version 1.4 last modified by AdminWiki on 30/12/2005 at 03:38
Version 1.4 last modified by AdminWiki on 30/12/2005 at 03:38
Document data
- Lost account?
- Join the community, be part of the Club: it's free!
- Get the PWP Download Subscription!
Mandriva.com
Store
Club


