注意:

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "Funtoo Linux Kernels"

From Funtoo
Jump to navigation Jump to search
Line 1: Line 1:
{{#widget:AddThis}}
{{#widget:AddThis}}
__NOTITLE__
<languages/>
<languages/>
<translate>{{Announce|To help us translate this documentation, {{CreateAccount}}, log in to the wiki. Then go to Actions -> Translate in the menu, or click the "Translate this page" link, above. You will be able to select small parts of the install docs and translate these parts to your native language.}}
<translate>{{Announce|To help us translate this documentation, {{CreateAccount}}, log in to the wiki. Then go to Actions -> Translate in the menu, or click the "Translate this page" link, above. You will be able to select small parts of the install docs and translate these parts to your native language.}}
Line 7: Line 6:
Some points of interest:
Some points of interest:


* Most Funtoo Linux kernels support the handy <code>[[#Binary USE|binary]]</code> USE flag, described below.
* Most Funtoo Linux kernels support the handy {{c|[[#Binary USE|binary]]}} USE flag, described below.
* Funtoo Linux offers quality kernels from other Linux Distributions, like <code>debian-sources</code>.
* Funtoo Linux offers quality kernels from other Linux Distributions, like {{c|debian-sources}}.
* A detailed [[#Kernel Features and Stability Overview|Kernel Features and Stability]] table can be found below.
* A detailed [[#Kernel Features and Stability Overview|Kernel Features and Stability]] table can be found below.
* Advanced users may want to take a look at [[Additional Kernel Resources]].
* Advanced users may want to take a look at [[Additional Kernel Resources]].
Line 15: Line 14:
== Overview of Kernels ==
== Overview of Kernels ==


=== {{Package|sys-kernel/vanilla-sources}} ===
=== {{Package|sys-kernel/debian-sources-lts}} ===


This will install the "vanilla" (unmodified) Linux kernel sources. Current recommended version is 3.x. Funtoo Linux fully supports Linux 3.x. The advantages of this kernel include recent improvements to [[Linux Containers]], a very modern networking stack with lots of bug fixes, and high reliability for desktops and servers. The downside is that this kernel must be manually configured by the user and does not have built-in ''<code>genkernel</code>'' support via the ''<code>binary</code>'' USE flag at this time.
This is the Debian kernel, long-term stable edition and the default kernel for Funtoo Linux. '''These ebuilds now support the {{c|binary}} USE flag.''' Daniel has added a special {{c|config-extract}} command which can be used to list all available official Debian kernel configurations, and generate them from the Debian files included with the kernel.  
 
=== {{Package|sys-kernel/gentoo-sources}} ===
 
This kernel tree is based on stable kernels from [https://www.kernel.org/ kernel.org] with genpatches applied [http://dev.gentoo.org/~mpagano/genpatches/about.htm genpatches].
Gentoo patchset aims to support the entire range of Gentoo-supported architectures. List of available genpatched kernels: [http://dev.gentoo.org/~mpagano/genpatches/kernels.htm genpatches-kernels]
 
=== {{Package|sys-kernel/openvz-rhel6-stable}} ===
 
This is a RHEL6-based kernel with OpenVZ support. This kernel is now the preferred kernel for production OpenVZ deployments. It requires gcc-4.4.5 to build, which it will use automatically without the user needing to use ''<code>gcc-config</code>''. We use this version of gcc since this is the version of gcc used by Red Hat to build this kernel.


=== {{Package|sys-kernel/debian-sources}} ===
=== {{Package|sys-kernel/debian-sources}} ===


This is the Debian kernel. '''These ebuilds now support the ''<code>binary</code>'' USE flag.''' Daniel has added a special <tt>config-extract</tt> command which can be used to list all available official Debian kernel configurations, and generate them from the Debian files included with the kernel. This kernel has optional [[OpenVZ]] support, but it is much better to use <tt>openvz-rhel6-stable</tt> if you want a production-quality OpenVZ installation. For more information about how to use <tt>debian-sources</tt> and <tt>config-extract</tt>, see [[#Using Debian-Sources with Genkernel|Using debian-sources with Genkernel]] below.
This is a more up-to-date version of the Debian kernel but it less suited for server systems.


== Binary USE ==
== Binary USE ==


Many of the kernel ebuilds in Funtoo Linux support the very useful <code>binary</code> USE flag. By enabling this USE flag and emerging the kernel, the ebuild will automatically build a binary kernel image, initramfs and kernel modules and install them to <code>/boot</code>. The binary kernel image and initramfs can be used to boot your Funtoo Linux system without requiring any additional configuration. This is a great way to get a Funtoo Linux system up and running quickly. Here's how to do it:
Many of the kernel ebuilds in Funtoo Linux support the very useful {{c|binary}} USE flag. By enabling this USE flag and emerging the kernel, the ebuild will automatically build a binary kernel image, initramfs and kernel modules and install them to {{c|/boot}}. The binary kernel image and initramfs can be used to boot your Funtoo Linux system without requiring any additional configuration. This is a great way to get a Funtoo Linux system up and running quickly. Here's how to do it:


<console>
{{console|body=
###i## echo "sys-kernel/openvz-rhel6-stable binary" >> /etc/portage/package.use
###i## echo "sys-kernel/debian-sources binary" >> /etc/portage/package.use
###i## emerge openvz-rhel6-stable
###i## emerge debian-sources
###i## nano -w /etc/boot.conf
###i## nano -w /etc/boot.conf
###i## boot-update
###i## ego boot update
</console>
}}


More information can be found in the [[Funtoo Linux Installation]] Guide.
More information can be found in the [[Funtoo Linux Installation]] Guide.
Line 49: Line 39:
Funtoo Linux contains a forked/enhanced version of genkernel with the following new capabilities:
Funtoo Linux contains a forked/enhanced version of genkernel with the following new capabilities:


* genkernel can use a build directory that is separate from the kernel source directory. This is enabled using the new <tt>--build-dst</tt> option.
* genkernel can use a build directory that is separate from the kernel source directory. This is enabled using the new {{c|--build-dst}} option.
* <code>--build-src</code> is a new option that is equivalent to the <tt>--kerneldir</tt> option.
* {{c|--build-src}} is a new option that is equivalent to the {{c|--kerneldir}} option.
* <code>--fullname</code> can be used to specify the entire name of the kernel and initramfs images -- everything after <tt>kernel-</tt> and <tt>initramfs-</tt>.
* {{c|--fullname}} can be used to specify the entire name of the kernel and initramfs images -- everything after {{c|kernel-}} and {{c|initramfs-}}.
* <code>--firmware-src</code> - a new option that works identically to <tt>--firmware-dir</tt>.
* {{c|--firmware-src}} - a new option that works identically to {{c|--firmware-dir}}.
* <code>--firmware-dst</code> - a new capability - you can now define where genkernel installs firmware.
* {{c|--firmware-dst}} - a new capability - you can now define where genkernel installs firmware.
* Genkernel uses Funtoo Linux <code>lvm2</code> rather than building its own.
* Genkernel uses Funtoo Linux {{c|lvm2}} rather than building its own.
* Some compile fixes.
* Some compile fixes.


== Kernel Features and Stability Overview ==
== Kernel Features and Stability Overview ==
{{Fancywarning|'''SPARC64''': All kernels beyond 3.9 series and before 3.14-rc8 are subject to a [http://www.spinics.net/lists/sparclinux/msg11805.html bug] that stalls the kernel on sun4v machines '''only'''. Those latter are machines provided with UltraSPARC T1 and later CPUs (e.g. SunFire T1000, SunFire T2000, SunFire T52x0/T54x0 series...), all sun4u machines (UltraSPARC IV and prior CPUs) are not subject to this problem and any kernel version is functional. }}


{| {{table}}  
{| {{table}}  
Line 70: Line 58:
!Notes
!Notes
|-
|-
|<tt>{{Package|sys-kernel/vanilla-sources}}</tt>
|{{c|{{Package|sys-kernel/vanilla-sources}}}}
|3.17.0
|3.17.0
|N/A
|N/A
Line 78: Line 66:
|Recommended for modern networking stack, hardware and [[Linux Containers]] support. This kernel must be manually configured by the user. New Features: [http://kernelnewbies.org/Linux_3.12 kernelnewbies.org/linux_3.12]  New Drivers: [http://kernelnewbies.org/Linux_3.12-DriversArch kernelnewbies/Linux_3.12-DriversArch]
|Recommended for modern networking stack, hardware and [[Linux Containers]] support. This kernel must be manually configured by the user. New Features: [http://kernelnewbies.org/Linux_3.12 kernelnewbies.org/linux_3.12]  New Drivers: [http://kernelnewbies.org/Linux_3.12-DriversArch kernelnewbies/Linux_3.12-DriversArch]
|-
|-
|<tt>{{Package|sys-kernel/gentoo-sources}}</tt>
|{{c|{{Package|sys-kernel/gentoo-sources}}}}
|3.17.0
|3.17.0
|N/A
|N/A
Line 86: Line 74:
|Recommended for modern networking stack, hardware and [[Linux Containers]] support. This kernel must be manually configured by the user. New Features: [http://kernelnewbies.org/Linux_3.12 kernelnewbies.org/linux_3.12]  New Drivers: [http://kernelnewbies.org/Linux_3.12-DriversArch kernelnewbies/Linux_3.12-DriversArch]
|Recommended for modern networking stack, hardware and [[Linux Containers]] support. This kernel must be manually configured by the user. New Features: [http://kernelnewbies.org/Linux_3.12 kernelnewbies.org/linux_3.12]  New Drivers: [http://kernelnewbies.org/Linux_3.12-DriversArch kernelnewbies/Linux_3.12-DriversArch]
|-
|-
|<tt>{{Package|sys-kernel/openvz-rhel6-stable}}</tt>
|{{c|{{Package|sys-kernel/openvz-rhel6-stable}}}}
|2.6.32.042.092.2
|2.6.32.042.092.2
|<tt>binary</tt>
|{{c|binary}}
|'''Excellent''' - recommended for production servers
|'''Excellent''' - recommended for production servers
|N/A
|N/A
|Any
|Any
|This kernel is built with gcc-4.4.5. <tt>emerge broadcom-netxtreme2</tt> for reliable BCM5709+ support (integrated NIC)
|This kernel is built with gcc-4.4.5. {{c|emerge broadcom-netxtreme2}} for reliable BCM5709+ support (integrated NIC)


|-
|-
|<tt>{{Package|sys-kernel/debian-sources}}</tt>
|{{c|{{Package|sys-kernel/debian-sources}}}}
| 3.16.7, 3.19.3, 4.0.4{'''M'''}
| 3.16.7, 3.19.3, 4.0.4{'''M'''}
|<tt>openvz</tt>
|{{c|openvz}}
|''Good'' - default kernel recommended by Funtoo
|''Good'' - default kernel recommended by Funtoo
|N/A
|N/A
Line 109: Line 97:
{{fancyimportant|Debian-sources is now fully compatible with the ''binary'' USE flag and recommended for desktop users. The below example is valid for manual installation. At least 19G of disc space required to build. Take this into account, when using separate /var or using virtual machines with limited size}}
{{fancyimportant|Debian-sources is now fully compatible with the ''binary'' USE flag and recommended for desktop users. The below example is valid for manual installation. At least 19G of disc space required to build. Take this into account, when using separate /var or using virtual machines with limited size}}


This section describes how to build a binary kernel with ''<code>debian-sources</code>'' and ''<code>genkernel</code>'', and it also explains how to use Funtoo Linux's ''<code>config-extract</code>'' tool to list and create official Debian kernel configurations.
This section describes how to build a binary kernel with ''{{c|debian-sources}}'' and ''{{c|genkernel}}'', and it also explains how to use Funtoo Linux's ''{{c|config-extract}}'' tool to list and create official Debian kernel configurations.


=== First step: emerging the required packages ===
=== First step: emerging the required packages ===
Line 124: Line 112:
</console>
</console>


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 '''<code>/usr/src</code>'''. Update your the '''<code>linux</code>''' symlink to point on this directory:
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 '''{{c|/usr/src}}'''. Update your the '''{{c|linux}}''' symlink to point on this directory:
<console>
<console>
###i## cd /usr/src
###i## cd /usr/src
Line 131: Line 119:
</console>
</console>


Alternatively, emerge the debian-sources with the ''<code>symlink</code>'' USE flag.
Alternatively, emerge the debian-sources with the ''{{c|symlink}}'' USE flag.


=== Second step: Grabbing a configuration file ===
=== 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.)  To view a complete list of available kernel configurations, type <code>./config-extract -l</code> '''in the Debian kernel source directory''':
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.)  To view a complete list of available kernel configurations, type {{c|./config-extract -l}} '''in the Debian kernel source directory''':


<pre>
<pre>
Line 178: Line 166:
</pre>
</pre>


Type <tt>config-extract -h</tt> for extended usage information:
Type {{c|config-extract -h}} for extended usage information:


<pre>
<pre>
Line 217: Line 205:
</pre>
</pre>


Let's use <tt>config-extract</tt> to create a kernel configuration for an amd64 system:
Let's use {{c|config-extract}} to create a kernel configuration for an amd64 system:


<console>
<console>
Line 225: Line 213:
</console>
</console>


<tt>config-extract</tt> also allows you to extract special Debian featuresets, such as settings for Xen and [[OpenVZ]] kernels:
{{c|config-extract}} also allows you to extract special Debian featuresets, such as settings for Xen and [[OpenVZ]] kernels:


<console>
<console>
Line 235: Line 223:




After using <tt>config-extract</tt>, run <tt>make oldconfig</tt> and accept all default options by hitting Enter at all prompts.
After using {{c|config-extract}}, run {{c|make oldconfig}} and accept all default options by hitting Enter at all prompts.


{{fancynote|if you are using the XFS file system as your root partition: Run <tt>make menuconfig</tt> and ensure that "File Systems --> XFS filesystem support" and "Library Routines --> CRC32c (Castagnoli, et al) Cyclic Redundancy-Check" are both set to * (and not [m]).}}
{{fancynote|if you are using the XFS file system as your root partition: Run {{c|make menuconfig}} and ensure that "File Systems --> XFS filesystem support" and "Library Routines --> CRC32c (Castagnoli, et al) Cyclic Redundancy-Check" are both set to * (and not [m]).}}
This is needed to ensure that your system can boot up correctly for kernel versions >= 3.10.11.
This is needed to ensure that your system can boot up correctly for kernel versions >= 3.10.11.



Revision as of 04:29, April 14, 2019

Other languages:
English • ‎Türkçe • ‎español • ‎português do Brasil • ‎中文(中国大陆)‎
   {{{title}}}
{{{body}}}

This Section will give you an overview of kernels used in funtoo. Some points of interest:

  • Most Funtoo Linux kernels support the handy binary USE flag, described below.
  • Funtoo Linux offers quality kernels from other Linux Distributions, like debian-sources.
  • A detailed Kernel Features and Stability table can be found below.
  • Advanced users may want to take a look at Additional Kernel Resources.
  • There is a quick'n dirty howto to compile your own kernel with initramfs the funtoo way.

Overview of Kernels

No results

This is the Debian kernel, long-term stable edition and the default kernel for Funtoo Linux. These ebuilds now support the binary USE flag. Daniel has added a special config-extract command which can be used to list all available official Debian kernel configurations, and generate them from the Debian files included with the kernel.

sys-kernel/debian-sources

This is a more up-to-date version of the Debian kernel but it less suited for server systems.

Binary USE

Many of the kernel ebuilds in Funtoo Linux support the very useful binary USE flag. By enabling this USE flag and emerging the kernel, the ebuild will automatically build a binary kernel image, initramfs and kernel modules and install them to /boot. The binary kernel image and initramfs can be used to boot your Funtoo Linux system without requiring any additional configuration. This is a great way to get a Funtoo Linux system up and running quickly. Here's how to do it:

root # echo "sys-kernel/debian-sources binary" >> /etc/portage/package.use
root # emerge debian-sources
root # nano -w /etc/boot.conf
root # ego boot update

More information can be found in the Funtoo Linux Installation Guide.

Funtoo Linux Genkernel

Funtoo Linux contains a forked/enhanced version of genkernel with the following new capabilities:

  • genkernel can use a build directory that is separate from the kernel source directory. This is enabled using the new --build-dst option.
  • --build-src is a new option that is equivalent to the --kerneldir option.
  • --fullname can be used to specify the entire name of the kernel and initramfs images -- everything after kernel- and initramfs-.
  • --firmware-src - a new option that works identically to --firmware-dir.
  • --firmware-dst - a new capability - you can now define where genkernel installs firmware.
  • Genkernel uses Funtoo Linux lvm2 rather than building its own.
  • Some compile fixes.

Kernel Features and Stability Overview

Kernel Name Version USE flags Stability Extra Features Req'd udev Notes
sys-kernel/vanilla-sources 3.17.0 N/A Excellent - recommended for desktops and servers. N/A Any Recommended for modern networking stack, hardware and Linux Containers support. This kernel must be manually configured by the user. New Features: kernelnewbies.org/linux_3.12 New Drivers: kernelnewbies/Linux_3.12-DriversArch
No results 3.17.0 N/A Excellent - recommended for desktops and workstations N/A Any Recommended for modern networking stack, hardware and Linux Containers support. This kernel must be manually configured by the user. New Features: kernelnewbies.org/linux_3.12 New Drivers: kernelnewbies/Linux_3.12-DriversArch
No results 2.6.32.042.092.2 binary Excellent - recommended for production servers N/A Any This kernel is built with gcc-4.4.5. emerge broadcom-netxtreme2 for reliable BCM5709+ support (integrated NIC)
sys-kernel/debian-sources 3.16.7, 3.19.3, 4.0.4{M} openvz Good - default kernel recommended by Funtoo N/A Any See #Using debian-sources with Genkernel, below.

Using Debian-Sources with Genkernel

   Important

Debian-sources is now fully compatible with the binary USE flag and recommended for desktop users. The below example is valid for manual installation. At least 19G of disc space required to build. Take this into account, when using separate /var or using virtual machines with limited size

This section describes how to build a binary kernel with debian-sources and genkernel, and it also explains how to use Funtoo Linux's config-extract tool to list and create official Debian kernel configurations.

First step: emerging the required packages

The first step is to emerge:

  1. The Debian sources
  2. Genkernel itself

This is achieved by running the following:

root # emerge -av 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:

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

Alternatively, emerge the debian-sources with the symlink USE flag.

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.) To view a complete list of available kernel configurations, type ./config-extract -l in the Debian kernel source directory:

ninja1 linux-debian-2.6.32.30 # ./config-extract -l

====== standard featureset ======

       alpha: alpha-generic, alpha-legacy, alpha-smp
       amd64
       armel: iop32x, ixp4xx, kirkwood, orion5x, versatile
        hppa: parisc, parisc-smp, parisc64, parisc64-smp
        i386: 486, 686, 686-bigmem, amd64
        ia64: itanium, mckinley
        m68k: amiga, atari, bvme6000, mac, mvme147, mvme16x
        mips: 4kc-malta, 5kc-malta, r4k-ip22, r5k-ip32, sb1-bcm91250a, sb1a-bcm91480b
      mipsel: 4kc-malta, 5kc-malta, r5k-cobalt, sb1-bcm91250a, sb1a-bcm91480b
     powerpc: powerpc, powerpc-smp, powerpc64
        s390: s390x, s390x-tape
         sh4: sh7751r, sh7785lcr
       sparc: sparc64, sparc64-smp
     sparc64: sparc64, sparc64-smp

====== vserver featureset ======

       amd64
        i386: 686, 686-bigmem
        ia64: itanium, mckinley
     powerpc: powerpc, powerpc64
        s390
       sparc
     sparc64

====== xen featureset ======

       amd64
        i386

====== openvz featureset ======

       amd64
        i386

Type config-extract -h for extended usage information:

ninja1 linux-debian-2.6.32.30 # ./config-extract -h
This work is free software.

Copyright 2011 Funtoo Technologies. You can redistribute and/or modify it under
the terms of the GNU General Public License version 3 as published by the Free
Software Foundation. Alternatively you may (at your option) use any other
license that has been publicly approved for use with this program by Funtoo
Technologies (or its successors, if any.)

usage: config-extract [options] arch [featureset] [subarch]

  -h  --help        print this usage and exit
  -l  --list        list all available kernel configurations
  -o  --outfile     specify kernel config outfile --
                    defaults to .config in current directory
  [featureset]      defaults to "none" if not specified
  [subarch]         defaults to the only one available; otherwise required

This program was written by Daniel Robbins for Funtoo Linux, for the purpose of
easily and conveniently extracting Debian kernel configurations. To see a nice
list of all available kernel configurations, use the --list option.

Debian's kernel configs are specified internally in arch_featureset_flavor
format, such as: "amd64_openvz_amd64". The featureset typically describes an
optional kernel configuration such as "xen" or "openvz", while the flavor in
Debian terminology typically refers to the sub-architecture of the CPU.

When using this command, you must specify an arch. A featureset of "none" is
assumed unless you specify one, and by default this program will pick the only
available subarch if there is only one to choose from. If not, you will need to
pick one (and the program will remind you to do this.)

The kernel configuration will be written to ".config" in the current directory,
or the location you specified using the -o/--outfile option.

Let's use config-extract to create a kernel configuration for an amd64 system:

root # cd linux
root # ./config-extract amd64 standard 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:

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

It is necessary to name the kernel configuration file something other than ".config" to avoid errors with genkernel.


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

   Note

if you are using the XFS file system as your root partition: Run make menuconfig and ensure that "File Systems --> XFS filesystem support" and "Library Routines --> CRC32c (Castagnoli, et al) Cyclic Redundancy-Check" are both set to * (and not [m]).

This is needed to ensure that your system can boot up correctly for kernel versions >= 3.10.11.

Third step: Building and installing the kernel

This is simply achieved by:

root # genkernel --kernel-config=config-2.6.32-5-amd64 all
  • --kernel-config: use the given configfile. If you only give a filename here, it is searched for in your current working dir. You can also use a relative or an absolute path leading to your configfile here (for example: "--kernel-config=/usr/src/linux/configfile").
  • 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).
   Important

Unless explicitly stated via --no-clean or --no-mrproper, Genkernel will do a make mrproper 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

Once 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.