Compare commits
No commits in common. 'c9' and 'c8' have entirely different histories.
@ -1 +1 @@
|
|||||||
SOURCES/memtest86+-5.31b.tar.gz
|
SOURCES/memtest86+-5.01.tar.gz
|
||||||
|
@ -1 +1 @@
|
|||||||
7f4c16c6b04eb894154347047226b6e79ebe3c03 SOURCES/memtest86+-5.31b.tar.gz
|
eb4b6d70114db3c9ed320785da44c0ba8349c10c SOURCES/memtest86+-5.01.tar.gz
|
||||||
|
@ -1,32 +1,38 @@
|
|||||||
.TH MEMTEST-SETUP 8 2018-05-17 Memtest86+ "Memtest86+ Manual"
|
.TH "MEMTEST\-SETUP" "8" "Aug 26, 2014" "memtest-setup" "Memtest86+ User Manual"
|
||||||
|
.nh
|
||||||
.SH NAME
|
.ad l
|
||||||
memtest-setup \- install Memtest86+ into GRUB\ 2 boot loader menu
|
.SH "NAME"
|
||||||
|
memtest\-setup \- Install Memtest86+ into your GRUB boot loader menu
|
||||||
.SH SYNOPSIS
|
.SH "SYNOPSIS"
|
||||||
.BR memtest-setup " [" \-b | \-e | \-h ]
|
.HP \w'\fBmemtest\-setup\fR\ 'u
|
||||||
.br
|
.B memtest\-setup
|
||||||
.BR memtest-setup " [" \-\-bin | \-\-elf | \-\-help ]
|
.RI [ OPTIONS ]
|
||||||
|
.SH "DESCRIPTION"
|
||||||
.SH DESCRIPTION
|
|
||||||
.RB "The " memtest-setup " utility installs Memtest86+ into GRUB\ 2 boot"
|
|
||||||
loader menu.
|
|
||||||
.RI "It installs GRUB\ 2 template into " /etc/grub.d " directory."
|
|
||||||
.PP
|
.PP
|
||||||
GRUB\ 2 configuration file needs to be regenerated manually by running:
|
\fBmemtest\-setup\fR
|
||||||
.IP
|
installs Memtest86+ into your GRUB boot loader menu. It supports both GRUB\ 2
|
||||||
.RI "grub2-mkconfig -o " /boot/grub2/grub.cfg
|
and GRUB Legacy (i.e. GRUB 0.9x). In case of GRUB\ 2 it installs GRUB\ 2 template
|
||||||
.PP
|
into \fI/etc/grub.d\fR and GRUB\ 2 config needs to be regenerated manually by
|
||||||
This is not done automatically because it could overwrite any custom
|
running \fBgrub2-mkconfig\ -o\ \fI/boot/grub2/grub.cfg\fR under root.
|
||||||
changes in GRUB\ 2 configuration file.
|
This is not done automatically because it could overwrite any custom changes in
|
||||||
|
\fI/boot/grub2/grub.cfg\fR.
|
||||||
.SH OPTIONS
|
.SH "OPTIONS"
|
||||||
.TP
|
.SS
|
||||||
.BR \-b ", " \-\-bin
|
|
||||||
Install a binary Memtest86+ image.
|
|
||||||
.TP
|
|
||||||
.BR \-e ", " \-\-elf
|
|
||||||
Install an ELF Memtest86+ image (the default).
|
|
||||||
.TP
|
.TP
|
||||||
.BR \-h ", " \-\-help
|
.BR \-h ", " \-\-help
|
||||||
Print a help message and exit.
|
Shows help.
|
||||||
|
.SH "AUTHOR"
|
||||||
|
.PP
|
||||||
|
\fBJaroslav Škarvada\fR <\&jskarvad@redhat\&.com\&>
|
||||||
|
.RS 4
|
||||||
|
Manpage author\&.
|
||||||
|
.RE
|
||||||
|
.SH "COPYRIGHT"
|
||||||
|
.BR
|
||||||
|
Copyright \(co 2014 Jaroslav Škarvada
|
||||||
|
.BR
|
||||||
|
.PP
|
||||||
|
Permission is granted to copy, distribute and/or modify this document under the terms of the
|
||||||
|
GNU
|
||||||
|
General Public License, Version 2 or (at your option) any later version published by the Free Software Foundation\&.
|
||||||
|
.SP
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
--- memtest86+-5.01/io.h~ 2013-08-10 02:01:58.000000000 +0000
|
||||||
|
+++ memtest86+-5.01/io.h 2014-01-08 01:29:12.404465515 +0000
|
||||||
|
@@ -31,7 +31,7 @@
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define __OUT1(s,x) \
|
||||||
|
-extern inline void __out##s(unsigned x value, unsigned short port) {
|
||||||
|
+static inline void __out##s(unsigned x value, unsigned short port) {
|
||||||
|
|
||||||
|
#define __OUT2(s,s1,s2) \
|
||||||
|
__asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1"
|
||||||
|
@@ -43,7 +43,7 @@
|
||||||
|
__OUT1(s##c_p,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); SLOW_DOWN_IO; }
|
||||||
|
|
||||||
|
#define __IN1(s) \
|
||||||
|
-extern inline RETURN_TYPE __in##s(unsigned short port) { RETURN_TYPE _v;
|
||||||
|
+static inline RETURN_TYPE __in##s(unsigned short port) { RETURN_TYPE _v;
|
||||||
|
|
||||||
|
#define __IN2(s,s1,s2) \
|
||||||
|
__asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0"
|
@ -0,0 +1,99 @@
|
|||||||
|
diff --git a/controller.c b/controller.c
|
||||||
|
index f4f7371..183e9c3 100644
|
||||||
|
--- a/controller.c
|
||||||
|
+++ b/controller.c
|
||||||
|
@@ -2,6 +2,8 @@
|
||||||
|
* MemTest86+ V5 Specific code (GPL V2.0)
|
||||||
|
* By Samuel DEMEULEMEESTER, sdemeule@memtest.org
|
||||||
|
* http://www.canardpc.com - http://www.memtest.org
|
||||||
|
+ *
|
||||||
|
+ * Edited by David McInnis Oct 4, 2014
|
||||||
|
*/
|
||||||
|
|
||||||
|
//#include "defs.h"
|
||||||
|
@@ -292,7 +294,7 @@ static void setup_nhm(void)
|
||||||
|
|
||||||
|
/* First, locate the PCI bus where the MCH is located */
|
||||||
|
|
||||||
|
- for(i = 0; i < sizeof(possible_nhm_bus); i++) {
|
||||||
|
+ for(i = 0; i < sizeof(possible_nhm_bus) / sizeof(possible_nhm_bus[0]); i++) {
|
||||||
|
pci_conf_read( possible_nhm_bus[i], 3, 4, 0x00, 2, &vid);
|
||||||
|
pci_conf_read( possible_nhm_bus[i], 3, 4, 0x02, 2, &did);
|
||||||
|
vid &= 0xFFFF;
|
||||||
|
@@ -327,7 +329,7 @@ static void setup_nhm32(void)
|
||||||
|
ctrl.mode = ECC_NONE;
|
||||||
|
|
||||||
|
/* First, locate the PCI bus where the MCH is located */
|
||||||
|
- for(i = 0; i < sizeof(possible_nhm_bus); i++) {
|
||||||
|
+ for(i = 0; i < sizeof(possible_nhm_bus) / sizeof(possible_nhm_bus[0]); i++) {
|
||||||
|
pci_conf_read( possible_nhm_bus[i], 3, 4, 0x00, 2, &vid);
|
||||||
|
pci_conf_read( possible_nhm_bus[i], 3, 4, 0x02, 2, &did);
|
||||||
|
vid &= 0xFFFF;
|
||||||
|
@@ -1424,7 +1426,7 @@ static void poll_fsb_amd64(void) {
|
||||||
|
unsigned long dramchr;
|
||||||
|
float clockratio;
|
||||||
|
double dramclock;
|
||||||
|
- unsigned int dummy[3];
|
||||||
|
+ unsigned int dummy[4];
|
||||||
|
int ram_type;
|
||||||
|
|
||||||
|
float coef = 10;
|
||||||
|
@@ -2851,13 +2853,13 @@ static void poll_timings_nf4ie(void) {
|
||||||
|
|
||||||
|
static void poll_timings_i875(void) {
|
||||||
|
|
||||||
|
- ulong dev6, dev62;
|
||||||
|
+ ulong dev6;
|
||||||
|
ulong temp;
|
||||||
|
float cas;
|
||||||
|
int rcd, rp, ras, chan;
|
||||||
|
long *ptr, *ptr2;
|
||||||
|
|
||||||
|
- pci_conf_read( 0, 6, 0, 0x40, 4, &dev62);
|
||||||
|
+ pci_conf_read( 0, 6, 0, 0x40, 4, &dev6);
|
||||||
|
ptr2=(long*)(dev6+0x68);
|
||||||
|
|
||||||
|
/* Read the MMR Base Address & Define the pointer */
|
||||||
|
diff --git a/init.c b/init.c
|
||||||
|
index 754b8d7..5bd8b4f 100644
|
||||||
|
--- a/init.c
|
||||||
|
+++ b/init.c
|
||||||
|
@@ -7,6 +7,8 @@
|
||||||
|
*
|
||||||
|
* Released under version 2 of the Gnu Public License.
|
||||||
|
* By Chris Brady
|
||||||
|
+ *
|
||||||
|
+ * Edited by David McInnis October 4, 2014
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@@ -914,7 +916,6 @@ void cpu_type(void)
|
||||||
|
default:
|
||||||
|
cprint(0, COL_MID, "Unknown Intel");
|
||||||
|
break;
|
||||||
|
- break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
diff --git a/main.c b/main.c
|
||||||
|
index 0bc7ca0..613f811 100644
|
||||||
|
--- a/main.c
|
||||||
|
+++ b/main.c
|
||||||
|
@@ -422,7 +422,7 @@ void test_start(void)
|
||||||
|
//initialise_cpus();
|
||||||
|
btrace(my_cpu_num, __LINE__, "BeforeInit", 1, 0, 0);
|
||||||
|
/* Draw the screen and get system information */
|
||||||
|
- init();
|
||||||
|
+ init();
|
||||||
|
|
||||||
|
/* Set defaults and initialize variables */
|
||||||
|
set_defaults();
|
||||||
|
@@ -737,7 +737,7 @@ void test_start(void)
|
||||||
|
/* Do the same test for each CPU */
|
||||||
|
if (++cpu_sel >= act_cpus)
|
||||||
|
{
|
||||||
|
- cpu_sel = 0;
|
||||||
|
+ cpu_sel = 0;
|
||||||
|
next_test();
|
||||||
|
} else {
|
||||||
|
continue;
|
@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 7906d50..03eb50b 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -13,7 +13,7 @@ AS=as -32
|
||||||
|
CC=gcc
|
||||||
|
|
||||||
|
CFLAGS= -Wall -march=i486 -m32 -O0 -fomit-frame-pointer -fno-builtin \
|
||||||
|
- -ffreestanding -fPIC $(SMP_FL) -fno-stack-protector
|
||||||
|
+ -ffreestanding -fPIC $(SMP_FL) -fno-stack-protector -fgnu89-inline
|
||||||
|
|
||||||
|
OBJS= head.o reloc.o main.o test.o init.o lib.o patn.o screen_buffer.o \
|
||||||
|
config.o cpuid.o linuxbios.o pci.o memsize.o spd.o error.o dmi.o controller.o \
|
@ -0,0 +1,11 @@
|
|||||||
|
--- memtest86+-5.01/Makefile~ 2014-01-08 01:30:11.355900076 +0000
|
||||||
|
+++ memtest86+-5.01/Makefile 2014-01-08 01:31:19.387555469 +0000
|
||||||
|
@@ -12,7 +12,7 @@
|
||||||
|
AS=as -32
|
||||||
|
CC=gcc
|
||||||
|
|
||||||
|
-CFLAGS= -Wall -march=i486 -m32 -O1 -fomit-frame-pointer -fno-builtin \
|
||||||
|
+CFLAGS= -Wall -march=i486 -m32 -O0 -fomit-frame-pointer -fno-builtin \
|
||||||
|
-ffreestanding -fPIC $(SMP_FL) -fno-stack-protector
|
||||||
|
|
||||||
|
OBJS= head.o reloc.o main.o test.o init.o lib.o patn.o screen_buffer.o \
|
@ -0,0 +1,12 @@
|
|||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index bd55c1c..9909f07 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -21,7 +21,6 @@ OBJS= head.o reloc.o main.o test.o init.o lib.o patn.o screen_buffer.o \
|
||||||
|
|
||||||
|
|
||||||
|
all: clean memtest.bin memtest
|
||||||
|
- scp memtest.bin root@192.168.0.12:/srv/tftp/mt86plus
|
||||||
|
|
||||||
|
# Link it statically once so I know I don't have undefined
|
||||||
|
# symbols and then link it dynamically so I have full
|
@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/lib.c b/lib.c
|
||||||
|
index a2b829d..6a7e210 100644
|
||||||
|
--- a/lib.c
|
||||||
|
+++ b/lib.c
|
||||||
|
@@ -1141,7 +1141,7 @@ void serial_console_setup(char *param)
|
||||||
|
|
||||||
|
end++;
|
||||||
|
|
||||||
|
- if (*end != '\0' || *end != ' ')
|
||||||
|
+ if (*end != '\0' && *end != ' ')
|
||||||
|
return; /* garbage at the end */
|
||||||
|
|
||||||
|
serial_bits = bits;
|
@ -1,13 +0,0 @@
|
|||||||
diff --git a/lib.c b/lib.c
|
|
||||||
index a2b829d..6a7e210 100644
|
|
||||||
--- a/lib.c
|
|
||||||
+++ b/lib.c
|
|
||||||
@@ -1141,7 +1141,7 @@ void serial_console_setup(char *param)
|
|
||||||
|
|
||||||
end++;
|
|
||||||
|
|
||||||
- if (*end != '\0' || *end != ' ')
|
|
||||||
+ if (*end != '\0' && *end != ' ')
|
|
||||||
return; /* garbage at the end */
|
|
||||||
|
|
||||||
serial_bits = bits;
|
|
@ -0,0 +1,352 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Invoked upon installation or removal of a kernel package, the following
|
||||||
|
# tasks are/can be done here:
|
||||||
|
# creation/removal of initrd
|
||||||
|
# run of depmod/removal of depmod generated files
|
||||||
|
# addition/removal of kernel images from grub/lilo configuration (via grubby)
|
||||||
|
#
|
||||||
|
# Copyright (C) 2002, 2003 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
|
||||||
|
PATH=/sbin:/bin:$PATH
|
||||||
|
|
||||||
|
lilo=/usr/sbin/lilo
|
||||||
|
|
||||||
|
# some defaults that are sane for most arches
|
||||||
|
kernelName=elf-memtest86+
|
||||||
|
|
||||||
|
if [ -x ./grubby ]; then
|
||||||
|
grubby=./grubby
|
||||||
|
else
|
||||||
|
grubby=/usr/sbin/grubby
|
||||||
|
fi
|
||||||
|
|
||||||
|
cfgGrub=""
|
||||||
|
cfgLilo=""
|
||||||
|
runLilo=""
|
||||||
|
grubConfig=""
|
||||||
|
|
||||||
|
ARCH=$(uname -m)
|
||||||
|
|
||||||
|
if [ $ARCH = 'ia64' ]; then
|
||||||
|
liloConfig=/boot/efi/EFI/redhat/elilo.conf
|
||||||
|
bootPrefix=/boot/efi/EFI/redhat
|
||||||
|
liloFlag=elilo
|
||||||
|
isx86=""
|
||||||
|
elif [ $ARCH = 'ppc64' -o $ARCH = 'ppc' ]; then
|
||||||
|
liloConfig=/etc/yaboot.conf
|
||||||
|
bootPrefix=/boot
|
||||||
|
lilo=/usr/sbin/ybin
|
||||||
|
kernelName=vmlinux
|
||||||
|
liloFlag=yaboot
|
||||||
|
runLilo="yes"
|
||||||
|
isx86=""
|
||||||
|
elif [ $ARCH = 'sparc' -o $ARCH = 'sparc64' ]; then
|
||||||
|
liloConfig=/etc/silo.conf
|
||||||
|
bootPrefix=/boot
|
||||||
|
liloFlag=silo
|
||||||
|
lilo=/usr/sbin/silo
|
||||||
|
isx86=""
|
||||||
|
elif [ $ARCH = 's390' -o $ARCH = 's390x' ]; then
|
||||||
|
liloConfig=/etc/zipl.conf
|
||||||
|
bootPrefix=/boot
|
||||||
|
liloFlag=zipl
|
||||||
|
lilo=/usr/sbin/zipl
|
||||||
|
runLilo="yes"
|
||||||
|
isx86=""
|
||||||
|
else
|
||||||
|
# this leaves i?86 and x86_64
|
||||||
|
liloConfig=/etc/lilo.conf
|
||||||
|
grubConfig=/boot/grub/grub.conf
|
||||||
|
bootPrefix=/boot
|
||||||
|
liloFlag=lilo
|
||||||
|
isx86="yes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mode=""
|
||||||
|
version=""
|
||||||
|
initrd=""
|
||||||
|
initrdfile=""
|
||||||
|
moddep=""
|
||||||
|
verbose=""
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
install() {
|
||||||
|
# XXX kernel should be able to be specified also (or work right on ia64)
|
||||||
|
if [ ! -f $bootPrefix/$kernelName-$version ] ; then
|
||||||
|
[ -n "$verbose" ] && echo "kernel for $version does not exist, not running grubby"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
INITRD=""
|
||||||
|
if [ -f $initrdfile ]; then
|
||||||
|
[ -n "$verbose" ] && echo "found $initrdfile and using it with grubby"
|
||||||
|
INITRD="--initrd $initrdfile"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# FIXME: is this a good heuristic to find out if we're on iSeries?
|
||||||
|
if [ -d /proc/iSeries ]; then
|
||||||
|
[ -n "$verbose" ] && echo "On an iSeries, just making img file"
|
||||||
|
if [ -z $initrdfile ]; then
|
||||||
|
[ -n "$verbose" ] && echo "No initrd, just adding system map"
|
||||||
|
/usr/sbin/addSystemMap $bootPrefix/System.map-$version $bootPrefix/$kernelName-$version $bootPrefix/vmlinitrd-$version
|
||||||
|
else
|
||||||
|
/usr/sbin/addSystemMap $bootPrefix/System.map-$version $bootPrefix/$kernelName-$version $bootPrefix/vmlinux.sm-$version
|
||||||
|
/usr/sbin/addRamDisk $initrdfile $bootPrefix/System.map-$version $bootPrefix/vmlinux.sm-$version $bootPrefix/vmlinitrd-$version 2>/dev/null
|
||||||
|
rm $bootPrefix/vmlinux.sm-$version
|
||||||
|
fi
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# get the root filesystem to use; if it's on a label/uuid make sure it's
|
||||||
|
# been configured. if not, get the root device from mount
|
||||||
|
rootdevice=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/fstab)
|
||||||
|
short=$(echo $rootdevice | cut -d= -f1)
|
||||||
|
if [ "$short" == "LABEL" -o "$short" == "UUID" ]; then
|
||||||
|
if ! /usr/sbin/findfs "$rootdevice" &> /dev/null; then
|
||||||
|
rootdevice=$(mount | awk '$3 == "/" { print $1 }')
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$cfgGrub" ]; then
|
||||||
|
[ -n "$verbose" ] && echo "adding $version to $grubConfig"
|
||||||
|
|
||||||
|
if [ -n "$banner" ]; then
|
||||||
|
title="$banner ($version)"
|
||||||
|
elif [ -f /etc/redhat-release ]; then
|
||||||
|
title="$(sed 's/ release.*$//' < /etc/redhat-release) ($version)"
|
||||||
|
else
|
||||||
|
title="Red Hat Linux ($version)"
|
||||||
|
fi
|
||||||
|
# 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"
|
||||||
|
else
|
||||||
|
[ -n "$verbose" ] && echo "$grubConfig does not exist, not running grubby"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$cfgLilo" ]; then
|
||||||
|
[ -n "$verbose" ] && echo "adding $version to $liloConfig"
|
||||||
|
|
||||||
|
/usr/sbin/grubby --add-kernel=$bootPrefix/$kernelName-$version $INITRD \
|
||||||
|
--copy-default --title $version \
|
||||||
|
--args="root=$rootdevice $kernargs" \
|
||||||
|
--remove-kernel="TITLE=$version" \
|
||||||
|
--$liloFlag
|
||||||
|
|
||||||
|
if [ -n "$runLilo" ]; then
|
||||||
|
[ -n "$verbose" ] && echo "running $lilo"
|
||||||
|
if [ ! -x $lilo ] ; then
|
||||||
|
[ -n "$verbose" ] && echo "$lilo does not exist"
|
||||||
|
else
|
||||||
|
$lilo > /dev/null
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
[ -n "$verbose" ] && echo "$liloConfig does not exist, not running grubby"
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
remove() {
|
||||||
|
# FIXME: is this a good heuristic to find out if we're on iSeries?
|
||||||
|
if [ -d /proc/iSeries ]; then
|
||||||
|
[ -n "$verbose" ] && echo "On an iSeries, remove img file"
|
||||||
|
rm -f $bootPrefix/$kernelName-$version.img 2>/dev/null
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$cfgGrub" ]; then
|
||||||
|
[ -n "$verbose" ] && echo "removing $version from $grubConfig"
|
||||||
|
/usr/sbin/grubby --remove-kernel=$bootPrefix/$kernelName-$version
|
||||||
|
else
|
||||||
|
[ -n "$verbose" ] && echo "$grubConfig does not exist, not running grubby"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$cfgLilo" ]; then
|
||||||
|
[ -n "$verbose" ] && echo "removing $version from $liloConfig"
|
||||||
|
/usr/sbin/grubby --remove-kernel=$bootPrefix/$kernelName-$version \
|
||||||
|
--$liloFlag
|
||||||
|
|
||||||
|
if [ -n "$runLilo" ]; then
|
||||||
|
[ -n "$verbose" ] && echo "running $lilo"
|
||||||
|
if [ ! -x $lilo ] ; then
|
||||||
|
[ -n "$verbose" ] && echo "$lilo does not exist"
|
||||||
|
else
|
||||||
|
$lilo > /dev/null
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
[ -n "$verbose" ] && echo "$liloConfig does not exist, not running grubby"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
mkinitrd() {
|
||||||
|
[ -n "$verbose" ] && echo "creating initrd $initrdfile using $version"
|
||||||
|
/usr/sbin/mkinitrd -f $initrdfile $version
|
||||||
|
rc=$?
|
||||||
|
if [ $rc != 0 ]; then
|
||||||
|
echo "mkinitrd failed" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
rminitrd() {
|
||||||
|
[ -n "$verbose" ] && echo "removing initrd $initrdfile"
|
||||||
|
[ -f $initrdfile ] && rm -f $initrdfile
|
||||||
|
}
|
||||||
|
|
||||||
|
doDepmod() {
|
||||||
|
[ -n "$verbose" ] && echo "running depmod for $version"
|
||||||
|
depmod -ae -F /boot/System.map-$version $version
|
||||||
|
}
|
||||||
|
|
||||||
|
doRmmoddep() {
|
||||||
|
[ -n "$verbose" ] && echo "removing modules.dep info for $version"
|
||||||
|
[ -d /lib/modules/$version ] && rm -f /lib/modules/$version/modules.*
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
case $1 in
|
||||||
|
--mkinitrd)
|
||||||
|
initrd="make"
|
||||||
|
;;
|
||||||
|
|
||||||
|
--rminitrd)
|
||||||
|
initrd="remove"
|
||||||
|
;;
|
||||||
|
|
||||||
|
--initrdfile*)
|
||||||
|
if echo $1 | grep '=' >/dev/null ; then
|
||||||
|
initrdfile=`echo $1 | sed 's/^--initrdfile=//'`
|
||||||
|
else
|
||||||
|
initrdfile=$2
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
--kernel-args*)
|
||||||
|
if echo $1 | grep '=' >/dev/null ; then
|
||||||
|
kernargs=`echo $1 | sed 's/^--kernel-args=//'`
|
||||||
|
else
|
||||||
|
kernargs=$2
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
--banner*)
|
||||||
|
if echo $1 | grep '=' >/dev/null ; then
|
||||||
|
banner=`echo $1 | sed 's/^--banner=//'`
|
||||||
|
else
|
||||||
|
banner=$2
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
--kernel-name*)
|
||||||
|
if echo $1 | grep '=' >/dev/null ; then
|
||||||
|
kernelName=`echo $1 | sed 's/^--kernel-name=//'`
|
||||||
|
else
|
||||||
|
kernelName=$2
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
--depmod)
|
||||||
|
moddep="make"
|
||||||
|
;;
|
||||||
|
|
||||||
|
--rmmoddep)
|
||||||
|
moddep="remove"
|
||||||
|
;;
|
||||||
|
|
||||||
|
-v)
|
||||||
|
verbose=-v
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
if [ -z "$mode" ]; then
|
||||||
|
mode=$1
|
||||||
|
elif [ -z "$version" ]; then
|
||||||
|
version=$1
|
||||||
|
else
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
# make sure the mode is valid
|
||||||
|
if [ "$mode" != "--install" -a "$mode" != "--remove" ] ; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$version" ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set the initrd file based on arch; ia64 is the only currently known oddball
|
||||||
|
if [ -z "$initrdfile" ]; then
|
||||||
|
if [ `uname -m` = "ia64" ]; then
|
||||||
|
initrdfile="/boot/efi/EFI/redhat/initrd-$version.img"
|
||||||
|
else
|
||||||
|
initrdfile="/boot/initrd-$version.img"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
[ -n "$verbose" ] && echo "initrdfile is $initrdfile"
|
||||||
|
|
||||||
|
if [ "$moddep" == "make" ]; then
|
||||||
|
doDepmod
|
||||||
|
elif [ "$moddep" == "remove" ]; then
|
||||||
|
doRmmoddep
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$initrd" == "make" ]; then
|
||||||
|
mkinitrd
|
||||||
|
elif [ "$initrd" == "remove" ]; then
|
||||||
|
rminitrd
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -x $grubby ] ; then
|
||||||
|
[ -n "$verbose" ] && echo "$grubby does not exist"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
[ -n "$grubConfig" ] && [ -f "$grubConfig" ] && cfgGrub=1;
|
||||||
|
[ -n "$liloConfig" ] && [ -f "$liloConfig" ] && cfgLilo=1;
|
||||||
|
|
||||||
|
# if we have a lilo config on an x86 box, see if the default boot loader
|
||||||
|
# is lilo to determine if it should be run
|
||||||
|
if [ -n "$cfgLilo" -a -n "$isx86" ]; then
|
||||||
|
runLilo=$($grubby --bootloader-probe | grep lilo)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$mode" == "--install" ]; then
|
||||||
|
install
|
||||||
|
elif [ "$mode" == "--remove" ]; then
|
||||||
|
remove
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
Loading…
Reference in new issue