]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Support the EFI Stub loader's splash image feature.
authorDonovan Tremura <neurognostic@protonmail.ch>
Sat, 15 Feb 2020 05:18:19 +0000 (05:18 +0000)
committerHarald Hoyer <harald@hoyer.xyz>
Thu, 20 Feb 2020 10:03:30 +0000 (11:03 +0100)
Checks if `uefi_splash_image` exists in `dracutsysroot` if not unset
`uefi_splash_image`. Alternate Value parameter expansion adds section-vma
for splash image to EFI stub loader when the path to image is valid and
not an empty file.

I did not test on other distributions, but on Arch Linux the `systemd`
package includes a splash image at the path
`/usr/share/systemd/bootctl/splash-arch.bmp`. Perhaps, if this is a
common practice, a default image could be gathered from that directory.

It is required that the image be in bitmap (`.bmp`) format according to
`splash.c`.

The code for `stub.c` and `splash.c` can be found at:
https://github.com/systemd/systemd/blob/master/src/boot/efi/stub.c
https://github.com/systemd/systemd/blob/master/src/boot/efi/splash.c

dracut.8.asc
dracut.conf.5.asc
dracut.sh

index d3f135db094817d5078c09e4c5701fb2b97aec1e..a873611e24a6ce1d708c9ce485694e3ece393f1a 100644 (file)
@@ -517,6 +517,10 @@ will not be able to boot.
     _$prefix/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
     or _$prefix/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
 
+**--uefi-splash-image _<FILE>_**::
+    Specifies the UEFI stub loader's splash image. Requires bitmap (**.bmp**) image
+    format.
+
 **--kernel-image _<FILE>_**::
     Specifies the kernel image, which to include in the UEFI executable. The default is
     _/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_
index b3bf6f442484347e4160bd283c0879408c43e175..937f54238592a4aac95cb445f306fbd8d8ba818f 100644 (file)
@@ -205,6 +205,9 @@ provide a valid _/etc/fstab_.
     _/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
     or _/usr/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
 
+*uefi_splash_image=*"_<FILE>_"::
+    Specifies the UEFI stub loader's splash image. Requires bitmap (**.bmp**) image format.
+
 *uefi_secureboot_cert=*"_<FILE>_", *uefi_secureboot_key=*"_<FILE>_"::
     Specifies a certificate and corresponding key, which are used to sign the created UEFI executable.
     Requires both certificate and key need to be specified and _sbsign_ to be installed.
index 6738dc91a90d2f706abd257b4aac024088a55b76..908d344812f40c3425d38a0cbcbd27af6e15fbfd 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -236,6 +236,9 @@ Creates initial ramdisk images for preloading modules
   --uefi                Create an UEFI executable with the kernel cmdline and
                         kernel combined
   --uefi-stub [FILE]    Use the UEFI stub [FILE] to create an UEFI executable
+  --uefi-splash-image [FILE]
+                        Use [FILE] as a splash image when creating an UEFI
+                        executable
   --kernel-image [FILE] location of the kernel image
 
 If [LIST] has multiple arguments, then you have to put these in quotes.
@@ -398,6 +401,7 @@ rearrange_params()
         --long loginstall: \
         --long uefi \
         --long uefi-stub: \
+        --long uefi-splash-image: \
         --long kernel-image: \
         --long no-hostonly-i18n \
         --long hostonly-i18n \
@@ -596,6 +600,8 @@ while :; do
         --uefi)        uefi="yes";;
         --uefi-stub)
                        uefi_stub_l="$2";               PARMS_TO_STORE+=" '$2'"; shift;;
+        --uefi-splash-image)
+                       uefi_splash_image_l="$2";       PARMS_TO_STORE+=" '$2'"; shift;;
         --kernel-image)
                        kernel_image_l="$2";            PARMS_TO_STORE+=" '$2'"; shift;;
         --no-machineid)
@@ -772,6 +778,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
 [[ $reproducible_l ]] && reproducible="$reproducible_l"
 [[ $loginstall_l ]] && loginstall="$loginstall_l"
 [[ $uefi_stub_l ]] && uefi_stub="$uefi_stub_l"
+[[ $uefi_splash_image_l ]] && uefi_splash_image="$uefi_splash_image_l"
 [[ $kernel_image_l ]] && kernel_image="$kernel_image_l"
 [[ $machine_id_l ]] && machine_id="$machine_id_l"
 
@@ -2018,11 +2025,14 @@ if [[ $uefi = yes ]]; then
 
     [[ -s $dracutsysrootdir/usr/lib/os-release ]] && uefi_osrelease="$dracutsysrootdir/usr/lib/os-release"
     [[ -s $dracutsysrootdir/etc/os-release ]] && uefi_osrelease="$dracutsysrootdir/etc/os-release"
+    [[ -s "${dracutsysrootdir}${uefi_splash_image}" ]] && \
+        uefi_splash_image="${dracutsysroot}${uefi_splash_image}" || unset uefi_splash_image
 
     if objcopy \
            ${uefi_osrelease:+--add-section .osrel=$uefi_osrelease --change-section-vma .osrel=0x20000} \
            --add-section .cmdline="${uefi_outdir}/cmdline.txt" --change-section-vma .cmdline=0x30000 \
-           --add-section .linux="$kernel_image" --change-section-vma .linux=0x40000 \
+           ${uefi_splash_image:+--add-section .splash="$uefi_splash_image" --change-section-vma .splash=0x40000} \
+           --add-section .linux="$kernel_image" --change-section-vma .linux=0x2000000 \
            --add-section .initrd="${DRACUT_TMPDIR}/initramfs.img" --change-section-vma .initrd=0x3000000 \
            "$uefi_stub" "${uefi_outdir}/linux.efi"; then
         if [[ -n "${uefi_secureboot_key}" && -n "${uefi_secureboot_cert}" ]]; then \