This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.

Please visit our production wiki at https://wiki.gentoo.org

内核

From Gentoo Wiki (test)
Jump to:navigation Jump to:search
This page is a translated version of the page Kernel and the translation is 100% complete.

尽管 Gentoo 是一个基于 Linux 或 FreeBSD 的自由操作系统,并且 FreeBSD 有它自己的内核,因为一些原因,这篇文章只介绍 Linux 内核的相关内容。

Linux 内核是操作系统的核心,提供了程序访问硬件的接口。内核包含了绝大多数的设备驱动。

安装

USE 旗标

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

USE flags for sys-kernel/gentoo-sources Full sources including the Gentoo patchset for the 6.9 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 官方 Portage 树中还有许多可选的内核源码归档:

  • sys-kernel/vanilla-sources - 官方的,没有打过补丁的 Linux 内核源代码。注意因为它们是 Linux 官方内核,不包含任何来自 Gentoo 的补丁,并不会受到来自 Gentoo 的支持。
  • sys-kernel/hardened-sources - 增强了安全方面的Gentoo 内核源码归档。

来源概述

Kernel sources overview
大多数情况下,可用的内核源代码包在Gentoo,都有内核源代码概述或详细介绍的文章。在那里具体内核源库,提供Gentoo知识的再认识。

查看所有可选项

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

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

配置

Automatic configuration
genkernel是一个用来自动化构建内核和initramfs的软件。genkernel的目的是内核构建过程中帮助用户。
手工配置
手工配置使得用户——通过一些努力——可以创建一个定制的内核配置。
Gentoo kernel configuration guide
Gentoo内核配置指南。
Kernel security
说明内核的安全性
Upgrade
通过已有的内核配置升级新内核。
Removal
如何移除旧的内核。

跟上面的类似,Kernel Seeds 帮助用户,通过一些努力,在一个已有的内核配置 .config 的基础上创建一个定制的内核配置。跟上面的类似,Kernel Seeds 帮助用户,通过一些努力,在一个已有的内核配置 .config 的基础上创建一个定制的内核配置。

2.4 to 2.6 Migration
从2.4内核到2.6内核的迁移指南。由于Linux内核代码库已经明显高于2.6,这些迁移步骤不再相关,但可能会帮助管理员,了解非常有用的东西。

参考

外部资源

  • planet.kernel.org/ - Blogs related to the Linux kernel.
  • kernelnewbies.org/ - "A site for aspiring Linux kernel developers who work to improve their Kernels and more experienced developers willing to share their kernel knowledge."