- Kernel
- Contents
- Officially supported kernels
- Compilation
- kernel.org kernels
- Unofficial kernels
- Debugging regressions
- Compile kernel module
- Contents
- Build environment
- Traditional compilation
- Arch Build System
- Source configuration
- Module compilation
- out-of-tree module compilation
- Module installation
- possible errors
- Kernel (Русский)
- Contents
- Официальные ядра
- Компиляция
- Ядра kernel.org
- Неофициальные ядра
- Отладка регрессий
Kernel
According to Wikipedia:
The Linux kernel is an open-source monolithic Unix-like computer operating system kernel.
Arch Linux is based on the Linux kernel. There are various alternative Linux kernels available for Arch Linux in addition to the latest stable kernel. This article lists some of the options available in the repositories with a brief description of each. There is also a description of patches that can be applied to the system’s kernel. The article ends with an overview of custom kernel compilation with links to various methods.
Kernel packages are installed onto the file system under /boot/ . To be able to boot into kernels, the boot loader has to be configured appropriately.
Contents
Officially supported kernels
Community support on forum and bug reporting is available for officially supported kernels.
- Stable — Vanilla Linux kernel and modules, with a few patches applied.
https://www.kernel.org/ || linux
- Hardened — A security-focused Linux kernel applying a set of hardening patches to mitigate kernel and userspace exploits. It also enables more upstream kernel hardening features than linux .
https://github.com/anthraxx/linux-hardened || linux-hardened
- Longterm — Long-term support (LTS) Linux kernel and modules.
https://www.kernel.org/ || linux-lts
- Zen Kernel — Result of a collaborative effort of kernel hackers to provide the best Linux kernel possible for everyday systems. Some more details can be found on https://liquorix.net (which provides kernel binaries based on Zen for Debian).
https://github.com/zen-kernel/zen-kernel || linux-zen
Compilation
Following methods can be used to compile your own kernel:
/Arch Build System Takes advantage of the high quality of existing linux PKGBUILD and the benefits of package management. /Traditional compilation Involves manually downloading a source tarball, and compiling in your home directory as a normal user.
Some of the listed packages may also be available as binary packages via Unofficial user repositories.
kernel.org kernels
- Git — Linux kernel and modules built using sources from Linus Torvalds’ Git repository
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git || linux-gitAUR
- Mainline — Kernels where all new features are introduced, released every 2-3 months.
https://www.kernel.org/ || linux-mainlineAUR
- Next — Bleeding edge kernels with features pending to be merged into next mainline release.
https://www.kernel.org/doc/man-pages/linux-next.html || linux-next-gitAUR
- Longterm 4.4 — Long-term support (LTS) Linux 4.4 kernel and modules.
https://www.kernel.org/ || linux-lts44AUR
- Longterm 4.9 — Long-term support (LTS) Linux 4.9 kernel and modules.
https://www.kernel.org/ || linux-lts49AUR
- Longterm 4.14 — Long-term support (LTS) Linux 4.14 kernel and modules.
https://www.kernel.org/ || linux-lts414AUR
- Longterm 4.19 — Long-term support (LTS) Linux 4.19 kernel and modules.
https://www.kernel.org/ || linux-lts419AUR
- Longterm 5.4 — Long-term support (LTS) Linux 5.4 kernel and modules.
https://www.kernel.org/ || linux-lts54AUR
Unofficial kernels
- Aufs — The aufs-compatible linux kernel and modules, useful when using docker.
http://aufs.sourceforge.net/ || linux-aufsAUR
- Ck — Contains patches by Con Kolivas (including the MuQSS scheduler) designed to improve system responsiveness with specific emphasis on the desktop, but they are suitable to any workload.
http://ck.kolivas.org/ || linux-ckAUR
- Clear — Patches from Intel’s Clear Linux project. Provides performance and security optimizations.
https://github.com/clearlinux-pkgs/linux || linux-clearAUR
- GalliumOS — The Linux kernel and modules with GalliumOS patches for Chromebooks.
https://github.com/GalliumOS/linux || linux-galliumosAUR
- Libre — Without propietary or obfuscated device drivers.
https://www.fsfla.org/ikiwiki/selibre/linux-libre/ || linux-libreAUR
- Liquorix — Kernel replacement built using Debian-targeted configuration and the Zen kernel sources. Designed for desktop, multimedia, and gaming workloads, it is often used as a Debian Linux performance replacement kernel. Damentz, the maintainer of the Liquorix patchset, is a developer for the Zen patchset as well.
https://liquorix.net || linux-lqxAUR
- MultiPath TCP — The Linux Kernel and modules with Multipath TCP support.
https://multipath-tcp.org/ || linux-mptcpAUR
- pf-kernel — Provides a handful of awesome features which are not merged into a kernel mainline. Maintained by a kernel engineer. If the port for the included patch for new kernels was not released officially, the patchset provides and supports patch ports to new kernels. The current most prominent patches of linux-pf are PDS CPU scheduler and UKSM.
https://gitlab.com/post-factum/pf-kernel/wikis/README || Packages:
- Repository by pf-kernel developer post-factum
- Repository, linux-pfAUR , linux-pf-preset-defaultAUR by pf-kernel fork developer Thaodan
- linux-pf-gitAUR by yurikoles
- Realtime kernel — Maintained by a small group of core developers led by Ingo Molnar. This patch allows nearly all of the kernel to be preempted, with the exception of a few very small regions of code («raw_spinlock critical regions»). This is done by replacing most kernel spinlocks with mutexes that support priority inheritance, as well as moving all interrupt and software interrupts to kernel threads.
https://wiki.linuxfoundation.org/realtime/start || linux-rtAUR , linux-rt-ltsAUR
- tkg — A highly customizable kernel build system that provides a selection of patches and tweaks aiming for better desktop and gaming performance. It is maintained by Etienne Juvigny. Amongst other patches, it offers various CPU schedulers: CFS, Project C PDS, Project C BMQ, MuQSS and CacULE.
https://github.com/Frogging-Family/linux-tkg || not packaged? search in AUR
- VFIO — The Linux kernel and a few patches written by Alex Williamson (acs override and i915) to enable the ability to do PCI Passthrough with KVM on some machines.
https://lwn.net/Articles/499240/ || linux-vfioAUR , linux-vfio-ltsAUR
- XanMod — Aiming to take full advantage in high-performance workstations, gaming desktops, media centers and others and built to provide a more rock-solid, responsive and smooth desktop experience. This kernel uses the MuQSS or CacULE scheduler, BFQ I/O scheduler, UKSM realtime memory data deduplication, TCP BBR congestion control, x86_64 advanced instruction set support, and other default changes.
https://xanmod.org/ || linux-xanmodAUR , linux-xanmod-caculeAUR
Debugging regressions
Try linux-mainline AUR to check if the issue is already fixed upstream. The stickied comment also mentions a repository which contains already built kernels, so it may not be necessary to build it manually, which can take some time.
It may also be worth considering trying the LTS kernel ( linux-lts ) to debug issues which did not appear recently. Older versions of the LTS kernel can be found in the Arch Linux Archive.
If the issue still persists, bisect linux-git AUR and report the bug on the kernel bugzilla. It is important to try the «vanilla» version without any patches to make sure it is not related to them. If a patch causes the issue, report it to the author of the patch.
Источник
Compile kernel module
Sometimes you may wish to compile Linux’s Kernel module without recompiling the whole kernel.
Contents
Build environment
Firstly you will need to install build dependencies such as compiler ( base-devel ) and linux-headers .
Next you will need to get the source code for the kernel version the module is intended to run on. You may try use newer kernel sources but most likely compiled module will not load.
In case the intended kernel version is the installed kernel, find its version with
There are two main options to acquire the required source. Each option has slightly different usage methods and directory structure.
Traditional compilation
See Kernels/Traditional compilation#Download the kernel source. If you fetch latest source using Git you will need to checkout needed version using tag (eg. v4.1).
Arch Build System
For a general overview on Arch Build System read ABS. See Kernel/Arch Build System for acquiring the kernel source, as well as the directory structure, and other details.
Source configuration
When you have the source code, enter its directory. For the #Arch Build System case, that directory would be src/archlinux-linux/ down from where the PKGBUILD is.
The output from make help is beneficial here. Start by cleaning with
An appropriate .config file is now required. If no config file is to be seen nearby, perhaps from a saved .config , and the intended kernel version is the running kernel, you can use its configuration file:
Next ensure the .config file is adjusted for the kernel version. If you are using kernel sources for the exact current version then it should not ask anything. But for another version than the current kernel you might be asked about some options. In any case, for the #Arch Build System option, you might want to examine the PKGBUILD::prepare() function.
If the module you want to compile have some compilation options such as debug build, or it was not compiled before, you can also, possibly must, adjust the kernel configuration. You can do this with one of the many configuration targets mentioned by make help.
Module compilation
In order to compile and load our module cleanly, we must find the value of the EXTRAVERSION component of the current kernel version number so we can match the version number exactly in our kernel source. EXTRAVERSION is a variable set in the kernel top-level Makefile, but the Makefile in a vanilla kernel source will have EXTRAVERSION empty; it is set only as part of the Arch kernel build process. If relevant, the value of the current kernel’s EXTRAVERSION can be found by looking at the output of the uname -r command. In general, the kernel version is the concatenation of three components. Namely, the numeric version, the EXTRAVERSION, and the LOCALVERSION. The numeric version itself is a concatenation of three numbers. If built by a PKGBUILD file, the LOCALVERSION will be taken from the pkgrel variable, prefixed by a hyphen. And the EXTRAVERSION will be the suffix of the pkgver variable, where the period character to the right of the third numeric number of the numeric version is replaced by a hyphen. For example, with the linux package linux 5.5.8.arch1-1 , the LOCALVERSION is -1 . The EXTRAVERSION is -arch1 . The output of uname -r will be 5.5.8-arch1-1 in that example.
Once the EXTRAVERSION value is known, we prepare the source for module compilation:
Alternatively, if you are happy to load modules with modprobe using the —force-vermagic option to ignore mismatches in the kernel version number, you can simply run:
Finally, compile wanted module by specifying its directory name. You can find the module location, thus also its directory name, with modinfo or find.
As a last resort, if nothing else has worked, you can
Which will build all the modules from the kernel configuration.
out-of-tree module compilation
get the official source code of the current running linux kernel as described in Kernel/Arch Build System:
then point to the checked out source when compiling the module:
Module installation
Now after successful compilation you just need to gzip and copy it over for your current kernel.
If you are replacing some existing module you will need to overwrite it (and remember that reinstalling linux will replace it with default module)
Or alternatively, you can place the updated module in the updates folder (create it if it does not already exist).
However if you are adding a new module you can just copy it to extramodules (note, this is just example as btrfs will not get loaded from here)
You need to rebuild the module dependency tree with «depmod» to use installed modules.
If you are compiling a module for early boot (e.g. updated module) which is copied to Initramfs then you must remember to regenerate it with (otherwise your compiled module will not be loaded).
possible errors
If EXTRAVERSION is not set correctly the following errors may occur
adding force-vermagic makes it ignore the version mismatch
Источник
Kernel (Русский)
Ядро Linux — ядро операционной системы, соответствующее стандартам POSIX, составляющее основу операционных систем семейства Linux.
Дистрибутив Arch Linux основан на ядре Linux. Помимо основной стабильной (stable) версии в Arch Linux можно использовать некоторые альтернативные ядра. В статье описываются доступные в официальных репозиториях версии ядер, возможные патчи, а также способы, которыми пользователи могут скомпилировать собственное ядро.
Пакет ядра устанавливается в файловую систему в каталоге /boot/ . Для загрузки нужного ядра при запуске системы необходимо соответствующим образом настроить загрузчик.
Contents
Официальные ядра
Помощь при работе с официальными ядрами можно найти на форуме и в баг-трекере.
- Stable — «ванильное» ядро Linux с модулями и некоторыми патчами.
https://www.kernel.org/ || linux
- Hardened — ориентированное на безопасность ядро Linux с набором патчей, защищающих от эксплойтов ядра и пространства пользователя. Содержит больше защитных особенностей, чем linux .
https://github.com/anthraxx/linux-hardened || linux-hardened
- Longterm — ядро и модули с долгосрочной поддержкой (Long Term Support, LTS).
https://www.kernel.org/ || linux-lts
- Zen Kernel — результат коллективных усилий исследователей с целью создать лучшее из возможных ядер Linux для систем общего назначения. Подробности проекта можно найти на сайте liquorix.net (там же можно скачать двоичные файлы Zen-ядра для Debian).
https://github.com/zen-kernel/zen-kernel || linux-zen
Компиляция
Скомпилировать собственное ядро можно двумя способами:
/Arch Build System Преимущества — наличие готового PKGBUILD для пакета linux и удобство системы управления пакетами. /Традиционная компиляция Ручная загрузка архива файлов с исходными кодами ядра и их компиляция.
Файлы конфигурации пакетов с ядрами Arch можно найти в исходниках (например, файл [1] из linux ). Если включена опция ядра CONFIG_IKCONFIG_PROC , то файл /proc/config.gz содержит настройки ядра, которое работает на вашей машине в данный момент.
Некоторые из перечисленных пакетов могут быть также доступны в двоичном виде в неофициальных репозиториях.
Ядра kernel.org
- Git — ядро Linux, собранное из файлов с исходным кодом из git-репозитория Линуса Торвальдса.
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git || linux-gitAUR
- Mainline — ядра, в которых появляются все нововведения. Выходят каждые 2-3 месяца.
https://www.kernel.org/ || linux-mainlineAUR
- Next — самые новейшие ядра, с улучшениями, которые будут добавлены в следующий mainline-выпуск.
https://www.kernel.org/doc/man-pages/linux-next.html || linux-next-gitAUR
- Longterm 4.4 — LTS-ядро версии 4.4.
https://www.kernel.org/ || linux-lts44AUR
- Longterm 4.9 — LTS-ядро версии 4.9.
https://www.kernel.org/ || linux-lts49AUR
- Longterm 4.14 — LTS-ядро версии 4.14.
https://www.kernel.org/ || linux-lts414AUR
- Longterm 4.19 — LTS-ядро версии 4.19.
https://www.kernel.org/ || linux-lts419AUR
- Longterm 5.4 — LTS-ядро версии 5.4.
https://www.kernel.org/ || linux-lts54AUR
Неофициальные ядра
- Aufs — совместимое с aufs ядро Linux. Полезно при работе с Docker.
http://aufs.sourceforge.net/ || linux-aufsAUR
- Ck — патч от Con Kolivas, повышение быстродействия для настольных систем с любым типом нагрузки.
http://ck.kolivas.org/ || linux-ckAUR
- Clear — патчи проекта Clear Linux от Intel. Содержит улучшения производительности и безопасности.
https://github.com/clearlinux-pkgs/linux || linux-clearAUR
- GalliumOS — ядро Linux с патчами GalliumOS для Хромбуков.
https://github.com/GalliumOS/linux || linux-galliumosAUR
- Libre — без проприетарных или обфусцированных драйверов устройств.
https://www.fsfla.org/ikiwiki/selibre/linux-libre/ || linux-libreAUR
- Liquorix — ядро, собранное из исходного кода Zen с настройками для Debian. Разработан для настольных, мультимедийных и игровых систем, часто используется в качестве замены основному ядру Debian. Создатель патча Liquorix, Damentz, также является разработчиком набора патчей Zen.
https://liquorix.net || linux-lqxAUR
- MultiPath TCP — ядро с поддержкой Multipath TCP.
https://multipath-tcp.org/ || linux-mptcpAUR
- pf-kernel — набор неплохих улучшений, не вошедших в mainline. Сопровождается разработчиком ядра. Предоставляет порты улучшений для новых версий ядра, если они не были выпущены официально. Наиболее важные нововведения — UKSM и планировщик процессорного времени PDS.
https://gitlab.com/post-factum/pf-kernel/wikis/README || Пакеты:
- Репозиторий разработчика pf-kernel, post-factum.
- Репозиторий с пакетами linux-pfAUR и linux-pf-preset-defaultAUR от создателя форка pf-kernel, Thaodan.
- linux-pf-gitAUR от yurikoles
- Realtime kernel — поддерживается небольшой группой разработчиков, возглавляемой Ingo Molnar. Патч позволяет применять kernel preemption практически ко всему ядру за исключением небольших участков кода («raw_spinlock critical regions»). Этого удалось добиться за счёт замены большинства спинлоков ядра на мьютексы с поддержкой наследования приоритета, а также перемещением всех прерываний (в том числе и программных) в потоки ядра.
https://wiki.linuxfoundation.org/realtime/start || linux-rtAUR , linux-rt-ltsAUR
- Tkg — ядро с набором патчей для планировщиков PDS и Project C / BMQ. Стандартный планировщик CFS также доступен. Изменения нацелены на улучшение баланса интерактивность/производительность в играх. Автор и сопроводитель — Etienne Juvigny (Tk-Glitch).
https://github.com/Frogging-Family/linux-tkg || not packaged? search in AUR
- VFIO — патч ядра от Alex Williamson с поддержкой PCI Passthrough для KVM на некоторых машинах.
https://lwn.net/Articles/499240/ || linux-vfioAUR , linux-vfio-ltsAUR
- XanMod — улучшение производительности ядер рабочих станций, игровых компьютеров, медиацентров и других систем. Включает планировщик MuQSS, планировщик ввода-вывода BFQ, алгоритм дедупликации памяти в реальном времени UKSM, алгоритм управления перегрузками TCP BBR, расширенный набор команд для архитектуры x86_64 и другие изменения.
https://xanmod.org/ || linux-xanmodAUR
Отладка регрессий
Прежде всего проверьте ядро linux-mainline AUR на предмет того, не была ли проблема уже решена. В прикреплённом комментарии указан репозиторий с уже собранными ядрами, так что собирать ядро вручную не придётся.
Если проблема проявляется не слишком часто, то имеет смысл попробовать LTS-ядро ( linux-lts ). Старые версии LTS-ядер можно найти в архиве Arch Linux.
Если избавиться от проблемы не удалось, попробуйте локализовать баг в linux-git AUR , после чего сообщите о нём в баг-трекер ядра. Важно проверять ванильное непропатченное ядро, чтобы убедиться, что причиной ошибки является не патч. Если проблемы вызывает патч, то сообщите об этом его автору.
Источник