Add support for systemd-ukify

This commit is contained in:
Alexandre CATTEAU 2024-08-15 17:15:48 +02:00
parent 32849372ad
commit f8e40e26a9
2 changed files with 14 additions and 6 deletions

View File

@ -8,6 +8,7 @@ The auto-update of this script should be disabled! Make sure to create `.disable
### Dependencies
Make sure that:
* if running Ubuntu 24.04+, Linux Mint 22+ or Debian 13+, `systemd-ukify` is installed
* `binutils`, `efibootmgr` and `systemd-boot-efi` packages are installed
* you [install](https://wiki.archlinux.org/title/Unified_kernel_image#Directly_from_UEFI) the UKI to your EFI
configuration

View File

@ -11,12 +11,19 @@ else
fi
# Build UKI
$sudo objcopy \
--add-section .osrel=/etc/os-release --change-section-vma .osrel=0x20000 \
--add-section .cmdline="/etc/kernel/cmdline" --change-section-vma .cmdline=0x30000 \
--add-section .linux="$path_to_vmlinuz_link/vmlinuz" --change-section-vma .linux=0x40000 \
--add-section .initrd="$path_to_vmlinuz_link/initrd.img" --change-section-vma .initrd=0x3000000 \
/usr/lib/systemd/boot/efi/linuxx64.efi.stub $path_to_uki
if [ -x /usr/bin/ukify ]; then
echo "Building UKI using systemd-ukify..."
$sudo ukify build --linux $path_to_vmlinuz_link/vmlinuz --initrd $path_to_vmlinuz_link/initrd.img \
--cmdline @/etc/kernel/cmdline --output $path_to_uki
else
echo "Building UKI using objcopy..."
$sudo objcopy \
--add-section .osrel=/etc/os-release --change-section-vma .osrel=0x20000 \
--add-section .cmdline="/etc/kernel/cmdline" --change-section-vma .cmdline=0x30000 \
--add-section .linux="$path_to_vmlinuz_link/vmlinuz" --change-section-vma .linux=0x40000 \
--add-section .initrd="$path_to_vmlinuz_link/initrd.img" --change-section-vma .initrd=0x3000000 \
/usr/lib/systemd/boot/efi/linuxx64.efi.stub $path_to_uki
fi
# Sign UKI
if [[ -v secureboot_enabled ]] && [[ $secureboot_enabled = "yes" ]]; then