Allow separate kernel cmd for current system

This commit adds the requirement for a new kernel command line file at
`/etc/snap-pac-uki/kernel-cmd-current`. When generating current ukis, this file
will be used for the non-fallback variant instead of the generic `kernel-cmd`.

The reason for this change is hibernating. When saving the system state to RAM,
users might not want snapshot varints to resume from there. Previosly, this
would not have been a possible configuration.
This commit is contained in:
Adrian Wannenmacher 2021-10-17 02:17:46 +02:00
parent 944e65bdae
commit 107721ef8f
Signed by: tfld
GPG Key ID: 19D986ECB1E492D5
2 changed files with 6 additions and 2 deletions

View File

@ -22,6 +22,9 @@ The fallback initramfs (`/boot/initramfs-linux-fallback.img`) and fallback
command line file (`/etc/snap-pac-uki/kernel-cmd-fallback`) are only required
on the current system.
Also the current command line file (`/etc/snap-pac-uki/kernel-cmd-current`)
needs is only required on the current system.
EFI boot options are only created for each snapshot. If you want the UKIs
created for the current system, you'll need to add boot entries yourself:

View File

@ -53,6 +53,7 @@ function create_uki -d "creates a new uki" -a variant id
switch $variant
case "rolling"
set bd "$CFG_BUILD_DIR/current"
set current "-current"
case "fallback"
set bd "$CFG_BUILD_DIR/current"
set fallback "-fallback"
@ -80,7 +81,7 @@ function create_uki -d "creates a new uki" -a variant id
# create uki
objcopy \
--add-section .osrel="$bd/os-release$fallback" --change-section-vma .osrel=0x20000 \
--add-section .cmdline="$bd/kernel-cmd$fallback" --change-section-vma .cmdline=0x30000 \
--add-section .cmdline="$bd/kernel-cmd$current$fallback" --change-section-vma .cmdline=0x30000 \
--add-section .splash="$prefix/usr/share/systemd/bootctl/splash-arch.bmp" --change-section-vma .splash=0x40000 \
--add-section .linux="$prefix/boot/vmlinuz-linux" --change-section-vma .linux=0x2000000 \
--add-section .initrd="$initrd" --change-section-vma .initrd=0x3000000 \
@ -129,7 +130,7 @@ function create_current_uki -d "creates an uki for the current system"
# create default
cp "/usr/lib/os-release" "$bd/os-release"
sed "s/SNAPSHOT/$CFG_DEFAULT_SUBVOL/" <"/etc/snap-pac-uki/kernel-cmd" >"$bd/kernel-cmd"
sed "s/SNAPSHOT/$CFG_DEFAULT_SUBVOL/" <"/etc/snap-pac-uki/kernel-cmd-current" >"$bd/kernel-cmd-current"
create_uki rolling
# create fallbac