Memtest GRUB fixes
Previous commits to support Memtest86+ 6.00+ split the files into "memtest" (backwards compatible / new BIOS name) and "memtest.efi" (new EFI name). However, the 6.00 non-EFI binaries are now 32/64-bit, and will not work with GRUB's linux16 boot when using GRUB for BIOS boot. - Legacy Memtest86+ pre-6.00 will continue to be "memtest", linux16 (continue to support builds on current Debian stable bullseye) - Change 6.00+ filename to "memtest.bin" - GRUB memtest.cfg contains logic for legacy / new bios / new EFI - Change EFI boot from "chainloader" to "linux", which allows for passing command line options to Memtest86+ - syslinux @MEMTEST@ will conditionally be memtest.bin or memtest - @MEMTEST_BIN@ will conditionally be memtest.bin or memtest, but is completely legacy at this point (all internal code paths now check for @MEMTEST_DIR@/memtest or @MEMTEST_DIR@/memtest.bin) Getting complicated, but this logic can be simplified again once we no longer need to support current Debian stable.
This commit is contained in:
parent
dcbbfed463
commit
5e01a0c09f
|
@ -232,8 +232,13 @@ fi
|
||||||
|
|
||||||
# Assembling memtest configuration
|
# Assembling memtest configuration
|
||||||
MEMTEST_DIR="/${INITFS}"
|
MEMTEST_DIR="/${INITFS}"
|
||||||
|
if [ -f "binary/${MEMTEST_DIR}/memtest.bin" ]
|
||||||
|
then
|
||||||
|
MEMTEST_BIN="${MEMTEST_DIR}/memtest.bin"
|
||||||
|
else
|
||||||
MEMTEST_BIN="${MEMTEST_DIR}/memtest"
|
MEMTEST_BIN="${MEMTEST_DIR}/memtest"
|
||||||
if [ -f "binary/${MEMTEST_BIN}" ]; then
|
fi
|
||||||
|
if [ -f "binary/${MEMTEST_DIR}/memtest" ] || [ -f "binary/${MEMTEST_DIR}/memtest.bin" ] || [ -f "binary/${MEMTEST_DIR}/memtest.efi" ]; then
|
||||||
ENABLE_MEMTEST="true"
|
ENABLE_MEMTEST="true"
|
||||||
MEMTEST="source /boot/grub/memtest.cfg" #for backwards compatibility
|
MEMTEST="source /boot/grub/memtest.cfg" #for backwards compatibility
|
||||||
else
|
else
|
||||||
|
|
|
@ -43,9 +43,11 @@ then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
_PREFIX=""
|
||||||
if [ "${LB_BUILD_WITH_CHROOT}" = "true" ]
|
if [ "${LB_BUILD_WITH_CHROOT}" = "true" ]
|
||||||
then
|
then
|
||||||
|
|
||||||
|
_PREFIX="chroot"
|
||||||
if [ -f chroot/usr/sbin/grub ] && [ ! -f chroot/boot/grub/menu.lst ]
|
if [ -f chroot/usr/sbin/grub ] && [ ! -f chroot/boot/grub/menu.lst ]
|
||||||
then
|
then
|
||||||
GRUB="yes"
|
GRUB="yes"
|
||||||
|
@ -57,6 +59,7 @@ fi
|
||||||
|
|
||||||
# Checking depends
|
# Checking depends
|
||||||
_MEMTEST_BIN="${LB_MEMTEST}"
|
_MEMTEST_BIN="${LB_MEMTEST}"
|
||||||
|
_MEMTEST_BIOS_FN="memtest"
|
||||||
case "${LB_MEMTEST}" in
|
case "${LB_MEMTEST}" in
|
||||||
memtest86)
|
memtest86)
|
||||||
Check_package chroot /boot/memtest86.bin memtest86
|
Check_package chroot /boot/memtest86.bin memtest86
|
||||||
|
@ -83,15 +86,11 @@ case "${LB_MEMTEST}" in
|
||||||
_MEMTEST_ARCH=x32
|
_MEMTEST_ARCH=x32
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
case "${LB_BUILD_WITH_CHROOT}" in
|
if [ -e "${_PREFIX}/boot/${LB_MEMTEST}${_MEMTEST_ARCH}.bin" ]
|
||||||
true)
|
then
|
||||||
[ -e "chroot/boot/${LB_MEMTEST}${_MEMTEST_ARCH}.bin" ] && _MEMTEST_BIN="${LB_MEMTEST}${_MEMTEST_ARCH}"
|
_MEMTEST_BIN="${LB_MEMTEST}${_MEMTEST_ARCH}"
|
||||||
;;
|
_MEMTEST_BIOS_FN="memtest.bin"
|
||||||
false)
|
fi
|
||||||
[ -e "/boot/${LB_MEMTEST}${_MEMTEST_ARCH}.bin" ] && _MEMTEST_BIN="${LB_MEMTEST}${_MEMTEST_ARCH}"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Setting destination directory
|
# Setting destination directory
|
||||||
|
@ -109,17 +108,8 @@ esac
|
||||||
mkdir -p "${DESTDIR}"
|
mkdir -p "${DESTDIR}"
|
||||||
|
|
||||||
# Installing memtest
|
# Installing memtest
|
||||||
case "${LB_BUILD_WITH_CHROOT}" in
|
cp -a "${_PREFIX}/boot/${_MEMTEST_BIN}.bin" "${DESTDIR}/${_MEMTEST_BIOS_FN}"
|
||||||
true)
|
[ -e "${_PREFIX}/boot/${_MEMTEST_BIN}.efi" ] && cp -a "${_PREFIX}/boot/${_MEMTEST_BIN}.efi" "${DESTDIR}/memtest.efi"
|
||||||
cp -a "chroot/boot/${_MEMTEST_BIN}.bin" "${DESTDIR}"/memtest
|
|
||||||
[ -e "chroot/boot/${_MEMTEST_BIN}.efi" ] && cp -a "chroot/boot/${_MEMTEST_BIN}.efi" "${DESTDIR}"/memtest.efi
|
|
||||||
;;
|
|
||||||
|
|
||||||
false)
|
|
||||||
cp -a "/boot/${_MEMTEST_BIN}.bin" "${DESTDIR}"/memtest
|
|
||||||
[ -e "/boot/${_MEMTEST_BIN}.efi" ] && cp -a "/boot/${_MEMTEST_BIN}.efi" "${DESTDIR}"/memtest.efi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Saving cache
|
# Saving cache
|
||||||
Save_package_cache binary
|
Save_package_cache binary
|
||||||
|
|
|
@ -280,7 +280,12 @@ sed -i \
|
||||||
-e "s|@INITRD_DI@|${INITRD_DI}|" \
|
-e "s|@INITRD_DI@|${INITRD_DI}|" \
|
||||||
"${_TARGET}"/install.cfg
|
"${_TARGET}"/install.cfg
|
||||||
|
|
||||||
|
if [ -e "binary/${_INITRAMFS}/memtest.bin" ]
|
||||||
|
then
|
||||||
|
MEMTEST_PATH="${_INITRAMFS}/memtest.bin"
|
||||||
|
else
|
||||||
MEMTEST_PATH="${_INITRAMFS}/memtest"
|
MEMTEST_PATH="${_INITRAMFS}/memtest"
|
||||||
|
fi
|
||||||
sed -i -e "s#@MEMTEST_VERSION@#${LB_MEMTEST}#g" -e "s#@MEMTEST@#/${MEMTEST_PATH}#g" "${_TARGET}"/memtest.cfg
|
sed -i -e "s#@MEMTEST_VERSION@#${LB_MEMTEST}#g" -e "s#@MEMTEST@#/${MEMTEST_PATH}#g" "${_TARGET}"/memtest.cfg
|
||||||
|
|
||||||
# Replace placeholder for optional install menu entries include
|
# Replace placeholder for optional install menu entries include
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
if [ "${grub_platform}" = "pc" ]; then
|
if [ "${grub_platform}" = "pc" ] -a [ -e @MEMTEST_DIR@/memtest ]; then
|
||||||
|
# Legacy 16-bit memtest
|
||||||
menuentry "Memory Diagnostic Tool (@MEMTEST_VERSION@)" --hotkey=m {
|
menuentry "Memory Diagnostic Tool (@MEMTEST_VERSION@)" --hotkey=m {
|
||||||
linux16 @MEMTEST_BIN@
|
linux16 @MEMTEST_DIR@/memtest
|
||||||
|
}
|
||||||
|
elif [ "${grub_platform}" = "pc" ] -a [ -e @MEMTEST_DIR@/memtest.bin ]; then
|
||||||
|
menuentry "Memory Diagnostic Tool (@MEMTEST_VERSION@)" --hotkey=m {
|
||||||
|
linux @MEMTEST_DIR@/memtest.bin
|
||||||
}
|
}
|
||||||
elif [ "${grub_platform}" = "efi" ] -a [ -e @MEMTEST_DIR@/memtest.efi ]; then
|
elif [ "${grub_platform}" = "efi" ] -a [ -e @MEMTEST_DIR@/memtest.efi ]; then
|
||||||
menuentry "Memory Diagnostic Tool (@MEMTEST_VERSION@)" --hotkey=m {
|
menuentry "Memory Diagnostic Tool (@MEMTEST_VERSION@)" --hotkey=m {
|
||||||
insmod chain
|
linux @MEMTEST_DIR@/memtest.efi
|
||||||
chainloader @MEMTEST_DIR@/memtest.efi
|
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue