From cdde475187e436adba92c03400e2177a6726992be01bc01cd303cdb1a0ec39f9 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Mon, 27 Oct 2008 23:51:20 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kexec-tools?expand=0&rev=61 --- kexec-bootloader | 31 +++++++++++++++------ kexec-tools-2.0.0-rpmlintrc | 16 +++++++++++ kexec-tools-ppc-check-flags.diff | 48 ++++++++++++++++++++++---------- kexec-tools.changes | 14 ++++++++++ kexec-tools.spec | 15 ++++++++-- 5 files changed, 98 insertions(+), 26 deletions(-) create mode 100644 kexec-tools-2.0.0-rpmlintrc diff --git a/kexec-bootloader b/kexec-bootloader index 9c7bfa5..2527b6e 100644 --- a/kexec-bootloader +++ b/kexec-bootloader @@ -53,11 +53,15 @@ sub show_help() # # Returns the value stored with "grubonce". If no value has been stored # or the /boot/grub/default file is not readable, then -1 is returned. -sub get_grubonce() # {{{ +# +# Also emulate the behaviour when using GRUB which resets the 'magic once' flag +# when booting. Because we use kexec, we have to reset that 'magic once' flag +# ourselves. +sub get_grubonce_and_reset_magic() # {{{ { # no /boot/grub/default file if (! -f $GRUBDEFAULT) { - print_debug("get_grubonce(): No $GRUBDEFAULT."); + print_debug("get_grubonce_and_reset_magic(): No $GRUBDEFAULT."); return -1; } @@ -65,11 +69,12 @@ sub get_grubonce() # {{{ open(FH, $GRUBDEFAULT) or return -1; my $value; my $ret = sysread(FH, $value, 10); - close FH; + close(FH); # only if we have read 4 bytes it's valid if ($ret != 10) { - print_debug("get_grubonce(): Read returned $ret instead of 4."); + print_debug("get_grubonce_and_reset_magic(): ". + "Read returned $ret instead of 4."); return -1; } @@ -78,12 +83,20 @@ sub get_grubonce() # {{{ my $once = int($value); # 0x4000 is the "magic once flag" - if ($once & 0x4000) { - return $once & ~0x4000; - } else { - print_debug("get_grubonce(): No magic 0x40000."); + unless ($once & 0x4000) { + print_debug("get_grubonce_and_reset_magic(): No magic 0x40000."); return -1; } + + my $defaultno = $once & ~0x4000; + my $buf = $defaultno . "\0" . "\n" x 9; + + # now reset the grubonce flag + open(FH, ">$GRUBDEFAULT") or return $defaultno; + $ret = syswrite(FH, $buf, 10); + close(FH); + + return $defaultno; } # }}} # @@ -107,7 +120,7 @@ my $loader = Bootloader::Tools::GetBootloader(); my $default = -1; if ($loader =~ m/GRUB/i) { - $default = get_grubonce(); + $default = get_grubonce_and_reset_magic(); print_debug("GRUB Default: $default"); } diff --git a/kexec-tools-2.0.0-rpmlintrc b/kexec-tools-2.0.0-rpmlintrc new file mode 100644 index 0000000..a8fe4a9 --- /dev/null +++ b/kexec-tools-2.0.0-rpmlintrc @@ -0,0 +1,16 @@ +# +# The name for the init script is correct. kexec-tools is no name +# for an init script. +addFilter(".*incoherent-init-script-name.*"); + +# +# $null is a valid dependency. +addFilter(".*init-script-undefined-dependency.*"); + +# +# It does not make any sense to stop the "service" kexec on removal. +# kexec is no service but an init script to run kexec when rebooting. +# Stopping it here would lead to a very unexpected behaviour on reboot. :) +addFilter(".*init-script-without-%stop_on_removal-preun.*"); + +# :mode=python: diff --git a/kexec-tools-ppc-check-flags.diff b/kexec-tools-ppc-check-flags.diff index e790860..4f70dc2 100644 --- a/kexec-tools-ppc-check-flags.diff +++ b/kexec-tools-ppc-check-flags.diff @@ -22,33 +22,53 @@ Signed-off-by: Simon Horman Acked-by: Bernhard Walle --- - kexec/arch/ppc64/crashdump-ppc64.c | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) + kexec/arch/ppc64/crashdump-ppc64.c | 12 ++++++++++-- + kexec/arch/ppc64/crashdump-ppc64.h | 3 +++ + 2 files changed, 13 insertions(+), 2 deletions(-) --- a/kexec/arch/ppc64/crashdump-ppc64.c +++ b/kexec/arch/ppc64/crashdump-ppc64.c -@@ -124,7 +124,7 @@ static void exclude_crash_region(uint64_ - static int get_dyn_reconf_crash_memory_ranges() +@@ -121,12 +121,13 @@ static void exclude_crash_region(uint64_ + } + } + +-static int get_dyn_reconf_crash_memory_ranges() ++static int get_dyn_reconf_crash_memory_ranges(void) { uint64_t start, end; -- char fname[128], buf[32]; -+ char fname[128], buf[32], flags; + char fname[128], buf[32]; FILE *file; int i, n; ++ uint32_t flags; -@@ -152,6 +152,13 @@ static int get_dyn_reconf_crash_memory_r + strcpy(fname, "/proc/device-tree/"); + strcat(fname, "ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory"); +@@ -150,10 +151,17 @@ static int get_dyn_reconf_crash_memory_r + return -1; + } - start = ((uint64_t *)buf)[0]; +- start = ((uint64_t *)buf)[0]; ++ start = ((uint64_t *)buf)[DRCONF_ADDR]; end = start + lmb_size; + if (start == 0 && end >= (BACKUP_SRC_END + 1)) + start = BACKUP_SRC_END + 1; + -+ flags = buf[23]; ++ flags = (*((uint32_t *)&buf[DRCONF_FLAGS])); + /* skip this block if the reserved bit is set in flags (0x80) -+ or if the memory region is not assigned to this partition (0x8) */ ++ or if the block is not assigned to this partition (0x8) */ + if ((flags & 0x80) || !(flags & 0x8)) + continue; + - if (start == 0 && end >= (BACKUP_SRC_END + 1)) - start = BACKUP_SRC_END + 1; exclude_crash_region(start, end); - - + } + fclose(file); +--- a/kexec/arch/ppc64/crashdump-ppc64.h ++++ b/kexec/arch/ppc64/crashdump-ppc64.h +@@ -31,4 +31,7 @@ extern unsigned int rtas_size; + uint64_t lmb_size; + unsigned int num_of_lmbs; + ++#define DRCONF_ADDR 0 ++#define DRCONF_FLAGS 20 ++ + #endif /* CRASHDUMP_PPC64_H */ diff --git a/kexec-tools.changes b/kexec-tools.changes index e83a473..efe9718 100644 --- a/kexec-tools.changes +++ b/kexec-tools.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Mon Oct 27 10:25:42 CET 2008 - bwalle@suse.de + +- Update patch that checks for reserved and assigned bit flags on + the memory regions (bnc#438086). + +------------------------------------------------------------------- +Sun Oct 26 18:11:02 CET 2008 - bwalle@suse.de + +- Clear grubonce after using in kexec-bootloader (bnc#438194). +- Add rpmlint supression file. +- Correct debugging output: Number of section was one too small + (last index != size of array). + ------------------------------------------------------------------- Fri Oct 24 14:17:21 CEST 2008 - bwalle@suse.de diff --git a/kexec-tools.spec b/kexec-tools.spec index ad6e202..fa3be8e 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -29,11 +29,12 @@ PreReq: %insserv_prereq %fillup_prereq AutoReqProv: on Summary: Tools for fast kernel loading Version: 2.0.0 -Release: 42 +Release: 43 Source: %{name}-%{version}.tar.bz2 Source1: kexec-bootloader Source2: kexec-bootloader.8.txt Source3: kexec.init +Source4: %{name}-%{version}-rpmlintrc Patch0: %{name}-ia64-uncached-memory.diff Patch1: %{name}-ia64-PA.diff Patch2: %{name}-build-warnings.diff @@ -148,10 +149,18 @@ install -m 0755 kexec.init ${RPM_BUILD_ROOT}/etc/init.d/kexec %endif %changelog +* Mon Oct 27 2008 bwalle@suse.de +- Update patch that checks for reserved and assigned bit flags on + the memory regions (bnc#438086). +* Sun Oct 26 2008 bwalle@suse.de +- Clear grubonce after using in kexec-bootloader (bnc#438194). +- Add rpmlint supression file. +- Correct debugging output: Number of section was one too small + (last index != size of array). * Fri Oct 24 2008 bwalle@suse.de - Check for reserved and assigned bit flags on the memory regions (bnc#438086). -* Sun Oct 19 2008 bwalle@suse.de +* Sat Oct 18 2008 bwalle@suse.de - Honor grubonce also when the 1st (== 0th) entry was chosen. * Mon Oct 13 2008 bwalle@suse.de - Fix runlevels (Default-Start, Default-Stop) in kexec.init. @@ -320,7 +329,7 @@ install -m 0755 kexec.init ${RPM_BUILD_ROOT}/etc/init.d/kexec package * Wed Aug 29 2007 bwalle@suse.de - add reset_devices kernel parameter as default -* Sun Aug 26 2007 olh@suse.de +* Sat Aug 25 2007 olh@suse.de - do not require kdump-helpers on s390 * Fri Jul 27 2007 bwalle@suse.de - update documentation for deleting all dumps (#302257)