diff --git a/iso/builder/build.sh b/iso/builder/build.sh index c4e0b5e..072d11a 100755 --- a/iso/builder/build.sh +++ b/iso/builder/build.sh @@ -111,6 +111,61 @@ resolve_iso_version() { resolve_audit_version } +validate_iso_memtest() { + iso_path="$1" + echo "=== validating memtest in ISO ===" + + [ -f "$iso_path" ] || { echo "ERROR: ISO not found for validation: $iso_path" >&2; exit 1; } + command -v bsdtar >/dev/null 2>&1 || { echo "ERROR: bsdtar is required for ISO validation" >&2; exit 1; } + + bsdtar -tf "$iso_path" | grep -q '^boot/memtest86+x64\.bin$' || { + echo "ERROR: memtest BIOS binary missing in ISO: boot/memtest86+x64.bin" >&2 + exit 1 + } + bsdtar -tf "$iso_path" | grep -q '^boot/memtest86+x64\.efi$' || { + echo "ERROR: memtest EFI binary missing in ISO: boot/memtest86+x64.efi" >&2 + exit 1 + } + + grub_cfg="$(mktemp)" + isolinux_cfg="$(mktemp)" + trap 'rm -f "$grub_cfg" "$isolinux_cfg"' EXIT INT TERM + + bsdtar -xOf "$iso_path" boot/grub/grub.cfg > "$grub_cfg" || { + echo "ERROR: failed to extract boot/grub/grub.cfg from ISO" >&2 + exit 1 + } + bsdtar -xOf "$iso_path" isolinux/live.cfg > "$isolinux_cfg" || { + echo "ERROR: failed to extract isolinux/live.cfg from ISO" >&2 + exit 1 + } + + grep -q 'Memory Test (memtest86+)' "$grub_cfg" || { + echo "ERROR: GRUB menu entry for memtest is missing" >&2 + exit 1 + } + grep -q '/boot/memtest86+x64\.efi' "$grub_cfg" || { + echo "ERROR: GRUB memtest EFI path is missing" >&2 + exit 1 + } + grep -q '/boot/memtest86+x64\.bin' "$grub_cfg" || { + echo "ERROR: GRUB memtest BIOS path is missing" >&2 + exit 1 + } + grep -q 'Memory Test (memtest86+)' "$isolinux_cfg" || { + echo "ERROR: isolinux menu entry for memtest is missing" >&2 + exit 1 + } + grep -q '/boot/memtest86+x64\.bin' "$isolinux_cfg" || { + echo "ERROR: isolinux memtest path is missing" >&2 + exit 1 + } + + rm -f "$grub_cfg" "$isolinux_cfg" + trap - EXIT INT TERM + echo "=== memtest validation OK ===" +} + AUDIT_VERSION_EFFECTIVE="$(resolve_audit_version)" ISO_VERSION_EFFECTIVE="$(resolve_iso_version)" @@ -522,6 +577,7 @@ fi ISO_RAW="${LB_DIR}/live-image-amd64.hybrid.iso" ISO_OUT="${DIST_DIR}/easy-bee-${BEE_GPU_VENDOR}-v${ISO_VERSION_EFFECTIVE}-amd64.iso" if [ -f "$ISO_RAW" ]; then + validate_iso_memtest "$ISO_RAW" cp "$ISO_RAW" "$ISO_OUT" echo "" echo "=== done (${BEE_GPU_VENDOR}) ===" diff --git a/iso/builder/config/bootloaders/grub-pc/grub.cfg b/iso/builder/config/bootloaders/grub-pc/grub.cfg index 997e06c..3d33e47 100644 --- a/iso/builder/config/bootloaders/grub-pc/grub.cfg +++ b/iso/builder/config/bootloaders/grub-pc/grub.cfg @@ -29,6 +29,16 @@ menuentry "EASY-BEE (fail-safe)" { initrd @INITRD_LIVE@ } +if [ "${grub_platform}" = "efi" ]; then + menuentry "Memory Test (memtest86+)" { + chainloader /boot/memtest86+x64.efi + } +else + menuentry "Memory Test (memtest86+)" { + linux16 /boot/memtest86+x64.bin + } +fi + if [ "${grub_platform}" = "efi" ]; then menuentry "UEFI Firmware Settings" { fwsetup diff --git a/iso/builder/config/bootloaders/isolinux/live.cfg.in b/iso/builder/config/bootloaders/isolinux/live.cfg.in index d3ba140..4290606 100644 --- a/iso/builder/config/bootloaders/isolinux/live.cfg.in +++ b/iso/builder/config/bootloaders/isolinux/live.cfg.in @@ -22,3 +22,7 @@ label live-@FLAVOUR@-failsafe linux @LINUX@ initrd @INITRD@ append @APPEND_LIVE@ bee.nvidia.mode=gsp-off memtest noapic noapm nodma nomce nolapic nosmp vga=normal + +label memtest + menu label ^Memory Test (memtest86+) + linux /boot/memtest86+x64.bin