You are not logged in.

#1 2023-09-11 07:16:35

LunarLambda
Member
Registered: 2021-08-02
Posts: 6

[SOLVED]mkinitcpio: Generate UKI without copying kernel to /boot first

Using systemd-boot, mkinitcpio's UKI generation support and systemd-gpt-generator, it is possible to create a system that is essentially "zero configuration",
meaning no fstab, no crypttab (for autodetected LUKS partitions) and no kernel command line (at least no root= option)

I already have this part working. My system boots and updates seamlessly.

This leaves /boot almost entirely empty, as systemd-boot and the UKIs land in /efi, except for the vmlinuz-linux binary, which is copied by the mkinitcpio pacman hook to /boot.

Ideally I'd like to get rid of this extraneous copy and just let mkinitcpio grab the latest kernel directly from /usr/lib.
I know the preset_kver option can take a kernel version rather than an absolute path, however I'm unsure how to make it grab the freshly installed kernel version.

Is there a straightforward way to do this? Should I simply create a post-generation hook that deletes the file from /boot again?
Ideally I want to try and get rid of /boot entirely, mostly to see if it's possible (it should be, as the mkinitcpio hook is optional)

Last edited by LunarLambda (2023-12-05 10:11:05)

Offline

#2 2023-12-05 10:10:03

LunarLambda
Member
Registered: 2021-08-02
Posts: 6

Re: [SOLVED]mkinitcpio: Generate UKI without copying kernel to /boot first

I figured out I can get the kernel version with `ALL_kver=$(pacman -Qql linux | grep 'vmlinuz$')`, but microcode packages install directly into `/boot`, so no getting rid of that after all.

Offline

#3 2023-12-05 11:09:46

icar
Member
From: Catalunya
Registered: 2020-07-31
Posts: 469

Re: [SOLVED]mkinitcpio: Generate UKI without copying kernel to /boot first

You can always install the firmware temporarily in a different root (https://man.archlinux.org/man/pacman.8#OPTIONS) like /tmp, and remove it afterwards. I don't know how of a good idea that is, though.

Offline

Board footer

Powered by FluxBB