内核

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Kernel and the translation is 41% complete.
Outdated translations are marked like this.

内核是操作系统的核心。 内核包含大多数设备驱动器,为程序提供访问系统硬件的接口,例如内存,显卡和块设备。

这篇文章只介绍 Linux 内核的相关内容。

另请参阅
See also the handbook on installing and setting up a kernel.

我该安装哪一个内核?

Gentoo provides a choice of methods to get a kernel up and running, from a standard binary kernel as would be supplied by most distributions, to custom configured and compiled kernels.

提示
When starting out, the gentoo-kernel-bin provides a quick and easy way to get a kernel up and running, while still providing a light, high performance kernel - just like any modern distribution would. Once a system is installed and functioning correctly, a different kernel may be selected if needed. The sys-kernel/gentoo-kernel-bin can be kept around in case of issues booting a custom kernel.

gentoo-sources

对于大多数用户来说,Gentoo推荐sys-kernel/gentoo-sources。该包的稳定(stable)版本与上游kernel.org的“长期稳定版本(LTS)”内核保持一致。

Distribution kernels

The distribution kernel project provides packages to install and manage kernels through Portage. These kernels are complied (if needed) and installed with just an emerge command, like any other package, which can lessen the administrative burden. Kernel updates are performed when updating the system (i.e. emerge -avuDN @world), and the only manual step is to have the bootloader use the new kernel.

These kernels come with a default configuration that should "just work" for most systems. For users not interested in configuring their own kernel from scratch, these kernels can get things up and running quicker.

另请参阅
For more information on gentoo-kernel see the distribution kernel project.
gentoo-kernel

The sys-kernel/gentoo-kernel package provides a kernel that will be compiled and be installed when the package is emerged. This comes with a default configuration that should work out of the box on most systems, but allows customization, if desired.

gentoo-kernel-bin

The sys-kernel/gentoo-kernel-bin is a binary package containing a precompiled kernel, allowing faster installation. This package is a precompiled version of the gentoo-kernel package, with the default configuration.

重要
Since the gentoo-kernel* packages automate the configuration and compilation process - independently from the usual, manual way of compiling and installing kernels - the rest of this article concerns installation using the sys-kernel/gentoo-sources package. See the distribution kernel project for further information on distribution-kernels

安装

This section covers installation when using sys-kernel/gentoo-sources.

USE 标记

要构建内核,必须先安装内核源码归档。对于桌面系统来说,我们推荐使用 sys-kernel/gentoo-sources。它由 Gentoo 开发者维护,提供修复安全漏洞,功能问题,以及兼容少见的系统架构所需的补丁。

USE flags for sys-kernel/gentoo-sources Full sources including the Gentoo patchset for the 6.3 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

安装(Emerge)

安装 sys-kernel/gentoo-sources:

root #emerge --ask sys-kernel/gentoo-sources

可选的其它内核

尽管Gentoo提供的所有稳定内核都是 sys-kernel/gentoo-sources ,Portage当中仍提供许多其他内核。内核源码概述 文章提供了其中大多数内核的细节。

对于内核的选择,参考主要内核开发人员Greg Kroah-Hartman的这篇文章 What Stable Kernel Should I Use?

查看所有可选项

所有内核的详细名单和简单的描述都可以通过emerge查询:

root #emerge --search "%@^sys-kernel/.*sources"

参考文章

配置

自动配置
genkernel 是一个用来自动化构建内核和initramfs 的工具。genkernel 的目的是内核构建过程中帮助用户。
手工配置
手工配置使得用户——通过一些努力——可以创建一个定制的内核配置。
Gentoo 内核配置指南
Gentoo内核配置指南。
内核安全
说明内核的安全性
Managing kernel modules
Kernel modules are object files that contain code to extend the kernel.
Kernel Optimizations
Describes various optimizations for the kernel, like performance.

升级

升级
通过已有的内核配置升级新内核。

移除

移除
如何移除旧的内核。

故障排除

内核中的配置支持

请查看 IKCONFIG 支持子条目。

内核命令行参数

当从启动引导器启动时,Linux 内核可以接受命令行参数来改变它的行为。这可以帮助在启动时排除内核的故障,将某个不应该加载的模块列入黑名单等。

Kernel.org 有一个格式良好的可用内核命令行参数列表供查看。

具体地说,以下命令行参数在引导 Gentoo 时可能会有帮助:

  • earlyprintk=
  • module_blacklist=
  • nomodule
  • loglevel=
  • rootdelay=

参考

  • Linux firmware — 是与 Linux 内核一起发行的软件包,它包含了某些硬件设备部分或全部功能所需固件的二进制 blob
  • LVFS — a daemon that provides a safe, reliable way of applying firmware updates on Linux.
  • Kernel/IKCONFIG support — Enabling In-kernel Config (IKCONFIG) support for the Linux kernel enables the inspection of kernel configuration for running kernels.
  • The kernel category - 在wiki-上的所有与内核相关的文章。
  • The hardware category - 具有相关内核配置的硬件堆栈列表。

外部资源

References