Adding a custom initrd entry to systemd-boot and make it persist

Hi,
I own a ASUS ROG Strix G16 laptop and like many other ASUS laptops it requires a custom Cirrus patch to be loaded during boot (see guide). Before on another Linux distro I simply added it to GRUB_EARLY_INITRD_LINUX_CUSTOM="patched_cirrus_acpi.cpio" but now I’m using systemd-boot and I’m having a hard time to understand how to make it work for all boot entries and not just one.

I have multiple kernels installed (mainline, g14, zen etc) and right now I only have the patch installed for zen.

When trying to make the patch load with system I moved the file to the efi/<ID>/<KERNEL_VERSION> folder and then changed my boot entry config to this:

title      EndeavourOS
version    6.4.11-zen2-1-zen
machine-id 52274c62f6014527874c27f0d0c2bf36
sort-key   endeavouros-6.4.11-zen2-1-zen
options    nvidia-drm.modeset=1 nvme_load=YES nowatchdog rw root=UUID=6047ecbb-896d-4445-b4bc-3c20036d3e4a systemd.machine_id=52274c62f6014527874c27f0d0c2bf36
linux      /52274c62f6014527874c27f0d0c2bf36/6.4.11-zen2-1-zen/linux
initrd     /52274c62f6014527874c27f0d0c2bf36/6.4.11-zen2-1-zen/patched_cirrus_acpi.cpio # here's the patch
initrd     /52274c62f6014527874c27f0d0c2bf36/6.4.11-zen2-1-zen/initrd

It worked, but any time I would run reinstall-kernels it would regenerate boot entries and make me have to add the missing initrd /..../patched_cirrus_acpi.cpio file again. Is it possible somehow with Dracut to make this change persistent and have it across all boot entries, not just one?

I suppose this can be done somehow via kernel-install? I couldn’t figure out some of the parameters so below I’ll show what I know,

$ sudo kernel-install add 6.5.0-rc6-1-mainline /efi/52274c62f6014527874c27f0d0c2bf36 [image file?] [custom initrd or both initrd?]

My inxi -FAZ output: http://ix.io/4ErS

What did you add there specifically?

excuse me, not GRUB_CMDLINE_LINUX, that: GRUB_EARLY_INITRD_LINUX_CUSTOM="patched_cirrus_acpi.cpio"

Eh…the way I have customized the scripts prevents doing that easily right now.

If you can live with it until the weekend I will modify kernel-install-for-dracut to make it easier.

1 Like

sure, I’m okay to wait

1 Like

which packages should I update btw to be able to test this feature when it’s going to be implemented?

kernel-install-for-dracut

I plan to work on it today.

This is now available in kernel-install-for-dracut 1.9. You can either install it from AUR or wait for the updated package to hit the repos.

To get your image added to automatically, you need to add a script named /etc/kernel/install.d/55-cirrus.install

The contents should be something like this:

#!/bin/sh

cp /path/to/patched_cirrus_acpi.cpio ${KERNEL_INSTALL_STAGING_AREA}/initrd-cirrus

Then sudo chmod a+x /etc/kernel/install.d/55-cirrus.install to make it executable.

Then run sudo reinstall-kernels.

Check the entries and ensure they are correct.

Going forward, it should automatically be added whenever a new kernel is added.

NOTE: Once moved to the staging area the filename needs to start with initrd but not be exactly initrd

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.