Difference between revisions of "Genkernel Quick Start Tutorial"

From Funtoo Linux
Jump to: navigation, search
(info about new config-extract tool.)
m (Second step: Grabbing a configuration file)
Line 57: Line 57:
  
 
To see a full list of available Debian kernel configurations, type <tt>./config-extract --list</tt> from within the root kernel source tree.
 
To see a full list of available Debian kernel configurations, type <tt>./config-extract --list</tt> from within the root kernel source tree.
 +
 +
After using <tt>config-extract</tt>, run <tt>make oldconfig</tt> and accept all default options by hitting Enter to all prompts.
  
 
== Third step: Building and installing the kernel ==
 
== Third step: Building and installing the kernel ==

Revision as of 23:34, 7 March 2011

Genkernel is a tool which help you to build a Linux kernel and deploy it along with a ramdisk image which contains all of the necessary modules to make the kernel being able to mount the different partitions of your harddrives in the VFS at the system startup.

Contents

Concepts

TBC

Genkernel applied to the Debian sources

A good candidate to quickly start with Genkernel is the Debian kernel (sys-kernel/debian-sources) mainly because:

  1. Configuration files are available for the various platforms supported by the Debian project
  2. The configuration makes an intensive use of putting features in modules

First step: emerging the rquired packages

The first step is to emerge:

  1. The Debian sources
  2. Genkernel itself

This is achieved with:

# emerge sys-kernel/debian-sources sys-kernel/genkernel

Once the Debian kernel sources are deployed, you should find a directory named linux-debian-version (e.g. linux-debian-2.6.32.30) under /usr/src. Update your the linux symlink to point on this directory:

# cd /usr/src
# rm linux
# ln -s linux-debian-2.6.32.30 linux

Second step: Grabbing a configuration file

If is now time to download the kernel configuration file. For this tutorial we will use a configuration file for AMD64 (several others architectures like MIPS or SPARC64 are available) as published by the Debian project, if you plan to use the Debian kernel you are advised to review it adjust it to your needs although it is tailored for a vast range of machines.

# cd linux
# wget http://merkel.debian.org/~jurij/2.6.32-30/amd64/config-2.6.32-5-amd64.gz
# gunzip config-2.6.32-5-amd64.gz

Alternatively, you can use Funtoo's config-extract tool to generate an official Debian kernel configuration. Use it as follows:

# cd linux
# ./config-extract amd64
Wrote amd64_none_amd64 kernel configuration to /usr/src/linux-debian-2.6.32.30/.config.

config-extract also allows you to extract special Debian featuresets, such as settings for Xen and OpenVZ kernels:

# ./config-extract amd64 openvz
Wrote amd64_openvz_amd64 kernel configuration to /usr/src/linux-debian-2.6.32.30/.config.

To see a full list of available Debian kernel configurations, type ./config-extract --list from within the root kernel source tree.

After using config-extract, run make oldconfig and accept all default options by hitting Enter to all prompts.

Third step: Building and installing the kernel

This is simply achieved by:

# genkernel --kernel-config=config-2.6.32-5-amd64 all
  • --kernel-config: use the given name located in the kernel source tree (/usr/src/linux by default is taken unless overridden by --kerndir)
  • all: rebuild the kernel image and the initramfs ramdisk image (aside of kernel modules, the ramdisk image contains tools such as BusyBox and some generic startup scripts, depending on options you use on the command line several additional tools like lvm or raid volume management can be incorporated as well).

Unless explicitly stated via --no-clean or no-mrproper, Genkernel will do a make mroprer in the kernel source tree, thus cleaning a previous build and removing the previous kernel configuration file in it.


If you use Genkernel to rebuild a Linux kernel on SPARC64, remember to either:

  • Set sparc64-unknown-linux-gnu- in General setup --> Cross-compiler tool prefix
  • Put --kernel-cross-compile=sparc64-unknown-linux-gnu- on the Genkernel command line

One the kernel has been compiled and the ram disk has been generated, the kernel image plus its companion files (initramfs image and System.map) are placed in the /boot directory, You can use your favourite tool to update your bootloader configuration files.

Personal tools
Namespaces

Variants
Actions
Categories
Toolbox
Stuff