# Kernel (简体中文)

From ArchWiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

相关文章

- Kernel modules (简体中文)
- Compile kernel module
- Kernel Panics (简体中文)
- Linux-ck (简体中文)
- sysctl

本文或本节需要翻译。要贡献翻译，请访问简体中文翻译团队。

附注： 部分内容未翻译（在 Talk:Kernel (简体中文)# 中讨论）
翻译状态：本文是 Kernel 的翻译。上次翻译日期：2021-7-10。如果英文版本有所更改，则您可以帮助同步翻译。

来自 Wikipedia:

  内核是计算机操作系统的核心组件，对系统有完全的控制。开机时最先启动，然后负责后续的启动工作。它负责处理其它软件的请求，讲这些请求转化为中央处理器的数据处理请求。内核还负责管理内存，管理系统和其它打印机、扬声器等外围设备的通讯，是操作系统最基础的部分。

在Arch Linux中，除了官方内核之外，还有许多各种各样的内核可供选择。这篇文章列出了这些内核和它们的简短介绍。这里还列出了一些可用的内核补丁的介绍。在文章的最后介绍了自行编译内核的方法。

内核包安装在`/boot/`下的文件系统上。为了能够引导到内核，必须适当配置启动加载器。

## 官方支持的内核

官方支持的内核可以获得论坛和[[Bug reporting guidelines|错误报告]方面的社区支持。

- Stable — 原版的Linux内核以及模块, 使用了一些补丁。

  https://www.kernel.org/ || linux

- Hardened — 更加注重安全的 Linux 内核，采用一系列 加固补丁 以减少内核和用户空间产生漏洞的风险。和 linux 相比，还启用了一些加固选项，比如用户命名空间(同时通过补丁禁用未授权用户的访问)、审计以及 SELinux

  https://github.com/anthraxx/linux-hardened || linux-hardened

- Longterm — 包含了长期支持的 Linux 内核和内核模块。

  https://www.kernel.org/ || linux-lts

- Zen Kernel — 一些内核黑客合作的结果，提供了适合日常使用的优秀内核。 更多详情请参见 https://liquorix.net (为Debian提供了基于Zen内核的二进制文件).

  https://github.com/zen-kernel/zen-kernel || linux-zen

## 编译

Arch Linux 提供了多种内核构建方式来编译你自己的内核：

Arch 构建系统（推荐）
  可以充分利用已有的 linux PKGBUILD 以及包管理系统。
传统方式
  这个方法需要手动下载内核源代码包，然后在自己的主目录里以普通用户的权限编译。配置完成之后，有两种编译(安装)方式：传统的安装和适用makepkg/pacman 的安装。

Warning:

- 使用自定义内核可能会引起各种稳定性和可靠性问题，包括数据丢失。强烈建议操作前进行数据备份。
- Arch Linux仅对#官方支持的内核提供官方支持。当使用非官方支持的内核时，务必在请求支持时提及。

Tip:

- 提高系统速度的最佳方法是首先根据架构和处理器类型定制内核配置。
- 您可以通过不包含对你没有用东西来缩小内核的大小（也因此减少构建时间）。例如，支持蓝牙、video4linux、1000Mbit以太网等。
- Arch Linux提供的预编译内核的软件包的配置文件位于软件包的源文件中（例如：[1] linux 的编译配置文件）。如果启用了`CONFIG_IKCONFIG_PROC`的内核选项，当前运行的内核的配置文件可能在文件系统中找到，地址为`/proc/config.gz`。

一些列出的软件包也可以通过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 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 custom Linux kernel with specific PDS and Project C / BMQ CPU schedulers related patchsets selector (stock CFS is also an option) and added tweaks for a nice interactivity/performance balance, aiming for the best gaming experience. Maintained by Etienne Juvigny (Tk-Glitch). Pre-compiled kernels are available in the Unofficial user repositories#chaotic-aur repository.

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

## Debugging regressions

See General troubleshooting#Debugging regressions.

Try linux-mainlineAUR 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-gitAUR 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.

Note: Bisecting the kernel can take a lot of time since it may need to be rebuilt many times.

## 参见

- O'Reilly - Linux Kernel in a Nutshell （自由开源的电子书，包含内核配置、安装和其他的东西）
- What stable kernel should I use? by Greg Kroah-Hartman
- Linux kernel 文档

Category:

- Kernel (简体中文)

Hidden categories:

- Pages or sections flagged with Template:Translateme (简体中文)
- Pages with missing package links