From dc002368a173ead461b289d6a485557a226a2c25 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Jun 13 2010 19:20:48 +0000 Subject: Pull EL6 kdump fixes into Rawhide Resolves: 597588 --- diff --git a/.cvsignore b/.cvsignore index 9cdba65..c5063c0 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1,11 +1,4 @@ -kexec-tools-1.101.tar.gz -makedumpfile.tar.gz -makedumpfile-1.1.1.tar.gz -kexec-tools-po.tar.gz -makedumpfile-1.1.5.tar.gz -kexec-tools-testing-20070330.tar.bz2 -makedumpfile-1.2.6.tar.gz -kexec-tools-2.0.0.tar.bz2 -makedumpfile-1.3.3.tar.gz -mkdumprd2-files.tbz2 dracut-files.tbz2 +kexec-tools-2.0.0.tar.bz2 +kexec-tools-po.tar.gz +makedumpfile-1.3.5.tar.gz diff --git a/Makefile.kcp b/Makefile.kcp deleted file mode 100644 index 38b57d3..0000000 --- a/Makefile.kcp +++ /dev/null @@ -1,35 +0,0 @@ -# -# kcp (copying date-stamped core files to filesystems) -# - -KCP_C_SRCS:= kcp/kcp.c - -KCP_C_OBJS:= $(patsubst %.c, $(OBJDIR)/%.o, $(KCP_C_SRCS)) -KCP_C_DEPS:= $(patsubst %.c, $(OBJDIR)/%.d, $(KCP_C_SRCS)) -KCP_SRCS:= $(KCP_C_SRCS) -KCP_OBJS:= $(KCP_C_OBJS) -KCP_DEPS:= $(KCP_C_DEPS) -KCP:= $(SBINDIR)/kcp - -include $(KCP_DEPS) - -$(KCP_C_DEPS): $(OBJDIR)/%.d: %.c - mkdir -p $(@D) - $(CC) $(CFLAGS) -M $< | sed -e 's|$(patsubst %.d,%.o,$(@F))|$(patsubst %.d,%.o,$(@))|' > $@ - -$(KCP_C_OBJS): $(OBJDIR)/%.o: %.c $(OBJDIR)/%.d - mkdir -p $(@D) - $(CC) $(CFLAGS) -o $@ -c $< - -$(KCP): $(KCP_OBJS) - mkdir -p $(@D) - $(CC) $(CFLAGS) -o $@ $(KCP_OBJS) - -echo:: - @echo "KCP_C_SRCS $(KCP_C_SRCS)" - @echo "KCP_C_DEPS $(KCP_C_DEPS)" - @echo "KCP_C_OBJS $(KCP_C_OBJS)" - @echo "KCP_SRCS $(KCP_SRCS)" - @echo "KCP_DEPS $(KCP_DEPS)" - @echo "KCP_OBJS $(KCP_OBJS)" - diff --git a/firstboot_kdump.py b/firstboot_kdump.py index b78eea6..beaf005 100755 --- a/firstboot_kdump.py +++ b/firstboot_kdump.py @@ -32,15 +32,13 @@ import time import gtk import gobject import commands -import rhpl.executil as executil from firstboot.config import * from firstboot.constants import * from firstboot.functions import * from firstboot.module import * - -from rhpl.translate import _, N_ -from rhpl import translate -translate.textdomain("firstboot") +import gettext +_ = lambda x: gettext.ldgettext("firstboot", x) +N_ = lambda x: x class moduleClass(Module): def __init__(self): @@ -58,9 +56,9 @@ class moduleClass(Module): # possible bootloaders we'll need to adjust # bootloader : (config file, kdump offset) - bootloaders = { "grub" : ("/boot/grub/grub.conf", 16), - "yaboot" : ("/boot/etc/yaboot.conf", 32), - "elilo" : ("/boot/efi/EFI/redhat/elilo.conf", 256) } + bootloaders = { "grub" : (["/boot/grub/grub.conf", "/boot/efi/EFI/redhat/grub.conf"], [16, 256]), + "yaboot" : (["/boot/etc/yaboot.conf"], [32]), + "elilo" : (["/boot/efi/EFI/redhat/elilo.conf"], [256]) } bootloader = None offset = 0 @@ -94,9 +92,17 @@ class moduleClass(Module): def getBootloader(self): for (name, (conf, offset)) in self.bootloaders.items(): - if os.access(conf, os.W_OK): - self.bootloader = name - return self.bootloader + i = 0 + for c in conf: + if os.access(c, os.W_OK): + self.bootloader = name + self.offset = i + return self.bootloader + i += 1 + + self.offset = None + self.bootloader = None + return None def createScreen(self, doDebug = None): self.doDebug = doDebug @@ -161,6 +167,7 @@ class moduleClass(Module): self.availMem += self.kdumpMem self.origCrashKernel = "%dM" % (self.kdumpMem) self.kdumpMemInitial = self.kdumpMem + self.kdumpEnabled = True else: self.kdumpEnabled = False self.initialState = self.kdumpEnabled @@ -344,8 +351,6 @@ class moduleClass(Module): self.enableKdumpCheck.set_active(False) self.showHide(False) return RESULT_FAILURE - else: - self.offset = self.bootloaders[self.bootloader][1] # Are we adding or removing the crashkernel param? if self.kdumpEnabled: diff --git a/import.log b/import.log new file mode 100644 index 0000000..72388de --- /dev/null +++ b/import.log @@ -0,0 +1 @@ +kexec-tools-2_0_0-36_fc14:HEAD:kexec-tools-2.0.0-36.fc14.src.rpm:1276456495 diff --git a/kcp.c b/kcp.c deleted file mode 100644 index 1133810..0000000 --- a/kcp.c +++ /dev/null @@ -1,181 +0,0 @@ - -/* Cheap program to make a variable directory first before copying contents. - * Main use is for kdump because nash does not support variables, hence a - * command sequence like the following does not work: - * date=`date ...` - * mkdir -p /x/y/$date - * cp foo /x/y/$date/bar - * - * Don Zickus (dzickus@redhat.com) - * - * Copyright 2006 Red Hat Software - * - * This software may be freely redistributed under the terms of the GNU - * General Public License, version 2. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* grab the local time and replace the %DATE var with it */ -char * xlate_time(const char *dst) -{ - struct tm *lclnow; - time_t now; - char *new_dst,*top; - int x; - - //get the time - if ((top=(char *)malloc(256)) == NULL) - return NULL; - if ((now = time(NULL)) < 1) - return NULL; - if ((lclnow = localtime(&now)) == NULL) - return NULL; - - //copy the easy stuff - new_dst=top; - while (*dst && (*dst != '%')) *new_dst++ = *dst++; - - //translate the date part - //we output Year-Month-Day-Hour:Minute - if (*dst == '%'){ - x = sprintf(new_dst,"%d-%02d-%02d-%02d:%02d", lclnow->tm_year+1900, - lclnow->tm_mon+1, lclnow->tm_mday, lclnow->tm_hour, - lclnow->tm_min); - new_dst += x; - - //finish the copy - dst += 5; //skip over %DATE - while (*dst) *new_dst++ = *dst++; - } - *new_dst='\0'; - - return top; -} - -void usage(int rc) -{ - - printf("usage: kcp source dest\n"); - printf(" kcp --ssh src user@host:/dst\n"); - printf(" kcp --local src dst\n"); - printf("Will translate any %%DATE command properly\n"); - printf("in the 'dest' variable\n"); - exit(rc); -} - -int main(int argc, char *argv[]) -{ - char *src, *dst, *new_dst, *ptr; - char *path; - int using_ssh=0; - char *login; - int status; - pid_t child; - - if (argc < 4) - usage(1); - - src = argv[2]; - dst = argv[3]; - if ((new_dst=xlate_time(dst)) == NULL){ - printf("Failed to translate time\n"); - exit(1); - } - - if (!strcmp(argv[1], "--ssh")) - using_ssh =1; - - /* - * Now that we have called xlate_time, new_dst - * holds the expanded ssh destination - */ - if (using_ssh) { - login=strdup(new_dst); - ptr=index(login, ':'); - *ptr++='\0'; - path = ptr; - } else { - login = NULL; - path = new_dst; - } - - /* - *this makes our target directory - */ - if ((child = fork()) == 0) { - /* - * child - */ - if (using_ssh) { - if (execlp("ssh", "ssh", "-q", "-o", "BatchMode=yes", "-o", - "StrictHostKeyChecking=no", login, "mkdir", "-p", - path, NULL) < 0) { - perror("Failed to run ssh"); - exit(1); - } - } else { - if (execlp("mkdir", "mkdir", "-p", path, NULL) < 0) { - perror("Failed to run mkdir"); - exit(1); - } - } - } else { - /* - * parent - */ - if (child < 0) { - perror("Could not fork"); - exit(1); - } - wait(&status); - if (WEXITSTATUS(status) != 0) { - printf ("%s exited abnormally: error = %d\n", - using_ssh ? "ssh":"mkdir", WEXITSTATUS(status)); - exit(1); - } - - } - - /* - * now that we have our directory, lets copy everything over - * Note that scp can be used for local copies as well - */ - if ((child = fork()) == 0) { - /*need to include login info if scp to remote host*/ - if (using_ssh) - path=new_dst; - if (execlp("scp", "scp", "-q", "-o", "BatchMode=yes", "-o", - "StrictHostKeyChecking=no", src, path, NULL) < 0) { - perror("Failed to run scp\n"); - exit(1); - } - } else { - if (child < 0) { - perror("Could not fork"); - exit(1); - } - wait(&status); - if (WEXITSTATUS(status) != 0) { - printf("scp exited abnormally: error = %d\n", - WEXITSTATUS(status)); - exit(1); - } - } - - exit(0); -} diff --git a/kdump.conf b/kdump.conf index bef6be9..2d05493 100644 --- a/kdump.conf +++ b/kdump.conf @@ -79,7 +79,7 @@ # modules can be listed, separated by a space, and any # dependent modules will automatically be included. # -# default +# default # - Action to preform instead of mounting root fs and # running init process # reboot: If the default action is reboot simply reboot @@ -88,6 +88,7 @@ # halt: If the default action is halt, then simply # halt the system after attempting to capture # a vmcore, regardless of success or failure. +# poweroff: The system will be powered down # shell: If the default action is shell, then drop to # an msh session inside the initramfs from # where you can try to record the core manually. @@ -96,9 +97,9 @@ # will mount the root file system and run init. #raw /dev/sda5 -#ext3 /dev/sda3 -#ext3 LABEL=/boot -#ext3 UUID=03138356-5e61-4ab3-b58e-27507ac41937 +#ext4 /dev/sda3 +#ext4 LABEL=/boot +#ext4 UUID=03138356-5e61-4ab3-b58e-27507ac41937 #net my.server.com:/export/tmp #net user@my.server.com #path /var/crash diff --git a/kdump.init b/kdump.init index 3296b74..e4113bd 100644 --- a/kdump.init +++ b/kdump.init @@ -136,39 +136,8 @@ function check_config() # 4GB of ram available. Returns 1 if we do, 0 if we dont function need_64bit_headers() { - - MEMSZ=`sed -e's/\(^[0-9]\+.*\)/0x\1/' -e's/\(-\)\(.*\)/ 0x\2/' /proc/iomem | \ - awk 'BEGIN { - totalmem=0; - segmentmem=0; - } - /.*RAM.*/ { - start = strtonum($1); - end = strtonum($2); - segmentmem=end-start; - totalmem=totalmem+(segmentmem/1024); - if (end >= 4194304) { - totalmem=totalmem+4194304; - } - } - END { - printf "%d", (totalmem+1); - }'` - - #The AWK script above computes the total number of KB - #in the RAM areas of /proc/iomem - #Note also that we set totalmem to 4GB in the event that - #any physical address is larger than 4GB. This lets us - #default to 64 bit ELF headers for PAE kernels, which - #need then to access those higher addresses. - - #This comparison tells us if the above amount is more than - #4GB (4096 KB). I do the funny math to avoid overflow - if [ $MEMSZ -ge 4194304 ] - then - return 1 - fi - return 0 + return `tail -n 1 /proc/iomem | awk '{ split ($1, r, "-"); \ + print (strtonum("0x" r[2]) > strtonum("0xffffffff")); }'` } # Load the kdump kerel specified in /etc/sysconfig/kdump @@ -186,6 +155,10 @@ function load_kdump() if [ "$ARCH" == "ppc64" ] then MEM_RESERVED=`grep "crashkernel=[0-9]\+[MmKkGg]@[0-9]\+[MmGgKk]" /proc/cmdline` + if [ -z "$MEM_RESERVED" ] + then + MEM_RESERVED=`grep "crashkernel=[0-9]\+[MmKkGg]" /proc/cmdline` + fi else MEM_RESERVED=`grep "Crash kernel" /proc/iomem | grep -v "00000000-00000000"` fi @@ -220,7 +193,7 @@ function load_kdump() fi fi - KDUMP_COMMANDLINE=`echo $KDUMP_COMMANDLINE | sed -e 's/crashkernel=[0-9]\+[MmKkGg]@[0-9]\+[MmGgKk]//'` + KDUMP_COMMANDLINE=`echo $KDUMP_COMMANDLINE | sed -e 's/crashkernel=[^ ]*//'` KDUMP_COMMANDLINE="${KDUMP_COMMANDLINE} ${KDUMP_COMMANDLINE_APPEND}" $KEXEC $KEXEC_ARGS $standard_kexec_args \ @@ -284,10 +257,10 @@ function propagate_ssh_key() SSH_SERVER=`echo $SSH_TARGET | sed -e's/\(.*@\)\(.*$\)/\2/'` #now send the found key to the found server - cat $KEYFILE | ssh -x $SSH_USER@$SSH_SERVER "mkdir -p ~$SSH_USER/.ssh; chmod 700 ~$SSH_USER/.ssh; cat >> ~$SSH_USER/.ssh/authorized_keys2; chmod 600 ~$SSH_USER/.ssh/authorized_keys2" + ssh-copy-id -i $KEYFILE $SSH_USER@$SSH_SERVER &>/dev/null RET=$? if [ $RET == 0 ]; then - echo $KEYFILE has been added to ~$SSH_USER/.ssh/authorized_keys2 on $SSH_SERVER + echo $KEYFILE has been added to ~$SSH_USER/.ssh/authorized_keys on $SSH_SERVER $LOGGER "propagated ssh key (ssh server: $SSH_SERVER)" return 0 else @@ -377,14 +350,15 @@ case "$1" in case "$?" in 0) echo "Kdump is operational" + EXIT_CODE=0 ;; 1) echo "Kdump is not operational" - EXIT_CODE=1 + EXIT_CODE=3 ;; 2) echo "Kdump is unsupported on this kernel" - EXIT_CODE=1 + EXIT_CODE=3 ;; esac exit $EXIT_CODE diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt index 0e9acb8..2254ce8 100644 --- a/kexec-kdump-howto.txt +++ b/kexec-kdump-howto.txt @@ -30,9 +30,8 @@ hence contents of first kernel's memory are preserved, which is essentially the kernel crash dump. Kdump is supported on the i686, x86_64, ia64 and ppc64 platforms. The -standard kernel and capture kernel are one in the same on i686, x86_64 -and ia64, while ppc64 requires a separate capture kernel (provided by the -kernel-kdump package) at this time. +standard kernel and capture kernel are one in the same on i686, x86_64, +ia64 and ppc64. If you're reading this document, you should already have kexec-tools installed. If not, you install it via the following command: @@ -60,25 +59,34 @@ kexec-tools installed. If not, you install it via the following command: # yum install kexec-tools -If you're on ppc64, you'll first need to install the kernel-kdump package: - - # yum install kernel-kdump - To be able to do much of anything interesting in the way of debug analysis, you'll also need to install the kernel-debuginfo package, of the same arch as your running kernel, and the crash utility: # yum --enablerepo=\*debuginfo install kernel-debuginfo.$(uname -m) crash -Next up, we need to modify some boot parameters to reserve a chunk of memory -for the capture kernel. For i686 and x86_64, edit /etc/grub.conf, and append -"crashkernel=128M@16M" to the end of your kernel line. Similarly, append -the same to the append line in /etc/yaboot.conf for ppc64, followed by a -/sbin/ybin to load the new configuration (not needed for grub). On ia64, -edit /etc/elilo.conf, adding "crashkernel=256M@256M" to the append line for -your kernel. Note that the X@Y values are such that X = the amount of memory -to reserve for the capture kernel and Y = the offset into memory at which -that reservation should start. +Next up, we need to modify some boot parameters to reserve a chunk of memory for +the capture kernel. For i686 and x86_64, edit /etc/grub.conf, and append +"crashkernel=128M" to the end of your kernel line. Similarly, append the same to +the append line in /etc/yaboot.conf for ppc64. On ia64, edit /etc/elilo.conf, +adding "crashkernel=256M" to the append line for your kernel. Note that the X +values are such that X = the amount of memory to reserve for the capture kernel. + +Note that there is an alternative form in which to specify a crashkernel +memory reservation, in the event that more control is needed over the size and +placement of the reserved memory. The format is: + +crashkernel=range1:size1[,range2:size2,...][@offset] + +Where range specifies a range of values that are matched against the amount +of physical RAM present in the system, and the corresponding size value +specifies the amount of kexec memory to reserve. For example: + +crashkernel=512M-2G:64M,2G-:128M + +This line tells kexec to reserve 64M of ram if the system contains between +512M and 2G of physical memory. If the system contains 2G or more of physical +memory, 128M should be reserved. Examples: # grub.conf generated by anaconda @@ -117,7 +125,7 @@ fstype=raw image=/vmlinuz-2.6.17-1.2621.el5 label=linux read-only initrd=/initrd-2.6.17-1.2621.el5.img - append="root=LABEL=/ crashkernel=128M@16M" + append="root=LABEL=/ crashkernel=128M" # cat /etc/elilo.conf @@ -129,15 +137,15 @@ relocatable image=vmlinuz-2.6.17-1.2621.el5 label=2.6.17-1.2621.el5 initrd=initrd-2.6.17-1.2621.el5.img read-only - append="-- root=LABEL=/ crashkernel=256M@256M" + append="-- root=LABEL=/ crashkernel=256M" -After making said changes, reboot your system, so that the X MB of memory -starting Y MB into your memory is left untouched by the normal system, -reserved for the capture kernel. Take note that the output of 'free -m' will -show X MB less memory than without this parameter, which is expected. You -may be able to get by with less than 128M, but testing with only 64M has -proven unreliable of late. On ia64, as much as 512M may be required. +After making said changes, reboot your system, so that the X MB of memory is +left untouched by the normal system, reserved for the capture kernel. Take note +that the output of 'free -m' will show X MB less memory than without this +parameter, which is expected. You may be able to get by with less than 128M, but +testing with only 64M has proven unreliable of late. On ia64, as much as 512M +may be required. Now that you've got that reserved memory region set up, you want to turn on the kdump init script: @@ -200,10 +208,6 @@ http://kbase.redhat.com/faq/FAQ_85_9129.shtm Once this feature has been enabled in the kernel, any lockups will result in an OOPs message to be generated, followed by Kdump being triggered. -Please refrain from simultaneously enabling 'nmi_watchdog' and setting -/proc/sys/kernel/unknown_nmi_panic, as this would result in a Kernel Panic -from legitimate NMIs generated by the nmi_watchdog. - 3) Kernel OOPs If we want to generate a dump everytime the Kernel OOPses, we can achieve this @@ -231,9 +235,6 @@ the 'unknown_nmi_panic' option as follows: # echo 1 > /proc/sys/kernel/unknown_nmi_panic -When enabling unknown_nmi_panic please be careful not to enable Nmi Watchdog -feature, else the system will panic. - 5) PowerPC specific methods: On IBM PowerPC machines, issuing a soft reset invokes the XMON debugger(if @@ -337,13 +338,13 @@ Dedicated file system Similar to raw partition dumping, you can format a partition with the file system of your choice, leaving it unmounted during normal operation. Again, it should be at least as large as the amount of memory in the system. Assuming -/dev/sda3 has been formatted ext3, specify 'ext3 /dev/sda3' in kdump.conf, +/dev/sda3 has been formatted ext4, specify 'ext4 /dev/sda3' in kdump.conf, and a vmcore file will be copied onto the file system after it has been mounted. Dumping to a dedicated partition has the advantage that you can dump multiple vmcores to the file system, space permitting, without overwriting previous ones, as would be the case in a raw partition setup. Restart the kdump service via '/sbin/service kdump restart' to commit this change to -your kdump initrd. Note that for local file systems ext3 and ext2 are +your kdump initrd. Note that for local file systems ext4 and ext2 are supported as dumpable targets. Kdump will not prevent you from specifying other filesystems, and they will most likely work, but their operation cannot be guaranteed. for instance specifying a vfat filesystem or msdos diff --git a/kexec-tools-2.0.0-fix-page-offset.patch b/kexec-tools-2.0.0-fix-page-offset.patch new file mode 100644 index 0000000..0d0dfec --- /dev/null +++ b/kexec-tools-2.0.0-fix-page-offset.patch @@ -0,0 +1,12 @@ +diff -up kexec-tools-2.0.0/kexec/arch/x86_64/crashdump-x86_64.h.orig kexec-tools-2.0.0/kexec/arch/x86_64/crashdump-x86_64.h +--- kexec-tools-2.0.0/kexec/arch/x86_64/crashdump-x86_64.h.orig 2010-01-29 09:12:07.000000000 -0500 ++++ kexec-tools-2.0.0/kexec/arch/x86_64/crashdump-x86_64.h 2010-01-29 09:12:19.000000000 -0500 +@@ -5,7 +5,7 @@ int load_crashdump_segments(struct kexec + unsigned long max_addr, unsigned long min_base); + + #define __START_KERNEL_map 0xffffffff80000000UL +-#define PAGE_OFFSET 0xffff810000000000UL ++#define PAGE_OFFSET 0xffff880000000000UL + #define __pa(x) (((unsigned long)(x)>=__START_KERNEL_map)?(unsigned long)(x) - (unsigned long)__START_KERNEL_map:(unsigned long)(x) - PAGE_OFFSET) + + #define MAXMEM 0x3fffffffffffUL diff --git a/kexec-tools-2.0.0-makedumpfile-2.6.32-sparsemem.patch b/kexec-tools-2.0.0-makedumpfile-2.6.32-sparsemem.patch new file mode 100644 index 0000000..b449d49 --- /dev/null +++ b/kexec-tools-2.0.0-makedumpfile-2.6.32-sparsemem.patch @@ -0,0 +1,66 @@ +From: Masayuki Igawa +Date: Tue, 6 Apr 2010 04:50:45 +0000 (+0900) +Subject: [PATCH] handle !SPARSEMEM_EX properly. +X-Git-Url: http://makedumpfile.git.sourceforge.net/git/gitweb.cgi?p=makedumpfile%2Fmakedumpfile;a=commitdiff_plain;h=27b71566ec11128c5b061a350e467546f2d26be6 + +[PATCH] handle !SPARSEMEM_EX properly. + +In !SPARSEMEM_EX case, the symbol mem_section points a array of struct +mem_section, doesn't point a array of pointer to mem_section[], so I +think the check: + + if (!is_kvaddr(mem_sec[SECTION_NR_TO_ROOT(nr)])) + return NOT_KV_ADDR; + +in nr_to_section() is not a valid check in this case. + +To make the matters worse, if CONFIG_CGROUP_MEM_RES_CTLR is enabled, the +end of struct mem_section is padded with 0. + +So, reading mem_section by "rd" of crash will look like: + + crash> rd mem_section 128 + c08b71e0: c9002003 c9001200 f7000000 00000000 + c08b71f0: c9002003 c9001260 f6980000 00000000 + c08b7200: c9002003 c90012c0 f6300000 00000000 + c08b7210: c9002003 c9001320 f5c80000 00000000 + +This means nr_to_section() will return 0 when "nr" is 3,7,11,... because +it meets the condition(mem_sec[SECTION_NR_TO_ROOT(nr)] == mem_sec[nr] +== 0 == !is_kvaddr). + +As a result, mem_map for section 3,7,11,... cannot be handled properly. + +This patch is a fix for this problem. nr_to_section() will check "addr" +by is_kvaddr() later anyway, so this patch just removes the problematic +check. + +Signed-off-by: Masayuki Igawa +Signed-off-by: Daisuke Nishimura +--- + +diff -up kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.c.orig kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.c +--- kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.c.orig 2010-04-06 17:01:15.858262785 +0200 ++++ kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.c 2010-04-06 17:01:15.865290984 +0200 +@@ -3550,9 +3550,6 @@ nr_to_section(unsigned long nr, unsigned + { + unsigned long addr; + +- if (!is_kvaddr(mem_sec[SECTION_NR_TO_ROOT(nr)])) +- return NOT_KV_ADDR; +- + if (is_sparsemem_extreme()) + addr = mem_sec[SECTION_NR_TO_ROOT(nr)] + + (nr & SECTION_ROOT_MASK()) * SIZE(mem_section); +diff -up kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.h.orig kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.h +--- kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.h.orig 2009-11-11 01:44:51.000000000 +0100 ++++ kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.h 2010-04-06 17:02:36.471367908 +0200 +@@ -449,7 +449,7 @@ do { \ + #define KVER_MIN_SHIFT 16 + #define KERNEL_VERSION(x,y,z) (((x) << KVER_MAJ_SHIFT) | ((y) << KVER_MIN_SHIFT) | (z)) + #define OLDEST_VERSION KERNEL_VERSION(2, 6, 15)/* linux-2.6.15 */ +-#define LATEST_VERSION KERNEL_VERSION(2, 6, 31)/* linux-2.6.31 */ ++#define LATEST_VERSION KERNEL_VERSION(2, 6, 32)/* linux-2.6.32 */ + + /* + * vmcoreinfo in /proc/vmcore diff --git a/kexec-tools-2.0.0-makedumpfile-2.6.32-utsname.patch b/kexec-tools-2.0.0-makedumpfile-2.6.32-utsname.patch new file mode 100644 index 0000000..8132c15 --- /dev/null +++ b/kexec-tools-2.0.0-makedumpfile-2.6.32-utsname.patch @@ -0,0 +1,83 @@ +diff -up kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.c.orig kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.c +--- kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.c.orig 2009-11-10 19:44:51.000000000 -0500 ++++ kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.c 2010-03-03 10:33:45.000000000 -0500 +@@ -3772,6 +3772,8 @@ initialize_bitmap_memory(void) + int + initial(void) + { ++ int debug_info = FALSE; ++ + if (!(vt.mem_flags & MEMORY_XEN) && info->flag_exclude_xen_dom) { + MSG("'-X' option is disable,"); + MSG("because %s is not Xen's memory core image.\n", info->name_memory); +@@ -3803,6 +3805,7 @@ initial(void) + if (!read_vmcoreinfo()) + return FALSE; + close_vmcoreinfo(); ++ debug_info = TRUE; + /* + * Get the debug information for analysis from the kernel file + */ +@@ -3818,6 +3821,8 @@ initial(void) + + if (!get_srcfile_info()) + return FALSE; ++ ++ debug_info = TRUE; + } else { + /* + * Check whether /proc/vmcore contains vmcoreinfo, +@@ -3847,6 +3852,7 @@ initial(void) + if (!read_vmcoreinfo_from_vmcore(info->offset_vmcoreinfo, + info->size_vmcoreinfo, FALSE)) + return FALSE; ++ debug_info = TRUE; + } + + if (!get_value_for_old_linux()) +@@ -3863,31 +3869,25 @@ out: + if (!get_max_mapnr()) + return FALSE; + +- if ((info->max_dump_level <= DL_EXCLUDE_ZERO) && !info->flag_dmesg) { +- /* +- * The debugging information is unnecessary, because the memory +- * management system will not be analazed. +- */ +- if (!get_mem_map_without_mm()) ++ if (debug_info) { ++ if (!get_machdep_info()) + return FALSE; +- else +- return TRUE; +- } + +- if (!get_machdep_info()) +- return FALSE; +- +- if (!check_release()) +- return FALSE; ++ if (!check_release()) ++ return FALSE; + +- if (!get_versiondep_info()) +- return FALSE; ++ if (!get_versiondep_info()) ++ return FALSE; + +- if (!get_numnodes()) +- return FALSE; ++ if (!get_numnodes()) ++ return FALSE; + +- if (!get_mem_map()) +- return FALSE; ++ if (!get_mem_map()) ++ return FALSE; ++ } else { ++ if (!get_mem_map_without_mm()) ++ return FALSE; ++ } + + return TRUE; + } diff --git a/kexec-tools-2.0.0-makedumpfile-boption.patch b/kexec-tools-2.0.0-makedumpfile-boption.patch new file mode 100644 index 0000000..9faf326 --- /dev/null +++ b/kexec-tools-2.0.0-makedumpfile-boption.patch @@ -0,0 +1,27 @@ +diff -up kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.8.orig kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.8 +--- kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.8.orig 2009-11-10 19:44:51.000000000 -0500 ++++ kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.8 2010-03-22 09:20:57.000000000 -0400 +@@ -446,6 +446,10 @@ it is necessary to specfiy [\-x \fIVMLIN + Print debugging message. + + .TP ++\fB-b \fR ++cache 2^order pages in ram when generating vmcore info before writing to output ++ ++.TP + \fB\-h\fR + Show help message. + +diff -up kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.c.orig kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.c +--- kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.c.orig 2010-03-22 09:20:33.000000000 -0400 ++++ kexec-tools-2.0.0/makedumpfile-1.3.5/makedumpfile.c 2010-03-22 09:21:06.000000000 -0400 +@@ -738,6 +738,9 @@ print_usage(void) + MSG(" [-D]:\n"); + MSG(" Print debugging message.\n"); + MSG("\n"); ++ MSG(" [-b ]:\n"); ++ MSG(" Specify the block write size of makedumpfile. 2^order pages are cached on each write\n"); ++ MSG("\n"); + MSG(" [-f]:\n"); + MSG(" Overwrite DUMPFILE even if it already exists.\n"); + MSG("\n"); diff --git a/kexec-tools-2.0.0-makedumpfile-dynamic-build.patch b/kexec-tools-2.0.0-makedumpfile-dynamic-build.patch index eebcf57..6b2e2d2 100644 --- a/kexec-tools-2.0.0-makedumpfile-dynamic-build.patch +++ b/kexec-tools-2.0.0-makedumpfile-dynamic-build.patch @@ -1,12 +1,11 @@ -diff -up kexec-tools-2.0.0/makedumpfile-1.3.3/Makefile.orig kexec-tools-2.0.0/makedumpfile-1.3.3/Makefile ---- kexec-tools-2.0.0/makedumpfile-1.3.3/Makefile.orig 2009-07-06 15:45:56.000000000 -0400 -+++ kexec-tools-2.0.0/makedumpfile-1.3.3/Makefile 2009-07-06 15:46:06.000000000 -0400 -@@ -32,7 +32,7 @@ $(OBJ_ARCH): $(SRC_ARCH) +--- kexec-tools-2.0.0/makedumpfile-1.3.5/Makefile.orig 2009-11-11 08:44:51.000000000 +0800 ++++ kexec-tools-2.0.0/makedumpfile-1.3.5/Makefile 2010-05-30 00:25:17.350869858 +0800 +@@ -32,7 +32,7 @@ $(CC) $(CFLAGS_ARCH) -c -o ./$@ ./$(@:.o=.c) makedumpfile: $(SRC) $(OBJ_ARCH) - $(CC) $(CFLAGS) $(OBJ_ARCH) -o $@ $< -static -ldw -lelf -lz + $(CC) $(CFLAGS) $(OBJ_ARCH) -o $@ $< -ldw -lelf -lz - gzip -c ./makedumpfile.8 > ./makedumpfile.8.gz - - clean: + echo .TH MAKEDUMPFILE 8 \"$(DATE)\" \"makedumpfile v$(VERSION)\" \"Linux System Administrator\'s Manual\" > temp.8 + grep -v "^.TH MAKEDUMPFILE 8" makedumpfile.8 >> temp.8 + mv temp.8 makedumpfile.8 diff --git a/kexec-tools-2.0.0-x8664-kernel-text-size.patch b/kexec-tools-2.0.0-x8664-kernel-text-size.patch new file mode 100644 index 0000000..13fb80d --- /dev/null +++ b/kexec-tools-2.0.0-x8664-kernel-text-size.patch @@ -0,0 +1,12 @@ +diff -up kexec-tools-2.0.0/kexec/arch/x86_64/crashdump-x86_64.h.orig kexec-tools-2.0.0/kexec/arch/x86_64/crashdump-x86_64.h +--- kexec-tools-2.0.0/kexec/arch/x86_64/crashdump-x86_64.h.orig 2010-04-30 15:14:13.000000000 -0400 ++++ kexec-tools-2.0.0/kexec/arch/x86_64/crashdump-x86_64.h 2010-04-30 15:14:20.000000000 -0400 +@@ -11,7 +11,7 @@ int load_crashdump_segments(struct kexec + #define MAXMEM 0x3fffffffffffUL + + /* Kernel text size */ +-#define KERNEL_TEXT_SIZE (40UL*1024*1024) ++#define KERNEL_TEXT_SIZE (512UL*1024*1024) + + #define CRASH_MAX_MEMMAP_NR (KEXEC_MAX_SEGMENTS + 1) + #define CRASH_MAX_MEMORY_RANGES (MAX_MEMORY_RANGES + 2) diff --git a/kexec-tools.spec b/kexec-tools.spec index 517d31a..af71c4f 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -1,10 +1,10 @@ Name: kexec-tools Version: 2.0.0 -Release: 33%{?dist} +Release: 36%{?dist} License: GPLv2 Group: Applications/System Summary: The kexec/kdump userspace component. -Source0: %{name}-%{version}.tar.bz2 +Source0: http://www.kernel.org/pub/linux/kernel/people/horms/kexec-tools/%{name}-%{version}.tar.bz2 Source1: kdump.init Source2: kdump.sysconfig Source3: kdump.sysconfig.x86_64 @@ -13,7 +13,7 @@ Source5: kdump.sysconfig.ppc64 Source6: kdump.sysconfig.ia64 Source7: mkdumprd Source8: kdump.conf -Source9: makedumpfile-1.3.3.tar.gz +Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.3.5/makedumpfile-1.3.5.tar.gz Source10: kexec-kdump-howto.txt Source11: firstboot_kdump.py Source12: mkdumprd.8 @@ -47,6 +47,8 @@ Obsoletes: diskdumputils netdump # # Patches 101 through 200 are meant for x86_64 kexec-tools enablement # +Patch101: kexec-tools-2.0.0-fix-page-offset.patch +Patch102: kexec-tools-2.0.0-x8664-kernel-text-size.patch # # Patches 201 through 300 are meant for ia64 kexec-tools enablement @@ -69,6 +71,9 @@ Obsoletes: diskdumputils netdump # Patch601: kexec-tools-2.0.0-disable-kexec-test.patch Patch602: kexec-tools-2.0.0-makedumpfile-dynamic-build.patch +Patch603: kexec-tools-2.0.0-makedumpfile-2.6.32-utsname.patch +Patch604: kexec-tools-2.0.0-makedumpfile-boption.patch +Patch605: kexec-tools-2.0.0-makedumpfile-2.6.32-sparsemem.patch %description kexec-tools provides /sbin/kexec binary that facilitates a new @@ -83,8 +88,14 @@ component of the kernel's kexec feature. mkdir -p -m755 kcp tar -z -x -v -f %{SOURCE9} +%patch101 -p1 +%patch102 -p1 + %patch601 -p1 %patch602 -p1 +%patch603 -p1 +%patch604 -p1 +%patch605 -p1 tar -z -x -v -f %{SOURCE13} @@ -114,7 +125,7 @@ cp %{SOURCE10} . make %ifarch %{ix86} x86_64 ia64 ppc64 -make -C makedumpfile-1.3.3 +make -C makedumpfile-1.3.5 %endif make -C kexec-tools-po @@ -145,7 +156,8 @@ install -m 644 %{SOURCE14} $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d/98-kexec.r install -m 644 %{SOURCE15} $RPM_BUILD_ROOT%{_mandir}/man5/kdump.conf.5 %ifarch %{ix86} x86_64 ia64 ppc64 -install -m 755 makedumpfile-1.3.3/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile +install -m 755 makedumpfile-1.3.5/makedumpfile $RPM_BUILD_ROOT/sbin/makedumpfile +install -m 644 makedumpfile-1.3.5/makedumpfile.8.gz $RPM_BUILD_ROOT/%{_mandir}/man8/makedumpfile.8.gz %endif make -C kexec-tools-po install DESTDIR=$RPM_BUILD_ROOT %find_lang %{name} @@ -268,6 +280,52 @@ done %changelog +* Sun Jun 13 2010 Lubomir Rintel - 2.0.0-36 +- Cosmetic mkdumprd fixes (drop an unused function, streamline another) + +* Sat May 29 2010 CAI Qian - 2.0.0-35 +- Forward-port from F13 +- Fixed kernel text area search in kcore (bz 587750) + +* Sat May 29 2010 CAI Qian - 2.0.0-34 +- Massive forward-port from RHEL6 +- Update kexec-kdump-howto.txt +- Update docs to reflect use of ext4 +- Update mkdumprd to pull in all modules needed +- Fix mkdumprd typo +- Removed universal add of ata_piix from mkdumprd +- Fix infinite loop from modprobe changes +- Fixed kexec-kdump-howto.doc for RHEL6 +- Update makedumpfile to 1.3.5 +- Improved mkdumprd run time +- Cai's fix for broken regex +- Fixing crashkernel syntax parsing +- Fix initscript to return proper LSB return codes +- Fixed bad call to resolve_dm_name +- Added poweroff option to mkdumprd +- Fixed readlink issue +- Fixed x86_64 page_offset specifictaion +- Fixed lvm setup loop to not hang +- Added utsname support to makedumpfile for 2.6.32 +- Fix critical_disks list to exclude cciss/md +- Add help info for -b option +- Add ability to handle firmware hotplug events +- Update mkdumprd to deal with changes in busybox fsck +- Vitaly's fix to detect need for 64 bit elf +- Fix major/minor numbers on /dev/rtc +- Fix ssh id propogation w/ selinux +- Add blacklist feature to kdump.conf +- Removed rhpl code from firstboot +- Fixed firstboot enable sense +- Remove bogus debug comment from mkdumprd. +- Handle SPARSEMEM properly +- Fix scp monitoring script +- Fix firstboot to find grub on EFI systems +- Fixed mkdumprd to remove dup insmod +- Fixed kdump fsck pause +- Fixed kdump option handling +- fixed raid5 module detection + * Thu Mar 11 2010 Neil Horman - 2.0.0-33 - Remove nash references from mkdumprd diff --git a/mkdumprd b/mkdumprd index ac3a959..24aefba 100644 --- a/mkdumprd +++ b/mkdumprd @@ -122,7 +122,6 @@ moduledep() { exit 1 fi - vecho -n "Looking for deps of module $1" deps=$(awk 'BEGIN { searched=ARGV[2]; ARGV[2]=""; rc=1 } \ function modname(filename) { match(filename, /\/([^\/]+)\.k?o:?$/, ret); return ret[1] } \ function show() { if (orig == searched) { print dep; orig=""; rc=0; exit } } \ @@ -131,24 +130,108 @@ moduledep() { if ($2) { for (i = 2; i <= NF; i++) { dep=sprintf("%s %s", dep, modname($i)); } } } \ /^ / { dep=sprintf("%s %s", dep, modname($1)); } \ END { show(); exit(rc) }' /lib/modules/$kernel/modules.dep $1) + for i in `modprobe --show-depends $1 2>/dev/null | awk '/insmod/ {print $2}'` + do + modname=`basename $i | sed -e's/\.ko//'` + if [ "$modname" == "$1" ] + then + continue + fi + deps="$deps $modname" + done [ -n "$deps" ] && vecho ":$deps" || vecho } findone() { - echo nash-find "$@" | /sbin/nash --force --quiet \ - | /bin/awk '{ print $1; exit; }' -} - -findall() { - find "$@" + find "$@" -print -quit } dm_get_uuid() { dmsetup info "$1" | awk '/^.*UUID.*/ {print $2}' } +depsolve_modlist() +{ + local TMPINMODS=$MODULES + local TMPOUTMODS="" + local i + local j + local mname + local dpcnt + local scnt + + # + # So, basically, we just do this until TMPINMODS + # is an empty list + # + while [ -n "$TMPINMODS" ] + do + for i in $TMPINMODS + do + mname=`basename $i | sed -e's/\.ko//'` + dpcnt=`modprobe --show-depends $mname 2>/dev/null | awk '/insmod/ {print $2}' | wc -l` + if [ $dpcnt -le 1 ] + then + # we have no dependencies, just add it to the list + echo "$TMPOUTMODS" | grep -q $i + if [ $? -ne 0 ] + then + TMPOUTMODS="$TMPOUTMODS $i" + fi + continue + fi + # We should start this counter at 1, since we expect that the last + # line output by modprobe --show-depends will be the module we + # specify as mname below, but since modprobe is busted and + # sometimes doesn't do that, we start at zero, and increment an + # extra time below if we are searching for a dependency on ourself + let scnt=0 + for j in `modprobe --show-depends $mname 2>/dev/null | awk '/insmod/ {print $2}'` + do + echo $TMPOUTMODS | grep -q $j + if [ $? -eq 0 ] + then + let scnt=$scnt+1 + fi + # here we are looking to see if the insmod line is for the + # module that we are searching for dependencies on. We do this + # because modprobe is busted in its show-depends line + echo $j | grep -q $i + if [ $? -eq 0 ] + then + let scnt=$scnt+1 + fi + done + if [ "$scnt" == "$dpcnt" ] + then + echo "$TMPOUTMODS" | grep -q $i + if [ $? -ne 0 ] + then + TMPOUTMODS="$TMPOUTMODS $i" + fi + fi + #Finish for i loop + done + for j in $TMPOUTMODS + do + TMPTMPMODS="" + for z in $TMPINMODS + do + if [ "$j" == "$z" ] + then + continue + fi + TMPTMPMODS="$TMPTMPMODS $z" + done + TMPINMODS=$TMPTMPMODS + done + done + MODULES=$TMPOUTMODS +} + findmodule() { - skiperrors="" + local skiperrors="" + if [ $1 == "--skiperrors" ]; then skiperrors=--skiperrors @@ -156,6 +239,7 @@ findmodule() { fi local modName=$1 + local skipdeps=$2 if [ "$modName" = "off" -o "$modName" = "null" ]; then return @@ -176,6 +260,12 @@ findmodule() { fi # special cases + case "$modName" in + raid[456]) + modName=raid456 + ;; + esac + if [ "$modName" = "i2o_block" ]; then findmodule i2o_core findmodule -i2o_pci @@ -192,32 +282,31 @@ findmodule() { findmodule raid456 modName="raid456" else - moduledep $modName - for i in $deps; do - findmodule $i - done + if [ -z "$skipdeps" ] + then + moduledep $modName + for i in $deps; do + findmodule $i + done + fi fi fmPath=$(modprobe --set-version $kernel -l $modName 2>/dev/null) - - if [ ! -f "$fmPath" ]; then - for modExt in o.gz o ko - do - for modDir in /lib/modules/$kernel/updates /lib/modules/$kernel - do - if [ -d $modDir ] - then - fmPath=$(findone $modDir -name $modName.$modExt) - if [ -f "$fmPath" ] - then - break 2 - fi + if [ ! -f "/lib/modules/$kernel/$fmPath" ]; then + for modDir in /lib/modules/$kernel/updates /lib/modules/$kernel + do + if [ -d $modDir ] + then + fmPath=$(findone $modDir -name $modName.ko) + if [ -f "$fmPath" ] + then + break 2 + fi fi - done - done + done fi - if [ ! -f "$fmPath" ]; then + if [ ! -f "/lib/modules/$kernel/$fmPath" ]; then if [ -n "$skiperrors" ]; then return fi @@ -239,7 +328,7 @@ findmodule() { fi # only need to add each module once - MODULES="$MODULES $fmPath" + MODULES="$MODULES /lib/modules/$kernel/$fmPath" # need to handle prescsimods here -- they need to go _after_ scsi_mod if [ "$modName" = "scsi_mod" ]; then @@ -249,6 +338,17 @@ findmodule() { fi } +do_blacklist() +{ + local modName=$1 + + if echo "$modName" | grep -q "\/" ; then + local dirName="/lib/modules/$kernel/$modName" + find $dirName -xtype f -exec basename {} \; | sed "s/^\(.*\).ko/blacklist \1/g" >> $MNTIMAGE/etc/blacklist-kdump.conf + else + echo "blacklist $modName" >> $MNTIMAGE/etc/blacklist-kdump.conf + fi +} inst() { if [ "$#" != "2" ];then @@ -259,11 +359,6 @@ inst() { cp $1 $2 } -readlink() { - readlink "$1" -} - - findstoragedriverinsys () { while [ ! -L device ]; do [ "$PWD" = "/sys" ] && return @@ -278,23 +373,39 @@ findstoragedriverinsys () { for driver in $(modprobe --set-version $kernel --show-depends $modalias 2>/dev/null| awk '{ print gensub(".*/","","g",$2) }') ; do findmodule ${driver%%.ko} done + # Handle special needs for missing deps or wierd modalias lines + case $modalias in + "scsi:t-0x00") + findmodule ata_generic + ;; + *) + ;; + esac } findstoragedriver () { for device in $@ ; do + basedev=`echo $device | sed -e's/\/dev\///' -e's/[0-9]\+//'` + if [ -d /sys/block/$basedev ] + then + #only add devices which have a presence in sysfs + echo $basedev >> $TMPDISKLIST + fi case " $handleddevices " in *" $device "*) continue ;; *) handleddevices="$handleddevices $device" ;; esac - if [[ "$device" == "md[0-9]+" ]]; then + echo $device | grep -q "md[0-9]\+" + if [ $? == 0 ]; then vecho "Found RAID component $device" handleraid "$device" continue fi - vecho "Looking for driver for device $device" device=`echo $device | sed 's/\//\!/g'` - pushd $(readlink /sys/class/block/$device ) >/dev/null 2>&1 || return + sysfs=$(findone -L /sys/block -maxdepth 2 -type d -name $device) + [ -z "$sysfs" ] && return + pushd $sysfs >/dev/null 2>&1 findstoragedriverinsys popd >/dev/null 2>&1 done @@ -331,6 +442,7 @@ findnetdriver() { } handleraid() { + echo IN HANDLERAID local start=0 if [ -n "$noraid" -o ! -f /proc/mdstat ]; then @@ -389,7 +501,6 @@ handlelvordev() { else devname=$device fi - echo $devname | sed -e's/\/dev\///' -e's/[0-9]\+//' >> $TMPDISKLIST findstoragedriver ${device##/dev/} done ;; @@ -404,7 +515,6 @@ handlelvordev() { devname=$1 fi - echo $devname | sed -e's/\/dev\///' -e's/[0-9]\+//' >> $TMPDISKLIST findstoragedriver ${1##/dev/} fi } @@ -785,15 +895,17 @@ if [ -n "$testdm" ]; then fi fi if [ -x /sbin/dmraid -a -z "$nodmraid" ]; then - for raid in $(/sbin/dmraid -s -craidname 2>/dev/null | grep -vi "no raid disks" ) ; do - dmname=$(resolve_dm_name $raid) - if [ -n "$dmname" ]; then - DMRAIDS="$DMRAIDS $dmname" - fi - done + NOBLK=`/sbin/dmraid -s -craidname 2>/dev/null | grep "no block devices"` + NORAD=`/sbin/dmraid -s -craidname 2>/dev/null | grep "no raid disks"` + if [ -z "$NOBLK" ] && [ -z "$NORAD" ] + then + for raid in $(/sbin/dmraid -s -craidname 2>/dev/null) ; do + DMRAIDS="$DMRAIDS $raid" + done + fi fi fi - + for n in $basicmodules; do findmodule $n done @@ -858,6 +970,21 @@ if [ -z "$MNTIMAGE" -o -z "$IMAGE" ]; then fi +# Just get all the modules that are currently loaded +# We're likely to need them +for i in `lsmod | tail --lines=+2 | awk '{print $1}'` +do + findmodule -$i skip + echo $MODULES | grep -q $i + if [ $? -ne 0 ] + then + ALTERNATE=`echo $i | sed -e's/_/-/g'` + findmodule $ALTERNATE skip + fi + +done + + #START BUILDING INITRD HERE mkdir -p $MNTIMAGE mkdir -p $MNTIMAGE/lib @@ -880,7 +1007,6 @@ ln -s bin $MNTIMAGE/sbin if [ -n "$KDUMP_CONFIG_FILE" ]; then while read config_opt config_val; do - case "$config_opt" in net) #grab remote host and xlate into numbers @@ -981,6 +1107,11 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then extra_modules) extra_kdump_mods="$extra_kdump_mods $config_val" ;; + blacklist) + blacklist_mods="$blacklist_mods $config_val" + ;; + options) + ;; default) DEFAULT_ACTION=$config_val case $DEFAULT_ACTION in @@ -990,18 +1121,35 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then halt) FINAL_ACTION="halt -f" ;; + poweroff) + FINAL_ACTION="poweroff -f" + ;; esac ;; disk_timeout) DISK_TIMEOUT=$config_val ;; *) - IS_COMMENT=`echo $config_opt | grep ^#.*$` - if [ -n "$IS_COMMENT" -o -z "$config_val" ] + IS_COMMENT=`echo $config_opt | grep "^#.*$"` + if [ -n "$IS_COMMENT" -o -z "$config_opt" ] then #don't process comments or blank line continue fi + let grep_rc=0 + echo $config_opt | grep -q "ext[234]" + ga_rc=$? + echo $config_opt | grep -q "minix" + gb_rc=$? + echo $config_opt | grep -q "xfs" + gc_rc=$? + echo $config_opt | grep -q "btrfs" + gd_rc=$? + if [ $ga_rc -ne 0 -a $gb_rc -ne 0 -a $gc_rc -ne 0 -a $gd_rc -ne 0 ] + then + echo "Unknown parameter " $config_opt + exit 1 + fi USING_METHOD="filesystem" if (echo $config_val | egrep -q "^(LABEL|UUID)="); then config_val=$(findfs $config_val) @@ -1068,6 +1216,14 @@ for n in $extra_kdump_mods; do findmodule $n done +# After we get all the modules, lets depsolve the list +# so that we load them in proper order +depsolve_modlist + +for n in $blacklist_mods; do + do_blacklist $n +done + if [ -z "$FINAL_ACTION" ]; then FINAL_ACTION="reboot -f" else @@ -1100,8 +1256,15 @@ then done fi +# we need the fstab file so that we can fsck properly +cp /etc/fstab $MNTIMAGE/etc/fstab +bin="$bin /sbin/fsck.ext2 /sbin/fsck.ext3 /sbin/fsck.ext4" + #this provides us with a list of disks that we need to make sure we have available before we capture our core -mv $TMPDISKLIST $MNTIMAGE/etc/critical_disks +# don't block on cciss or md devices, parsing them in sysfs takes a special case and they are there +# as soon as the driver loads +egrep -v '(^cciss|^md)' $TMPDISKLIST > $MNTIMAGE/etc/critical_disks +rm -f $TMPDISKLIST #THIS IS WHERE WE GENERATE OUR ADDITINONAL UTILITIES #Busybox doesn't have a /bin/sh applet, @@ -1426,6 +1589,34 @@ done EOF +cat >> $SCRIPTDIR/handle_event < /sys\$DEVPATH/loading + cat "\$DIR/\$FIRMWARE" > /sys\$DEVPATH/data + echo 0 > /sys\$DEVPATH/loading + exit 0 +done + +EOF + #DONT ADD STUFF to SCRIPTDIR PAST HERE for i in `ls $SCRIPTDIR/*` do @@ -1469,7 +1660,6 @@ done mknod $MNTIMAGE/dev/tty c 5 0 mknod $MNTIMAGE/dev/console c 5 1 mknod $MNTIMAGE/dev/ptmx c 5 2 -mknod $MNTIMAGE/dev/rtc c 10 135 if [ "$(uname -m)" == "ia64" ]; then mknod $MNTIMAGE/dev/efirtc c 10 136 fi @@ -1484,6 +1674,10 @@ if [ -n "$vg_list" ]; then fi fi +# Firmware, we need to suck it all in, just in case... +mkdir -p $MNTIMAGE/lib/firmware +cp -r /lib/firmware/* $MNTIMAGE/lib/firmware/ + echo -n >| $RCFILE cat >> $MNTIMAGE/init << EOF #!/bin/msh @@ -1492,6 +1686,7 @@ mount -t proc /proc /proc echo Mounting proc filesystem echo Mounting sysfs filesystem mount -t sysfs /sys /sys +echo "/scriptfns/handle_event" > /sys/kernel/uevent_helper echo 1 > /proc/sys/vm/dirty_background_ratio echo 5 > /proc/sys/vm/dirty_ratio echo 10 > /proc/sys/vm/dirty_writeback_centisecs @@ -1509,7 +1704,7 @@ mknod /dev/systty c 4 0 mknod /dev/tty c 5 0 mknod /dev/console c 5 1 mknod /dev/ptmx c 5 2 -mknod /dev/rtc c 10 135 +mknod /dev/rtc c 254 0 mknod /dev/urandom c 1 9 EOF @@ -1530,6 +1725,13 @@ for MODULE in $MODULES; do fullmodule=`echo $MODULE | sed "s|.*/||"` options=`sed -n -e "s/^options[ ][ ]*$module[ ][ ]*//p" $modulefile 2>/dev/null` + options2=`sed -n -e "s/^options[ ][ ]*$module[ ][ ]*//p" $KDUMP_CONFIG_FILE 2>/dev/null` + + # Overwrite options if option is specified in kdump.conf + if [ -n "$options2" ]; then + options=$options2 + fi + if [ -n "$options" ]; then vecho "Adding module $module$text with options $options" @@ -1661,18 +1863,18 @@ if [ -n "$vg_list" ]; then emit "echo Activating logical volumes" emit "lvm vgchange -a y --ignorelockingfailure" emit "DM_NUM=0" - emit "lvm lvs --noheadings -o lv_name,vg_name | while read i" + emit "for i in \`lvm lvs --noheadings -o lv_name,vg_name | sed -e's/ \\+/:/g'\`" emit "do" - emit " LV=\`echo \$i | awk '{ print \$1 }'\`" - emit " VGRP=\`echo \$i | awk '{ print \$2 }'\`" + emit " LV=\`echo \$i | awk -F\":\" '{ print \$2 }'\`" + emit " VGRP=\`echo \$i | awk -F\":\" '{ print \$3 }'\`" emit " mkdir -p /dev/\$VGRP" emit " if [ ! -e /dev/\$VGRP/\$LV ]" - emit " then" + emit " then" emit " ln -s /dev/mapper/\$VGRP-\$LV /dev/\$VGRP/\$LV" emit " DM_NUM=\`echo \$DM_NUM 1 + p | dc\`" emit " if [ -z \"\$noresume\" ]" emit " then" - emit " /sbin/dmsetup resume /dev/mapper/\$VGRP-\$LV" + emit " /sbin/dmsetup.static resume /dev/mapper/\$VGRP-\$LV" emit " fi" emit " fi" emit "done" @@ -1756,6 +1958,7 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then emit "then" emit " echo -e \"\\\033[0JSaving core complete\"" emit "fi" + emit "sync" if [ -x "$KDUMP_POST" ]; then emit "$KDUMP_POST \$exitcode" fi @@ -1960,6 +2163,10 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then ;; disk_timeout) ;; + blacklist) + ;; + options) + ;; default) ;; link_delay) @@ -2013,7 +2220,7 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then emit "then" emit " DUMPDEV=\`findfs \$DUMPDEV\`" emit "fi" - emit "fsck.$config_opt \$DUMPDEV" + emit "fsck.$config_opt -y \$DUMPDEV" emit "mount -t $config_opt \$DUMPDEV /mnt" emit "if [ \$? == 0 ]" emit "then" @@ -2030,6 +2237,7 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then emit " mv \$VMCORE-incomplete \$VMCORE" emit " echo -e \"\\\033[0JSaving core complete\"" emit " fi" + emit " sync" if [ -x "$KDUMP_POST" ]; then emit " $KDUMP_POST \$exitcode" fi @@ -2048,7 +2256,7 @@ if [ -n "$KDUMP_CONFIG_FILE" ]; then emit "/bin/msh" fi case $DEFAULT_ACTION in - reboot|halt|shell) + reboot|halt|poweroff|shell) emit "$FINAL_ACTION" ;; *) @@ -2099,7 +2307,7 @@ emit " ROOTDEV=/dev/rootdev" emit "fi" emit "echo Checking root filesystem." -emit "fsck \$ROOTDEV" +emit "fsck -y \$ROOTDEV" emit "echo Mounting root filesystem: mount -t $rootfs \$ROOTDEV /sysroot" emit "mount -t $rootfs \$ROOTDEV /sysroot >/dev/null 2>&1 " emit "if [ \$? != 0 ]" @@ -2114,6 +2322,16 @@ emit "mount -t proc proc /sysroot/proc" emit "umount /sys" emit "mount -t sysfs sysfs /sysroot/sys" emit "mount -o bind /dev /sysroot/dev" + +if [ -f $MNTIMAGE/etc/blacklist-kdump.conf ] ; then + emit "tdir=\`mktemp -d\`" + emit "mkdir -p \$tdir" + emit "cp -r /sysroot/etc/modprobe.d/* \$tdir/" + emit "mount -t ramfs ramfs /sysroot/etc/modprobe.d" + emit "cp -r \$tdir/* /sysroot/etc/modprobe.d/" + emit "cp /etc/blacklist-kdump.conf /sysroot/etc/modprobe.d/" +fi + emit "touch /sysroot/fastboot" emit "echo Switching to new root and running init." emit "exec switch_root /sysroot /sbin/init" @@ -2122,7 +2340,7 @@ emit "exec switch_root /sysroot /sbin/init" chmod +x $RCFILE -(cd $MNTIMAGE; findall . | cpio --quiet -c -o) >| $IMAGE || exit 1 +(cd $MNTIMAGE; find | cpio --quiet -c -o) >| $IMAGE || exit 1 if [ -n "$compress" ]; then gzip -9 < $IMAGE >| $target || rc=1 diff --git a/sources b/sources index e3fe2a9..b5e574a 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ +9a5f7a5781bd9c357badb0ade0896842 dracut-files.tbz2 d9f2ecd3c3307905f24130a25816e6cc kexec-tools-2.0.0.tar.bz2 3e802d638dce0080b910f15908c04a24 kexec-tools-po.tar.gz -190f8878aa7e7b63a96fde5d59538eec makedumpfile-1.3.3.tar.gz -9a5f7a5781bd9c357badb0ade0896842 dracut-files.tbz2 +e3a813bd6d7dace903a05c1296e20d57 makedumpfile-1.3.5.tar.gz