Removed some spec artifacts (like buildroot cleaning)
- Fixed malformed "Loading" banner - Introduced new configuration file (/etc/memtest86+.conf) - Introduced new memtest-setup switches for selecting ELF/non-ELF versions Resolves: rhbz#1303804
This commit is contained in:
parent
d552800479
commit
05c6babd98
@ -34,6 +34,20 @@ else
|
||||
OS="${GRUB_DISTRIBUTOR} Memtest"
|
||||
fi
|
||||
|
||||
CONF_FILE="/etc/memtest86+.conf"
|
||||
CONF_ELF_VAR="INSTALL_ELF"
|
||||
|
||||
MEMTEST86_ELF=`[ -r "$CONF_FILE" ] && sed -n "/^\s*${CONF_ELF_VAR}\s*=/ {s/^\s*${CONF_ELF_VAR}\s*=\s*\(.*\)$/\1/; T end; s/\s*\(\S\)*\s*/\1/; p; :end}" "$CONF_FILE" 2>/dev/null`
|
||||
if [ "x${MEMTEST86_ELF}" = "x" ] || [ "x${MEMTEST86_ELF}" = "x1" ] || [ "x${MEMTEST86_ELF}" = "xtrue" ]; then
|
||||
MEMTEST86_ELF=1
|
||||
BANNER_SUFFIX=
|
||||
IMAGE="elf-memtest"
|
||||
else
|
||||
MEMTEST86_ELF=0
|
||||
IMAGE="memtest"
|
||||
BANNER_SUFFIX=" (non-ELF)"
|
||||
fi
|
||||
|
||||
# loop-AES arranges things so that /dev/loop/X can be our root device, but
|
||||
# the initrds that Linux uses don't like that.
|
||||
case ${GRUB_DEVICE} in
|
||||
@ -65,7 +79,7 @@ memtest_entry ()
|
||||
recovery="$3"
|
||||
args="$4"
|
||||
title="$(gettext_quoted "%s %s")"
|
||||
printf "menuentry '${title}' {\n" "${os}" "${version}"
|
||||
printf "menuentry '${title}${BANNER_SUFFIX}' {\n" "${os}" "${version}"
|
||||
|
||||
|
||||
if [ x$dirname = x/ ]; then
|
||||
@ -79,22 +93,30 @@ memtest_entry ()
|
||||
fi
|
||||
printf '%s\n' "${prepare_boot_cache}"
|
||||
fi
|
||||
message="$(gettext_printf "Loading %s %s ..." ${os} ${version})"
|
||||
cat << EOF
|
||||
message="$(gettext_printf "Loading %s %s ..." "${os}" "${version}")"
|
||||
if [ "x${MEMTEST86_ELF}" = "x1" ]; then
|
||||
cat << EOF
|
||||
insmod bsd
|
||||
echo '$message'
|
||||
knetbsd ${rel_dirname}/${basename}
|
||||
}
|
||||
EOF
|
||||
else
|
||||
cat << EOF
|
||||
echo '$message'
|
||||
linux16 ${rel_dirname}/${basename}
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
}
|
||||
|
||||
case x`uname -m` in
|
||||
xi?86 | xx86_64)
|
||||
list=`for i in /boot/elf-memtest* ; do
|
||||
list=`for i in /boot/${IMAGE}* ; do
|
||||
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
|
||||
done` ;;
|
||||
*)
|
||||
list=`for i in /boot/elf-memtest* ; do
|
||||
list=`for i in /boot/${IMAGE}* ; do
|
||||
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
|
||||
done` ;;
|
||||
esac
|
||||
|
17
README
17
README
@ -11,13 +11,20 @@ This is not done automatically because it could overwrite any custom changes
|
||||
in /boot/grub2/grub.cfg.
|
||||
|
||||
By default ELF version of memtest86+ is installed, which should work on most of
|
||||
the systems. In case it doesn't work for you, you can try the non-ELF version:
|
||||
the systems. In case it doesn't work for you, you can try to install the non-ELF
|
||||
version by running:
|
||||
|
||||
- in your grub.conf (usually /etc/grub.conf) locate the line containing:
|
||||
kernel --type=netbsd /elf-memtest86+-VERSION
|
||||
# memtest-setup -b
|
||||
|
||||
- edit it to contain:
|
||||
kernel /memtest86+-VERSION
|
||||
Or with GRUB 2 you can switch between ELF and non-ELF versions of memtest86+
|
||||
by using INSTALL_ELF variable from /etc/memtest86+.conf. Setting it to '1'
|
||||
will instruct GRUB 2 to install ELF version of memtest86+ and setting it
|
||||
to '0' will instruct GRUB2 to install non-ELF version. If the variable
|
||||
is empty or unset, the ELF version is installed (it's due to backward
|
||||
compatibility). For the change to take effect you need to regenerate your
|
||||
GRUB 2 config by running:
|
||||
|
||||
# grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||
|
||||
The non-ELF version is known to cause various problems and it may not work on
|
||||
several systems. That's why the ELF version is installed by default.
|
||||
|
@ -3,12 +3,27 @@
|
||||
# package name
|
||||
PNAME="memtest86+"
|
||||
|
||||
# executable
|
||||
ENAME="elf-memtest86+"
|
||||
# binary image
|
||||
BNAME="memtest86+"
|
||||
|
||||
# ELF image
|
||||
ELFNAME="elf-$BNAME"
|
||||
|
||||
# executable image to be installed
|
||||
ENAME="$ELFNAME"
|
||||
|
||||
# GRUB 2 template
|
||||
G2TEMPL="20_memtest86+"
|
||||
|
||||
# GRUB 2 environment file
|
||||
CONF_FILE="/etc/memtest86+.conf"
|
||||
|
||||
# GRUB2 environment variable to control image type
|
||||
CONF_VAR="INSTALL_ELF"
|
||||
|
||||
# whether to install ELF image
|
||||
ELF=1
|
||||
|
||||
if [ "$1" = "--help" -o "$1" = "-h" ]; then
|
||||
cat <<:EOF
|
||||
usage: memtest-setup [OPTIONS]
|
||||
@ -24,12 +39,27 @@ This is not done automatically because it could overwrite any custom changes
|
||||
in /boot/grub2/grub.cfg.
|
||||
|
||||
OPTIONS:
|
||||
-e , --elf installs ELF image (the default)
|
||||
-b , --bin installs binary image (non-ELF)
|
||||
-h , --help show this help
|
||||
|
||||
:EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
[ "$1" = "-b" -o "$1" = "--bin" ] && ELF=0
|
||||
[ "$1" = "-e" -o "$1" = "--elf" ] && ELF=1
|
||||
|
||||
if [ "$ELF" = 1 ]; then
|
||||
# BANNER_SUFFIX needs to be simultaneously changed also in grub2 template
|
||||
BANNER_SUFFIX=
|
||||
ENAME="$ELFNAME"
|
||||
else
|
||||
ELF=0
|
||||
BANNER_SUFIX="(non-ELF)"
|
||||
ENAME="$BNAME"
|
||||
fi
|
||||
|
||||
if [ -d /sys/firmware/efi ]; then
|
||||
echo "memtest86+ does not support EFI platforms."
|
||||
exit 254
|
||||
@ -41,23 +71,20 @@ if [ -f /boot/grub2/grub.cfg ]; then
|
||||
echo "ERROR: unable to find /etc/grub.d"
|
||||
exit 253
|
||||
fi
|
||||
if [ -x /etc/grub.d/$G2TEMPL ]; then
|
||||
echo "GRUB 2 template is already installed. Exiting..."
|
||||
exit 252
|
||||
if [ ! -r /usr/share/memtest86+/$G2TEMPL ]; then
|
||||
echo "ERROR: unable to find GRUB 2 template."
|
||||
exit 251
|
||||
fi
|
||||
if [ -f /etc/grub.d/$G2TEMPL ]; then
|
||||
echo "GRUB 2 template is already in place, only enabling..."
|
||||
else
|
||||
if [ ! -r /usr/share/memtest86+/$G2TEMPL ]; then
|
||||
echo "ERROR: unable to find GRUB 2 template."
|
||||
exit 251
|
||||
fi
|
||||
if ! cp /usr/share/memtest86+/$G2TEMPL /etc/grub.d; then
|
||||
echo "ERROR: unable to copy GRUB 2 template, do you have write permission to"
|
||||
echo "/etc/grub.d?"
|
||||
# EX_IOERR
|
||||
exit 74
|
||||
fi
|
||||
if ! cp /usr/share/memtest86+/$G2TEMPL /etc/grub.d; then
|
||||
echo "ERROR: unable to copy GRUB 2 template, do you have write permission to"
|
||||
echo "/etc/grub.d?"
|
||||
# EX_IOERR
|
||||
exit 74
|
||||
fi
|
||||
if [ ! -w "$CONF_FILE" ]
|
||||
then
|
||||
echo "ERROR: file '$CONF_FILE' is not writable."
|
||||
exit 250
|
||||
fi
|
||||
chmod a+x /etc/grub.d/$G2TEMPL
|
||||
echo "GRUB 2 template installed."
|
||||
@ -78,16 +105,24 @@ else
|
||||
exit 255
|
||||
fi
|
||||
|
||||
/sbin/new-memtest-pkg --install $MTVERSION --banner="Memtest86+"
|
||||
/sbin/new-memtest-pkg --install $MTVERSION --banner="Memtest86+${BANNER_SUFFIX}" --kernel-name="$ENAME"
|
||||
RETVAL="$?"
|
||||
|
||||
if [ "$RETVAL" != "0" ]; then
|
||||
echo "ERROR: grubby failed to configure your bootloader for $MTPATH."
|
||||
exit $RETVAL
|
||||
else
|
||||
sed -i -e"s,kernel \(/boot\)\?/$ENAME,kernel --type=netbsd \1/$ENAME," /boot/grub/grub.conf
|
||||
[ "$ELF" = 1 ] && sed -i -e"s,kernel \(/boot\)\?/$ENAME,kernel --type=netbsd \1/$ENAME," /boot/grub/grub.conf
|
||||
sed -i -e"s,/$ENAME-$MTVERSION.*,/$ENAME-$MTVERSION," /boot/grub/grub.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
# update/add configuration variable to the configuration file
|
||||
if grep -q "^\s*$CONF_VAR\s*=" "$CONF_FILE"
|
||||
then
|
||||
sed -i "/^\s*$CONF_VAR\s*=/ s/\(\s*$CONF_VAR\s*=[\"']\?\)[^\"']*\([\"']\?\s*\)/\1${ELF}\2/g" "$CONF_FILE"
|
||||
else
|
||||
echo "$CONF_VAR=\"$ELF\"" >> "$CONF_FILE"
|
||||
fi
|
||||
|
||||
echo "Setup complete."
|
||||
|
10
memtest86+.conf
Normal file
10
memtest86+.conf
Normal file
@ -0,0 +1,10 @@
|
||||
# If INSTALL_ELF is set to 1 or if it is unset/empty, the ELF version of the
|
||||
# memtest86+ will be installed, otherwise the non-ELF version will be
|
||||
# installed. If you change this variable, you will have to regenerate your
|
||||
# grub.conf for the changed to take effect, it is usually done by the
|
||||
# following command:
|
||||
#
|
||||
# grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||
#
|
||||
# For details see memtest86+ package documentation.
|
||||
INSTALL_ELF=1
|
@ -9,7 +9,7 @@
|
||||
|
||||
Name: memtest86+
|
||||
Version: 5.01
|
||||
Release: 13%{?dist}
|
||||
Release: 14%{?dist}
|
||||
License: GPLv2
|
||||
Summary: Stand-alone memory tester for x86 and x86-64 computers
|
||||
Group: System Environment/Base
|
||||
@ -18,7 +18,8 @@ Source1: memtest-setup
|
||||
Source2: new-memtest-pkg
|
||||
Source3: 20_memtest86+
|
||||
Source4: memtest-setup.8
|
||||
Source5: README
|
||||
Source5: memtest86+.conf
|
||||
Source6: README
|
||||
# reported upstream
|
||||
Patch0: memtest86+-5.01-no-scp.patch
|
||||
# patches to get memtest86+ working with gcc-4.7.2 or later + PCI scan fix
|
||||
@ -54,7 +55,7 @@ to add the %{name} entry to your GRUB boot menu.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
cp -p %{SOURCE5} README.%{readme_suffix}
|
||||
cp -p %{SOURCE6} README.%{readme_suffix}
|
||||
%patch0 -p1 -b .no-scp
|
||||
%patch1 -p1 -b .no-optimization
|
||||
%patch2 -p1 -b .compile-fix
|
||||
@ -74,9 +75,7 @@ sed -i -e's,$(LD) -s -T memtest.lds,$(LD) -s -T memtest.lds -z max-page-size=0x1
|
||||
make
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
mkdir -p %{buildroot}/boot
|
||||
mkdir -p %{buildroot}%{_sbindir}
|
||||
mkdir -p %{buildroot}/{boot,%{_sbindir}}
|
||||
|
||||
# the ELF (memtest) version.
|
||||
install -m644 memtest %{buildroot}/boot/elf-%{name}-%{version}
|
||||
@ -97,8 +96,12 @@ install -m644 %{SOURCE3} %{buildroot}%{_datadir}/%{name}
|
||||
# install manual page
|
||||
install -Dpm 0644 %{SOURCE4} %{buildroot}%{_mandir}/man8/memtest-setup.8
|
||||
|
||||
# install configuration file
|
||||
install -Dpm 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/memtest86+.conf
|
||||
|
||||
%post
|
||||
%if %{with update_grub}
|
||||
%post -p /usr/sbin/memtest-setup
|
||||
/usr/sbin/memtest-setup
|
||||
%endif
|
||||
|
||||
%preun
|
||||
@ -108,12 +111,9 @@ then
|
||||
%{_sbindir}/new-memtest-pkg --remove %{version}
|
||||
fi
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc README README.%{readme_suffix}
|
||||
%config(noreplace) %{_sysconfdir}/memtest86+.conf
|
||||
/boot/%{name}-%{version}
|
||||
/boot/elf-%{name}-%{version}
|
||||
%{_sbindir}/new-memtest-pkg
|
||||
@ -124,6 +124,13 @@ rm -rf %{buildroot}
|
||||
%{_mandir}/man8/*.8.gz
|
||||
|
||||
%changelog
|
||||
* Tue Feb 23 2016 Jaroslav Škarvada <jskarvad@redhat.com> - 5.01-14
|
||||
- Removed some spec artifacts (like buildroot cleaning)
|
||||
- Fixed malformed "Loading" banner
|
||||
- Introduced new configuration file (/etc/memtest86+.conf)
|
||||
- Introduced new memtest-setup switches for selecting ELF/non-ELF versions
|
||||
Resolves: rhbz#1303804
|
||||
|
||||
* Fri Feb 12 2016 Jaroslav Škarvada <jskarvad@redhat.com> - 5.01-13
|
||||
- Updated distribution specific README
|
||||
|
||||
|
@ -75,6 +75,7 @@ usage() {
|
||||
echo "Usage: `basename $0` [-v] [--mkinitrd] [--rminitrd]" >&2
|
||||
echo " [--initrdfile=<initrd-image>] [--depmod] [--rmmoddep]" >&2
|
||||
echo " [--kernel-args=<args>] [--banner=<banner>]" >&2
|
||||
echo " [--kernel-name=<kernel-name>]" >&2
|
||||
echo " <--install | --remove> <kernel-version>" >&2
|
||||
echo " (ex: `basename $0` --mkinitrd --depmod --install 2.4.7-2)" >&2
|
||||
exit 1
|
||||
@ -127,7 +128,13 @@ install() {
|
||||
else
|
||||
title="Red Hat Linux ($version)"
|
||||
fi
|
||||
/usr/sbin/grubby --add-kernel=$bootPrefix/$kernelName-$version $INITRD \
|
||||
# check whether grubby supports --grub argument
|
||||
if /usr/sbin/grubby --help | grep -qe '--grub\W'; then
|
||||
GRUB_ARG="--grub "
|
||||
else
|
||||
GRUB_ARG=
|
||||
fi
|
||||
/usr/sbin/grubby ${GRUB_ARG}--add-kernel=$bootPrefix/$kernelName-$version $INITRD \
|
||||
--copy-default --title "$title" \
|
||||
--args="root=$rootdevice $kernargs" \
|
||||
--remove-kernel="TITLE=$title"
|
||||
@ -233,7 +240,7 @@ while [ $# -gt 0 ]; do
|
||||
else
|
||||
initrdfile=$2
|
||||
shift
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
--kernel-args*)
|
||||
@ -242,7 +249,7 @@ while [ $# -gt 0 ]; do
|
||||
else
|
||||
kernargs=$2
|
||||
shift
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
--banner*)
|
||||
@ -251,7 +258,16 @@ while [ $# -gt 0 ]; do
|
||||
else
|
||||
banner=$2
|
||||
shift
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
--kernel-name*)
|
||||
if echo $1 | grep '=' >/dev/null ; then
|
||||
kernelName=`echo $1 | sed 's/^--kernel-name=//'`
|
||||
else
|
||||
kernelName=$2
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
|
||||
--depmod)
|
||||
|
Loading…
Reference in New Issue
Block a user