Package: memtest86+
Version: 4.10-1.1
Severity: wishlist
Tags: patch

When installing the memtest86+ package, four GRUB menu entries get added
nowadays:
memtest86+
memtest86+, serial console 115200
memtest86+, experimental multiboot
memtest86+, serial console 115200, experimental multiboot

In order to reduce that, I've added two variables and some if-statements
to /etc/grub.d/20_memtest86+.

In /etc/default/grub:
GRUB_MEMTEST_ENABLE_SERIAL=[true|false]
GRUB_MEMTEST_ENABLE_MULTIBOOT=[true|false]

In addition, I've added a variable holding the memtest86+ serial params:
GRUB_MEMTEST_SERIAL_PARAMS="ttyS0,115200n8"

In /etc/grub.d/20_memtest86+:
 Have a look at the patch file.


-- System Information:
Debian Release: 6.0.10
  APT prefers oldoldstable-updates
  APT policy: (500, 'oldoldstable-updates'), (500, 'oldoldstable')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-0.bpo.4-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages memtest86+ depends on:
ii  debconf [debconf-2.0]         1.5.36.1   Debian configuration management sy

memtest86+ recommends no packages.

Versions of packages memtest86+ suggests:
ii  grub-pc        1.98+20100804-14+squeeze1 GRand Unified Bootloader, version 
pn  hwtools        <none>                    (no description available)
pn  kernel-patch-b <none>                    (no description available)
pn  memtest86      <none>                    (no description available)
pn  memtester      <none>                    (no description available)
ii  mtools         4.0.12-1                  Tools for manipulating MSDOS files

-- Configuration Files:
/etc/grub.d/20_memtest86+ changed:
set -e
if [ -f /usr/lib/grub/grub-mkconfig_lib ]; then
  . /usr/lib/grub/grub-mkconfig_lib
  LX=linux16
elif [ -f /usr/lib/grub/update-grub_lib ]; then
  . /usr/lib/grub/update-grub_lib
  LX=linux
else
  # no grub file, so we notify and exit gracefully
  echo "Cannot find grub config file, exiting." >&2
  exit 0
fi
case ${GRUB_DEVICE_BOOT} in
  /dev/loop/*|/dev/loop[0-9]) exit 0 ;;
esac
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed 
-e "s/^/\t/")"
if test -e /boot/memtest86+.bin ; then
  MEMTESTPATH=$( make_system_path_relative_to_its_root "/boot/memtest86+.bin" )
  echo "Found memtest86+ image: $MEMTESTPATH" >&2
  cat << EOF
menuentry "Memory test (memtest86+)" {
EOF
  printf '%s\n' "${prepare_boot_cache}"
  cat << EOF
        $LX     $MEMTESTPATH
}
EOF
 if [ "${GRUB_MEMTEST_ENABLE_SERIAL}" = "true" ]; then
  cat << EOF
menuentry "Memory test (memtest86+, serial console)" {
EOF
  printf '%s\n' "${prepare_boot_cache}"
  cat << EOF
        $LX     $MEMTESTPATH console=${GRUB_MEMTEST_SERIAL_PARAMS}
}
EOF
 fi
fi
if [ "${GRUB_MEMTEST_ENABLE_MULTIBOOT}" = "true" ]; then
 if test -e /boot/memtest86+_multiboot.bin ; then
  MEMTESTPATH=$( make_system_path_relative_to_its_root 
"/boot/memtest86+_multiboot.bin" )
  echo "Found memtest86+ multiboot image: $MEMTESTPATH" >&2
  cat << EOF
menuentry "Memory test (memtest86+, experimental multiboot)" {
EOF
  printf '%s\n' "${prepare_boot_cache}"
  cat << EOF
        multiboot       $MEMTESTPATH
}
EOF
  if [ "${GRUB_MEMTEST_ENABLE_SERIAL}" = "true" ]; then
   cat << EOF
menuentry "Memory test (memtest86+, experimental multiboot, serial console)" {
EOF
  printf '%s\n' "${prepare_boot_cache}"
  cat << EOF
        multiboot       $MEMTESTPATH console=${GRUB_MEMTEST_SERIAL_PARAMS}
}
EOF
  fi
 fi
fi


-- debconf information:
  shared/memtest86-run-lilo: false
--- 20_memtest86+.orig  2018-05-14 00:52:58.719587898 +0200
+++ 20_memtest86+       2015-02-18 17:47:52.000000000 +0100
@@ -30,16 +30,21 @@
   cat << EOF
        $LX     $MEMTESTPATH
 }
-menuentry "Memory test (memtest86+, serial console 115200)" {
+EOF
+ if [ "${GRUB_MEMTEST_ENABLE_SERIAL}" = "true" ]; then
+  cat << EOF
+menuentry "Memory test (memtest86+, serial console)" {
 EOF
   printf '%s\n' "${prepare_boot_cache}"
   cat << EOF
-       $LX     $MEMTESTPATH console=ttyS0,115200n8
+       $LX     $MEMTESTPATH console=${GRUB_MEMTEST_SERIAL_PARAMS}
 }
 EOF
+ fi
 fi
 
-if test -e /boot/memtest86+_multiboot.bin ; then
+if [ "${GRUB_MEMTEST_ENABLE_MULTIBOOT}" = "true" ]; then
+ if test -e /boot/memtest86+_multiboot.bin ; then
   MEMTESTPATH=$( make_system_path_relative_to_its_root 
"/boot/memtest86+_multiboot.bin" )
   echo "Found memtest86+ multiboot image: $MEMTESTPATH" >&2
   cat << EOF
@@ -49,11 +54,16 @@
   cat << EOF
        multiboot       $MEMTESTPATH
 }
-menuentry "Memory test (memtest86+, serial console 115200, experimental 
multiboot)" {
+EOF
+  if [ "${GRUB_MEMTEST_ENABLE_SERIAL}" = "true" ]; then
+   cat << EOF
+menuentry "Memory test (memtest86+, experimental multiboot, serial console)" {
 EOF
   printf '%s\n' "${prepare_boot_cache}"
   cat << EOF
-multiboot      $MEMTESTPATH console=ttyS0,115200n8
+       multiboot       $MEMTESTPATH console=${GRUB_MEMTEST_SERIAL_PARAMS}
 }
 EOF
+  fi
+ fi
 fi

Reply via email to