--- /dev/null
+#!/usr/bin/env bash
+########################################################
+# This script generates a memtest86+ entry on grub.cfg #
+# if memtest is installed on the system. #
+########################################################
+
+prefix="/usr"
+exec_prefix="${prefix}"
+
+datarootdir="/usr/share"
+datadir="${datarootdir}"
+
+. "${datadir}/grub/grub-mkconfig_lib"
+
+MEMTEST86_IMAGE="/boot/memtest86+/memtest.bin"
+CLASS="--class memtest86 --class gnu --class tool"
+
+if [ -e "${MEMTEST86_IMAGE}" ] && is_path_readable_by_grub "${MEMTEST86_IMAGE}" ; then
+ ## image exists, create menu entry
+ echo "Found memtest86+ image: ${MEMTEST86_IMAGE}" >&2
+ _GRUB_MEMTEST_HINTS_STRING="$(${grub_probe} --target=hints_string ${MEMTEST86_IMAGE})"
+ _GRUB_MEMTEST_FS_UUID="$(${grub_probe} --target=fs_uuid ${MEMTEST86_IMAGE})"
+ _GRUB_MEMTEST_REL_PATH="$(make_system_path_relative_to_its_root ${MEMTEST86_IMAGE})"
+ cat << EOF
+if [ "\${grub_platform}" == "pc" ]; then
+ menuentry "Memory Tester (memtest86+)" ${CLASS} {
+ search --fs-uuid --no-floppy --set=root ${_GRUB_MEMTEST_HINTS_STRING} ${_GRUB_MEMTEST_FS_UUID}
+ linux16 ${_GRUB_MEMTEST_REL_PATH} ${GRUB_CMDLINE_MEMTEST86}
+ }
+fi
+EOF
+fi
--- /dev/null
+#!/usr/bin/env bash
+########################################################
+# This script generates a memtest86+ entry on grub.cfg #
+# if memtest is installed on the system. #
+########################################################
+
+prefix="/usr"
+exec_prefix="${prefix}"
+
+datarootdir="/usr/share"
+datadir="${datarootdir}"
+
+. "${datadir}/grub/grub-mkconfig_lib"
+
+MEMTEST86_IMAGE="/boot/memtest86+/memtest.efi"
+CLASS="--class memtest86 --class gnu --class tool"
+
+if [ -e "${MEMTEST86_IMAGE}" ] && is_path_readable_by_grub "${MEMTEST86_IMAGE}" ; then
+ ## image exists, create menu entry
+ echo "Found memtest86+ EFI image: ${MEMTEST86_IMAGE}" >&2
+ _GRUB_MEMTEST_HINTS_STRING="$(${grub_probe} --target=hints_string ${MEMTEST86_IMAGE})"
+ _GRUB_MEMTEST_FS_UUID="$(${grub_probe} --target=fs_uuid ${MEMTEST86_IMAGE})"
+ _GRUB_MEMTEST_REL_PATH="$(make_system_path_relative_to_its_root ${MEMTEST86_IMAGE})"
+ cat << EOF
+if [ "\${grub_platform}" == "efi" ]; then
+ menuentry "Memory Tester (memtest86+)" ${CLASS} {
+ if loadfont unicode ; then
+ set gfxmode=1024x768,800x600,auto
+ set gfxpayload=800x600,1024x768
+ terminal_output gfxterm
+ fi
+ search --fs-uuid --no-floppy --set=root ${_GRUB_MEMTEST_HINTS_STRING} ${_GRUB_MEMTEST_FS_UUID}
+ linux ${_GRUB_MEMTEST_REL_PATH} ${GRUB_CMDLINE_MEMTEST86}
+ }
+fi
+EOF
+fi
+++ /dev/null
-#!/bin/sh
-set -e
-
-# older versions of grub2 do not have this yet (LP: #459080)
-if [ ! -e /usr/lib/grub/grub-mkconfig_lib ]; then
- echo "no grub-mkconfig_lib, exiting"
- exit 0
-fi
-
-. /usr/lib/grub/grub-mkconfig_lib
-
-# We can't cope with loop-mounted devices here.
-case ${GRUB_DEVICE_BOOT} in
- /dev/loop/*|/dev/loop[0-9])
- exit 0
- ;;
-esac
-
-if test -e /boot/memtest86+; then
- MEMTESTPATH=$( make_system_path_relative_to_its_root "/boot/memtest86+" )
- echo "Found memtest86+ image: $MEMTESTPATH" >&2
- cat << EOF
-menuentry "Memory test (memtest86+)" {
-EOF
- prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
- printf '%s\n' "${prepare_boot_cache}"
- cat << EOF
- linux16 $MEMTESTPATH
-}
-menuentry "Memory test (memtest86+, serial console 115200)" {
-EOF
- printf '%s\n' "${prepare_boot_cache}"
- cat << EOF
- linux16 $MEMTESTPATH console=ttyS0,115200n8
-}
-EOF
-fi
###############################################################################
name = memtest86+
-version = 4.20
-release = 4
-sup_arches = i686 x86_64
+version = 6.00
+release = 1
+thisapp = memtest86plus-%{version}
+sup_arches = x86_64
groups = System/Base
url = http://www.memtest.org/
license = GPLv2
-summary = Stand-alone memory tester for x86 and x86-64 computers.
+summary = Stand-alone memory tester for x86 and x86-64 computers
description
Memtest86+ is a thorough stand-alone memory test for x86 and x86-64
Memtest86+.
end
-source_dl =
+source_dl = https://github.com/memtest86plus/memtest86plus/archive/refs/tags/%{version}.tar.gz#/
+sources = %{thisapp}.tar.gz
build
- CFLAGS += -fno-builtin -ffreestanding
+ requires
+ dosfstools
+ end
build
- make CC="gcc -fno-stack-protector -fno-PIE" \
- CFLAGS="%{CFLAGS}" memtest.bin %{PARALLELISMFLAGS}
+ make -C build64 memtest.bin memtest.efi %{PARALLELISMFLAGS}
end
install
- mkdir -pv %{BUILDROOT}/boot
- cp -vf memtest.bin %{BUILDROOT}/boot/memtest86+
+ mkdir -pv %{BUILDROOT}/boot/memtest86+
+ install -v -m 644 build64/memtest.{bin,efi} %{BUILDROOT}/boot/memtest86+/
- mkdir -pv %{BUILDROOT}/etc/grub.d
- cp -vf %{DIR_SOURCE}/%{name}.grub %{BUILDROOT}/etc/grub.d/20_%{name}
+ mkdir -pv %{BUILDROOT}%{sysconfdir}/grub.d
+ install -v -m 644 %{DIR_SOURCE}/60_memtest86+{,-efi} %{BUILDROOT}%{sysconfdir}/grub.d/
end
end
packages
package %{name}
+ recommends
+ %{name}-efi = %{thisver}
+ end
+
+ files
+ /boot/memtest86+/memtest.bin
+ %{sysconfdir}/grub.d/60_memtest86+
+ end
+ end
+
+ package %{name}-efi
+ summary = Memory Test for EFI systems
+
+ files
+ /boot/memtest86+/memtest.efi
+ %{sysconfdir}/grub.d/60_memtest86+-efi
+ end
+ end
end