1 Mise à niveau du noyau III - Les sources
- 1 Kernel Configuration
- 2 Kernel Compilation And Installation
- 3 System Configuration
- 4 Configuring LiLo
- 5 Configuring GNU GRUB
- 6 Related Resources:
Navigation :
Page précédente : Mise à jour du noyau II - RPM
Page suivante : Mise à jour du noyau IV - Problèmes
Index de la section ~~Administration avancée du système~~ - Index de la Base de Connaissances
1.1 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).
Run
tar xfzC {kernel-source}.tar.gz
If you have already built a kernel from these sources, run
make mrproper
The kernel configuration takes place in the new 'linux' directory. Basically, there are two ways to accomplish it, a short one by editing the '.config' file and a long one by using one of the provided configuration tools.
The first approach works by editing a copy of M's default kernel configuration file '/usr/src/linux-{...}/arch/{i386|ppc}/defconfig'. It is especially suited for situations where you just want to change a few options and you know what you are doing.
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
to
{OPTION}=y
You'll find help on most options in the file 'linux/Documentation/Configure.help'.
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
Some advice about choosing a good configuration:
- 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.
1.1 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).
Run
make dep && make clean && make bzImage && make modules
Compile time depends on system and kernel configuration, of course. On most machines, compilation will take between 15 and 45 minutes (that's a wild guess).
If the compilation finished successfully,
su
make modules_install && make install
The last command will call the '/sbin/installkernel' script - via 'linux/arch/i386/boot/install.sh' - which will in turn use scripts in '/usr/share/loader' to:
- 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).
1.1 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}
Index de la section ~~Administration avancée du système~~ - Index de la Base de Connaissances
1.1 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
image=/boot/vmlinuz
- change
label=linux
label=linold
linold
image=/boot/vmlinuz-{new kernel version} label=linux root=/dev/{root partition} initrd=/boot/{initrd image} readonly
The 'root partition' is the same as for the old kernel. The
label=linux
You only need
initrd="/boot/{initrd image}"
mkinitrd /boot/{initrd image} {new kernel version}
The only requirement for the name of the new initrd images is that it differs from the old one. Then point the
initrd
Run
lilo
Index de la section ~~Administration avancée du système~~ - Index de la Base de Connaissances
1.1 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)
By changing the number in the
default
Having made your changes, save the file and reboot.
Index de la section ~~Administration avancée du système~~ - Index de la Base de Connaissances
Next Item: Troubleshooting
1.1 Related Resources:
~MdkReference, 14
The Linux Kernel HOWTO
~KernelTrap
Jeffrey Borg: Compiling a New Kernel
Page suivante : Mise à jour du noyau IV - Problèmes
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.
Version 1.9 modifié par ptyxs le 06/11/2006 à 11:21
Données du document
Base de connaissances
- Compte perdu ?
- Rejoignez la communauté, faites partie du Club: c'est gratuit!
- Abonnez vous au service PWP!