projg2 / installkernel-gentoo

Gentoo fork of installkernel from debianutils
GNU General Public License v2.0
19 stars 7 forks source link

Install icons for refind #17

Closed Nowa-Ammerlaan closed 9 months ago

Nowa-Ammerlaan commented 10 months ago

Still needs verification that refind will actually pick up the icon.

Closes: https://github.com/projg2/installkernel-gentoo/issues/16

JohnTheCoolingFan commented 9 months ago

I've tested these scripts with the USE flags you told me to try in the issue. I've changed layout to compat when trying USE="systemd -uki +/-ukify". Here are the results:

  1. USE="systemd uki ukify": worked immediately, autodetected in ESP
  2. USE="systemd -uki ukify": didn't work until my patch, autodetected in btrfs subvolume
  3. USE="systemd -uki -ukify": same as above
  4. USE="-systemd uki ukify": worked immediately, autodetected in ESP
  5. USE="-systemd -uki ukify": didn't work, the script put the icon file to ESP, but the kernel was installed to /boot
  6. USE="-systemd -uki -ukify": worked, the icon file was installed correctly. Autodetected from btrfs subvolume.

My patch for 2 and 3 was this:

17c17
<       cp "${ICON}" "${KERNEL_INSTALL_BOOT_ROOT}/kernel-${KERNEL_VERSION}.png" || exit 1
---
>       cp "${ICON}" "${KERNEL_INSTALL_BOOT_ROOT}/vmlinuz-${KERNEL_VERSION}.png" || exit 1

Do note that I only patched it for add, not for remove.

JohnTheCoolingFan commented 9 months ago

Also, the script copies the icon provided by the refind package, but many users of rEFInd change the theme and icons using configuration in ESP. I suggest adding an environment variable or something to configure the directory to take the icon file from.

Nowa-Ammerlaan commented 9 months ago

I've tested these scripts with the USE flags you told me to try in the issue. I've changed layout to compat when trying USE="systemd -uki". Here are the results:

1. `USE="systemd uki ukify"`: worked immediately, autodetected in ESP

2. `USE="systemd -uki ukify"`: didn't work until my patch, autodetected in btrfs subvolume

This is a bit strange, with +systemd the kernel is always named 'kernel' not 'vmlinuz'. The 'vmlinuz' image is installed by -systemd. Are you sure this vmlinuz image wasn't left over from an install with -systemd? If you don't have the latest version of installkernel then it may have installed the kernel in the bls layout (this used to be the default prior to version 20).

3. `USE="systemd -uki -ukify"`: same as above

4. `USE="-systemd uki ukify"`: worked immediately, autodetected in ESP

5. `USE="-systemd -uki ukify"`: didn't work, the script put the icon file to ESP, but the kernel was installed to `/boot`

Hmm, the issue here I think is that the -systemd plugin checks if there is an UKI for this kernel version on the ESP and installs the plugin for that if there is. Probably this UKI was still left over by case 4, which then causes this problem here in case 5. I'm not sure if we can improve this though, since the -systemd installkernel has no mechanism of finding out which layout is used.

6. `USE="-systemd -uki -ukify"`: worked, the icon file was installed correctly. Autodetected from btrfs subvolume.

Also, the script copies the icon provided by the refind package, but many users of rEFInd change the theme and icons using configuration in ESP. I suggest adding an environment variable or something to configure the directory to take the icon file from.

This makes sense, I'll make this overridable.

JohnTheCoolingFan commented 9 months ago

Oh, sorry for spoiling the test results, I have installkernel version 19 installed. I'll update and see how it works with USE="systemd -uki +/-ukify"

Also, I specified that in cases 2 and 3 I changed the default bls layout to compat

Nowa-Ammerlaan commented 9 months ago

Also, I specified that in cases 2 and 3 I changed the default bls layout to compat

Right, sorry I missed that. In version 19 layout=compat does not exist, so neither 90-loadentry.install nor 90-uki-copy.install will do anything and due to the lack of 90-compat.install nothing will be installed at all.

The push just now makes the icon file overridable by setting REFIND_ICON=/my/icon.png in the environment.

JohnTheCoolingFan commented 9 months ago

OK, after updating installkernel to version 24 and systemd to 255, the cases 2 and 3 now work without changing to vmlinuz prefix, and the kernel is installed as kernel-<...>.

Nowa-Ammerlaan commented 9 months ago

OK, after updating installkernel to version 24 and systemd to 255, the cases 2 and 3 now work without changing to vmlinuz prefix, and the kernel is installed as kernel-<...>.

Great!

I think I have a fix for case 5, which I will push in a bit.

JohnTheCoolingFan commented 9 months ago

Small question: where do I set the REFIND_ICON env var? I've tried to do that in make.conf, but it didn't work.

Nowa-Ammerlaan commented 9 months ago

Small question: where do I set the REFIND_ICON env var? I've tried to do that in make.conf, but it didn't work.

Anywhere in the environment e.g. /etc/env.d/, bashrc, zshrc. Or simply as REFIND_ICON="/my/icon.png" make install

Perhaps make.conf will also work, but it will require a full re-emerge of gentoo-kernel(-bin) because emerge --config gentoo-kernel(-bin) retains the original environment.

The push just now should work better for case 5 I think. Now in -systemd we check both possible locations (ESP and /boot) and install icons there if our kernel image exists there, instead of exiting after we find one in ESP and then do nothing for /boot.

Nowa-Ammerlaan commented 9 months ago

@JohnTheCoolingFan Released as version 25. Thanks for testing!

JohnTheCoolingFan commented 9 months ago

Many thanks. My rEFInd setup will now become perfect!