Kernel/Installing
From Gentoo Linux Wiki
Kernel installation is covered in the Gentoo Handbook. This guide attempts to cover the topic in a bit more depth.
Contents |
[edit] Choosing the Sources
First off, head over to the Kernel Sources page and figure out which kernel you want to install.
The most commonly used sources are the vanilla and gentoo sources:
- vanilla-sources: sources straight from kernel.org (unpatched)
- gentoo-sources: sources patched for bug fixes and features by Gentoo Developers
- mm-sources: sources of the development version, maintained by Andrew Morton. Use if you want to help with kernel testing or really bleeding-edge material.
[edit] Installing the Kernel Sources
Download and extract the chosen kernel sources with, for example: emerge gentoo-sources
If a specific version is desired, run, for example: emerge =gentoo-sources-2.6.18-r4
If using a tarball, for example 2.6.14.2 directly from kernel.org, unpack it to /usr/src/linux-2.6.14 using the following instructions.
| Code: Unpacking kernel sources |
cd /usr/src mkdir linux-2.6.14.2 cd linux-2.6.14.2 tar xjvf linux-2.6.14.2.tar.bz2 |
[edit] Determining What Options You Need
The first thing you need to know is what hardware you have. For information on how to do this, see Detecting your Hardware.
As a note, it is recommended that if this is your first time installing a kernel, don't try to include all the options you might need for all your hardware. Your first aim should be to get a basic working kernel, so concentrate on essential devices such as:
- PATA/SATA (or other type of) disk controller
- Keyboard and mouse
- Graphics card
- Filesystems
- Networking
[edit] Configuring the Kernel
See the Configuration section.
[edit] Compiling the kernel
Run the following in the kernel source directory: make && make modules_install
Voila! Your kernel has been compiled and you are ready to install.
[edit] Installing the kernel
To install the kernel, you need to copy it to the partition on which the contents of /boot reside. You can do this manually, however there's a useful tool to help you.
[edit] Using the Install Tool
First install debianutils: emerge -a debianutils
Which ever method you're using, make sure your /boot partition is mounted: mount /boot
To run the install utility, use: make install
This will make a backup of the old kernel under the name /boot/vmlinuz.old and save a copy of the new one with the name /boot/vmlinuz. You can keep your bootloader (either GRUB or LILO) pointed at /boot/vmlinuz at all times and provide for a backup, /boot/vmlinuz.old. That way if something goes wrong, you can boot to the old version of the kernel (vmlinuz.old).
[edit] Manual installation
Mount /boot with: mount /boot
Then copy new kernel in to the boot directory: cp /usr/src/linux/arch/i386/boot/bzImage /boot/YourKernelName_with_BuildDate_if_you_wish
Then install the modules in /lib/modules with: make modules_install
Now configure the boot manager. Make sure to match your chosen filename when you specify the kernel in the GRUB or LILO config file.
To be specific, use a line like:
kernel /boot/vmlinuz ...
in /boot/grub/grub.conf if you use GRUB, or
image=/boot/vmlinuz ...
in /etc/lilo.conf if you use LILO. In either case, replace "..." with suitable kernel options. You can find and copy these from a working grub.conf or lilo.conf.
In both GRUB and LILO, you may wish to give yourself a "fallback" option by creating a separate menu entry pointing to /boot/vmlinuz.old. See the documentation for your bootloader for further details.
