From 778efabe6ceb2475afe8a782dcfcb65dd0e026ce Mon Sep 17 00:00:00 2001 From: tiyn Date: Thu, 21 Aug 2025 04:49:23 +0200 Subject: [PATCH] linux: added and moved kernel options to mkinitcpio --- wiki/linux/kernel.md | 41 -------------------- wiki/linux/mkinitcpio.md | 84 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 83 insertions(+), 42 deletions(-) delete mode 100644 wiki/linux/kernel.md diff --git a/wiki/linux/kernel.md b/wiki/linux/kernel.md deleted file mode 100644 index 922c55f..0000000 --- a/wiki/linux/kernel.md +++ /dev/null @@ -1,41 +0,0 @@ -# Kernel - -The [Linux](/wiki/linux.md) kernel is an open-source Unix-like computer operating system kernel. - -## Versions - -There are a few possible kernel version. - -### Stable-Version: `linux` - -The stable version of the [Linux](/wiki/linux.md) kernel can usually be found in a package called -`linux` and is usually installed from the start or in the recommended setup. - -### Zen-Version: `linux-zen` - -The zen kernel is a collaborative project of kernel hackers to provide the best -[Linux](/wiki/linux.md) kernel for everyday systems. -Especially the response time of the system under load -[is said to be better](https://github.com/zen-kernel/zen-kernel/wiki/Detailed-Feature-List#zen-kernel-improvements). -This will - for example - make the system less stuttery when something is compiled. -Desktop and gaming systems will benefit the most. - -To setup the zen kernel do the following. Firstly install the packages `linux-zen` and -`linux-zen-header`. -Afterwards open the file `boot/loader/entries/arch.conf` and change the following lines. - -```txt -linux /vmlinuz-linux -initrd /initramfs-linux.img -``` - -To look like the following lines. - -```txt -linux /vmlinuz-linux-zen -initrd /initramfs-linux-zen.img -``` - -If you want to switch the backup to Zen too, the backup file in `boot/loader/entries/` has to be -changed too. -Afterwards the system should be rebooted for the change to take effect. diff --git a/wiki/linux/mkinitcpio.md b/wiki/linux/mkinitcpio.md index b4ddc09..663bcb1 100644 --- a/wiki/linux/mkinitcpio.md +++ b/wiki/linux/mkinitcpio.md @@ -1,8 +1,68 @@ # mkinitcpio `mkinitcpio` is a script to create an initial ramdisk environment. +This environment provides the [Linux](/wiki/linux.md) kernel, containing essential drivers and +utilities required at boot. -## Usage +## Kernel Versions + +There are a few possible kernel version that can be used by `mkinitcpio`. + +### Stable-Version: `linux` + +The stable version of the [Linux](/wiki/linux.md) kernel can usually be found in a package called +`linux` and is usually installed from the start or in the recommended setup. + +### Zen-Version: `linux-zen` + +The zen kernel is a collaborative project of kernel hackers to provide the best +[Linux](/wiki/linux.md) kernel for everyday systems. +Especially the response time of the system under load +[is said to be better](https://github.com/zen-kernel/zen-kernel/wiki/Detailed-Feature-List#zen-kernel-improvements). +This will - for example - make the system less stuttery when something is compiled. +Desktop and gaming systems will benefit the most. + +To setup the zen kernel do the following. Firstly install the packages `linux-zen` and +`linux-zen-header`. +Afterwards open the file `boot/loader/entries/arch.conf` and change the following lines. + +```txt +linux /vmlinuz-linux +initrd /initramfs-linux.img +``` + +To look like the following lines. + +```txt +linux /vmlinuz-linux-zen +initrd /initramfs-linux-zen.img +``` + +If you want to switch the backup to Zen too, the backup file in `boot/loader/entries/` has to be +changed too. +Afterwards the system should be rebooted for the change to take effect. + +## Usage + +The following addresses various usage and configuration choices for mkinitcpio. + +### Default and Fallback Images + +It is recommended to have at least one default and one fallback version for kernels. +After the initial generation of the kernel the configuration file can be found in the +`/etc/mkinitcpio.d` directory. +For the [`linux`-kernel](#stable-version-linux) it would contain `linux.preset` and for the +[`linux-zen`-kernel](#zen-version-linux-zen) `linux-zen.preset`. +Inside these preset files the following line manages the generation of a default or fallback image. + +```txt +PRESETS=('default' 'fallback') +``` + +Notice that the options are separated only by a space. +To just build a fallback image remove `'default'` or vice versa. + +Afterwards the initial ramdisk has to be [rebuild](#manually-generate-initial-ramdisk). ### Manually Generate Initial Ramdisk @@ -20,6 +80,22 @@ But it is also possible to (re-)generate all available presets with the followin mkinitcpio -P ``` +### Enable/Disable Compression + +To save space on the boot partition the kernel images can be compressed. +To enable compression activate it in `/etc/mkinitcpio.conf` under `COMPRESSION=`. +In the configuration file some compression algorithms are recommended. +Additionally compression options can be set under `COMPRESSION_OPTIONS=`. +An easily usable example for this is the following line. + +```txt +COMPRESSION_OPTIONS=(-v -5 --long) +``` + +To disable compression remove the corresponding lines. +After enabling and disabling of the compression the initial ramdisk has to be +[rebuild](#manually-generate-initial-ramdisk). + ## Troubleshooting This section addresses various errors that can happen when using mkinitcpio. @@ -47,3 +123,9 @@ A simple table that shows firmware modules and corresponding [Arch Linux](/wiki/linux/arch-linux.md) packages is shown on the [Arch Linux wiki](https://wiki.archlinux.org/title/Mkinitcpio#Possibly_missing_firmware_for_module_XXXX). +### `No space left on device` + +If this error or one similar to this is shown the boot partition is filled up completely during the +generation of the initial ramdisk. +This can be fixed by either [compressing the image](#enabledisable-compression) or by +[disabling unused fallbacks](#default-and-fallback-images).