User:Immolo/Sandbox/Manual kernel/Selecting a convenient kernel version
Tutorial: Selecting a convenient kernel version
This tutorial explains all options for selecting a certain kernel version. Only our default sys-kernel/gentoo-sources will be used.
First of all there is a difference what is a stable version in the point of view of Gentoo and kernel developers. Kernel developers flag all kernels not being a release candidate as stable (-rc-versions). This is not true for Gentoo. In Gentoo only kernels which have Long Term Support (LTS) are stable. List of LTS kernels: https://www.kernel.org/category/releases.html
Usually kernels developers create approximately every week a new minor version. See more here: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git (Select latest LTS version in column "Branch")
Not every minor version of a LTS kernel will become stable in Gentoo. Gentoo selects only some of them as stable. This leads to a new version of stable gentoo-sources approximately once in a month. There are 4 options for selecting a kernel version. First, get a list of all current available versions:
List of available kernel version
Best tool for an overview is eix. If not installed use
root #
emerge --ask app-portage/eix
Stable versions are coloured in green:
root #
eix gentoo-sources
USE flags
USE flags for sys-kernel/gentoo-sources Full sources including the Gentoo patchset for the 6.12 kernel tree
build
|
!!internal use only!! DO NOT SET THIS FLAG YOURSELF!, used for creating build images and the first half of bootstrapping [make stage1] |
experimental
|
Apply experimental patches; for more information, see "https://wiki.gentoo.org/wiki/Project:Kernel/Experimental". |
symlink
|
Force kernel ebuilds to automatically update the /usr/src/linux symlink |
On the fly USE flag could set by ''USE=symlink'' before emerge command inline, but I do not recommend the use of the "symlink" use flag. Why ? Because it changes the link to /usr/src/linux before you have even built the new kernel. If it breaks, do you really think about resetting the link manually ? This is also the reason why I first build the kernel in my CheatSheets and then update the link with eselect kernel set X !
Install Gentoo Sources
Choose one of these options:
Option 1: Choosing a Gentoo stable version
Just install the source without any additional step. This is the easiest way to go and also recommended in our Handbook:AMD64/Installation/Kernel#Installing_the_kernel_sources
root #
emerge --ask sys-kernel/gentoo-sources
Option 2: Choosing the newest version
In Gentoo terms this is an unstable version. Kernel developers see it stable. Add these lines to /etc/portage/package.accept_keywords (or create this file if it doesnt exist) before emerging gentoo-sources.
sys-kernel/gentoo-sources ~amd64
sys-kernel/linux-headers ~amd64
Proceed with step in Option 1.
Option 3: Choosing the newest version of current LTS series
This is the article recommendationpoint of view for security, because every minor version of current LTS series will be installed. Disadvantage is of course the frequency of new versions. Choose this only if willing to update approximately every week.
At the time of writing this article version 5.15.x was the newest available LTS version and 5.16.x was available also. Do the same as explained in Option 2 and additionally add these lines to /etc/portage/package.mask
>=sys-kernel/gentoo-sources-5.16.0
>=sys-kernel/linux-headers-5.16
The 2nd line is not really necessary because it is said that you can always use the newest sys-kernel/linux-header in this forums thread: https://forums.gentoo.org/viewtopic-p-8597427.html#8597427 so it is your decision what you like. Proceed now with step in Option 1.
Option 4: Choosing a version of a certain series
If there is a reason to stay on an older series combine Option 2 and Option 3 to fulfill your needs.
Finalizing
Check if a softlink /usr/src/linux already exists with
root #
ls -l /usr/src
If there is no softlink create it with eselect and proceed with your base installation or configuration training.
This is my first try for creating a wiki article. Maybe some formatting is wrong. Because it is a tutorial and not a reference guide I ignored the standard of not writing in first or second person. Yes, my english is very poor.