From eee0856d76ab3873ff63cce58873085bfbcc481d Mon Sep 17 00:00:00 2001 From: Michal Suchanek Date: Sun, 8 Jun 2014 09:47:18 +0200 Subject: [PATCH] Add memtest support. Signed-off-by: Michal Suchanek --- debian/local/extlinux.d/0000-defaults | 2 +- debian/local/extlinux.d/0015-memtest | 78 +++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100755 debian/local/extlinux.d/0015-memtest diff --git a/debian/local/extlinux.d/0000-defaults b/debian/local/extlinux.d/0000-defaults index 535863cd..8b1a0d10 100755 --- a/debian/local/extlinux.d/0000-defaults +++ b/debian/local/extlinux.d/0000-defaults @@ -28,7 +28,7 @@ else fi # Setting defaults -EXTLINUX_CONFIGS="${EXTLINUX_CONFIGS:-linux memdisk os-prober}" +EXTLINUX_CONFIGS="${EXTLINUX_CONFIGS:-linux memtest memdisk os-prober}" # Support old style enabler variables for c in $EXTLINUX_CONFIGS ; do diff --git a/debian/local/extlinux.d/0015-memtest b/debian/local/extlinux.d/0015-memtest new file mode 100755 index 00000000..8d4e8c03 --- /dev/null +++ b/debian/local/extlinux.d/0015-memtest @@ -0,0 +1,78 @@ +#!/bin/sh + +## Copyright (C) 2006-2013 Daniel Baumann +## +## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +## This is free software and you are welcome to redistribute it +## under certain conditions; see COPYING for details. + + +set -e + +. /usr/share/extlinux/extlinux-update.sh + +if [ "${EXTLINUX_MEMTEST}" != "true" ] +then + echo "I: memtest disabled in /etc/default/extlinux: Skipping ${_EXTLINUX_DIRECTORY}/memtest.cfg" + exit 0 +fi + +if ! ls /boot/memtest*.bin 2>&1 +then + echo "I: /boot/memtest*.bin - No such files: Skipping ${_EXTLINUX_DIRECTORY}/memtest.cfg" + exit 0 +fi + +# Create memtest.cfg +_CONFIG="\ +## ${_EXTLINUX_DIRECTORY}/memtest.cfg +## +## IMPORTANT WARNING +## +## The configuration of this file is generated automatically. +## Do not edit this file manually use: extlinux-update + + +" + +# Find linux versions +_VERSIONS="$(cd /boot && ls memtest*.bin | grep -v .dpkg-tmp | sed -e 's|^memtest||g' -e 's|[.]bin$||g' | sort -Vr)" + +for _VERSION in ${_VERSIONS} +do + if echo "${_VERSION}" | grep multiboot > /dev/null ; + then + echo "W: Memtest /boot/memtest${_VERSION}.bin unsupported..." + continue + fi + echo "P: Writing config for /boot/memtest${_VERSION}.bin..." + + _NUMBER="${_NUMBER:-0}" + _ENTRY="${_ENTRY:-1}" + _CONFIG="${_CONFIG} + +label mt${_NUMBER} + menu label ${EXTLINUX_MENU_LABEL} memtest${_VERSION}" + + if [ "${EXTLINUX_DEFAULT}" = "mt${_NUMBER}" ] + then + _CONFIG="${_CONFIG} + menu default" + fi + + _CONFIG="${_CONFIG} + linux ${_BOOT_DIRECTORY}/memtest${_VERSION}.bin" + + + _NUMBER="$((${_NUMBER} + 1))" + _ENTRY="$((${_ENTRY} + 1))" + + if [ "${EXTLINUX_ENTRIES}" = "${_ENTRY}" ] + then + break + fi +done + +_NUMBER="" + +Update "${_EXTLINUX_DIRECTORY}/memtest.cfg" "${_CONFIG}" -- 2.11.4.GIT