summaryrefslogtreecommitdiffstats
path: root/system/memtest86
diff options
context:
space:
mode:
Diffstat (limited to 'system/memtest86')
-rw-r--r--system/memtest86/20_memtest8682
-rw-r--r--system/memtest86/README13
-rw-r--r--system/memtest86/doinst.sh14
-rw-r--r--system/memtest86/memtest86.SlackBuild36
4 files changed, 127 insertions, 18 deletions
diff --git a/system/memtest86/20_memtest86 b/system/memtest86/20_memtest86
new file mode 100644
index 0000000000..2e820018e0
--- /dev/null
+++ b/system/memtest86/20_memtest86
@@ -0,0 +1,82 @@
+#!/bin/sh
+set -e
+
+prefix="/usr"
+exec_prefix="/usr"
+datarootdir="/usr/share"
+
+. "$pkgdatadir/grub-mkconfig_lib"
+
+CLASS="--class memtest86 --class gnu --class tool"
+
+prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)"
+
+memtest_entry ()
+{
+ image="$1"
+ args="$2"
+ rel_image="$(make_system_path_relative_to_its_root ${image})"
+
+ # Apply some heuristics to show some images only on particular platforms.
+ basename="$(basename ${image})"
+ ftype="$(file ${image} | cut -d: -f2)"
+ if echo "${basename}" | grep -q ".elf\$" || echo "${ftype}" | grep -q "ELF"; then
+ protocol="knetbsd"
+ platform="pc"
+ #platform="" # Uncomment to show on EFI platforms; see below.
+ elif echo "${basename}" | grep -q ".efi\$" || echo "${ftype}" | grep -q "EFI"; then
+ protocol="chainloader"
+ platform="efi"
+ else # .bin, DOS/MBR boot sector
+ protocol="linux16"
+ platform="pc"
+ #platform="" # Uncomment to show on EFI platforms; see below.
+ fi
+
+ # All images listed above should boot on EFI platforms, but many (those
+ # marked with platform="pc") will likely run without graphics and appear to
+ # the casual user to not work, so are hidden by default. (Some versions
+ # beep at startup, verifying it booted, but the display will be blank.)
+ # Serial consoles may still be useful.
+ #
+ # Uncomment this to un-hide all images on EFI platforms, or selectively edit
+ # the platform lines above to un-hide particular images.
+ #if [ "$platform" = "pc" ]; then
+ # platform=""
+ #fi
+
+ if echo "${ftype}" | grep -q "Linux"; then # Linux kernel x86 boot executable
+ # .efi or .bin images may also present themselves as a Linux kernel image.
+ # When booted using the "linux" protocol, these images can be used on
+ # either "pc" or "efi" platform, and on EFI platforms they may have better
+ # or native resolution graphics.
+ protocol="linux"
+ #platform="" # Uncomment to discard platform constraint chosen above.
+ fi
+
+ # TODO: Detect multiboot images, use protocol="multiboot"
+
+ # Emit the menuentry.
+ platform_indent=""
+ if [ -n "${platform}" ]; then
+ echo "if [ x\$grub_platform = x${platform} ]; then"
+ platform_indent="${grub_tab}"
+ fi
+ echo "${platform_indent}menuentry \"Memory Tester (${basename})\" ${CLASS} {"
+ if [ "${protocol}" = "linux" -o "${protocol}" = "knetbsd" ]; then
+ echo "${platform_indent}${grub_tab}load_video"
+ fi
+ printf '%s\n' "${prepare_boot_cache}" | sed "s/^/${platform_indent}/"
+ echo "${platform_indent}${grub_tab}${protocol} ${rel_image} ${args}"
+ echo "${platform_indent}}"
+ if [ -n "${platform}" ]; then
+ echo "fi"
+ fi
+}
+
+for image in $(find /boot -maxdepth 1 -type f -regex '/boot/memtest86[^+].*' | sort -Vr); do
+ if is_path_readable_by_grub "${image}" ; then
+ gettext_printf "Found memtest86 image: %s\n" "${image}" >&2
+ memtest_entry "${image}" "${GRUB_CMDLINE_MEMTEST86}"
+ fi
+done
diff --git a/system/memtest86/README b/system/memtest86/README
index cdb6a2877a..b42a45b16e 100644
--- a/system/memtest86/README
+++ b/system/memtest86/README
@@ -15,15 +15,6 @@ Then run `/sbin/lilo` to update the boot loader.
Don't forget to re-run `/sbin/lilo` if you upgrade this package.
-GRUB 2 users: Append something like this to your /etc/grub.d/40_custom:
-
- menuentry 'memtest86' {
- linux16 (hd0,1)/boot/memtest86.bin
- }
-
-Then run `grub-mkconfig -o /boot/grub/grub.cfg` to update the boot menu.
-
-
GRUB Legacy users: Append something like this to your
/boot/grub/menu.lst:
@@ -31,4 +22,8 @@ GRUB Legacy users: Append something like this to your
kernel (hd0,0)/boot/memtest86.bin
+GRUB 2 users: Auto-detected by the /etc/grub.d/20_memtest86 script.
+Run `grub-mkconfig -o /boot/grub/grub.cfg` to update the boot menu.
+
+
See /usr/doc/memtest86-$VERSION/README for more info.
diff --git a/system/memtest86/doinst.sh b/system/memtest86/doinst.sh
new file mode 100644
index 0000000000..22414beaee
--- /dev/null
+++ b/system/memtest86/doinst.sh
@@ -0,0 +1,14 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+config etc/grub.d/20_memtest86.new
diff --git a/system/memtest86/memtest86.SlackBuild b/system/memtest86/memtest86.SlackBuild
index 62f991c21a..a223030e9b 100644
--- a/system/memtest86/memtest86.SlackBuild
+++ b/system/memtest86/memtest86.SlackBuild
@@ -22,27 +22,40 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# 20230515 bkw: Modified by SlackBuilds.org, BUILD=4:
+# - create a proper top-level source directory (to avoid
+# surprising anyone who expects to find one).
+# - hardcode ARCH=i586, since we no longer allow i486. this
+# is strictly a cosmetic change (it only affects the name
+# of the package file, not the contents).
+
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=memtest86
VERSION=${VERSION:-4.3.7}
-BUILD=${BUILD:-2}
+BUILD=${BUILD:-4}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
-# i486 only. Modify the Makefile at your own risk :-)
-ARCH=i486
+ARCH=${ARCH:-$(uname -m)}
+case $ARCH in
+ i?86) ;; # OK
+ x86_64) ;; # OK
+ *) echo "$ARCH is not supported." >&2; exit 1 ;;
+esac
+
+# 20230515 bkw: Hardcode this. Even if the package contains code that
+# would work on i486, this is the minimum *Slackware supported* CPU it
+# will run on.
+ARCH=i586
-# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
-# the name of the created package would be, and then exit. This information
-# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
TMP=${TMP:-/tmp/SBo}
-PKG=$TMP/package-$PRGNAM-$VERSION
+PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
DOCS="README*"
@@ -52,11 +65,13 @@ set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
-rm -rf src
+rm -rf $PRGNAM-$VERSION
+mkdir -p $PRGNAM-$VERSION
+cd $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION-src.tar.gz
-cd src
chown -R root:root .
chmod -R u+w,go-w,a+rX-st .
+cd src
# Permissions and line endings need to be sanitized.
# Required so that memtest86+ backported patches will apply cleanly.
@@ -94,12 +109,15 @@ install -D -m 0644 memtest.bin $PKG/boot/$PRGNAM-$VERSION.bin
ln -s $PRGNAM-$VERSION $PKG/boot/$PRGNAM
ln -s $PRGNAM-$VERSION.bin $PKG/boot/$PRGNAM.bin
+install -D -m 0755 $CWD/20_memtest86 $PKG/etc/grub.d/20_memtest86.new
+
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE