Installkernel
Installkernel は、新しい カーネル のインストールと ブートローダ の設定の更新を自動的に行う、スクリプトのコレクションです。
パッケージ sys-kernel/installkernel はカーネルのインストールを管理するための 2 通りの方法を提供しています。1 つは systemd の kernel-install で、もう 1 つは Debian に由来する伝統的な installkernel です。
systemd USE フラグは、どちらがデフォルトで使用されるかを変更します。このデフォルトは SYSTEMD_KERNEL_INSTALL 環境変数で無視することができます。一般論としては、systemd の kernel-install のほうがより現代的な実装なので推奨され、systemd プロファイルではデフォルトで有効化されています。systemd のツールを使用したくないユーザは、Debian の installkernel 実装にフォールバックするかもしれません。
追加の自動化プラグイン、例えば:
- initramfs を生成する
- Unified Kernel Image を生成する
- ブートローダ設定を更新する
は、以下に概要を示す sys-kernel/installkernel に対する USE フラグを介して、インストールまたは有効化されます:
USE flags for sys-kernel/installkernel Gentoo fork of installkernel script from debianutils
dracut
|
Generate an initramfs or UKI on each kernel installation |
efistub
|
EXPERIMENTAL: Update UEFI configuration on each kernel installation |
grub
|
Re-generate grub.cfg on each kernel installation, used grub.cfg is overridable with GRUB_CFG env var |
refind
|
Install a Gentoo icon for rEFInd alongside the (unified) kernel image, used icon is overridable with REFIND_ICON env var |
systemd
|
Use systemd's kernel-install to install kernels, overridable with SYSTEMD_KERNEL_INSTALL env var |
systemd-boot
|
Use systemd-boot's native layout by default |
ugrd
|
Generate an initramfs using UGRD on each kernel installation |
uki
|
Install UKIs to ESP/EFI/Linux for EFI stub booting and/or bootloaders with support for auto-discovering UKIs |
ukify
|
Build an UKI with systemd's ukify on each kernel installation |
Systemd の kernel-install
このインストール手法を選択するためには、 systemd USE フラグを有効化するか、環境で SYSTEMD_KERNEL_INSTALL=1 を設定してください。
/etc/portage/package.use/installkernel
sys-kernel/installkernel systemd
root
#
emerge --ask sys-kernel/installkernel
または
/etc/env.d/99systemd-kernel-install
SYSTEMD_KERNEL_INSTALL=1
root
#
env-update
systemd の kernel-install はカーネルをインストール ( kernel-install add ) できるだけでなく、カーネルの削除 ( kernel-install remove ) も処理することができます。 kernel-install がインストールされていれば、 eclean-kernel によって自動的に呼び出されるでしょう。
構成設定
kernel-install の構成は /etc/kernel/install.conf および /usr/lib/kernel/install.conf で行われ、後者よりも前者が優先されます。3 個の構成オプションを設定することができます:
/etc/kernel/install.conf
layout=
initrd_generator=
uki_generator=
デフォルトの設定ファイル /usr/lib/kernel/install.conf は sys-kernel/installkernel によって提供されます。もちろん、 /etc/kernel/install.conf で設定を手動で変更することもできます。
/etc/kernel/install.conf は /usr/lib/kernel/install.conf 全体を無効化します! /etc/kernel/install.conf が存在する場合、 /usr/lib/kernel/install.conf 内のすべての設定が無視されます。そのため設定をひとつだけ上書きしたい場合、 /usr/lib/kernel/install.conf から /etc/kernel/install.conf に、上書きしたくない他の設定もコピーしなくてはなりません。
layout
上流の systemd は Boot Loader Specification type 1 ( layout=bls ) および type 2 ( layout=uki ) レイアウトをサポートしています。type 1 レイアウトは systemd-boot によって使用され、type 2 レイアウトは Unified カーネルイメージのために使用されることが想定されており、 GRUB 、systemd-boot および refind によってサポートされています。
Gentoo は GRUB との併用を意図した、より伝統的なレイアウト ( layout=grub ) もサポートしています。これは上に記述した Debian の installkernel によって使用されるレイアウトに非常に似ています (が、同一ではありません)。このレイアウトは、より基本的で伝統的なレイアウトが望まれるような他の場合でも使用することができます。 Unified カーネルイメージ と組み合わせて GRUB を使用するためには、代わりに uki レイアウトを使用してください。
grub 、 systemd-boot 、 efistub 、および uki USE フラグがすべて無効化されている場合、カーネルは Debian の installkernel とおおよそ後方互換性のあるレイアウト ( layout=compat ) でインストールされるでしょう。
レイアウトを指定するフラグが複数有効化されている場合、 uki レイアウト ( uki USE フラグによって有効化される) は bls レイアウト ( systemd-boot USE フラグによって有効化される) より優先され、さらにこれは grub レイアウト ( grub USE フラグによって有効化される) より優先されます。
各レイアウトの概要を以下の節に示します:
compat
compat レイアウトは、Debian の伝統的な installkernel によって使用されるレイアウトに非常に似ていますが、同一ではありません:
/boot/initramfs-x.y.z-gentoo-dist.img # USE=dracut (または他の initramfs ジェネレータ) の場合
/boot/kernel-x.y.z-gentoo-dist
efistub
efistub レイアウトは compat レイアウトと同一ですが、 EFI スタブ ブートを行うために EFI システムパーティション に配置されます。カーネルイメージは .efi 拡張子を持ちます、一部のファームウェアベンダがこれを要求するためです:
/${ESP}/EFI/Gentoo/initramfs-x.y.z-gentoo-dist.img # USE=dracut (または他の initramfs ジェネレータ) の場合
/${ESP}/EFI/Gentoo/kernel-x.y.z-gentoo-dist.efi
(自動化された) EFI スタブブートが機能するかどうかは、UEFI ベンダによって大きく異なります。これは応用的で実験的な機能と見なされています。
grub
grub レイアウトは compat レイアウトと同一のものに加えて、 GRUB によって使用される grub.cfg が追加されています:
/boot/grub/grub.cfg
/boot/initramfs-x.y.z-gentoo-dist.img # USE=dracut (または他の initramfs ジェネレータ) の場合
/boot/kernel-x.y.z-gentoo-dist
bls
Bootloader Specification Type 1 、またの名を bls レイアウトは、 systemd-boot によって使用されます:
/${ESP}/gentoo/x.y.z-gentoo-dist/initrd # USE=dracut (または他の initramfs ジェネレータ) の場合
/${ESP}/gentoo/x.y.z-gentoo-dist/linux
/${ESP}/loader/entries/gentoo-x.y.z-gentoo-dist.conf
uki
Bootloader Specification Type 2 、またの名を uki レイアウトは:
/boot/grub/grub.cfg # USE=grub の場合
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
initrd_generator
この設定は initramfs を生成するためにどのプラグインを使用すべきかを制御します。現時点でそのようなプラグインをインストールする唯一のパッケージは、 sys-kernel/dracut の Dracut です。この設定は ${KERNEL_INSTALL_INITRD_GENERATOR} としてプラグインに公開されます。 dracut USE フラグが有効化されている場合、この設定は自動的に dracut に設定されます。それ以外の場合、この設定は自動的に none に設定されます。
uki_generator
この設定は Unified カーネルイメージを生成するためにどのプラグインを使用すべきかを制御します。現時点でそのようなプラグインを提供するパッケージは 2 つあります: sys-kernel/dracut と systemd ( sys-apps/systemd と sys-apps/systemd-utils の ukify フラグを介して) です。この設定は ${KERNEL_INSTALL_UKI_GENERATOR} としてプラグインに公開されます。 ukify USE フラグが有効化されている場合、この設定は自動的に ukify に設定されます。 ukify USE フラグが無効化されているが、 dracut および uki USE フラグが有効化されている場合、この設定は自動的に dracut に設定されます。それ以外の場合、この設定は自動的に none に設定されます。
kernel-install のコマンド群
Below an overview is provided of the available commands in systemd's kernel-install .
kernel-install add
(Re-)installs a kernel version. This command is called by sys-kernel/installkernel if the systemd USE flag is enabled.
root
#
kernel-install [OPTIONS...] add KERNEL-VERSION KERNEL-IMAGE [INITRD-FILE...]
kernel-install remove
Uninstalls a kernel version. This command is called by app-admin/eclean-kernel if it is available.
root
#
kernel-install [OPTIONS...] remove KERNEL-VERSION
kernel-install inspect
Prints an overview of parameters that will be used when installing a kernel version.
root
#
kernel-install [OPTIONS...] inspect [KERNEL-VERSION] [KERNEL-IMAGE] [INITRD-FILE...]
kernel-install list
Prints an overview of all installed kernel versions. Meaning all kernel versions for which a directory is present in /lib/modules .
root
#
kernel-install [OPTIONS...] list
kernel-install add-all
(Re-)installs all kernel versions. Iterates kernel-install add over each kernel for which a vmlinuz file is present in the associated /lib/modules directory.
root
#
kernel-install [OPTIONS...] add-all
実行時に上書きする
When the dracut and ukify plugins are enabled (i.e. the dracut and/or ukify USE flags are enabled) they may be skipped at runtime by overriding the default configuration provided by sys-kernel/installkernel at /usr/lib/kernel/install.conf with a custom configuration at /etc/kernel/install.conf . This may be useful on systems that have both the distribution kernels installed and manually configured kernels where the former enforces the enablement of the dracut USE flag but the latter might not require an initramfs at all.
例えば:
/etc/kernel/install.conf
layout=compat
initrd_generator=none
uki_generator=none
Note that this override will apply to all installed kernels. It is also possible to specify several different configurations and switch between them at runtime using the KERNEL_INSTALL_CONF_ROOT environment variable.
例えば:
/etc/manual-kernel/install.conf
layout=compat
initrd_generator=none
uki_generator=none
root
#
KERNEL_INSTALL_CONF_ROOT=/etc/manual-kernel make install
Another method of overriding the default kernel installation is to use the KERNEL_INSTALL_PLUGINS environment variable. When this variable is set, only the specified plugins are run.
例えば:
root
#
KERNEL_INSTALL_PLUGINS="90-compat.install 90-loaderentry.install 90-uki-copy.install" make install
カスタマイズ
カスタムプラグインは、例えば initramfs または UKI を生成したり、あるいはブートローダ構成設定を更新したりしますが、これらは /etc/kernel/install.d 内にインストールすることができます。initramfs プラグインは ${KERNEL_INSTALL_STAGING_AREA } 上に initrd という名前のファイルとしてインストールすべきです。UKI プラグインは ${KERNEL_INSTALL_STAGING_AREA } 上に uki.efi という名前のファイルとしてインストールすべきです。すべてのプラグインファイルは .install の接尾辞を持たなくてはなりません。 /etc/kernel/install.d 内のプラグインは、 /usr/lib/kernel/install.d 内にある同名のデフォルトプラグインを無効化します。
プラグインスクリプトの説明
In exection order, the install.d plugins
- /usr/lib/kernel/install.d/00-00machineid-directory.install
- Create the ENTRY_DIR_ABS directory where kernels will be installed for systemd-boot .
- Installed by: sys-kernel/installkernel
- Executed if: layout=bls and kernel-install command is add
- /usr/lib/kernel/install.d/10-copy-prebuilt.install
- Copy prebuilt initramfs and Unified Kernel Image to the staging area if they exist. A prebuilt initramfs and Unified Kernel Image are present when the distribution kernels are installed with the generic-uki USE flag enabled.
- Installed by: sys-kernel/installkernel
- Executed if: kernel-install command is add
- /usr/lib/kernel/install.d/35-amd-microcode-systemd.install
- Builds an AMD CPU microcode early initramfs if an initramfs generator is used that does not already bundle the CPU microcode.
- Installed by: sys-kernel/linux-firmware if the initramfs is enabled.
- Executed if: kernel-install command is add and initrd_generator!=dracut .
- /usr/lib/kernel/install.d/35-intel-microcode-systemd.install
- Builds an Intel CPU microcode early initramfs if an initramfs generator is used that does not already bundle the CPU microcode.
- Installed by: sys-firmware/intel-microcode if the initramfs is enabled.
- Executed if: kernel-install command is add and initrd_generator!=dracut .
- /usr/lib/kernel/install.d/40-dkms.install
- Automatically rebuild kernel modules registered with DKMS on kernel installation, and clean them up on kernel removal.
- Installed by: sys-kernel/dkms
- Executed if: Always
- /usr/lib/kernel/install.d/50-depmod.install
- Update kernel module dependencies on kernel installation, and cleanup depmod files on kernel removal.
- Installed by: sys-apps/systemd or sys-apps/systemd-utils
- Executed if: Always
- /usr/lib/kernel/install.d/50-dracut.install
- Builds a initramfs or Unified Kernel Image (UKI) with dracut . A initramfs is built if initrd_generator=dracut . If uki_generator=dracut and not layout=bls then an UKI is built, this will be the case if the uki USE flag is enabled on sys-kernel/installkernel but the ukify USE flag is disabled.
- Installed by: sys-kernel/dracut
- Executed if: kernel-install command is add and initrd_generator=dracut (USE dracut ) or uki_generator=dracut (USE dracut and USE uki but not USE ukify ). Also executed if layout is set to an unsupported value.
- /usr/lib/kernel/install.d/51-dracut-rescue.install
- Build a dracut rescue initramfs image, currently not supported in combination with Unified Kernel Images.
- Installed by: sys-kernel/dracut
- Executed if: kernel-install command is add and dracut_rescue_image=yes in any dracut configuration file
- /usr/lib/kernel/install.d/52-ugrd.install
- Builds an initramfs using the ugrd initramfs generator.
- Installed by: sys-kernel/ugrd
- Executed if: kernel-install command is add and initrd_generator=ugrd .
- /usr/lib/kernel/install.d/85-check-diskspace.install
- Checks if there is enough disk space on the target partition to install the kernel.
- Installed by: sys-kernel/installkernel
- Executed if: Always
- /usr/lib/kernel/install.d/90-compat.install
- Install the staged (unified) kernel image (and initramfs) in a backwards compatibility layout similar to Debian's installkernel. And clean them up when the kernel is removed.
- Installed by: sys-kernel/installkernel
- Executed if: layout=compat or layout=grub
- /usr/lib/kernel/install.d/90-loaderentry.install
- Install the staged kernel image (and initramfs) in systemd-boot 's native format and register the new kernel with systemd-boot. And clean up these files when the kernel is removed.
- Installed by: sys-apps/systemd or sys-apps/systemd-utils
- Executed if: layout=bls
- /usr/lib/kernel/install.d/90-runlilo.install
- Update LILO 's configuration.
- Installed by: sys-boot/lilo
- Executed if: Always
- /usr/lib/kernel/install.d/90-uki-copy.install
- Copy the staged Unified Kernel Image to the EFI/Linux directory on the EFI System Partition . And clean it up on kernel removal. This plugin script will exit fatally if there is no UKI to install.
- Installed by: sys-apps/systemd or sys-apps/systemd-utils
- Executed if: layout=uki
- /usr/lib/kernel/install.d/90-zz-update-static.install
- Update version-less files or symlinks if they exist at the target location.
- Installed by: sys-kernel/installkernel
- Executed if: kernel-install command is add and layout=uki or layout=efistub or layout=compat or layout=grub
- /usr/lib/kernel/install.d/91-grub-mkconfig.install
- Update GRUB 's configuration by running grub-mkconfig . Automatically finds Unified Kernel Images in the EFI/Linux directory on the EFI System Partition . Which grub.cfg to use is overridable with the GRUB_CFG environment variable.
- Installed by: sys-kernel/installkernel with grub
- Executed if: layout=uki or layout=grub
- /usr/lib/kernel/install.d/91-sbctl.install
- Sign the installed (unified) kernel image with sbctl's keys and add it to the sbctl database. Upon kernel removal it is removed from the database. The plugin script will exit fatally if sbctl's keys are not already setup. Note that both dracut and ukify are capable of signing generated unified kernel images by themselves and distribution kernels can already be signed using the secureboot USE flag. This plugin may be useful however for manually compiled kernels.
- Installed by: app-crypt/sbctl
- Executed if: Always
- /usr/lib/kernel/install.d/95-efistub-kernel-bootcfg.install
- Adds and removes UEFI boot entries on kernel installation or removal using kernel-bootcfg from app-emulation/virt-firmware .
- Installed by: sys-kernel/installkernel with USE efistub
- Executed if: layout=efistub or layout=uki
- /usr/lib/kernel/install.d/95-refind-copy-icon.install
- Install a Gentoo icon for the rEFInd bootloader alongside the (unified) kernel image. Which icon file to use is overridable with the REFIND_ICON environment variable.
- Installed by: sys-kernel/installkernel with USE refind
- Executed if: layout=uki or layout=compat
- /usr/lib/kernel/install.d/99-write-log.install
- Appends last installed kernel to /var/log/installkernel.log and updates state file at /var/lib/installkernel .
- Installed by: sys-kernel/installkernel
- Executed if: Always
Debian の installkernel
このインストール手法を選択するには、 systemd USE フラグを無効化するか、環境で SYSTEMD_KERNEL_INSTALL=0 を設定してください。
/etc/portage/package.use/installkernel
sys-kernel/installkernel -systemd
root
#
emerge --ask sys-kernel/installkernel
あるいは
/etc/env.d/99no-systemd-kernel-install
SYSTEMD_KERNEL_INSTALL=0
root
#
env-update
伝統的な installkernel は initramfs や Unified カーネルイメージ (UKI) をカーネルソースツリー内のカーネルイメージと同じ場所にインストールするので、initramfs や Unified カーネルイメージを使用する構成から使用しない構成に切り換えたとき、これらのファイルが残り続けてしまうかもしれません。そのような状況では、これらのファイルが installkernel によって選択されてインストールされてしまうことがないようにするために、これらのファイルをカーネルソースツリーから手動で削除する必要があるかもしれません。
設定
kernel-install の設定は /etc/kernel/install.conf と /usr/lib/kernel/install.conf で行われており、前者が後者よりも優先されます。3つの設定オプションを設定できます:
/etc/kernel/install.conf
layout=
initrd_generator=
uki_generator=
デフォルトの設定ファイル /usr/lib/kernel/install.conf は sys-kernel/installkernel によって提供されます。もちろん、 /etc/kernel/install.conf で設定を手動で変更することもできます。
/etc/kernel/install.conf は /usr/lib/kernel/install.conf 全体を上書きします! /etc/kernel/install.conf が存在する場合には、 /usr/lib/kernel/install.conf の設定はすべて無視されます。したがって、1つの設定のみ上書きしたいユーザーは、その他の上書きされるべきでない設定も /usr/lib/kernel/install.conf から /etc/kernel/install.conf へコピーしなければなりません。
レイアウト
Debian の伝統的な installkernel は、カーネルと initramfs または Unified カーネルイメージ をこのようなレイアウトでインストールします:
/boot/System.map-x.y.z-gentoo-dist
/boot/config-x.y.z-gentoo-dist
/boot/grub/grub.cfg # USE=grub が有効な場合
/boot/initramfs-x.y.z-gentoo-dist.img # USE=dracut (またはその他の initramfs ジェネレーター)が有効な場合
/boot/vmlinuz-x.y.z-gentoo-dist
/boot/vmlinuz-x.y.z-gentoo-dist.png # USE=refind が有効な場合
efistub
efistub USE フラグが有効化されている場合、インストールツリーは EFI システムパーティション (ESP) に再配置され、カーネルイメージの末尾には .efi が追加されます。
/${ESP}/EFI/Gentoo/System.map-x.y.z-gentoo-dist
/${ESP}/EFI/Gentoo/config-x.y.z-gentoo-dist
/${ESP}/EFI/Gentoo/initramfs-x.y.z-gentoo-dist.img # USE=dracut (またはその他の initramfs ジェネレーター)が有効な場合
/${ESP}/EFI/Gentoo/vmlinuz-x.y.z-gentoo-dist.efi
uki
uki USE フラグが有効化されている場合、生成された Unified カーネルイメージは EFI システムパーティション (ESP) の EFI/Linux ディレクトリにインストールされます。
/boot/grub/grub.cfg # USE=grub が有効な場合
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.png # USE=refind が有効な場合
initrd_generator
この設定は、どのプラグインを initramfs の生成に使用するか制御します。今のところ、こうしたプラグインをインストールするパッケージは sys-kernel/dracut の Dracut のみです。この設定は、 ${INSTALLKERNEL_INITRD_GENERATOR} としてプラグインに公開されます。 dracut USE フラグが有効化されている場合、この設定は自動的に dracut に設定されます。そうでない場合、この設定は自動的に none に設定されます。
uki_generator
この設定は、Unified カーネルイメージの生成にどのプラグインを使用するか制御します。今のところ、2つのパッケージがそうしたプラグインを提供しています: sys-kernel/dracut と systemd ( sys-apps/systemd と sys-apps/systemd-utils の ukify フラグを通じて)です。この設定は、 ${INSTALLKERNEL_UKI_GENERATOR} としてプラグインに公開されます。 ukify USE フラグが有効化されている場合、この設定は自動的に ukify に設定されます。 ukify USE フラグが無効化されており、かつ dracut と uki フラグが有効化されている場合、この設定は自動的に dracut に設定されます。そうでない場合、この設定は自動的に none 設定されます。
実行時に上書きする
dracut と ukify プラグインがインストールされている(つまり dracut または ukify USE フラグが有効になっている)場合、 INSTALLKERNEL_INITRD_GENERATOR や INSTALLKERNEL_UKI_GENERATOR 環境変数を使用することで実行時にそれらをスキップできます。これは、 dracut USE フラグを有功にする必要があるディストリビューションカーネルと、initramfs をまったく必要としない手動設定のカーネルの両方がインストールされているシステムにおいて有用です。
root
#
INSTALLKERNEL_INITRD_GENERATOR=none INSTALLKERNEL_UKI_GENERATOR=none make install
代わりに、 /etc/kernel/install.conf を使ってこれらの設定を恒久的に設定することもできます:
/etc/kernel/install.conf
layout=compat
initrd_generator=none
uki_generator=none
この上書きはインストールされているすべてのカーネルに適用されることに留意してください。複数の異なる設定を指定しておいて、実行時に INSTALLKERNEL_CONF_ROOT 環境変数を使ってそれらを切り替えることもできます。
例えば:
/etc/manual-kernel/install.conf
layout=compat
initrd_generator=none
uki_generator=none
root
#
INSTALLKERNEL_CONF_ROOT=/etc/manual-kernel make install
デフォルトのカーネルインストールを上書きするもう1つの方法は、 INSTALLKERNEL_PREINST_PLUGINS と INSTALLKERNEL_POSTINST_PLUGINS 環境変数を使用することです。これらの変数が設定されている場合、指定されているプラグインのみが実行されます。
例えば:
root
#
INSTALLKERNEL_POSTINST_PLUGINS="91-grub-mkconfig.install" make install
カスタマイズ
カスタムプラグインには、例えば initramfs または Unified カーネルイメージ (UKI) を生成するカスタムプラグインがありますが、これらは /etc/kernel/preinst.d にインストールすることができます。initramfs プラグインは、 INSTALLKERNEL_INITRD_GENERATOR 環境変数を参照して、 ${INSTALLKERNEL_STAGING_AREA } に initrd という名前のファイルをインストールするはずです。そして、UKI プラグインは、 INSTALLKERNEL_UKI_GENERATOR 環境変数を参照して、 ${INSTALLKERNEL_STAGING_AREA } に uki.efi という名前のファイルをインストールするはずです。
さらに、例えばブートローダの構成設定を更新するカスタムプラグインもあり、これらは /etc/kernel/postinst.d にインストールすることができます。
/etc/kernel/preinst.d または /etc/kernel/postinst.d にあるプラグインは、 /usr/lib/kernel/preinst.d と /usr/lib/kernel/postinst.d にある同名のデフォルトプラグインを上書きします。
プラグインスクリプトの説明
preinst.d プラグインは、実行順に
- /usr/lib/kernel/preinst.d/35-amd-microcode.install
- CPU マイクロコードを含めない initramfs ジェネレーターを使用している場合、AMD CPU のマイクロコードの早期 initramfs をビルドします。
- インストール元: initramfs が有効化されている場合、 sys-kernel/linux-firmware
- 実行条件: initrd_generator!=dracut
- /usr/lib/kernel/preinst.d/35-intel-microcode.install
- CPU マイクロコードを含めない initramfs ジェネレーターを使用している場合、Intel CPU のマイクロコードの早期 initramfs をビルドします。
- インストール元: initramfs が有効化されている場合、 sys-firmware/intel-microcode
- 実行条件: initrd_generator!=dracut
- /usr/lib/kernel/preinst.d/50-dracut.install
- dracut を使用して initramfs または Unified カーネルイメージ (UKI) をビルドします。initramfs ではなく UKI をビルドするには、 /etc/dracut.conf で uefi=yes と設定してください。
- インストール元: dracut USE フラグが有効化されている場合、 sys-kernel/installkernel
- 実行条件: initrd_generator=dracut
- /usr/lib/kernel/preinst.d/52-ugrd.install
- ugrd initramfs ジェネレーターを使用してinitramfs をビルドします。
- インストール元: sys-kernel/ugrd
- 実行条件: initrd_generator=ugrd .
- /usr/lib/kernel/preinst.d/60-ukify.install
- systemd の ukify を使用して Unified カーネルイメージをビルドします。これには、既に別のプラグインによって生成されたものがあれば、initramfs が組み込まれます。
- インストール元: ukify USE フラグが有効化されている場合、 sys-kernel/installkernel
- 実行条件: uki_generator=ukify and layout=uki .
- /usr/lib/kernel/preinst.d/99-check-diskspace.install
- カーネルのインストール先のパーティションに十分なディスク容量があるか確認します。
- インストール元: sys-kernel/installkernel
- 実行条件: 常時
postinst.d は、実行順に
- /usr/lib/kernel/postinst.d/40-dkms.install
- インストールされたカーネルに DKMS で登録されたカーネルモジュールを自動的に再ビルドします。
- インストール元: sys-kernel/dkms
- 実行条件: 常時
- /usr/lib/kernel/postinst.d/91-grub-mkconfig.install
- grub-mkconfig を実行して GRUB の設定を更新します。 EFI System Partition の EFI/Linux にある Unified カーネルイメージを自動的に検出します。使用する grub.cfg は GRUB_CFG 環境変数で上書きできます。
- インストール元: grub USE フラグが有効化されている場合、 sys-kernel/installkernel
- 実行条件: 常時
- /usr/lib/kernel/postinst.d/95-efistub-uefi-mkconfig.install
- sys-boot/uefi-mkconfig を使用して、新たにインストールしたカーネル用の UEFI ブートエントリーを追加し、削除されたカーネル用のエントリーを削除します。
- インストール元: efistub USE フラグが有効化されている場合、 sys-kernel/installkernel
- 実行条件: 常時
- /usr/lib/kernel/postinst.d/95-refind-copy-icon.install
- rEFInd ブートローダー用に、Gentoo のアイコンを (unified) カーネルイメージと同じ場所にインストールします。使用するアイコンファイルは REFIND_ICON 環境変数で上書きできます。
- インストール元: refind USE フラグが遊行されている場合、 sys-kernel/installkernel
- 実行条件: 常時
- /usr/lib/kernel/postinst.d/99-write-log.install
- 直近でインストールしたカーネルを /var/log/installkernel.log に追加し、 /var/lib/installkernel の状態ファイルを更新します。
- インストール元: sys-kernel/installkernel
- 実行条件: 常時
- /usr/lib/kernel/postinst.d/90-runlilo.install
- LILO の設定を更新します。
- インストール元: sys-boot/lilo
- 実行条件: 常時
USE 設定とブートレイアウトの対応関係
The code boxes below maps possible sys-kernel/installkernel USE configurations to how the kernel and related files will be installed. It may be useful for users who are unsure which USE configuration suits their setup. ESP refers to the mount point of the EFI System Partition which may be /efi , /boot , /boot/efi or {{Path|/boot/EFI}. generic-uki refers to the generic-uki USE flag on the Distribution kernels .
For all layouts (except for the bls type 1 layout for systemd-boot) sys-kernel/installkernel supports updating an unversioned symlink or file at the same location as the installed kernel images. For example, if the kernel images are installed as /efi/EFI/Gentoo/kernel-x.y.z-gentoo-dist.efi then /efi/EFI/Gentoo/kernel.efi will be updated every time a kernel is installed if this file or symlink exists.
Systemd kernel-install (USE=+systemd)
GRUB 使用時のレイアウト
Plain kernel image installation.
/boot/grub/grub.cfg
/boot/kernel-x.y.z-gentoo-dist
Plain kernel image installation, with initramfs generated by dracut.
/boot/grub/grub.cfg
/boot/initramfs-x.y.z-gentoo-dist.img
/boot/kernel-x.y.z-gentoo-dist
Plain kernel image installation, initramfs is pregenerated by the distribution kernel package.
/boot/grub/grub.cfg
/boot/initramfs-x.y.z-gentoo-dist.img
/boot/kernel-x.y.z-gentoo-dist
Unified カーネルイメージ使用時のレイアウト
Unified kernel image installation, uki is generated with ukify and is then installed to the ESP.
/boot/grub/grub.cfg
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
Unified kernel image installation, uki is generated with dracut and is then installed to the ESP.
/boot/grub/grub.cfg
</div>
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
Unified kernel image installation, uki is generated with ukify and includes a initramfs generated with dracut and is then installed to the ESP.
/boot/grub/grub.cfg
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
Unified kernel image installation, uki is pregenerated by the distribution kernel package.
/boot/grub/grub.cfg
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
systemd-boot 使用時のレイアウト
Plain kernel image installation.
/${ESP}/gentoo/x.y.z-gentoo-dist/linux
/${ESP}/loader/entries/gentoo-x.y.z-gentoo-dist.conf
Plain kernel image installation, with initramfs generated by dracut.
/${ESP}/gentoo/x.y.z-gentoo-dist/initrd
/${ESP}/gentoo/x.y.z-gentoo-dist/linux
/${ESP}/loader/entries/gentoo-x.y.z-gentoo-dist.conf
Plain kernel image installation, initramfs is pregenerated by the distribution kernel package.
/${ESP}/gentoo/x.y.z-gentoo-dist/initrd
/${ESP}/gentoo/x.y.z-gentoo-dist/linux
/${ESP}/loader/entries/gentoo-x.y.z-gentoo-dist.conf
Unified カーネルイメージ使用時のレイアウト
Unified kernel image installation, uki is generated with ukify and is then installed to the ESP.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
Unified kernel image installation, uki is generated with dracut and is then installed to the ESP.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
Unified kernel image installation, uki is generated with ukify and includes a initramfs generated with dracut and is then installed to the ESP.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
Unified kernel image installation, uki is pregenerated by the distribution kernel package.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
rEFInd 使用時のレイアウト
Plain kernel image installation with icon for rEFInd.
/boot/kernel-x.y.z-gentoo-dist
/boot/kernel-x.y.z-gentoo-dist.png
Plain kernel image installation, with a initramfs generated by dracut and icon for rEFInd.
/boot/initramfs-x.y.z-gentoo-dist.img
/boot/kernel-x.y.z-gentoo-dist
/boot/kernel-x.y.z-gentoo-dist.png
Plain kernel image installation with icon for rEFInd, initramfs is pregenerated by the distribution kernel package.
/boot/initramfs-x.y.z-gentoo-dist.img
/boot/kernel-x.y.z-gentoo-dist
/boot/kernel-x.y.z-gentoo-dist.png
Unified カーネルイメージ使用時のレイアウト
Unified kernel image installation with icon for rEFInd, uki is generated with ukify and is then installed to the ESP.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.png
Unified kernel image installation with icon for rEFInd, uki is generated with dracut and is then installed to the ESP.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.png
Unified kernel image installation with icon for rEFInd, uki is generated with ukify and includes a initramfs generated with dracut and is then installed to the ESP.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.png
Unified kernel image installation with icon for rEFInd, uki is pregenerated by the distribution kernel package.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.png
GRUB/systemd-boot/rEFInd (またはその他のブートローダ) 不使用時のレイアウト
Plain kernel image installation.
/boot/kernel-x.y.z-gentoo-dist
Plain kernel image installation, with a initramfs generated by dracut.
/boot/initramfs-x.y.z-gentoo-dist.img
/boot/kernel-x.y.z-gentoo-dist
Plain kernel image installation, initramfs is pregenerated by the distribution kernel package.
/boot/initramfs-x.y.z-gentoo-dist.img
/boot/kernel-x.y.z-gentoo-dist
Unified カーネルイメージ使用時のレイアウト
Unified kernel image installation, uki is generated with ukify and is then installed to the ESP.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
Unified kernel image installation, uki is generated with dracut and is then installed to the ESP.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
Unified kernel image installation, uki is generated with ukify and includes a initramfs generated with dracut and is then installed to the ESP.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
Unified kernel image installation, uki is pregenerated by the distribution kernel package.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
伝統的な installkernel (USE=-systemd)
GRUB 使用時のレイアウト
Plain kernel image installation.
/boot/System.map-x.y.z-gentoo-dist
/boot/config-x.y.z-gentoo-dist
/boot/grub/grub.cfg
/boot/vmlinuz-x.y.z-gentoo-dist
Plain kernel image installation, with initramfs generated by dracut.
/boot/System.map-x.y.z-gentoo-dist
/boot/config-x.y.z-gentoo-dist
/boot/grub/grub.cfg
/boot/initramfs-x.y.z-gentoo-dist.img
/boot/vmlinuz-x.y.z-gentoo-dist
Plain kernel image installation, initramfs is pregenerated by the distribution kernel package.
/boot/System.map-x.y.z-gentoo-dist
/boot/config-x.y.z-gentoo-dist
/boot/grub/grub.cfg
/boot/initramfs-x.y.z-gentoo-dist.img
/boot/vmlinuz-x.y.z-gentoo-dist
Unified カーネルイメージ使用時のレイアウト
Unified kernel image installation, with an uki generated by dracut ( uki has no effect since there is no unified kernel image).
/boot/grub/grub.cfg
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
Unified kernel image installation, uki is generated with ukify and is then copied to the ESP.
/boot/grub/grub.cfg
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
Unified kernel image installation, uki is generated with ukify and includes a initramfs generated with dracut and is then copied to the ESP.
/boot/grub/grub.cfg
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
Unified kernel image installation, uki is pregenerated by the distribution kernel package and is then copied to the ESP.
/boot/grub/grub.cfg
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
rEFInd 使用時のレイアウト
Plain kernel image installation with icon for rEFInd.
/boot/System.map-x.y.z-gentoo-dist
/boot/config-x.y.z-gentoo-dist
/boot/vmlinuz-x.y.z-gentoo-dist
/boot/vmlinuz-x.y.z-gentoo-dist.png
Plain kernel image installation, with a initramfs generated by dracut and icon for rEFInd.
/boot/System.map-x.y.z-gentoo-dist
/boot/config-x.y.z-gentoo-dist
/boot/initramfs-x.y.z-gentoo-dist.img
/boot/vmlinuz-x.y.z-gentoo-dist
/boot/vmlinuz-x.y.z-gentoo-dist.png
Plain kernel image installation with icon for rEFInd, initramfs is pregenerated by the distribution kernel package.
/boot/System.map-x.y.z-gentoo-dist
/boot/config-x.y.z-gentoo-dist
/boot/initramfs-x.y.z-gentoo-dist.img
/boot/vmlinuz-x.y.z-gentoo-dist
/boot/vmlinuz-x.y.z-gentoo-dist.png
Unified カーネルイメージ使用時のレイアウト
Unified kernel image installation, with a initramfs generated by dracut.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.png
Unified kernel image installation with icon for rEFInd, uki is generated with ukify and is then copied to the ESP.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.png
Unified kernel image installation with icon for rEFInd, uki is generated with ukify and includes a initramfs generated with dracut and is then copied to the ESP.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.png
Unified kernel image installation with icon for rEFInd, uki is pregenerated by the distribution kernel package and is then copied to the ESP.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.png
GRUB/systemd-boot/rEFInd (またはその他のブートローダ) 不使用時のレイアウト
Plain kernel image installation.
/boot/System.map-x.y.z-gentoo-dist
/boot/config-x.y.z-gentoo-dist
/boot/vmlinuz-x.y.z-gentoo-dist
Plain kernel image installation, with a initramfs generated by dracut.
/boot/System.map-x.y.z-gentoo-dist
/boot/config-x.y.z-gentoo-dist
/boot/initramfs-x.y.z-gentoo-dist.img
/boot/vmlinuz-x.y.z-gentoo-dist
Plain kernel image installation, initramfs is pregenerated by the distribution kernel package.
/boot/System.map-x.y.z-gentoo-dist
/boot/config-x.y.z-gentoo-dist
/boot/initramfs-x.y.z-gentoo-dist.img
/boot/vmlinuz-x.y.z-gentoo-dist
Unified カーネルイメージ使用時のレイアウト
Unified kernel image installation, with uki generated by dracut.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
Unified kernel image installation, uki is generated with ukify and is then copied to the ESP.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
Unified kernel image installation, uki is generated with ukify and includes a initramfs generated with dracut and is then copied to the ESP.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
Unified kernel image installation, uki is pregenerated by the distribution kernel package and is then copied to the ESP.
/${ESP}/EFI/Linux/gentoo-x.y.z-gentoo-dist.efi
関連項目
- GRUB — 多くのシステムアーキテクチャ上で、様々な ファイルシステム からカーネルをロードすることができる、マルチブート 2 次 ブートローダ です。
- systemd-boot — a minimal UEFI boot manager.
- EFI stub — EFI スタブカーネル、つまり、UEFI から直接実行可能なカーネルについて記載します。
- initramfs — is used to prepare Linux systems during boot before the init process starts.
- Project:Distribution_Kernel — aims to maintain sys-kernel/*-kernel packages.