SHA256
1
0
forked from pool/kdump

Accepting request 433330 from home:ptesarik:branches:Kernel:kdump

Update to 0.8.16

OBS-URL: https://build.opensuse.org/request/show/433330
OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/kdump?expand=0&rev=121
This commit is contained in:
Petr Tesařík 2016-10-05 10:35:07 +00:00 committed by Git OBS Bridge
parent 09a0e2b156
commit ad9a064371
23 changed files with 128 additions and 1950 deletions

View File

@ -1,26 +0,0 @@
From 4ce21a05fdfa91cb894d140c1962b29fb4b1431a Mon Sep 17 00:00:00 2001
From: Julian Wolf <juwolf@suse.de>
Date: Mon, 1 Sep 2014 15:46:21 +0200
Subject: multipath: Write proper regex into multipath.conf
Signed-off-by: Julian Wolf <juwolf@suse.de>
---
kdumptool/multipath.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdumptool/multipath.cc b/kdumptool/multipath.cc
index 4ffe493..a9acafc 100644
--- a/kdumptool/multipath.cc
+++ b/kdumptool/multipath.cc
@@ -206,7 +206,7 @@ void AddBlacklistHandler::outputLine(const string &raw)
// -----------------------------------------------------------------------------
void AddBlacklistHandler::doBlacklist(lineHandler handler)
{
- (this->*handler)("\twwid \"*\"\n");
+ (this->*handler)("\twwid \".*\"\n");
m_blacklist_done = true;
}
--
1.8.1.4

View File

@ -1,9 +0,0 @@
diff -Ndur kdump-0.8.15/init/rc.kdump.functions kdump-0.8.15-fix-shebang/init/rc.kdump.functions
--- kdump-0.8.15/init/rc.kdump.functions 2014-06-23 18:47:39.000000000 +0300
+++ kdump-0.8.15-fix-shebang/init/rc.kdump.functions 2014-11-23 07:28:42.856444929 +0200
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Copyright 2005 Red Hat, Inc.
# Author: Jeff Moyer <jmoyer@redhat.com>

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2d492a9b833e571b32721d949ca140889a48aae38ae2288d7988f6c4e3aa5185
size 3336592

3
kdump-0.8.16.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:00e4ba5d9b424c7051e28b4014a0d341670ba1f3969226452d52007649e521fc
size 3336777

View File

@ -1,200 +0,0 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Tue Sep 23 16:12:34 2014 +0200
Subject: Add KDUMP_NETCONFIG modes to support IPv6
References: bnc#885897
Patch-mainline: v0.8.16
Git-commit: ffd6542ed47a41be1f1d9f8df95781b6d94123d4
KDUMP_NETCONFIG had only two modes: static and dhcp, where dhcp
actually only means DHCP4. New modes are needed to get an IPv6
address on the interface.
Note that automatic configuration (KDUMP_NETCONFIG=auto) still uses
only IPv4, because dracut does not implement multiple alternative
ip configurations, and there's no way to determine in advance
which stack should be used.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
doc/man/kdump.5.txt.in | 35 ++++++++++++++++++++++++++++++-----
init/module-setup.sh | 42 ++++++++++++++++++++++++++++++++++--------
init/setup-kdump.functions | 39 ++++++++++++++++++++++++++++++++++++++-
sysconfig.kdump.in | 4 ++--
4 files changed, 104 insertions(+), 16 deletions(-)
--- a/doc/man/kdump.5.txt.in
+++ b/doc/man/kdump.5.txt.in
@@ -513,13 +513,38 @@ KDUMP_NETCONFIG
Network configuration for kdump. Because the dump process runs in initrd, the
network configuration is different from the normal network configuration. Use
-_auto_ to auto-detect the network configuration, this is also the default.
+_auto_ to auto-detect the network configuration (see *auto* mode below). The
+interface with the default route will be used. This is the default.
+
+Auto-detection cannot be used to set up dual-stack (IPv4 and IPv6) hosts
+because of limitations in the implementation of the _ip=_ initrd command line
+option.
Use a _netdevice:mode_ string to force a specific network device to be used. A
-_netdevice_ is for example "eth0". The _mode_ can be either "dhcp" or "static".
-If you use "static", you have to set the IP address with _ip=ipspec_. _ipspec_
-is <client>:<server>:<gateway>:<netmask>:<hostname>:<device>:<proto>. See
-*mkinitrd*(8) for details.
+_netdevice_ is for example "eth0". The _mode_ can be:
+
+*static*::
+ Always re-use the current configuration of _netdevice_ (both IPv4 and IPv6).
+ Note that only permanent global IPv6 addresses are stored, because temporary
+ addresses are likely to expire before the system crashes, and link-local
+ addresses are set up automatically.
+
+*auto6*::
+ Use IPv6 autoconfiguration to get an address on the interface.
+
+*dhcp*::
+*dhcp4*::
+ Use DHCP to configure an IPv4 address on the interface.
+
+*dhcp6*::
+ Use DHCP6 to configure an IPv6 address on the interface.
+
+*auto*::
+ Select the mode depending on the current state of the interface:
+
+ * use DHCP4 if it has an IPv4 address (IPv6 not set up),
+ * use DHCP6 if it has a permanent IPv6 address (IPv4 not set up),
+ * use IPv6 auto-configuration if it has neither (IPv4 not set up).
You can set KDUMP_NETCONFIG to "" if you want no network in initrd, i.e. you use
disk dumping.
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -65,24 +65,50 @@ kdump_cmdline_ip() {
[ "$kdump_neednet" = y ] || return 0
echo -n "rd.neednet=1"
+
+ local _if _mode
if [ "$KDUMP_NETCONFIG" = "auto" ] ; then
- echo -n " ip=any"
+ _if=default
+ _mode=auto
else
set -- ${KDUMP_NETCONFIG//:/ }
local _if=$1
local _mode=$2
+ fi
- if [ "$_if" = "default" ] ; then
- _if=$(kdump_default_netdev)
- fi
- printf " %s" $(kdump_ifname_config "$_if")
+ [ "$_if" = "default" ] && _if=$(kdump_default_netdev)
- if [ "$_mode" = "static" ] ; then
- printf " %s" $(kdump_ip_config "$_if")
+ printf " %s" $(kdump_ifname_config "$_if")
+
+ if [ "$_mode" = "auto" ] ; then
+ if [ -n $(kdump_ip_config "$_if") ] ; then
+ _mode=dhcp4
+ elif [ -n $(kdump_ip6_config "$_if") ] ; then
+ _mode=dhcp6
else
- echo -n " ip=${_if}:dhcp"
+ _mode=auto6
fi
fi
+
+ case "$_mode" in
+ static)
+ printf " %s" \
+ $(kdump_ip_config "$_if") \
+ $(kdump_ip6_config "$_if")
+ ;;
+ dhcp|dhcp4)
+ echo " ip=${_if}:dhcp"
+ ;;
+ dhcp6)
+ echo " ip=${_if}:dhcp6"
+ ;;
+ auto6)
+ echo " ip=${_if}:auto6"
+ ;;
+ *)
+ derror "Wrong KDUMP_NETCONFIG mode: $_mode"
+ ;;
+ esac
}
cmdline() {
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -230,7 +230,7 @@ kdump_prefix2netmask() { # {{{
} # }}}
#
-# Get the ip= parameter for a given device
+# Get the IPv4 ip= parameter for a given device
#
# Parameters:
# 1) device device name
@@ -267,6 +267,43 @@ function kdump_ip_config() # {{{
} # }}}
#
+# Get the IPv6 ip= parameter for a given device
+#
+# Parameters:
+# 1) device device name
+# Output:
+# ip configuration string that can be used for the ip= initrd parameter
+function kdump_ip6_config() # {{{
+{
+ local iface="$1"
+ local ipaddr peeraddr gwaddr hostname
+ local family cidr rest prefix
+
+ hostname=$(hostname)
+ gwaddr=$(ip -6 route show ::/0 | sed -n 's/.* via \([^ ]*\).*/[\1]/p')
+
+ while read family cidr rest
+ do
+ [ "$family" = "inet6" ] || continue
+
+ ipaddr="${cidr%/*}"
+ prefix="${cidr:${#ipaddr}}"
+ ipaddr="[$ipaddr]$prefix"
+ set -- $rest
+
+ if [ "$1" == "peer" ] ; then
+ peeraddr="${2%/*}"
+ prefix="${2:${#peeraddr}}"
+ peeraddr="[$peeraddr]"
+ else
+ peeraddr=
+ fi
+
+ echo "ip=$ipaddr:$peeraddr:$gwaddr::$hostname:$iface:none"
+ done < <(ip -6 address show dev "$iface" permanent scope global)
+} # }}}
+
+#
# Get the save directory and protocol.
#
# Output variables:
--- a/sysconfig.kdump.in
+++ b/sysconfig.kdump.in
@@ -279,8 +279,8 @@ KDUMPTOOL_FLAGS=""
## ServiceRestart: kdump
#
# Network configuration. Use "auto" for auto-detection in initrd, or a string
-# that contains the network device and the mode (dhcp,static), separated by
-# a colon. Example: "eth0:static" or "eth1:dhcp".
+# that contains the network device and the mode (static, dhcp, dhcp6, auto6),
+# separated by a colon. Example: "eth0:static" or "eth1:dhcp".
#
# For static configuration, you have to add the configuration to
# KDUMP_COMMANDLINE_APPEND.

