User:Pietinger/Tutorials/Manual kernel configuration

Tutorial: Manual kernel configuration
This tutorial gathers all links and informations needed for a manual kernel configuration. Only our Gentoo default sources will be used.

Basics
Many options in your kernel configuration depends on other options. Many options selects one or more other options. Sometimes a option is not visible whilst others are not enabled. My recommendation for later: Look into every  of an option you want to enable or disable.

You can search for kernel modules by pressing Typing a leading "CONFIG_" is not necessary.

You must enable all modules which kernel needs to find its root partition static <*> into your kernel and not as odule !

Never edit .config
I quote from this thread:

"Horrible things happen if you use a text editor on the kernel .config file. If you are lucky, you will get a kernel that won't build. If not, it may be broken in ways that nobody has ever seen before.

Use menuconfig and its search. Press / If the symbol you want is not found, press the 'z' key to toggle the display of hidden symbols. Search again.

The search will find it but you still can't select it. Read the help on the menu option. Pay attention to the Depends on: That boolean expression must be true before the item can be selected. Select other things so that your symbol can be selected.

Read the Selects: too. Now ask yourself if you would have got that right with your text editor?

The usual advice to someone who has used a text editor on the .config file is to throw it away and start it again."

More informations
If you have never done a manual kernel configuration you really should read all these before starting:
 * User:NeddySeagoon/PC_Boot_Process
 * Kernel/Gentoo_Kernel_Configuration_Guide
 * Kernel/Configuration
 * Short Explanation which kernel modules are needed for your harddisk: []

Before you start
1. Choose which kernel version you want and install it. This may help you: User:Pietinger/Tutorials/Selecting_a_convenient_kernel_version

2. Gather some informations: Boot with Handbook:AMD64/Installation/Media or any other Live Distribution CD and do (as user root):

Notice all "Kernel driver in use: XXXX" and all modules. You will need it later. For an INTEL system ask also:

Notice family,model and stepping.

Basic Settings (Must have)
1. Start with our Handbook:AMD64/Installation/Kernel. I am missing some important options. Add these for all 5.15.x LTS kernels

In all Links you will get now, you will need only the chapter "Kernel Configuration":

2. Links for configuring your Harddisk or NVMe:
 * SATA HD or SATA SSD: HDD and/or
 * NVMe: NVMe or
 * Old IDE or PATA: Kernel/Gentoo_Kernel_Configuration_Guide

3. This is also a must; you will have a black screen without: Framebuffer

4. It is highly recommended to add your microcode for your CPU:
 * INTEL: [] or
 * AMD: AMD_microcode

5. Search with and your notice from lscpi -k for your ethernet module. Enable it (and disable all others because unneeded).

6. Search with and your notice from lscpi -k for additionally modules needed for your harddisk. If you miss a module kernel needs to find its root partition you will get a kernel panic and kernel cannot boot. For example: If you find a module named "vmd" you must enable it also:

(more details: https://forums.gentoo.org/viewtopic-t-1156306-highlight-.html )

7. At last we need: Libinput

This configuration should be able to boot your kernel. If you want to use a graphical environment you need:

Graphics adapter
Choose from these links:
 * Intel or
 * Nouveau or
 * Radeon or
 * AMDGPU

Sound and others
This should be done also:
 * ALSA
 * Power_management/Processor
 * Power_management/Guide
 * System_time

Optional settings

 * CDROM
 * Webcams
 * Motion
 * NTFS
 * KDE Vaults needs: Encfs

At last you can check all other modules you have in your lists from lspci -k and lsmod by searching with

Cheat Sheets
These are only valid if you have done a standard installation according to our Handbook:AMD64


 * Updating to a new kernel version:


 * Changing the configuration of your used kernel:

Kconfig / KSPP ?
View the content of ... and examine if you have really enabled some security options. Take a look into User:Pietinger/Tutorials/Kernel_Hardening_with_KSPP

Useful links

 * https://www.kernel.org/doc/html/latest/
 * https://kernelnewbies.org/LinuxChanges
 * https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git