commit:     59b0932124c23e3088353d4992d5686b7d65ef82
Author:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
AuthorDate: Thu Dec  1 17:43:35 2022 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Dec  1 17:43:35 2022 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=59b09321

livecd-stage2: add memtest86+ detection for x86/amd64

When memtest86+ is detected, catalyst should now copy to the livecd and
add it to grub menus.

Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>

 targets/livecd-stage2/controller.sh |  4 ++++
 targets/support/bootloader-setup.sh | 23 +++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/targets/livecd-stage2/controller.sh 
b/targets/livecd-stage2/controller.sh
index 2b8858c0..9aba8167 100755
--- a/targets/livecd-stage2/controller.sh
+++ b/targets/livecd-stage2/controller.sh
@@ -93,6 +93,10 @@ case $1 in
                        cp -f ${clst_sharedir}/livecd/files/README.txt $1
                fi
 
+               if [ -e ${clst_chroot_path}/boot/memtest86plus/ ]; then
+                       cp -rv ${clst_chroot_path}/boot/memtest86plus/* $1
+               fi
+
                case ${clst_livecd_type} in
                        gentoo-release-livecd)
                                mkdir -p $1/snapshots

diff --git a/targets/support/bootloader-setup.sh 
b/targets/support/bootloader-setup.sh
index 08d25b59..deff5609 100755
--- a/targets/support/bootloader-setup.sh
+++ b/targets/support/bootloader-setup.sh
@@ -30,6 +30,28 @@ case ${clst_fstype} in
        ;;
 esac
 
+# Optional memtest setups
+memtest_grub() {
+  if [[ -e $1/memtest64.bios ]]; then
+    echo 'if [ "x$grub_platform" = xpc ]; then'
+    echo '  menuentry "Memtest86+ 64bit BIOS" {'
+    echo '    linux "/memtest64.bios"'
+    echo '  }'
+    echo 'fi'
+  fi
+  if [[ -e $1/memtest.efi64 ]]; then
+    echo 'if [ "x$grub_platform" = xefi ]; then'
+    echo '  menuentry "Memtest86+ 64bit UEFI" {'
+    echo '    chainloader "/memtest.efi64"'
+    echo '  }'
+    echo 'fi'
+  fi
+  if [[ -e $1/memtest32.bios ]]; then
+    echo 'menuentry "Memtest86+ 32bit BIOS" {'
+    echo '  linux "/memtest32.bios"'
+    echo '}'
+  fi
+}
 
 default_append_line=(root=/dev/ram0 init=/linuxrc ${cmdline_opts[@]} cdroot)
 
@@ -118,6 +140,7 @@ case ${clst_hostarch} in
                        fi
                        echo "" >> ${iacfg}
                done
+               memtest_grub $1 >> ${iacfg}
        ;;
        mips)
                # NO SOFTLEVEL SUPPORT YET

Reply via email to