.. title: Gentoo 6.1.x generic kernel configuration
.. slug: gentoo-61x-generic-kernel-configuration
.. date: 2023-11-26 08:43:54 UTC+01:00
.. tags: gentoo, linux, kernel
.. category: 
.. link: 
.. description: A generic configuration file for building 6.1.x Linux kernels on Gentoo
.. type: text

The 6.1.x branch of the Linux kernel has been marked as stable in Gentoo_ for a
few months already and I was busy enough that I forgot to publish an updated
generic kernel configuration for it. As with my previous posts this
configuration is largely based on the Fedora kernel with some Gentoo-specific
tweaks. It supports practically every bit of hardware in existence and enables
a lot of bleeding-edge kernel functionality.

The only few notable changes compared to the Fedora kernel are the following:

- The ``binfmt_misc`` module is baked in for convenience
- The NVMe core modules are baked in so you can boot from an NVMe drive without
  having to use an initrd
- The ``CONFIG_ACPI_EXTLOG`` option is enabled. This is useful if you're using
  :doc:`rasdaemon to monitor ECC memory <monitoring-ecc-memory-on-linux-with-rasdaemon>`
- The boot logo is disabled
- Kernel debugging is disabled
- The ``CONFIG_GENTOO_KERNEL_SELF_PROTECTION`` option is enabled. This
  implicitly enables an additional set of security features for hardening the
  kernel
- The ``CONFIG_GENTOO_PRINT_FIRMWARE_INFO`` option is enabled, it prints out
  the firmwares that are loaded into various bits of hardware. This is useful
  if you want to reduce the amount of files installed
  ``sys-kernel/linux-firmware`` package

Note that the **RTC time based on NTP synchronization** is enabled so - if
you're using OpenRC - you don't need the **hwclock** service (but you can use
**osclock** instead if some other service requires the **clock** facility).

Additionally note that this kernel configuration is for use with OpenRC. If
you're using systemd you'll have to remove the
``CONFIG_GENTOO_LINUX_INIT_SCRIPT=y`` line from the configuration file and add
``CONFIG_GENTOO_LINUX_INIT_SYSTEMD=y`` instead.

Now that zstd is well supported in many packages I have enabled it for
compressing kernel modules. The only thing you need to make sure to use it is
that the ``sys-apps/kmod`` package has the **zstd** ``USE`` flag set so that it
can handle the compressed modules. If for some reason you don't want modules
to be compressed set `CONFIG_MODULE_COMPRESS_ZSTD=n` and
`CONFIG_MODULE_COMPRESS_NONE=y` respectively.
 

To use this configuration file install the latest stable
``sys-kernel/gentoo-sources`` package (6.1.x), copy the configuration file
under ``/usr/src/linux/`` and rename it to ``.config`` then proceed to build
and install the kernel as usual.

`Gentoo 6.1.x kernel configuration file`_

.. _Gentoo: https://www.gentoo.org
.. _`Gentoo 6.1.x kernel configuration file`: https://www.setphaserstostun.org/config-6.1
