Difference between revisions of "Genkernel Quick Start Tutorial"

From Funtoo Linux
Jump to: navigation, search
(Third step: Building and installing the kernel)
(Concepts)
Line 2: Line 2:
  
 
= Concepts =
 
= Concepts =
 +
 +
TBC
  
 
= Genkernel applied to the Debian sources =
 
= Genkernel applied to the Debian sources =

Revision as of 19:19, 6 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 Derbian 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

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