View File

@ -1,59 +0,0 @@
Date: Fri Sep 26 11:43:33 2014 +0200
From: Petr Tesarik <ptesarik@suse.cz>
Subject: kdump-Bootloader: add support for GRUB2
References: bsc#889192
Patch-mainline: v0.8.16
Git-commit: 30d4271c72251c5f1c995d0580b19aa000ade1d6
GRUB2 is very different from the other bootloader, because the final
configuration file is generated by an external utility. This means
that the command line must be modified in the global settings instead
of the individual section.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
init/kdump-bootloader.pl | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
--- a/init/kdump-bootloader.pl
+++ b/init/kdump-bootloader.pl
@@ -4,11 +4,19 @@ use Bootloader::Tools;
Bootloader::Tools::InitLibrary();
+my $grub2;
+my $section;
+if (Bootloader::Tools::GetBootloader() =~ /^(grub2|grub2-efi)$/) {
+ $grub2 = true;
+ $section = Bootloader::Tools::GetGlobals();
+} else {
+ $grub2 = false;
+ $section = Bootloader::Tools::GetDefaultSection();
+}
+
if ($ARGV[0] eq "--get") {
- my $section = Bootloader::Tools::GetDefaultSection ();
print $section->{"append"};
} elsif ($ARGV[0] eq "--update") {
- my $section = Bootloader::Tools::GetDefaultSection ();
my $input = $section->{"append"};
my $result;
while (length($input)) {
@@ -28,9 +36,13 @@ if ($ARGV[0] eq "--get") {
shift @ARGV;
$result .= " " if length($result);
$result .= join(" ", @ARGV);
- $section->{"append"} = $result;
- $section->{"__modified"} = 1;
- Bootloader::Tools::SetGlobals();
+ if ($grub2) {
+ Bootloader::Tools::SetGlobals("append" => $result);
+ } else {
+ $section->{"append"} = $result;
+ $section->{"__modified"} = 1;
+ Bootloader::Tools::SetGlobals();
+ }
} else {
die "Need an action (--get or --update)";
}

View File

@ -1,99 +0,0 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Thu Sep 18 17:03:46 2014 +0200
Subject: Calibrate: update the initramfs size
References: bnc#883883
Patch-mainline: v0.8.16
Git-commit: b2ab003f54da780cc1ca8ebfe47f39ddd936b34a
Yes, systemd also needs some space in the initramfs, causing approx.
20% increase. Let's account for it...
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
kdumptool/calibrate.cc | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
--- a/kdumptool/calibrate.cc
+++ b/kdumptool/calibrate.cc
@@ -59,7 +59,7 @@
#if defined(__x86_64__)
# define DEF_RESERVE_KB MB(128)
# define KERNEL_KB MB(16)
-# define INIT_KB MB(28)
+# define INIT_KB MB(34)
# define INIT_NET_KB MB(3)
# define SIZE_STRUCT_PAGE 56
# define KDUMP_PHYS_LOAD 0
@@ -69,7 +69,7 @@
#elif defined(__i386__)
# define DEF_RESERVE_KB MB(128)
# define KERNEL_KB MB(14)
-# define INIT_KB MB(24)
+# define INIT_KB MB(29)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 32
# define KDUMP_PHYS_LOAD 0
@@ -79,7 +79,7 @@
#elif defined(__powerpc64__)
# define DEF_RESERVE_KB MB(256)
# define KERNEL_KB MB(16)
-# define INIT_KB MB(48)
+# define INIT_KB MB(58)
# define INIT_NET_KB MB(4)
# define SIZE_STRUCT_PAGE 64
# define KDUMP_PHYS_LOAD MB(128)
@@ -89,7 +89,7 @@
#elif defined(__powerpc__)
# define DEF_RESERVE_KB MB(128)
# define KERNEL_KB MB(12)
-# define INIT_KB MB(28)
+# define INIT_KB MB(34)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 32
# define KDUMP_PHYS_LOAD MB(128)
@@ -99,7 +99,7 @@
#elif defined(__s390x__)
# define DEF_RESERVE_KB MB(128)
# define KERNEL_KB MB(13)
-# define INIT_KB MB(28)
+# define INIT_KB MB(34)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 56
# define KDUMP_PHYS_LOAD 0
@@ -111,7 +111,7 @@
#elif defined(__s390__)
# define DEF_RESERVE_KB MB(128)
# define KERNEL_KB MB(12)
-# define INIT_KB MB(24)
+# define INIT_KB MB(29)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 32
# define KDUMP_PHYS_LOAD 0
@@ -123,7 +123,7 @@
#elif defined(__ia64__)
# define DEF_RESERVE_KB MB(512)
# define KERNEL_KB MB(32)
-# define INIT_KB MB(36)
+# define INIT_KB MB(44)
# define INIT_NET_KB MB(4)
# define SIZE_STRUCT_PAGE 56
# define KDUMP_PHYS_LOAD 0
@@ -133,7 +133,7 @@
#elif defined(__aarch64__)
# define DEF_RESERVE_KB MB(128)
# define KERNEL_KB MB(10)
-# define INIT_KB MB(24)
+# define INIT_KB MB(29)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 56
# define KDUMP_PHYS_LOAD 0
@@ -143,7 +143,7 @@
#elif defined(__arm__)
# define DEF_RESERVE_KB MB(128)
# define KERNEL_KB MB(12)
-# define INIT_KB MB(24)
+# define INIT_KB MB(29)
# define INIT_NET_KB MB(2)
# define SIZE_STRUCT_PAGE 32
# define KDUMP_PHYS_LOAD 0

View File

@ -1,49 +0,0 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Thu Sep 18 17:01:08 2014 +0200
Subject: Calibrate: update user-space run-time requirements for systemd
References: bnc#883883
Patch-mainline: v0.8.16
Git-commit: 04bc6fa91a88e7ff91acb6d2924774bf28463c6b
If systemd is included, journald is also started, so the estimate
must add:
1. the process
2. the journal, which is stored in ramfs
I would love to reduce the size of the journal, but systemd hard-codes
the minimum to 4M, see src/journal/journal-file.c:
/* This is the minimum journal file size */
#define JOURNAL_FILE_SIZE_MIN (4ULL*1024ULL*1024ULL) /* 4 MiB */
Strictly speaking, journald is allowed to use at least twice as much,
but let's hope it doesn't in practice.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
kdumptool/calibrate.cc | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
--- a/kdumptool/calibrate.cc
+++ b/kdumptool/calibrate.cc
@@ -203,13 +203,15 @@ static inline unsigned long s390x_align_
#define DIRTY_RATIO 20
// Userspace base requirements:
-// bash (PID 1) 3 M
+// systemd (PID 1) 3 M
+// journald 2 M
+// the journal itself 4 M
// 10 * udevd 12 M
// kdumptool 4 M
// makedumpfile 1 M
// -------------------------
-// TOTAL: 20 M
-#define USER_BASE_KB MB(20)
+// TOTAL: 26 M
+#define USER_BASE_KB MB(26)
// Additional requirements when network is configured
// dhclient 7 M

22
kdump-cmake-compat.patch Normal file
View File

@ -0,0 +1,22 @@
From: Petr Tesarik <ptesarik@suse.com>
Subject: Avoid using TARGET_* cmake directives
Patch-mainline: never; compatibility with older SUSE distros
This patch can be removed when we stop caring about SLES11...
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
init/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/init/CMakeLists.txt
+++ b/init/CMakeLists.txt
@@ -20,7 +20,7 @@
ADD_EXECUTABLE(device-timeout-generator
device-timeout-generator.c
)
-TARGET_INCLUDE_DIRECTORIES(device-timeout-generator
+INCLUDE_DIRECTORIES(device-timeout-generator
PUBLIC ${BLKID_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(device-timeout-generator
${BLKID_LIBRARIES})

View File

@ -1,252 +0,0 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Mon Sep 8 17:33:38 2014 +0200
Subject: Take constant-size slabs into account for "kdump calibrate"
References: bnc#879460
Patch-mainline: v0.8.16
Git-commit: 3a7c9b3a02893ab9ac39e23cae5ead9e42716927
Git-commit: 8c0a42e80a89100addc09d584253f1c8accde500
Some slabs do not depend on available memory or system utilization.
Their size can be taken directly from the running kernel.
Note that the size of the ACPI slab cache may vary widely across
machines (e.g. mine has only a few hundred kilobytes, while another
one I saw had over 10 megabytes).
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
kdumptool/calibrate.cc | 215 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 215 insertions(+)
--- a/kdumptool/calibrate.cc
+++ b/kdumptool/calibrate.cc
@@ -448,6 +448,201 @@ unsigned long Framebuffers::size(void) c
}
//}}}
+//{{{ SlabInfo -----------------------------------------------------------------
+
+class SlabInfo {
+
+ public:
+ /**
+ * Initialize a new SlabInfo object.
+ *
+ * @param[in] line Line from /proc/slabinfo
+ */
+ SlabInfo(const KString &line);
+
+ protected:
+ bool m_comment;
+ KString m_name;
+ unsigned long m_active_objs;
+ unsigned long m_num_objs;
+ unsigned long m_obj_size;
+ unsigned long m_obj_per_slab;
+ unsigned long m_pages_per_slab;
+ unsigned long m_active_slabs;
+ unsigned long m_num_slabs;
+
+ public:
+ bool isComment(void) const
+ throw ()
+ { return m_comment; }
+
+ const KString &name(void) const
+ throw ()
+ { return m_name; }
+
+ unsigned long activeObjs(void) const
+ throw ()
+ { return m_active_objs; }
+
+ unsigned long numObjs(void) const
+ throw ()
+ { return m_num_objs; }
+
+ unsigned long objSize(void) const
+ throw ()
+ { return m_obj_size; }
+
+ unsigned long objPerSlab(void) const
+ throw ()
+ { return m_obj_per_slab; }
+
+ unsigned long pagesPerSlab(void) const
+ throw ()
+ { return m_pages_per_slab; }
+
+ unsigned long activeSlabs(void) const
+ throw ()
+ { return m_active_slabs; }
+
+ unsigned long numSlabs(void) const
+ throw ()
+ { return m_num_slabs; }
+};
+
+// -----------------------------------------------------------------------------
+SlabInfo::SlabInfo(const KString &line)
+{
+ static const char slabdata_mark[] = " : slabdata ";
+
+ std::istringstream ss(line);
+ ss >> m_name;
+ if (!ss)
+ throw KError("Invalid slabinfo line: " + line);
+
+ if (m_name[0] == '#') {
+ m_comment = true;
+ return;
+ }
+ m_comment = false;
+
+ ss >> m_active_objs >> m_num_objs >> m_obj_size
+ >> m_obj_per_slab >> m_pages_per_slab;
+ if (!ss)
+ throw KError("Invalid slabinfo line: " + line);
+
+ size_t sdpos = line.find(slabdata_mark, ss.tellg());
+ if (sdpos == KString::npos)
+ throw KError("Invalid slabinfo line: " + line);
+
+ ss.seekg(sdpos + sizeof(slabdata_mark) - 1, ss.beg);
+ ss >> m_active_slabs >> m_num_slabs;
+ if (!ss)
+ throw KError("Invalid slabinfo line: " + line);
+}
+
+//}}}
+//{{{ SlabInfos ----------------------------------------------------------------
+
+// Taken from procps:
+#define SLABINFO_LINE_LEN 2048
+#define SLABINFO_VER_LEN 100
+
+class SlabInfos {
+
+ public:
+ typedef std::map<KString, const SlabInfo*> Map;
+
+ /**
+ * Initialize a new SlabInfos object.
+ *
+ * @param[in] procdir Mount point for procfs
+ */
+ SlabInfos(const char *procdir = "/proc")
+ throw ()
+ : m_path(FilePath(procdir).appendPath("slabinfo"))
+ {}
+
+ ~SlabInfos()
+ { destroyInfo(); }
+
+ protected:
+ /**
+ * Path to the slabinfo file
+ */
+ const FilePath m_path;
+
+ /**
+ * SlabInfo for each slab
+ */
+ Map m_info;
+
+ private:
+ /**
+ * Destroy SlabInfo objects in m_info.
+ */
+ void destroyInfo(void)
+ throw();
+
+ public:
+ /**
+ * Read the information about each slab.
+ */
+ const Map& getInfo(void);
+};
+
+// -----------------------------------------------------------------------------
+void SlabInfos::destroyInfo(void)
+ throw()
+{
+ Map::iterator it;
+ for (it = m_info.begin(); it != m_info.end(); ++it)
+ delete it->second;
+ m_info.clear();
+}
+
+// -----------------------------------------------------------------------------
+const SlabInfos::Map& SlabInfos::getInfo(void)
+{
+ static const char verhdr[] = "slabinfo - version: ";
+ char buf[SLABINFO_VER_LEN], *p, *end;
+ unsigned long major, minor;
+
+ std::ifstream f(m_path.c_str());
+ if (!f)
+ throw KError(m_path + ": Open failed");
+ f.getline(buf, sizeof buf);
+ if (f.bad())
+ throw KError(m_path + ": Read failed");
+ else if (!f || strncmp(buf, verhdr, sizeof(verhdr)-1))
+ throw KError(m_path + ": Invalid version");
+ p = buf + sizeof(verhdr) - 1;
+
+ major = strtoul(p, &end, 10);
+ if (end == p || *end != '.')
+ throw KError(m_path + ": Invalid version");
+ p = end + 1;
+ minor = strtoul(p, &end, 10);
+ if (end == p || *end != '\0')
+ throw KError(m_path + ": Invalid version");
+ Debug::debug()->dbg("Found slabinfo version %lu.%lu", major, minor);
+
+ if (major != 2)
+ throw KError(m_path + ": Unsupported slabinfo version");
+
+ char line[SLABINFO_LINE_LEN];
+ while(f.getline(line, SLABINFO_LINE_LEN)) {
+ SlabInfo *si = new SlabInfo(line);
+ if (si->isComment()) {
+ delete si;
+ continue;
+ }
+ m_info[si->name()] = si;
+ }
+
+ return m_info;
+}
+
+//}}}
//{{{ Calibrate ----------------------------------------------------------------
// -----------------------------------------------------------------------------
@@ -498,6 +693,26 @@ void Calibrate::execute()
required += DEF_FRAMEBUFFER_KB;
}
+ // Add space for constant slabs
+ try {
+ SlabInfos slab;
+ SlabInfos::Map info = slab.getInfo();
+ SlabInfos::Map::iterator it;
+ for (it = info.begin(); it != info.end(); ++it) {
+ if (it->first.startsWith("Acpi-") ||
+ it->first.startsWith("ftrace_") ) {
+ unsigned long slabsize = it->second->numSlabs() *
+ it->second->pagesPerSlab() * pagesize / 1024;
+ required += slabsize;
+
+ Debug::debug()->dbg("Adding %ld KiB for %s slab cache",
+ slabsize, it->second->name().c_str());
+ }
+ }
+ } catch (KError e) {
+ Debug::debug()->dbg("Cannot get slab sizes: %s", e.what());
+ }
+
// Add memory based on CPU count
unsigned long cpus;
if (CAN_REDUCE_CPUS) {

View File

@ -1,228 +0,0 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Mon Sep 8 09:28:04 2014 +0200
Subject: Take framebuffer size into account for "kdumptool calibrate"
References: bnc#879460
Patch-mainline: v0.8.16
Git-commit: 77ad2fff73fc6dd2dd0615e56967721ba9b96d83
Git-commit: 7cd4e826671ded8fe36a4b4bdeef1223ce8397ca
Depending on the resolution, framebuffer(s) may considerably influence
kdump kernel requirements.
Note that there is no framebuffer on z/Series, so after reading sysfs
fails, the default size for s390(x) is zero.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
kdumptool/calibrate.cc | 153 +++++++++++++++++++++++++++++++++++++++++++++++++
kdumptool/fileutil.cc | 2
kdumptool/fileutil.h | 2
3 files changed, 155 insertions(+), 2 deletions(-)
--- a/kdumptool/fileutil.cc
+++ b/kdumptool/fileutil.cc
@@ -295,7 +295,7 @@ FilePath FilePath::getCanonicalPath(cons
}
// -----------------------------------------------------------------------------
-StringVector FilePath::listDir(const ListDirFilter &filter)
+StringVector FilePath::listDir(const ListDirFilter &filter) const
throw (KError)
{
StringVector v;
--- a/kdumptool/fileutil.h
+++ b/kdumptool/fileutil.h
@@ -224,7 +224,7 @@ class FilePath : public KString {
* list, @c false if all files should be included
* @exception KError if something went wrong
*/
- StringVector listDir(const ListDirFilter &filter)
+ StringVector listDir(const ListDirFilter &filter) const
throw (KError);
/**
--- a/kdumptool/calibrate.cc
+++ b/kdumptool/calibrate.cc
@@ -19,7 +19,10 @@
#include <iostream>
#include <fstream>
#include <cerrno>
+#include <cstring>
+#include <cstdlib>
#include <unistd.h>
+#include <dirent.h>
#include "subcommand.h"
#include "debug.h"
@@ -173,6 +176,13 @@ static inline unsigned long s390x_align_
// Estimated non-changing dynamic data (sysfs, procfs, etc.)
#define KERNEL_DYNAMIC_KB MB(4)
+// Default framebuffer size: 1024x768 @ 32bpp, except on mainframe
+#if defined(__s390__) || defined(__s390x__)
+# define DEF_FRAMEBUFFER_KB 0
+#else
+# define DEF_FRAMEBUFFER_KB (768UL*4)
+#endif
+
// large hashes, default settings: -> per MiB
// PID: sizeof(void*) for each 256 KiB 4
// Dentry cache: sizeof(void*) for each 8 KiB 128
@@ -303,6 +313,141 @@ unsigned long SystemCPU::count(const cha
}
//}}}
+//{{{ Framebuffer --------------------------------------------------------------
+
+class Framebuffer {
+
+ public:
+ /**
+ * Initialize a new Framebuffer object.
+ *
+ * @param[in] fbpath Framebuffer sysfs directory path
+ */
+ Framebuffer(const char *fbpath)
+ throw ()
+ : m_dir(fbpath)
+ {}
+
+ protected:
+ /**
+ * Path to the framebuffer device base directory
+ */
+ const FilePath m_dir;
+
+ public:
+ /**
+ * Get length of the framebuffer [in bytes].
+ */
+ unsigned long size(void) const;
+};
+
+// -----------------------------------------------------------------------------
+unsigned long Framebuffer::size(void) const
+{
+ FilePath fp;
+ std::ifstream f;
+ unsigned long width, height, stride;
+ char sep;
+
+ fp.assign(m_dir);
+ fp.appendPath("virtual_size");
+ f.open(fp.c_str());
+ if (!f)
+ throw KError(fp + ": Open failed");
+ f >> width >> sep >> height;
+ f.close();
+ if (f.bad())
+ throw KError(fp + ": Read failed");
+ else if (!f || sep != ',')
+ throw KError(fp + ": Invalid content!");
+ Debug::debug()->dbg("Framebuffer virtual size: %lux%lu", width, height);
+
+ fp.assign(m_dir);
+ fp.appendPath("stride");
+ f.open(fp.c_str());
+ if (!f)
+ throw KError(fp + ": Open failed");
+ f >> stride;
+ f.close();
+ if (f.bad())
+ throw KError(fp + ": Read failed");
+ else if (!f || sep != ',')
+ throw KError(fp + ": Invalid content!");
+ Debug::debug()->dbg("Framebuffer stride: %lu bytes", stride);
+
+ return stride * height;
+}
+
+//}}}
+//{{{ Framebuffers -------------------------------------------------------------
+
+class Framebuffers {
+
+ public:
+ /**
+ * Initialize a new Framebuffer object.
+ *
+ * @param[in] sysdir Mount point for sysfs
+ */
+ Framebuffers(const char *sysdir = "/sys")
+ throw ()
+ : m_fbdir(FilePath(sysdir).appendPath("class/graphics"))
+ {}
+
+ protected:
+ /**
+ * Path to the base directory with links to framebuffer devices
+ */
+ const FilePath m_fbdir;
+
+ /**
+ * Filter only valid framebuffer device name
+ */
+ class DirFilter : public ListDirFilter {
+
+ public:
+ virtual ~DirFilter()
+ {}
+
+ bool test(const struct dirent *d) const
+ {
+ char *end;
+ if (strncmp(d->d_name, "fb", 2))
+ return false;
+ strtoul(d->d_name + 2, &end, 10);
+ return (*end == '\0' && end != d->d_name + 2);
+ }
+ };
+
+ public:
+ /**
+ * Get size of all framebuffers [in bytes].
+ */
+ unsigned long size(void) const;
+};
+
+// -----------------------------------------------------------------------------
+unsigned long Framebuffers::size(void) const
+{
+ Debug::debug()->trace("Framebuffers::size()");
+
+ unsigned long ret = 0UL;
+
+ StringVector v = m_fbdir.listDir(DirFilter());
+ for (StringVector::const_iterator it = v.begin(); it != v.end(); ++it) {
+ Debug::debug()->dbg("Found framebuffer: %s", it->c_str());
+
+ FilePath fp(m_fbdir);
+ fp.appendPath(*it);
+ Framebuffer fb(fp.c_str());
+ ret += fb.size();
+ }
+
+ Debug::debug()->dbg("Total size of all framebuffers: %lu bytes", ret);
+ return ret;
+}
+
+//}}}
//{{{ Calibrate ----------------------------------------------------------------
// -----------------------------------------------------------------------------
@@ -345,6 +490,14 @@ void Calibrate::execute()
// Run-time kernel requirements
required = KERNEL_KB + ramfs + KERNEL_DYNAMIC_KB;
+ try {
+ Framebuffers fb;
+ required += fb.size() / 1024UL;
+ } catch(KError e) {
+ Debug::debug()->dbg("Cannot get framebuffer size: %s", e.what());
+ required += DEF_FRAMEBUFFER_KB;
+ }
+
// Add memory based on CPU count
unsigned long cpus;
if (CAN_REDUCE_CPUS) {

View File

@ -1,33 +0,0 @@
Date: Wed Sep 24 13:56:42 2014 +0200
From: Petr Tesarik <ptesarik@suse.cz>
Subject: Enable FADUMP on ppc64le
References: bsc#889192
Patch-mainline: v0.8.16
Git-commit: 69bce53e9a02145e857bd4c36effcaf560a8f8cf
The FADUMP feature is only available on IBM POWER systems, but the
new little-endian variant has a new CMAKE_SYSTEM_PROCESSOR value.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
CMakeLists.txt | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -144,11 +144,11 @@ ENDIF(NOT LIBSSL_FOUND)
# Check for FADUMP
#
-IF(“${CMAKE_SYSTEM_PROCESSOR}” STREQUAL “ppc64”)
+IF("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "ppc64(le)?")
SET(HAVE_FADUMP TRUE)
-ELSE(“${CMAKE_SYSTEM_PROCESSOR}” STREQUAL “ppc64”)
+ELSE()
SET(HAVE_FADUMP FALSE)
-ENDIF(“${CMAKE_SYSTEM_PROCESSOR}” STREQUAL “ppc64”)
+ENDIF()
#
# Configure file

View File

@ -1,44 +0,0 @@
Date: Fri Sep 26 08:10:38 2014 +0200
From: Petr Tesarik <ptesarik@suse.cz>
Subject: Always turn on fadump if KDUMP_FADUMP is true
References: bsc#889192
Patch-mainline: v0.8.16
Git-commit: 1f7e52d908f0ad2b2a33cdd374a8888bcf6f8234
The problem is that fadump-related files under /sys/kernel are
created only if the kernel is booted with fadump=on. So, this
is a chicken-and-egg problem, and a reboot is always necessary if
the current kernel is loaded without fadump=on.
However, if the command line is not modified here, the admin must
first add fadump=on to the bootloader command line, and then enable
KDUMP_FADUMP, i.e. enable it in two different places. If the command
line is modified unconditionally, there is only one "big switch" for
FADUMP.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
init/rc.kdump.functions | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/init/rc.kdump.functions
+++ b/init/rc.kdump.functions
@@ -259,6 +259,8 @@ function fadump_bootloader()
# Update fadump configuration
function load_kdump_fadump()
{
+ fadump_bootloader on
+
if ! fadump_enabled; then
echo ": fadump is not enabled in the kernel."
rc_status -s
@@ -266,8 +268,6 @@ function load_kdump_fadump()
rc_exit
fi
- fadump_bootloader on
-
# The kernel fails with EINVAL if registered already
# (see bnc#814780)
if [ "$(cat $FADUMP_REGISTERED)" != "1" ]; then

View File

@ -1,59 +0,0 @@
Date: Fri Sep 26 15:50:05 2014 +0200
From: Petr Tesarik <ptesarik@suse.cz>
Subject: Keep /sysroot mount point if fadump is on
References: bsc#889192
Patch-mainline: v0.8.16
Git-commit: 4c1a5aac3df1e4ea2f0509c5b653083a02c1d4dc
As FADUMP uses the normal initrd, the system must be able to boot up
eventually, so normal mount points are required.
But mounting the same device twice may not be possible because of
conflicting mount options, so system root may not be mountable under
/kdump. In order to keep the kdump-specific mount point hierarchy,
convert any such mount to a bind mount from /sysroot.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
init/module-setup.sh | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -126,17 +126,33 @@ install() {
kdump_map_mpath_wwid
for_each_host_dev_and_slaves_all kdump_add_mpath_dev
+ # Convert system root mounts to bind mounts
+ if [ "$KDUMP_FADUMP" = "yes" ] ; then
+ local i line
+ for i in "${!fstab_lines[@]}"
+ do
+ line=( ${fstab_lines[i]} )
+ if [ "${line[1]%/*}" = "/kdump" ] ; then
+ fstab_lines[i]="/sysroot ${line[1]} none bind"
+ fi
+ done
+ fi
+
kdump_setup_files "$initdir" "$kdump_mpath_wwids"
if dracut_module_included "systemd" ; then
- rm -f "${initdir}/$systemdutildir"/system-generators/dracut-rootfs-generator
+ [ "$KDUMP_FADUMP" != yes ] && \
+ rm -f "${initdir}/$systemdutildir"/system-generators/dracut-rootfs-generator
+
inst_simple /lib/kdump/save_dump.sh
inst_simple "$moddir/kdump-save.service" \
"$systemdsystemunitdir"/kdump-save.service
ln_r "$systemdsystemunitdir"/kdump-save.service \
"$systemdsystemunitdir"/initrd.target.wants/kdump-save.service
else
- inst_hook mount 30 "$moddir/mount-kdump.sh"
+ [ "$KDUMP_FADUMP" != yes ] && \
+ inst_hook mount 30 "$moddir/mount-kdump.sh"
+
inst_hook pre-pivot 90 /lib/kdump/save_dump.sh
fi

View File

@ -1,164 +0,0 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Mon Sep 22 17:23:49 2014 +0200
Subject: Get required multipath wwids from sysfs
References: bnc#883883
Patch-mainline: v0.8.16
Git-commit: 4aa46801a53070dc0b0c27f4247cdc8e2b678694
Git-commit: bb073caafcecfe667fba528c170f89bb29447a1d
The dracut code path must use for_each_host_dev_and_slaves_all to
find multipath devices that are "hidden" beneath e.g. an LVM volume.
That will iterate over all devices in the chain down to each physical
device. Note that /lib/udev/scsi_id sends a low-level SCSI command to
the device to find out the WWID. If it sends it to an unreachable
device in an active-passive multipath setup, it may hang indefinitely.
But the WWID is already available as the name of the multipath device,
so we can get it from the kernel via sysfs.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
init/module-setup.sh | 18 +++++++++++++++++-
init/setup-kdump.functions | 41 +++++++++++++++++++++++++++--------------
init/setup-kdump.sh | 16 +++++++++++++++-
3 files changed, 59 insertions(+), 16 deletions(-)
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -11,12 +11,28 @@ depends() {
echo drm
}
+kdump_add_mpath_dev() {
+ local _major=${1%:*}
+ local _minor=${1#*:}
+ local _wwid
+
+ eval _wwid=\$kdump_mpath_wwid_${_major}_${_minor}
+ if [ -n "$_wwid" ] ; then
+ kdump_mpath_wwids+=$(printf "%q " "wwid $_wwid")
+ fi
+}
+
install() {
# Get configuration
kdump_get_config || return 1
kdump_import_targets
- kdump_setup_files "$initdir" "${!host_fs_types[*]}"
+ # Get a list of required multipath devices
+ local kdump_mpath_wwids
+ kdump_map_mpath_wwid
+ for_each_host_dev_and_slaves_all kdump_add_mpath_dev
+
+ kdump_setup_files "$initdir" "$kdump_mpath_wwids"
if dracut_module_included "systemd" ; then
rm -f "${initdir}/$systemdutildir"/system-generators/dracut-rootfs-generator
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -542,24 +542,36 @@ function kdump_modify_config() #
} # }}}
#
+# Build a mapping between multipath devices and their wwid
+# This map would be best stored in an associative array, but
+# then bash 4.0+ would be needed (and SLES11 has bash 3.2).
+#
+# Output variables:
+# kdump_mpath_wwid_$major_$minor wwid of the given major/minor device
+function kdump_map_mpath_wwid() # {{{
+{
+ local f _dir _uuid _wwid _dev
+ for f in /sys/block/*/dm/uuid ; do
+ eval "_uuid=\$(<$f)" 2>/dev/null
+ [[ "$_uuid" = mpath-* ]] || continue
+ _dir="${f%/dm/uuid}"
+ _wwid=$(<"$_dir"/dm/name)
+ _dev=$(<"$_dir"/dev)
+ eval kdump_mpath_wwid_${_dev/:/_}=\$_wwid
+ done
+} # }}}
+
+#
# Keep only required devices in multipath.conf
#
# Parameters:
-# 1) devices: list of all required block devices
+# 1) devices: list of all required devices (multipath.conf syntax)
# Output:
# filtered multipath.conf
function kdump_modify_multipath() # {{{
{
- local devices="$1"
- local i bd scsi_id
local -a wwids
-
- i=0
- for bd in $devices ; do
- scsi_id=$(/lib/udev/scsi_id --whitelisted --device="$bd")
- [ -z "$scsi_id" ] && continue
- wwids[i++]="wwid "\""$scsi_id"\"
- done
+ eval wwids="($1)"
kdumptool multipath "${wwids[@]}" \
< /etc/multipath.conf
} # }}}
@@ -633,8 +645,9 @@ function kdump_init_dirs() # {{{
#
# Set up or create all necessary files
# Parameters:
-# 1) outdir: initrd temporary root
-# 2) dumpdevs: space-separated list of all block devices required by kdump
+# 1) outdir: initrd temporary root
+# 2) mpathdevs: space-separated list of all multipath devices required
+# by kdump (using multipath.conf syntax)
# Input variables:
# KDUMP_* see kdump_get_config
# kdump_mnt[] mountpoints in kdump environment
@@ -643,7 +656,7 @@ function kdump_init_dirs() # {{{
function kdump_setup_files() # {{{
{
local outdir="${1%/}"
- local dumpdevs="$2"
+ local mpathdevs="$2"
local kdump_over_ssh
#
@@ -673,7 +686,7 @@ function kdump_setup_files() # {
# create modified multipath.conf
#
if [ -e /etc/multipath.conf ] ; then
- kdump_modify_multipath "$dumpdevs" > "${outdir}/etc/multipath.conf"
+ kdump_modify_multipath "$mpathdevs" > "${outdir}/etc/multipath.conf"
fi
return 0
--- a/init/setup-kdump.sh
+++ b/init/setup-kdump.sh
@@ -28,9 +28,23 @@ fi
# /lib/kdump/setup-kdump.functions was sourced from setup-kdumpfs.sh already
#
+# Get a list of required multipath devices
+#
+mpath_wwids=
+kdump_map_mpath_wwid
+for bd in $blockdev ; do
+ update_blockdev $bd
+ [ $blockmajor -ge 0 -a $blockminor -ge 0 ] || continue
+ eval _wwid=\$kdump_mpath_wwid_${blockmajor}_${blockminor}
+ if [ -n "$_wwid" ] ; then
+ mpath_wwids="$mpath_wwids"$(printf "%q " "wwid $_wwid")
+ fi
+done
+
+#
# Copy or create all necessary files for the initrd
#
-kdump_setup_files "$tmp_mnt" "$blockdev"
+kdump_setup_files "$tmp_mnt" "$mpath_wwids"
#
# check if extra modules are needed

View File

@ -1,238 +0,0 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Tue Sep 23 11:02:22 2014 +0200
Subject: Move dracut network command line to module-setup.sh
References: bnc#885897
Patch-mainline: v0.8.16
Git-commit: 16e3640c2bcbb08fb31c7c3da03a8fb726d7686a
This is mostly a cleanup to allow adding more code to module-setup.sh
without too much duplication.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
init/mkdumprd | 54 -------------------------------
init/module-setup.sh | 76 ++++++++++++++++++++++++++++++++++++++++++---
init/setup-kdump.functions | 19 ++++++++++-
3 files changed, 90 insertions(+), 59 deletions(-)
--- a/init/mkdumprd
+++ b/init/mkdumprd
@@ -120,8 +120,6 @@ function run_mkinitrd()
# Create a new initrd using dracut {{{
function run_dracut()
{
- local modules="kdump"
-
DRACUT_ARGS="--force --hostonly --omit 'plymouth resume usrmount'"
DRACUT_ARGS="$DRACUT_ARGS --compress='xz -0 --check=crc32'"
@@ -136,60 +134,10 @@ function run_dracut()
i=$((i+1))
done
- # Check for additional modules
- neednet=
- for protocol in "${kdump_Protocol[@]}" ; do
- if [ "$protocol" = "nfs" ]; then
- modules="$modules nfs"
- fi
- if [ "$protocol" = "cifs" -o "$protocol" = "smb" ]; then
- modules="$modules cifs"
- fi
- if [ "$protocol" != "file" ]; then
- neednet=y
- fi
- done
-
- # network configuration
- if [ -n "$KDUMP_SMTP_SERVER" -a -n "$KDUMP_NOTIFICATION_TO" ]; then
- neednet=y
- fi
- if [ "$KDUMP_NETCONFIG" = "auto" ] ; then
- status_message "Network: auto"
- if [ -n "$neednet" ]; then
- DRACUT_ARGS+=" --kernel-cmdline 'rd.neednet=1 ip=any'"
- modules="$modules network"
- fi
- elif [ -z "$KDUMP_NETCONFIG" ] ; then
- status_message "Network: none"
- else
- interface=$(echo "$KDUMP_NETCONFIG" | cut -d ':' -f 1)
- mode=$(echo "$KDUMP_NETCONFIG" | cut -d ':' -f 2)
-
- if [ "$interface" = "default" ] ; then
- interface=$( kdump_default_netdev )
- status_message "Network interface: $interface (default)"
- else
- status_message "Network interface: $interface"
- fi
-
- if [ "$mode" = "static" ] ; then
- ipcfg="$(kdump_ip_config "$interface")"
- hwaddr=$(cat "/sys/class/net/$interface/address")
- status_message "Network mode: Static IP"
- DRACUT_ARGS+=" --kernel-cmdline 'rd.neednet=1 ip=$ipcfg::$hwaddr'"
- else
- status_message "Network mode: Automatic IP (DHCP)"
- DRACUT_ARGS+=" --kernel-cmdline 'rd.neednet=1 ip=${interface}:dhcp'"
- fi
- modules="$modules network"
- fi
-
# Make resolved variables visible to the dracut module
kdump_export_targets
- DRACUT_ARGS="$DRACUT_ARGS --add '$modules' $INITRD $KERNELVERSION"
- status_message "Calling dracut $DRACUT_ARGS"
+ DRACUT_ARGS="$DRACUT_ARGS --add 'kdump' $INITRD $KERNELVERSION"
echo "Regenerating kdump initrd ..." >&2
eval "bash -$- dracut $DRACUT_ARGS"
} # }}}
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -3,12 +3,51 @@
. /lib/kdump/setup-kdump.functions
+kdump_check_net() {
+ kdump_neednet=
+ for protocol in "${kdump_Protocol[@]}" ; do
+ if [ "$protocol" != "file" ]; then
+ kdump_neednet=y
+ fi
+ done
+
+ # network configuration
+ if [ -n "$KDUMP_SMTP_SERVER" -a -n "$KDUMP_NOTIFICATION_TO" ]; then
+ kdump_neednet=y
+ fi
+
+ # network explicitly disabled in configuration?
+ [ -z "$KDUMP_NETCONFIG" ] && kdump_neednet=
+}
+
check() {
+ # Get configuration
+ kdump_import_targets || return 1
+ kdump_get_config || return 1
+ kdump_check_net
+
return 255
}
depends() {
- echo drm
+ local -A _modules
+
+ # drm is needed to get console output, but it is not included
+ # automatically, because kdump does not use plymouth
+ _modules[drm]=
+
+ [ "$kdump_neednet" = y ] && _modules[network]=
+
+ for protocol in "${kdump_Protocol[@]}" ; do
+ if [ "$protocol" = "nfs" ]; then
+ _modules[nfs]=
+ fi
+ if [ "$protocol" = "cifs" -o "$protocol" = "smb" ]; then
+ _modules[cifs]=
+ fi
+ done
+
+ echo ${!_modules[@]}
}
kdump_add_mpath_dev() {
@@ -22,10 +61,39 @@ kdump_add_mpath_dev() {
fi
}
+kdump_cmdline_ip() {
+ [ "$kdump_neednet" = y ] || return 0
+
+ echo -n "rd.neednet=1"
+ if [ "$KDUMP_NETCONFIG" = "auto" ] ; then
+ echo -n " ip=any"
+ else
+ set -- ${KDUMP_NETCONFIG//:/ }
+ local _if=$1
+ local _mode=$2
+
+ if [ "$_if" = "default" ] ; then
+ _if=$(kdump_default_netdev)
+ fi
+ printf " %s" $(kdump_ifname_config "$_if")
+
+ if [ "$_mode" = "static" ] ; then
+ printf " %s" $(kdump_ip_config "$_if")
+ else
+ echo -n " ip=${_if}:dhcp"
+ fi
+ fi
+}
+
+cmdline() {
+ kdump_cmdline_ip
+}
+
install() {
- # Get configuration
- kdump_get_config || return 1
- kdump_import_targets
+ if [[ $hostonly_cmdline == "yes" ]] ; then
+ local _cmdline=$(cmdline)
+ [ -n "$_cmdline" ] && printf "%s\n" "$_cmdline" >> "${initdir}/etc/cmdline.d/99kdump.conf"
+ fi
# Get a list of required multipath devices
local kdump_mpath_wwids
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -193,6 +193,20 @@ function kdump_netdev_mode() # {
} # }}}
#
+# Get the ifname parameter for a given device
+#
+# Parameters:
+# 1) device device name
+# Output:
+# ifname corresponding ifname= initrd parameter (or empty)
+function kdump_ifname_config() # {{{
+{
+ local iface="$1"
+ local hwaddr=$(<"/sys/class/net/$iface/address")
+ [ -n "$hwaddr" ] && echo "ifname=$iface:$hwaddr"
+} # }}}
+
+#
# Convert a CIDR prefix to IPv4 netmask
#
# Parameters:
@@ -219,7 +233,7 @@ kdump_prefix2netmask() { # {{{
# Get the ip= parameter for a given device
#
# Parameters:
-# 1) device device name (use default if empty)
+# 1) device device name
# Output:
# ip configuration string that can be used for the ip= initrd parameter
function kdump_ip_config() # {{{
@@ -249,7 +263,7 @@ function kdump_ip_config() # {{{
gwaddr=$(ip route show 0/0 | sed -n 's/.* via \([^ ]*\).*/\1/p')
hostname=$(hostname)
- echo "$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$iface:none"
+ echo "ip=$ipaddr:$peeraddr:$gwaddr:$netmask:$hostname:$iface:none"
} # }}}
#
@@ -311,6 +325,7 @@ function kdump_import_targets()
eval "kdump_Host=( $KDUMP_x_Host )"
eval "kdump_Realpath=( $KDUMP_x_Realpath )"
eval "kdump_mnt=( $KDUMP_x_mnt )"
+ test ${#kdump_URL[@]} -gt 0
} # }}}
#

View File

@ -1,32 +0,0 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Thu Sep 18 10:15:59 2014 +0200
Subject: Remove root= and resume= from the kdump kernel command line
References: bnc#883883
Patch-mainline: v0.8.16
Git-commit: 8caaba657548133d476b2a13fd5abb68314927c7
Resume from hibernation should never be even attempted in kdump.
If using dracut, the module is even omitted from the initrd, so
passing the command line option only consumes command line space.
The default root device is not needed either, because all required
filesystems are handled by the mount dracut module. In fact, if the
root filesystem is also mounted, it may be mounted twice.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
init/rc.kdump.functions | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/init/rc.kdump.functions
+++ b/init/rc.kdump.functions
@@ -108,7 +108,7 @@ function build_kdump_commandline()
local nr_cpus=$(cpus_param "$kdump_kernel")
commandline=$(
remove_from_commandline \
- 'crashkernel|splash|mem|BOOT_IMAGE|showopts|zfcp\.allow_lun_scan|hugepages|acpi_no_memhotplug|cgroup_disable' \
+ 'root|resume|crashkernel|splash|mem|BOOT_IMAGE|showopts|zfcp\.allow_lun_scan|hugepages|acpi_no_memhotplug|cgroup_disable' \
< /proc/cmdline)
# Use deadline for saving the memory footprint
commandline="$commandline elevator=deadline sysrq=yes reset_devices acpi_no_memhotplug cgroup_disable=memory"

View File

@ -1,178 +0,0 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Tue Sep 23 07:09:44 2014 +0200
Subject: Split kdump_default_netdev()
References: bnc#885897
Patch-mainline: v0.8.16
Git-commit: 4da0601f2edcef642da502db6f4299204365c631
This function did too many things, which are now split thus:
1. determine the default network interface
-> kept in kdump_default_netdev
2. get the underlying physical devices of a bridge
-> kdump_bridge_phys_dev
3. determine network interface operating mode
-> kdump_netdev_mode
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
---
init/mkdumprd | 1
init/setup-kdump.functions | 94 +++++++++++++++++++++++++--------------------
2 files changed, 54 insertions(+), 41 deletions(-)
--- a/init/mkdumprd
+++ b/init/mkdumprd
@@ -168,7 +168,6 @@ function run_dracut()
if [ "$interface" = "default" ] ; then
interface=$( kdump_default_netdev )
- interface="${interface% *}"
status_message "Network interface: $interface (default)"
else
status_message "Network interface: $interface"
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -77,12 +77,10 @@ function kdump_wicked_conf() # {
# Determine the default network device.
#
# Output:
-# "$ifname $mode"
-# ifname default network interface name (or empty if none)
-# mode initialization mode ("static" or "dhcp")
+# ifname default network interface name (or empty if none)
function kdump_default_netdev() # {{{
{
- local ifname BOOTPROTO
+ local ifname
local inffile="/etc/install.inf"
# check current default routes
@@ -95,7 +93,6 @@ function kdump_default_netdev()
if [ -z "$ifname" -a -f "$inffile" ] ; then
local dev hwaddr hwaddr2
eval $( sed -ne '
- s/^NetConfig: \(.*\)/BOOTPROTO=\1/p;
s/^Netdevice: \(.*\)/ifname=\1/p;
s/HWAddr: \(.*\)/hwaddr=\1/p' \
"$inffile" )
@@ -108,12 +105,53 @@ function kdump_default_netdev()
done
fi
fi
+ echo "$ifname"
+} # }}}
- # if still not found, there is no network
- if [ -z "$ifname" ] ; then
- return 0
+# Get the underlying physical devices of a bridge.
+#
+# Virtual devices (tap or vif) are ignored.
+#
+# Parameters:
+# 1) ifname bridge interface name
+# Output:
+# ifnames list of underlying physical interfaces;
+function kdump_bridge_phys_dev() # {{{
+{
+ local ifname="$1"
+
+ if [ -d "/sys/class/net/$ifname/bridge" -a \
+ -d "/sys/class/net/$ifname/brif" ] ; then
+
+ local ifname2 count=0
+ local -a res
+ for ifname2 in "/sys/class/net/$ifname/brif"/*; do
+ case "$(readlink -f "$ifname2")" in
+ /sys/devices/virtual/*)
+ continue
+ esac
+ res[count]="${ifname2##*/}"
+ count=$(( count+1 ))
+ done
+ ifname=${res[@]}
fi
+ echo "$ifname"
+} # }}}
+
+#
+# Determine the default network mode of a given device.
+#
+# Parameters:
+# 1) ifname network interface name
+# Output:
+# mode initialization mode ("static" or "dhcp")
+function kdump_netdev_mode() # {{{
+{
+ local ifname="$1"
+ local inffile="/etc/install.inf"
+ local BOOTPROTO
+
# get mode using wicked if possible
if [ -n "$(type -P wicked)" -a \
"$(kdump_wicked_conf "$ifname" name)" = "$ifname" ]
@@ -135,6 +173,12 @@ function kdump_default_netdev()
fi
fi
+ # try install.conf
+ if [ -z "$BOOTPROTO" ] ; then
+ eval $( sed -ne 's/^NetConfig: \(.*\)/BOOTPROTO=\1/p;' \
+ "$inffile" )
+ fi
+
# if not found, look if there is a dhcp daemon for the interface
if [ -z "$BOOTPROTO" ] ; then
if [ -n "$(ps -C dhclient,dhclient6,dhcpcd -o cmd= |
@@ -145,31 +189,7 @@ function kdump_default_netdev()
fi
fi
- # if the interface is a bridge, then try to use the underlying interface
- # if it is the only non-virtual interface (not tap or vif)
- if [ -d "/sys/class/net/$ifname/bridge" -a \
- -d "/sys/class/net/$ifname/brif" ] ; then
-
- local ifname2 res count=0
- for ifname2 in "/sys/class/net/$ifname/brif"/*; do
- case "$(readlink -f "$ifname2")" in
- /sys/devices/virtual/*)
- continue
- esac
- res="${ifname2##*/}"
- count=$(( count+1 ))
- done
-
- if [ "$count" -ne 1 ] ; then
- echo >&2 ">>> WARNING: $ifname is a bridge with more than one"
- echo >&2 ">>> underlying interface. Please specify the device"
- echo >&2 ">>> in KDUMP_NETCONFIG manually."
- else
- ifname="$res"
- fi
- fi
-
- echo "$ifname $BOOTPROTO"
+ echo "$BOOTPROTO"
} # }}}
#
@@ -205,13 +225,7 @@ kdump_prefix2netmask() { # {{{
function kdump_ip_config() # {{{
{
local iface="$1"
- if [ -z "$iface" ] ; then
- iface=$( kdump_default_netdev )
- iface="${iface% *}"
- fi
- [ -z "$iface" ] && return 1
-
- local ipaddr peeraddr gwaddr netmask hostname iface
+ local ipaddr peeraddr gwaddr netmask hostname
local family cidr rest
local prefix
while read family cidr rest

View File

@ -1,131 +0,0 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Thu Sep 18 15:40:37 2014 +0200
Subject: Dracut-systemd support
References: bnc#883883
Patch-mainline: v0.8.16
Git-commit: 9940475e501273ddac4a13fa2f4284b4121415de
Adjust the dracut module to work with the systemd module.
A new service is added to the initrd. I could not use a pre-pivot
hook, because dracut-pre-pivot.service does not send the output
to the terminal, so dump progress was not visible.
It is also necessary to avoid mounting the root filesystem. All
filesystems needed by kdump are mounted under /kdump and set up
with the --mount dracut option.
The system root mount can be generated in two ways:
a. by initrd-fstab-generator (if "root=" is passed on the kernel
command line)
b. by dracut-rootfs-generator (if the root option is stored in
/etc/cmdline.d/*)
The root= parameter is already removed from the command line, but
it is always saved to /etc/cmdline.d/95root-dev.conf if dracut is
called with --hostonly-cmdline. This is the default in SLES (cf.
/etc/dracut.conf.d/01-dist.conf) and it is required to get correct
configuration for many setups.
So, the only way to avoid mounting /sysroot is to remove the
appropriate systemd generator from the initrd.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
diff --git a/init/CMakeLists.txt b/init/CMakeLists.txt
index 662197c..9cc8b71 100644
--- a/init/CMakeLists.txt
+++ b/init/CMakeLists.txt
@@ -79,4 +79,15 @@ INSTALL(
WORLD_READ WORLD_EXECUTE
)
+INSTALL(
+ FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/kdump-save.service
+ DESTINATION
+ /usr/lib/dracut/modules.d/99kdump
+ PERMISSIONS
+ OWNER_READ OWNER_WRITE
+ GROUP_READ
+ WORLD_READ
+)
+
# vim: set sw=4 ts=4 et:
diff --git a/init/kdump-save.service b/init/kdump-save.service
new file mode 100644
index 0000000..ac527f4
--- /dev/null
+++ b/init/kdump-save.service
@@ -0,0 +1,31 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+# See systemd.special(7) for details
+
+[Unit]
+Description=save kernel crash dump
+Documentation=man:kdump(7)
+Wants=dracut-mount.service dracut-pre-pivot.service
+After=dracut-mount.service dracut-pre-pivot.service
+After=initrd.target
+Before=initrd-cleanup.service
+ConditionPathExists=/etc/initrd-release
+ConditionPathExists=/proc/vmcore
+
+[Service]
+Type=oneshot
+ExecStart=/lib/kdump/save_dump.sh
+StandardInput=tty
+StandardOutput=tty
+StandardError=tty
+KillMode=process
+RemainAfterExit=yes
+
+# Bash ignores SIGTERM, so we send SIGHUP instead, to ensure that bash
+# terminates cleanly.
+KillSignal=SIGHUP
diff --git a/init/mkdumprd b/init/mkdumprd
index 334786f..bb818d2 100755
--- a/init/mkdumprd
+++ b/init/mkdumprd
@@ -122,7 +122,7 @@ function run_dracut()
{
local modules="kdump"
- DRACUT_ARGS="--force --hostonly --omit 'systemd plymouth resume usrmount'"
+ DRACUT_ARGS="--force --hostonly --omit 'plymouth resume usrmount'"
DRACUT_ARGS="$DRACUT_ARGS --compress='xz -0 --check=crc32'"
# add mount points
diff --git a/init/module-setup.sh b/init/module-setup.sh
index 06f9775..690de38 100644
--- a/init/module-setup.sh
+++ b/init/module-setup.sh
@@ -18,8 +18,18 @@ install() {
kdump_setup_files "$initdir" "${!host_fs_types[*]}"
- inst_hook mount 30 "$moddir/mount-kdump.sh"
- inst_hook pre-pivot 90 /lib/kdump/save_dump.sh
+ if dracut_module_included "systemd" ; then
+ rm -f "${initdir}/$systemdutildir"/system-generators/dracut-rootfs-generator
+ inst_simple /lib/kdump/save_dump.sh
+ inst_simple "$moddir/kdump-save.service" \
+ "$systemdsystemunitdir"/kdump-save.service
+ ln_r "$systemdsystemunitdir"/kdump-save.service \
+ "$systemdsystemunitdir"/initrd.target.wants/kdump-save.service
+ else
+ inst_hook mount 30 "$moddir/mount-kdump.sh"
+ inst_hook pre-pivot 90 /lib/kdump/save_dump.sh
+ fi
+
inst_multiple makedumpfile makedumpfile-R.pl kdumptool \
$KDUMP_REQUIRED_PROGRAMS
inst_simple /etc/resolv.conf

View File

@ -1,34 +0,0 @@
From: Petr Tesarik <ptesarik@suse.cz>
Date: Fri Sep 5 12:26:36 2014 +0200
Subject: Use device from /etc/fstab to mount / and /boot
References: bnc#892451
Patch-mainline: v0.8.16
Git-commit: 2895d4a8d24dd9b0a83e64cd58e464a3eaf7fe96
Since kdump_read_mounts() falls back to /proc/mounts, the root/boot
mount points must not be changed if they were found in /etc/fstab
previously.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
diff --git a/init/setup-kdump.functions b/init/setup-kdump.functions
index a676a82..2b96f8e 100644
--- a/init/setup-kdump.functions
+++ b/init/setup-kdump.functions
@@ -388,12 +388,14 @@ function kdump_get_mountpoints() # {{{
kdump_opts=( )
while read device mountpoint filesystem opts dummy ; do
- if [ "$mountpoint" = "/" ] ; then
+ if [ "$mountpoint" = "/" -a \
+ -z "$rootmnt" ] ; then
rootdev="$device"
rootmnt="$mountpoint"
rootfstype="$filesystem"
rootopts="$opts"
- elif [ "$mountpoint" = "/boot" ] ; then
+ elif [ "$mountpoint" = "/boot" -a \
+ -z "$bootmnt" ] ; then
bootdev="$device"
bootmnt="$mountpoint"
bootfstype="$filesystem"

View File

@ -1,3 +1,27 @@
-------------------------------------------------------------------
Wed Oct 5 07:53:00 UTC 2016 - ptesarik@suse.com
- Update to 0.8.16
- Drop patches now in mainline:
o 0001-multipath-Write-proper-regex-into-multipath-conf.patch
o kdump-add-IPv6-KDUMP_NETCONFIG-modes.patch
o kdump-bootloader-grub2.patch
o kdump-calibrate-systemd-initramfs.patch
o kdump-calibrate-systemd-runtime.patch
o kdump-count-const-slabs.patch
o kdump-count-framebuffer.patch
o kdump-enable-fadump-ppc64le.patch
o kdump-fadump-bootloader-always.patch
o kdump-fadump-keep-sysroot.patch
o kdump-get-multipath-wwid-from-sysfs.patch
o kdump-move-network-setup-to-module-setup.patch
o kdump-remove-root-and-resume.patch
o kdump-split-kdump_default_netdev.patch
o kdump-systemd-support.patch
o kdump-use-fstab-device.patch
- Drop obsolete patches:
o kdump-0.8.15-fix-shebang.patch
-------------------------------------------------------------------
Thu Feb 11 14:54:58 UTC 2016 - rguenther@suse.com

View File

@ -1,12 +0,0 @@
[Unit]
Description=Load kdump kernel on startup
After=local-fs.target
[Service]
Type=oneshot
ExecStart=/etc/init.d/boot.kdump start
ExecStop=/etc/init.d/boot.kdump stop
RemainAfterExit=true
[Install]
WantedBy=multi-user.target

View File

@ -28,76 +28,66 @@
%endif
%define _udevrulesdir %{_udevdir}/rules.d
Url: https://github.com/ptesarik/kdump
%if 0%{?suse_version} > 1220
%define uses_systemd 1
%else
%define uses_systemd 0
%endif
Name: kdump
Version: 0.8.15
Version: 0.8.16
Release: 0
Requires: curl
Requires: makedumpfile
Requires: openssh
Summary: Script for kdump
License: GPL-2.0+
Group: System/Kernel
Url: https://github.com/ptesarik/kdump
Source: %{name}-%{version}.tar.bz2
Source2: %{name}-rpmlintrc
Patch1: %{name}-cmake-compat.patch
BuildRequires: asciidoc
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: libblkid-devel
BuildRequires: libcurl-devel
BuildRequires: libelf-devel
BuildRequires: libesmtp-devel
BuildRequires: libopenssl-devel
BuildRequires: libssh2-devel
BuildRequires: libxslt
BuildRequires: pkg-config
BuildRequires: pkgconfig
BuildRequires: udev
BuildRequires: zlib-devel
Requires: curl
Requires: kexec-tools
Requires: makedumpfile
Requires: openssh
PreReq: %insserv_prereq %fillup_prereq
PreReq: coreutils
PreReq: sed
Recommends: cifs-utils
Recommends: nfs-client
#!BuildIgnore: fop
%if 0%{?suse_version} > 1220
# rename "kdump-helpers" (10.3) -> "kdump" (11.0/SP2)
Provides: kdump-helpers = %{version}
Obsoletes: kdump-helpers < %{version}
# update should detect the split-off from kexec-tools
Provides: kexec-tools:%{_initddir}/kdump
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExcludeArch: s390 ppc
%if %{uses_systemd}
BuildRequires: systemd
%endif
PreReq: %insserv_prereq %fillup_prereq
%if 0%{?suse_version} > 1310
PreReq: dracut
%else
PreReq: mkinitrd
%endif
Source: %{name}-%{version}.tar.bz2
Source2: %{name}-rpmlintrc
Source3: kdump.service
Patch0: 0001-multipath-Write-proper-regex-into-multipath-conf.patch
Patch1: %{name}-use-fstab-device.patch
Patch2: %{name}-count-framebuffer.patch
Patch3: %{name}-count-const-slabs.patch
Patch4: %{name}-remove-root-and-resume.patch
Patch5: %{name}-systemd-support.patch
Patch6: %{name}-calibrate-systemd-runtime.patch
Patch7: %{name}-calibrate-systemd-initramfs.patch
Patch8: %{name}-get-multipath-wwid-from-sysfs.patch
Patch9: %{name}-split-kdump_default_netdev.patch
Patch10: %{name}-move-network-setup-to-module-setup.patch
Patch11: %{name}-add-IPv6-KDUMP_NETCONFIG-modes.patch
Patch12: %{name}-enable-fadump-ppc64le.patch
Patch13: %{name}-fadump-bootloader-always.patch
Patch14: %{name}-bootloader-grub2.patch
Patch15: %{name}-fadump-keep-sysroot.patch
Patch16: %{name}-0.8.15-fix-shebang.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# rename "kdump-helpers" (10.3) -> "kdump" (11.0/SP2)
Provides: kdump-helpers = %{version}
Obsoletes: kdump-helpers < %{version}
# update should detect the split-off from kexec-tools
Provides: kexec-tools:/etc/init.d/kdump
Requires: kexec-tools
%if 0%{?suse_version} > 1220
%if %{uses_systemd}
%systemd_requires
%endif
Recommends: nfs-client cifs-utils
PreReq: coreutils sed
ExcludeArch: s390 ppc
%description
kdump is a package that includes several scripts for kdump, including
the init script /etc/init.d/kdump and the configuration file for kdump.
the kdump service and configuration files
The kernel package and this package are all that are required for a
crash dump to occur. However, if you wish to debug the crash dump
@ -112,125 +102,110 @@ For example, if you are debugging kernel-default, you will need:
These packages are not needed to create the dump and can be installed
after a crash dump has occured.
Authors:
--------
Bernhard Walle <bwalle@suse.de>
%prep
%setup
%patch0 -p1
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%build
export CFLAGS="%optflags"
export CXXFLAGS="%optflags -std=gnu++98"
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags} -std=gnu++98"
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} ..
make
make %{?_smp_mflags}
cd -
%check
cd build
make test
make %{?_smp_mflags} test
%install
cd build
make DESTDIR=$RPM_BUILD_ROOT install
make %{?_smp_mflags} DESTDIR=%{buildroot} install
cd -
# move udev rules
mkdir -p $RPM_BUILD_ROOT/%{_udevrulesdir}
mv $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d/* $RPM_BUILD_ROOT/%{_udevrulesdir}/
mkdir -p %{buildroot}/%{_udevrulesdir}
mv %{buildroot}/%{_sysconfdir}/udev/rules.d/* %{buildroot}/%{_udevrulesdir}/
# remove executable bit from non-binaries
chmod -x $RPM_BUILD_ROOT/lib/kdump/setup-kdump.functions
# symlink for init script
mkdir -p $RPM_BUILD_ROOT/sbin
ln -s /etc/init.d/boot.kdump $RPM_BUILD_ROOT/sbin/rckdump
chmod -x %{buildroot}/lib/kdump/setup-kdump.functions
# empty directory
mkdir $RPM_BUILD_ROOT/var/crash
mkdir %{buildroot}/var/crash
%if 0%{?suse_version} > 1310
rm -r $RPM_BUILD_ROOT/lib/mkinitrd
rm -r %{buildroot}/lib/mkinitrd
%endif
%if 0%{?suse_version} > 1220
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
install -m644 %{S:3} $RPM_BUILD_ROOT%{_unitdir}
# symlink for init script
%if %{uses_systemd}
rm %{buildroot}%{_initddir}/boot.kdump
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rckdump
%else
rm %{buildroot}/usr/lib/systemd/system/kdump.service
rm %{buildroot}/usr/lib/systemd/system/kdump-rebuild-initrd.service
ln -s ../..%{_initddir}/boot.kdump %{buildroot}%{_sbindir}/rckdump
%endif
%if 0%{?suse_version} > 1220
%if %{uses_systemd}
%pre
%service_add_pre kdump.service
%service_add_pre kdump-rebuild-initrd.service
%endif
%post
# change only permission if the file exists before /etc/sysconfig/kdump
# has been created from /var/adm/fillup-templates/sysconfig.kdump
change_permission=0
if [ ! -f /etc/sysconfig/kdump ] ; then
if [ ! -f %{_sysconfdir}/sysconfig/kdump ] ; then
change_permission=1
fi
%if %{uses_systemd}
%{fillup_only -n kdump}
%service_add_post kdump.service
%service_add_post kdump-rebuild-initrd.service
%else
%{fillup_and_insserv -n kdump boot.kdump}
%endif
if [ "$change_permission" = 1 ]; then
chmod 0600 /etc/sysconfig/kdump
chmod 0600 %{_sysconfdir}/sysconfig/kdump
fi
# if /var/log/dump is empty, make it a symlink to /var/crash
if test -d /var/log/dump && rmdir /var/log/dump >/dev/null 2>&1 ||
! test -d /var/log/dump ; then
ln -snf /var/crash /var/log/dump
fi
%if 0%{?suse_version} > 1220
%service_add_post kdump.service
%endif
%preun
echo "Stopping kdump ..."
%stop_on_removal boot.kdump
%if 0%{?suse_version} > 1220
%if %{uses_systemd}
%service_del_preun kdump.service
%service_del_preun kdump-rebuild-initrd.service
%else
%stop_on_removal boot.kdump
%endif
%postun
# force regeneration of kdumprd
touch /etc/sysconfig/kdump
touch %{_sysconfdir}/sysconfig/kdump
# delete symbolic link
rm /var/log/dump >/dev/null 2>&1 || true
%if %{uses_systemd}
%service_del_postun kdump.service
%service_del_postun kdump-rebuild-initrd.service
%else
%restart_on_update boot.kdump
%insserv_cleanup
%if 0%{?suse_version} > 1220
%service_del_postun kdump.service
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc ChangeLog COPYING README NEWS
%{_sbindir}/kdumptool
%{_sbindir}/mkdumprd
%{_sbindir}/kdump-bootloader.pl
%{_mandir}/man5/kdump.5.gz
%{_mandir}/man7/kdump.7.gz
%{_mandir}/man8/kdumptool.8.gz
%{_mandir}/man8/mkdumprd.8.gz
/sbin/rckdump
%{_sysconfdir}/init.d/boot.kdump
/var/adm/fillup-templates/sysconfig.kdump
%{_mandir}/man5/kdump.5%{ext_man}
%{_mandir}/man7/kdump.7%{ext_man}
%{_mandir}/man8/kdumptool.8%{ext_man}
%{_mandir}/man8/mkdumprd.8%{ext_man}
%{_localstatedir}/adm/fillup-templates/sysconfig.kdump
%if 0%{?suse_version} <= 1310
/lib/mkinitrd/scripts/*-kdump.sh
/lib/mkinitrd/scripts/setup-kdumpfs.sh
@ -242,8 +217,12 @@ rm -rf $RPM_BUILD_ROOT
%dir /lib/kdump
/lib/kdump/*
%{_udevrulesdir}/70-kdump.rules
%if 0%{?suse_version} > 1220
%if %{uses_systemd}
%{_unitdir}/kdump.service
%{_unitdir}/kdump-rebuild-initrd.service
%else
%{_sysconfdir}/init.d/boot.kdump
%endif
%{_sbindir}/rckdump
%changelog