Bug#898587: grub-pc: Adding code for toggling 'serial console' and 'multiboot' memtest86+ menu entries on and off

Martin Teufel teufel at cs.uni-frankfurt.de
Mon May 14 00:15:00 BST 2018


Package: grub-pc
Version: 1.98+20100804-14+squeeze1
Severity: wishlist
Tags: upstream 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 diff file.

I think it would be nice if this would make it into upstream. 


-- Package-specific info:

*********************** BEGIN /proc/mounts
/dev/disk/by-uuid/0adcabcc-c32e-4760-9eac-12d8d7749208 / ext4 rw,relatime,errors=remount-ro,user_xattr,acl,barrier=1,data=ordered 0 0
/dev/sda5 /tmp ext4 rw,relatime,user_xattr,acl,barrier=1,data=ordered 0 0
/dev/sda6 /home ext4 rw,relatime,user_xattr,acl,barrier=1,data=ordered 0 0
/dev/sda7 /data ext4 rw,relatime,user_xattr,acl,barrier=1,data=ordered 0 0
*********************** END /proc/mounts

*********************** BEGIN /boot/grub/device.map
(hd0)	/dev/disk/by-id/ata-ST9160310AS_5SV1V363
*********************** END /boot/grub/device.map

*********************** BEGIN /boot/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos2)'
search --no-floppy --fs-uuid --set 0adcabcc-c32e-4760-9eac-12d8d7749208
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=1024x600
  load_video
  insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos2)'
search --no-floppy --fs-uuid --set 0adcabcc-c32e-4760-9eac-12d8d7749208
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
set timeout=5
# set superusers to enable authentication support
set superusers='martin'
### PASSWORD LINE REMOVED ###
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos2)'
search --no-floppy --fs-uuid --set 0adcabcc-c32e-4760-9eac-12d8d7749208
insmod png
if background_image /usr/share/images/desktop-base/spacefun-grub.png; then
  set color_normal=light-gray/black
  set color_highlight=white/black
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Debian GNU/Linux, with Linux 3.2.0-0.bpo.4-686-pae' --class debian --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(/dev/sda,msdos2)'
	search --no-floppy --fs-uuid --set 0adcabcc-c32e-4760-9eac-12d8d7749208
	echo	'Loading Linux 3.2.0-0.bpo.4-686-pae ...'
	linux	/boot/vmlinuz-3.2.0-0.bpo.4-686-pae root=UUID=0adcabcc-c32e-4760-9eac-12d8d7749208 ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-3.2.0-0.bpo.4-686-pae
}
menuentry 'Debian GNU/Linux, with Linux 3.2.0-0.bpo.4-686-pae (recovery mode)' --class debian --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(/dev/sda,msdos2)'
	search --no-floppy --fs-uuid --set 0adcabcc-c32e-4760-9eac-12d8d7749208
	echo	'Loading Linux 3.2.0-0.bpo.4-686-pae ...'
	linux	/boot/vmlinuz-3.2.0-0.bpo.4-686-pae root=UUID=0adcabcc-c32e-4760-9eac-12d8d7749208 ro single 
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-3.2.0-0.bpo.4-686-pae
}
menuentry 'Debian GNU/Linux, with Linux 2.6.38-bpo.2-686' --class debian --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(/dev/sda,msdos2)'
	search --no-floppy --fs-uuid --set 0adcabcc-c32e-4760-9eac-12d8d7749208
	echo	'Loading Linux 2.6.38-bpo.2-686 ...'
	linux	/boot/vmlinuz-2.6.38-bpo.2-686 root=UUID=0adcabcc-c32e-4760-9eac-12d8d7749208 ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-2.6.38-bpo.2-686
}
menuentry 'Debian GNU/Linux, with Linux 2.6.38-bpo.2-686 (recovery mode)' --class debian --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(/dev/sda,msdos2)'
	search --no-floppy --fs-uuid --set 0adcabcc-c32e-4760-9eac-12d8d7749208
	echo	'Loading Linux 2.6.38-bpo.2-686 ...'
	linux	/boot/vmlinuz-2.6.38-bpo.2-686 root=UUID=0adcabcc-c32e-4760-9eac-12d8d7749208 ro single 
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-2.6.38-bpo.2-686
}
menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-686' --class debian --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(/dev/sda,msdos2)'
	search --no-floppy --fs-uuid --set 0adcabcc-c32e-4760-9eac-12d8d7749208
	echo	'Loading Linux 2.6.32-5-686 ...'
	linux	/boot/vmlinuz-2.6.32-5-686 root=UUID=0adcabcc-c32e-4760-9eac-12d8d7749208 ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-2.6.32-5-686
}
menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-686 (recovery mode)' --class debian --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(/dev/sda,msdos2)'
	search --no-floppy --fs-uuid --set 0adcabcc-c32e-4760-9eac-12d8d7749208
	echo	'Loading Linux 2.6.32-5-686 ...'
	linux	/boot/vmlinuz-2.6.32-5-686 root=UUID=0adcabcc-c32e-4760-9eac-12d8d7749208 ro single 
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-2.6.32-5-686
}
menuentry 'Debian GNU/Linux, with Linux 2.6.26-2-686' --class debian --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(/dev/sda,msdos2)'
	search --no-floppy --fs-uuid --set 0adcabcc-c32e-4760-9eac-12d8d7749208
	echo	'Loading Linux 2.6.26-2-686 ...'
	linux	/boot/vmlinuz-2.6.26-2-686 root=UUID=0adcabcc-c32e-4760-9eac-12d8d7749208 ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-2.6.26-2-686
}
menuentry 'Debian GNU/Linux, with Linux 2.6.26-2-686 (recovery mode)' --class debian --class gnu-linux --class gnu --class os {
	insmod part_msdos
	insmod ext2
	set root='(/dev/sda,msdos2)'
	search --no-floppy --fs-uuid --set 0adcabcc-c32e-4760-9eac-12d8d7749208
	echo	'Loading Linux 2.6.26-2-686 ...'
	linux	/boot/vmlinuz-2.6.26-2-686 root=UUID=0adcabcc-c32e-4760-9eac-12d8d7749208 ro single 
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-2.6.26-2-686
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
	insmod part_msdos
	insmod ext2
	set root='(/dev/sda,msdos2)'
	search --no-floppy --fs-uuid --set 0adcabcc-c32e-4760-9eac-12d8d7749208
	linux16	/boot/memtest86+.bin
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
*********************** END /boot/grub/grub.cfg

-- 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 grub-pc depends on:
ii  debconf [debco 1.5.36.1                  Debian configuration management sy
ii  grub-common    1.98+20100804-14+squeeze1 GRand Unified Bootloader, version 
ii  libc6          2.11.3-4                  Embedded GNU C Library: Shared lib
ii  libdevmapper1. 2:1.02.48-5               The Linux Kernel Device Mapper use
ii  ucf            3.0025+nmu1               Update Configuration File: preserv

grub-pc recommends no packages.

Versions of packages grub-pc suggests:
ii  desktop-base               6.0.5squeeze1 common files for the Debian Deskto

-- debconf information excluded
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20_memtest86+
Type: text/x-shellscript
Size: 1803 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-grub-devel/attachments/20180514/f6a71307/attachment.bin>
-------------- next part --------------
--- 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


More information about the Pkg-grub-devel mailing list