Skip to content

Commit

Permalink
gentoo-kernel-git: Update instructions for sys-kernel/installkernel
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo3418 committed Jan 27, 2024
1 parent c69b7c5 commit 2ac1a8a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions content/en/posts/2022-03-04-gentoo-kernel-git.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,23 +312,23 @@ a kernel without `genkernel` is definitely possible, is not very hard, and is

Before starting to compile and install a kernel, it is strongly recommended to
install a package that provides the `/sbin/installkernel` utility, such as
`sys-kernel/installkernel-gentoo`. This is because, if the installation
scripts in the kernel sources cannot locate `/sbin/installkernel`, they will
perform [their own kernel installation logic][linux-install.sh], which is to
install the kernel's executable image to [`/boot/vmlinuz` if it is
`sys-kernel/installkernel`. This is because, if the installation scripts in
the kernel sources cannot locate `/sbin/installkernel`, they will perform
[their own kernel installation logic][linux-install.sh], which is to install
the kernel's executable image to [`/boot/vmlinuz` if it is
compressed][vmlinuz-etymology] or `/boot/vmlinux` if it is not; however, some
bootloaders might not support these installation paths. For example, GRUB 2
searches the kernel's image using [`/boot/vmlinuz-*` and `/boot/vmlinux-*`
patterns][grub-10_linux]; the extra hyphen causes GRUB 2 to disregard
`/boot/vmlinuz` and `/boot/vmlinux`. Once `/sbin/installkernel` is installed,
the kernel sources' Makefiles will call it to handle kernel installation
instead, and the `/sbin/installkernel` provided by
`sys-kernel/installkernel-gentoo` installs the kernel's image to
`/boot/vmlinuz-*` or `/boot/vmlinux-*` (with the hyphen), so bootloaders like
GRUB 2 can properly detect it.
`sys-kernel/installkernel` installs the kernel's image to `/boot/vmlinuz-*` or
`/boot/vmlinux-*` (with the hyphen), so bootloaders like GRUB 2 can properly
detect it.

```console
# emerge --ask --noreplace sys-kernel/installkernel-gentoo
# emerge --ask --noreplace sys-kernel/installkernel
```

Assuming that a kernel configuration file has been created, compiling and
Expand Down
4 changes: 2 additions & 2 deletions content/zh/posts/2022-03-04-gentoo-kernel-git.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ Date: Thu Nov 18 19:17:21 2021 +0100

在刚开始接触内核构建与定制的用户当中,使用 `genkernel` 是一种很流行的方法;但是,这种方法在 Gentoo 手册中毕竟是[作为一种备选方法介绍的][handbook-genkernel]。不使用 `genkernel` 构建内核不仅可行,操作也并不难,并且[在手册中也是被作为一种主要方法介绍的][handbook-manual-build]

开始编译并安装内核之前,强烈推荐先安装一个提供 `/sbin/installkernel` 工具的软件包,例如 `sys-kernel/installkernel-gentoo`。这是因为,如果内核源码中的安装脚本未找到 `/sbin/installkernel`,其就会执行[自己的内核安装逻辑][linux-install.sh],将内核本体安装到 [`/boot/vmlinuz`(如果内核是压缩过的)][vmlinuz-etymology]或者 `/boot/vmlinux`(如果没有压缩);但是,一些引导程序可能不支持这些内核安装路径。例如,GRUB 2 搜索内核本体时检查的路径是 [`/boot/vmlinuz-*` 和 `/boot/vmlinux-*`][grub-10_linux];这个多出来的连字符就会导致 GRUB 2 忽略 `/boot/vmlinuz` 和 `/boot/vmlinux` 路径。`/sbin/installkernel` 安装好后,内核源码中的 Makefile 就会调用它来安装内核,而 `sys-kernel/installkernel-gentoo` 提供的 `/sbin/installkernel` 会将内核本体安装到 `/boot/vmlinuz-*` 或 `/boot/vmlinux-*`(即带有连字符的路径),允许诸如 GRUB 2 的引导程序识别到它。
开始编译并安装内核之前,强烈推荐先安装一个提供 `/sbin/installkernel` 工具的软件包,例如 `sys-kernel/installkernel`。这是因为,如果内核源码中的安装脚本未找到 `/sbin/installkernel`,其就会执行[自己的内核安装逻辑][linux-install.sh],将内核本体安装到 [`/boot/vmlinuz`(如果内核是压缩过的)][vmlinuz-etymology]或者 `/boot/vmlinux`(如果没有压缩);但是,一些引导程序可能不支持这些内核安装路径。例如,GRUB 2 搜索内核本体时检查的路径是 [`/boot/vmlinuz-*` 和 `/boot/vmlinux-*`][grub-10_linux];这个多出来的连字符就会导致 GRUB 2 忽略 `/boot/vmlinuz` 和 `/boot/vmlinux` 路径。`/sbin/installkernel` 安装好后,内核源码中的 Makefile 就会调用它来安装内核,而 `sys-kernel/installkernel` 提供的 `/sbin/installkernel` 会将内核本体安装到 `/boot/vmlinuz-*` 或 `/boot/vmlinux-*`(即带有连字符的路径),允许诸如 GRUB 2 的引导程序识别到它。

```console
# emerge --ask --noreplace sys-kernel/installkernel-gentoo
# emerge --ask --noreplace sys-kernel/installkernel
```

在已经准备好了内核配置文件的前提下,编译并安装内核本身(不带 initramfs)的操作很简单,只要运行以下手册中提及的命令即可:
Expand Down

0 comments on commit 2ac1a8a

Please sign in to comment.