# 详细工具 ### 环境
在认为您遇到错误之前,至少升级到这些软件版本!如果您不确定当前运行的是什么版本,建议的命令应该会告诉您。同样,请记住,此列表假定您已经在功能上运行 Linux 内核。此外,并非所有系统都需要所有工具。显然,如果您没有任何 PC 卡硬件,例如,您可能不需要关心 pcmciautils。 务必注意:您将需要至少 200GB 的本地可用磁盘空间来完成内核的编译过程。
程序 最低版本 检查版本的命令
GNU C 5.1 gcc -v
Clang/LLVM (optional) 11.0.0 clang –version
GNU make 3.81 make –version
bash 4.2 bash –version
binutils 2.23 ld -v
flex 2.5.35 flex –version
bison 2.0 bison –version
pahole 1.16 pahole –version
util-linux 2.10o fdformat –version
kmod 13 depmod -V
e2fsprogs 1.41.4 e2fsck -V
jfsutils 1.1.3 fsck.jfs -V
reiserfsprogs 3.6.3 reiserfsck -V
xfsprogs 2.6.0 xfs\_db -V
squashfs-tools 4.0 mksquashfs -version
btrfs-progs 0.18 btrfsck
pcmciautils 004 pccardctl -V
quota-tools 3.09 quota -V
PPP 2.4.0 pppd –version
nfs-utils 1.0.5 showmount –version
procps 3.2.0 ps –version
udev 081 udevd –version
grub 0.93 grub –version || grub-install –version
mcelog 0.6 mcelog –version
iptables 1.4.2 iptables -V
openssl & libcrypto 1.0.0 openssl version
bc 1.06.95 bc –version
Sphinx[1](https://www.kernel.org/doc/html/latest/process/changes.html#f1) 1.7 sphinx-build –version
cpio any cpio –version
仅在构建内核文档时才需要 [Sphinx](https://www.kernel.org/doc/html/latest/process/changes.html#id1)
### 内核编译
#### GCC gcc 版本要求可能因计算机中 CPU 的类型而异。
#### Clang/LLVM (可选) 支持构建内核的最新正式[版本](https://releases.llvm.org/)的 clang 和 LLVM 实用程序(根据 release.llvm.org )。不保证旧版本可以正常工作,我们可能会从内核中删除用于支持旧版本的变通方法。请参阅有关[使用 Clang/LLVM 构建 Linux 的](https://www.kernel.org/doc/html/latest/kbuild/llvm.html#kbuild-llvm)其他文档。
#### Make 制作 您将需要 GNU make 3.81 或更高版本来构建内核。
#### Bash 一些 bash 脚本用于内核构建。需要 Bash 4.2 或更高版本。
#### Binutils 二进制工具 构建内核需要 Binutils 2.23 或更高版本。
#### pkg-config 包配置 从 4.18 开始,构建系统需要 pkg-config 来检查已安装的 kconfig 工具并确定在 ‘make {g,x}config’中使用的标志设置。以前 pkg-config 正在使用但未验证或记录。
#### Flex[¶](https://www.kernel.org/doc/html/latest/process/changes.html#flex "Permalink to this heading") 从 Linux 4.16 开始,构建系统在构建期间会生成词法分析器。这需要 flex 2.5.35 或更高版本。
#### Bison
从 Linux 4.16 开始,构建系统在构建期间生成解析器。这需要 bison 2.0 或更高版本。
#### pahole 从 Linux 5.2 开始,如果选择了 CONFIG\_DEBUG\_INFO\_BTF,则构建系统会从 vmlinux 中的 DWARF 生成 BTF(BPF 类型格式),稍后也会从内核模块生成 BTF(BPF 类型格式)。这需要 pahole v1.16 或更高版本。
它可以在 'dwarves' 或 'pahole' 发行包或 [https://fedorapeople.org/~acme/dwarves/](https://fedorapeople.org/~acme/dwarves/)中找到。
#### Perl 您将需要 perl 5 和以下模块: `Getopt::Long`, `Getopt::Std`, `File::Basename`, and `File::Find` 来构建内核。
#### BC
您将需要 bc 来构建内核 3.10 及更高版本
#### OpenSSL 模块签名和外部证书处理使用 OpenSSL 程序和加密库来创建密钥和生成签名。
如果启用了模块签名,您将需要 openssl 来构建 3.7 及更高版本的内核。您还需要 openssl 开发包来构建内核 4.3 及更高版本。
### 系统实用程序
#### 架构变化 DevFS 已经过时,取而代之的是 udev ( [https://www.kernel.org/pub/linux/utils/kernel/hotplug/](https://www.kernel.org/pub/linux/utils/kernel/hotplug/) ) 32 位 UID 支持现已到位。玩得开心!
函数的 Linux 文档正在通过靠近源代码定义的特殊格式的注释转换为内联文档。这些注释可以与文档/目录中的 ReST 文件相结合,以制作丰富的文档,然后可以将其转换为 PostScript、HTML、LaTex、ePUB 和 PDF 文件。为了从 ReST 格式转换为您选择的格式,您需要 Sphinx。
#### Util-linux 实用程序
新版本的 util-linux`fdisk`支持更大的磁盘,支持新的挂载选项,识别更多支持的分区类型,具有适用于 2.4 内核的 fdformat,以及类似的好东西。您可能想要升级。
#### Ksymoops 克西莫普斯
如果发生了不可想象的事情并且您的内核出现故障,您可能需要 ksymoops 工具对其进行解码,但在大多数情况下您不需要。通常首选构建内核,`CONFIG_KALLSYMS`以便它生成可以按原样使用的可读转储(这也产生比 ksymoops 更好的输出)。如果由于某种原因您的内核没有构建,`CONFIG_KALLSYMS`并且您无法使用该选项重建和重现 Oops,那么您仍然可以使用 ksymoops 解码该 Oops。
#### Mkinitrd
对文件树布局的这些更改`/lib/modules`还需要升级 mkinitrd。
#### E2fsprogs
最新版本`e2fsprogs`修复了 fsck 和 debugfs 中的几个错误。显然,升级是个好主意。
#### JFSutils 该`jfsutils`软件包包含文件系统的实用程序。可以使用以下实用程序: - `fsck.jfs` - 启动事务日志的重放,检查和修复 JFS 格式的分区。 - `mkfs.jfs` - 创建一个 JFS 格式的分区。 - 此软件包中还提供了其他文件系统实用程序。
#### Reiserfsprogs
reiserfsprogs 包应该用于 reiserfs-3.6.x(Linux 内核 2.4.x)。它是一个组合包,包含`mkreiserfs`、和 . 这些实用程序可在 i386 和 alpha 平台上运行。`resize_reiserfs``debugreiserfs``reiserfsck`
#### Xfsprogs
最新版本的`xfsprogs`contains `mkfs.xfs`、`xfs_db`和 `xfs_repair`实用程序等,用于 XFS 文件系统。它独立于体系结构,并且从 2.0.0 开始的任何版本都应该可以与此版本的 XFS 内核代码一起正常工作(建议使用 2.6.0 或更高版本,因为有一些重大改进)。
#### PCMCIAutils
PCMCIAutils 替换`pcmcia-cs`. 如果内核是模块化的并且使用了热插拔子系统,它会在系统启动时正确设置 PCMCIA 套接字并为 16 位 PCMCIA 设备加载适当的模块。
#### Quota-tools
如果要使用较新的版本 2 配额格式,则需要支持 32 位 uid 和 gid。Quota-tools 3.07 及更新版本具有此支持。使用上表中推荐的版本或更新版本。
#### Intel IA32 microcode 添加了一个驱动程序以允许更新英特尔 IA32 微码,可作为普通(杂项)字符设备访问。如果您不使用 udev,您可能需要:
``` mkdir /dev/cpu mknod /dev/cpu/microcode c 10 184 chmod 0644 /dev/cpu/microcode ```
以root身份使用它。您可能还希望使用用户空间 microcode\_ctl 实用程序来使用它。
#### udev
`udev``/dev`是一个用户空间应用程序,用于仅使用实际存在的设备的条目动态填充。`udev`替换了 devfs 的基本功能,同时允许对设备进行持久的设备命名。
#### FUSE
需要 libfuse 2.4.0 或更高版本。绝对最小值是 2.3.0,但挂载选项`direct_io`不起作用`kernel_cache`。
### Networking 联网
#### General changes 一般变化 如果您有高级网络配置需求,您可能应该考虑使用 ip-route2 中的网络工具。
#### Packet Filter / NAT 包过滤/NAT
包过滤和 NAT 代码使用与之前的 2.4.x 内核系列 (iptables) 相同的工具。它仍然包括 2.2.x 风格的 ipchains 和 2.0.x 风格的 ipfwadm 的向后兼容模块。
#### PPP PPP 驱动程序已经过重组,以支持多链路并使其能够在不同的媒体层上运行。如果您使用 PPP,请将 pppd 至少升级到 2.4.0。 如果您不使用 udev,则必须拥有设备文件 /dev/ppp,该文件可以通过以下方式制作:
``` mknod /dev/ppp c 108 0 ```
作为根。
#### NFS-utils 实用程序 在古老的(2.4 和更早的)内核中,nfs 服务器需要知道任何期望能够通过 NFS 访问文件的客户端。此信息将`mountd`在客户端安装文件系统时或`exportfs`系统启动时提供给内核。exportfs 将从`/var/lib/nfs/rmtab`. 这种方法非常脆弱,因为它取决于 rmtab 是否正确,这并不总是那么容易,尤其是在尝试实现故障转移时。即使系统运行良好,也会`rmtab`遭受到许多永远不会被删除的旧条目的困扰。 使用现代内核,我们可以选择让内核在收到来自未知主机的请求时告诉 mountd,而 mountd 可以向内核提供适当的导出信息。这消除了对内核的依赖`rmtab`,意味着内核只需要知道当前活动的客户端。 要启用此新功能,您需要:
``` mount -t nfsd nfsd /proc/fs/nfsd ```
在运行 exportfs 或 mountd 之前。建议在可能的情况下通过防火墙保护所有 NFS 服务免受 Internet 的影响。
#### mcelog
在 x86 内核上,启用时需要 mcelog 实用程序来处理和记录机器检查事件`CONFIG_X86_MCE`。机器检查事件是 CPU 报告的错误。强烈建议处理它们。
### Kernel documentation 内核文档
#### Sphinx 狮身人面像
有关 Sphinx 要求的详细信息,请参阅[Documentation/doc-guide/sphinx.rst](https://www.kernel.org/doc/html/latest/doc-guide/sphinx.html#sphinxdoc)中的[Sphinx 安装。](https://www.kernel.org/doc/html/latest/doc-guide/sphinx.html#sphinx-install)
## Getting updated software 获取更新的软件
### Kernel compilation 内核编译
#### gcc - <[ftp://ftp.gnu.org/gnu/gcc/](ftp://ftp.gnu.org/gnu/gcc/)>
#### Clang/LLVM - [Getting LLVM](https://www.kernel.org/doc/html/latest/kbuild/llvm.html#getting-llvm).
#### Make - <[ftp://ftp.gnu.org/gnu/make/](ftp://ftp.gnu.org/gnu/make/)>
#### Bash - <[ftp://ftp.gnu.org/gnu/bash/](ftp://ftp.gnu.org/gnu/bash/)>
#### Binutils - <[https://www.kernel.org/pub/linux/devel/binutils/](https://www.kernel.org/pub/linux/devel/binutils/)>
#### Flex - <[https://github.com/westes/flex/releases](https://github.com/westes/flex/releases)>
#### Bison - <[ftp://ftp.gnu.org/gnu/bison/](ftp://ftp.gnu.org/gnu/bison/)>
#### OpenSSL - <[https://www.openssl.org/](https://www.openssl.org/)>
### System utilities
#### Util-linux - <[https://www.kernel.org/pub/linux/utils/util-linux/](https://www.kernel.org/pub/linux/utils/util-linux/)>
#### Kmod - <[https://www.kernel.org/pub/linux/utils/kernel/kmod/](https://www.kernel.org/pub/linux/utils/kernel/kmod/)> - <[https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git](https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git)>
#### Ksymoops - <[https://www.kernel.org/pub/linux/utils/kernel/ksymoops/v2.4/](https://www.kernel.org/pub/linux/utils/kernel/ksymoops/v2.4/)>
#### Mkinitrd - <[https://code.launchpad.net/initrd-tools/main](https://code.launchpad.net/initrd-tools/main)>
#### E2fsprogs - <[https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/](https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/)> - <[https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/](https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/)>
#### JFSutils - <[http://jfs.sourceforge.net/](http://jfs.sourceforge.net/)>
#### Reiserfsprogs - <[https://git.kernel.org/pub/scm/linux/kernel/git/jeffm/reiserfsprogs.git/](https://git.kernel.org/pub/scm/linux/kernel/git/jeffm/reiserfsprogs.git/)>
#### Xfsprogs - <[https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git](https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git)> - <[https://www.kernel.org/pub/linux/utils/fs/xfs/xfsprogs/](https://www.kernel.org/pub/linux/utils/fs/xfs/xfsprogs/)>
#### Pcmciautils - <[https://www.kernel.org/pub/linux/utils/kernel/pcmcia/](https://www.kernel.org/pub/linux/utils/kernel/pcmcia/)>
#### Quota-tools - <[http://sourceforge.net/projects/linuxquota/](http://sourceforge.net/projects/linuxquota/)>
#### Intel P6 microcode - <[https://downloadcenter.intel.com/](https://downloadcenter.intel.com/)>
#### udev - <[https://www.freedesktop.org/software/systemd/man/udev.html](https://www.freedesktop.org/software/systemd/man/udev.html)>
#### FUSE - <[https://github.com/libfuse/libfuse/releases](https://github.com/libfuse/libfuse/releases)>
#### mcelog - <[http://www.mcelog.org/](http://www.mcelog.org/)>
#### cpio - <[https://www.gnu.org/software/cpio/](https://www.gnu.org/software/cpio/)>
### Networking
#### PPP - <[https://download.samba.org/pub/ppp/](https://download.samba.org/pub/ppp/)> - <[https://git.ozlabs.org/?p=ppp.git](https://git.ozlabs.org/?p=ppp.git)> - <[https://github.com/paulusmack/ppp/](https://github.com/paulusmack/ppp/)>
#### NFS-utils - <[http://sourceforge.net/project/showfiles.php?group\_id=14](http://sourceforge.net/project/showfiles.php?group_id=14)>
#### Iptables - <[https://netfilter.org/projects/iptables/index.html](https://netfilter.org/projects/iptables/index.html)>
#### Ip-route2 - <[https://www.kernel.org/pub/linux/utils/net/iproute2/](https://www.kernel.org/pub/linux/utils/net/iproute2/)>
#### OProfile - <[http://oprofile.sf.net/download/](http://oprofile.sf.net/download/)>
#### NFS-Utils - <[http://nfs.sourceforge.net/](http://nfs.sourceforge.net/)>
### Kernel documentation
#### Sphinx - <[https://www.sphinx-doc.org/](https://www.sphinx-doc.org/)>