Difference between revisions of "Genkernel Quick Start Tutorial"
(→Second step) |
(→Third step: Building and installing the kernel) |
||
| (18 intermediate revisions by 4 users not shown) | |||
| Line 3: | Line 3: | ||
= Concepts = | = Concepts = | ||
| − | + | TBC | |
| − | + | = Recompiling the Gentoo kernel sources from a SystemRescue CD chroot = | |
| − | + | ||
| − | + | ||
| − | == First step == | + | A second case that many Funtoo users will face to is to compile their own kernel when installing a brand new Funtoo instance from a stage 3 archive (the most common scenario is to boot the machine with SystemRescue CD). |
| + | |||
| + | {{fancynote|If you want to use the System rescue CD sources provided by Funtoo ( sys-kernel/sysrescue-std-sources ), the philosophy remains exactly the same}} | ||
| + | |||
| + | == First step emerging the required packages == | ||
The first step is to emerge: | The first step is to emerge: | ||
| − | # The | + | # The Gentoo kernel sources |
# Genkernel itself | # Genkernel itself | ||
| Line 19: | Line 21: | ||
<pre> | <pre> | ||
| − | # emerge sys-kernel/ | + | # emerge sys-kernel/gentoo-sources sys-kernel/genkernel |
</pre> | </pre> | ||
| − | Once the | + | Once the Gentoo kernel sources are deployed, you should find a directory named '''linux-''version''-gentoo''' (e.g. linux-2.6.39-gentoo) under '''/usr/src'''. Update the '''linux''' symlink to point on this directory: |
<pre> | <pre> | ||
# cd /usr/src | # cd /usr/src | ||
# rm linux | # rm linux | ||
| − | # ln -s linux | + | # ln -s linux-2.6.39-gentoo linux |
</pre> | </pre> | ||
| − | == Second step == | + | == Second step: Grabbing and tweaking a configuration file == |
| − | + | How to start your kernel configuration? Simply by using the same configuration template the running System Rescue CD kernel had been built with! Before chrooting in your Funtoo instance, you did something like: | |
<pre> | <pre> | ||
| − | # | + | # mount -o bind /proc /mnt/gentoo/proc |
| − | + | ||
| − | + | ||
| − | + | ||
</pre> | </pre> | ||
| + | Or: | ||
| + | <pre> | ||
| + | # mount -t proc none /mnt/gentoo/proc | ||
| + | </pre> | ||
| + | |||
| + | In your chroot environment (or from a System Rescue CD virtual terminal) if you look what /proc contains you will notice a file named config.gz: | ||
| + | |||
| + | <pre> | ||
| + | # ls /proc | ||
| + | ... | ||
| + | dr-xr-xr-x 7 root root 0 May 23 03:13 952 | ||
| + | dr-xr-xr-x 7 root root 0 May 23 03:13 953 | ||
| + | dr-xr-xr-x 7 root root 0 May 23 18:42 9834 | ||
| + | ... | ||
| + | -r--r--r-- 1 root root 16024 May 23 22:27 config.gz | ||
| + | -r--r--r-- 1 root root 0 May 23 22:27 consoles | ||
| + | -r--r--r-- 1 root root 0 May 23 22:27 cpuinfo | ||
| + | ... | ||
| + | </pre> | ||
| + | |||
| + | config.gz holds the running kernel (System Rescue CD) configuration, just copy the gunziped content in the Gentoo sources directory: | ||
| + | |||
| + | <pre> | ||
| + | # cd /usr/src/linux | ||
| + | # zcat /proc/config.gz > .config | ||
| + | </pre> | ||
| + | |||
| + | Next, run make oldconfig to set all newly added options: | ||
| + | |||
| + | <pre> | ||
| + | # make oldconfig | ||
| + | </pre> | ||
| + | |||
| + | Next, tweak the kernel configuration in the way you prefer (manually edition of the .config file, make nconfig, make menuconfig....) if you wish. You are not ready yet! A final step is required: '''you ''must'' either set CONFIG_INITRAMFS_SOURCE to a blank value (CONFIG_INITRAMFS_SOURCE="") either delete the statement in the .config file'''. Forgotting to do that will make Genkernel abort the compilation process with a message like: | ||
| + | |||
| + | <pre> | ||
| + | /usr/src/linux-2.6.39-gentoo/scripts/gen_initramfs_list.sh: Cannot open '/var/tmp/genkernel/initramfs-2.6.32.14-std155-i386.cpio.gz' | ||
| + | make[1]: *** [usr/initramfs_data.cpio.lzma] Error 1 | ||
| + | </pre> | ||
| + | |||
| + | == Third step: Building and installing the kernel == | ||
| + | |||
| + | This is simply achieved by: | ||
| + | |||
| + | <pre> | ||
| + | # genkernel --no-mrproper all | ||
| + | </pre> | ||
| + | |||
| + | The same remarks written in the [[Genkernel_Quick_Start_Tutorial#Third_step:_Building_and_installing_the_kernel|third paragraph]] of the first use case are still valid here. | ||
| − | [[Category: | + | [[Category:Kernel]] |
Latest revision as of 13:12, 18 November 2012
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 |
[edit] Concepts
TBC
[edit] Recompiling the Gentoo kernel sources from a SystemRescue CD chroot
A second case that many Funtoo users will face to is to compile their own kernel when installing a brand new Funtoo instance from a stage 3 archive (the most common scenario is to boot the machine with SystemRescue CD).
If you want to use the System rescue CD sources provided by Funtoo ( sys-kernel/sysrescue-std-sources ), the philosophy remains exactly the same
[edit] First step emerging the required packages
The first step is to emerge:
- The Gentoo kernel sources
- Genkernel itself
This is achieved with:
# emerge sys-kernel/gentoo-sources sys-kernel/genkernel
Once the Gentoo kernel sources are deployed, you should find a directory named linux-version-gentoo (e.g. linux-2.6.39-gentoo) under /usr/src. Update the linux symlink to point on this directory:
# cd /usr/src # rm linux # ln -s linux-2.6.39-gentoo linux
[edit] Second step: Grabbing and tweaking a configuration file
How to start your kernel configuration? Simply by using the same configuration template the running System Rescue CD kernel had been built with! Before chrooting in your Funtoo instance, you did something like:
# mount -o bind /proc /mnt/gentoo/proc
Or:
# mount -t proc none /mnt/gentoo/proc
In your chroot environment (or from a System Rescue CD virtual terminal) if you look what /proc contains you will notice a file named config.gz:
# ls /proc ... dr-xr-xr-x 7 root root 0 May 23 03:13 952 dr-xr-xr-x 7 root root 0 May 23 03:13 953 dr-xr-xr-x 7 root root 0 May 23 18:42 9834 ... -r--r--r-- 1 root root 16024 May 23 22:27 config.gz -r--r--r-- 1 root root 0 May 23 22:27 consoles -r--r--r-- 1 root root 0 May 23 22:27 cpuinfo ...
config.gz holds the running kernel (System Rescue CD) configuration, just copy the gunziped content in the Gentoo sources directory:
# cd /usr/src/linux # zcat /proc/config.gz > .config
Next, run make oldconfig to set all newly added options:
# make oldconfig
Next, tweak the kernel configuration in the way you prefer (manually edition of the .config file, make nconfig, make menuconfig....) if you wish. You are not ready yet! A final step is required: you must either set CONFIG_INITRAMFS_SOURCE to a blank value (CONFIG_INITRAMFS_SOURCE="") either delete the statement in the .config file. Forgotting to do that will make Genkernel abort the compilation process with a message like:
/usr/src/linux-2.6.39-gentoo/scripts/gen_initramfs_list.sh: Cannot open '/var/tmp/genkernel/initramfs-2.6.32.14-std155-i386.cpio.gz' make[1]: *** [usr/initramfs_data.cpio.lzma] Error 1
[edit] Third step: Building and installing the kernel
This is simply achieved by:
# genkernel --no-mrproper all
The same remarks written in the third paragraph of the first use case are still valid here.