Rework memtest handling, incl. usage of latest available memtest file
authorMichael Prokop <mika@grml.org>
Mon, 16 Oct 2023 11:11:18 +0000 (13:11 +0200)
committerMichael Prokop <mika@grml.org>
Mon, 16 Oct 2023 18:26:42 +0000 (20:26 +0200)
commit1a9a788fa46053e882e7332c6403b59ff8d437f1
tree182b2bbfcd7fde68c6d3de2c7d7980b60ca33a33
parentf365415eff8ae0f96611bc16aa3ac30868a609d5
Rework memtest handling, incl. usage of latest available memtest file

If we try to copy the memtest86+.bin file as shipped with memtest86+
versions <=5.01-3.1, we either copy such an old file from the build
directory (grml_chroot), or if that doesn't exist (e.g. because the
memtest86+ package isn't installed), we might end up copying an old
memtest file from the build host system instead.

AS ${BUILD_OUTPUT}/boot/addons/memtest exists already then, we don't
update the file any longer (e.g. from a more recent memtest86+ package),
and therefore end up with an old and outdated memtest version in BIOS
boot, while EFI boot provides a more recent memtest version. This is
inconsistent and unexpected behavior.

So instead try to use the most recent version of memtest86* files first,
and only then fall back to the old memtest86+ <=5.01-3.1 file behavior.

While looking into this, I also noticed that until memtest86+ versions
<=6.10-2 it used to be named memtest86+x32.bin, while as of memtest86+
versions >=6.10-3 it's memtest86+ia32.bin instead. As we have version
6.10-4 in bookworm/stable and only pre-6 version 5.01-3.1 in e.g.
bullseye/oldstable, let's skip any backwards compatibility for
memtest86+x32.bin.

Furthermore while at it, drop duplicate execution of `copy_addon_file
memtest86+x64.bin /boot addons` and `copy_addon_file memtest86+x32.bin
/boot addons` to avoid ending up with further duplicate files on the
ISO. So related to https://github.com/grml/grml-live/issues/128, we now
ship /boot/addons/memtest on each of grml64 + grml32, and respectively
only /boot/addons/memtest86+x64.efi on grml64 only and
/boot/addons/memtest86+ia32.efi on grml32 only. To rename the files into
FAT16/8.3 compatible "/boot/addons/memtest", let's provide a proper
return code from within copy_addon_file() if we couldn't find any
matching file.

Related to https://github.com/grml/grml-live/issues/128

Closes: https://github.com/grml/grml/issues/178
grml-live
templates/boot/grub/addons.cfg