Accepting request 500224 from Kernel:kdump
1 OBS-URL: https://build.opensuse.org/request/show/500224 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kexec-tools?expand=0&rev=119
This commit is contained in:
commit
5d2d1a9d73
30
0001-kexec-tools-2.0.14.git.patch
Normal file
30
0001-kexec-tools-2.0.14.git.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
From 9da19c0a6f49b5577b147053f2c3226a8ce97d4e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Simon Horman <horms@verge.net.au>
|
||||||
|
Date: Tue, 20 Dec 2016 09:18:50 +0100
|
||||||
|
Subject: [PATCH 01/45] kexec-tools 2.0.14.git
|
||||||
|
|
||||||
|
Add .git to version so it doesn't look like a release.
|
||||||
|
This is just so when people build code from git it can
|
||||||
|
be identified as such from the version string.
|
||||||
|
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
configure.ac | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index 53962562db08..304418539be8 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -4,7 +4,7 @@ dnl
|
||||||
|
dnl
|
||||||
|
|
||||||
|
dnl ---Required
|
||||||
|
-AC_INIT(kexec-tools, 2.0.14)
|
||||||
|
+AC_INIT(kexec-tools, 2.0.14.git)
|
||||||
|
AC_CONFIG_AUX_DIR(./config)
|
||||||
|
AC_CONFIG_HEADERS([include/config.h])
|
||||||
|
AC_LANG(C)
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
66
0002-ppc64-Reduce-number-of-ELF-LOAD-segments.patch
Normal file
66
0002-ppc64-Reduce-number-of-ELF-LOAD-segments.patch
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
From f63d8530b9b6a2d7e79b946e326e5a2197eb8f87 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Petr Tesarik <ptesarik@suse.com>
|
||||||
|
Date: Thu, 19 Jan 2017 18:37:09 +0100
|
||||||
|
Subject: [PATCH 02/45] ppc64: Reduce number of ELF LOAD segments
|
||||||
|
|
||||||
|
The number of program header table entries (e_phnum) is an Elf64_Half,
|
||||||
|
which is a 16-bit entity, i.e. the limit is 65534 entries (one entry is
|
||||||
|
reserved for NOTE). This is a hard limit, defined by the ELF standard.
|
||||||
|
It is possible that more LMBs (Logical Memory Blocks) are needed to
|
||||||
|
represent all RAM on some machines, and this field overflows, causing
|
||||||
|
an incomplete /proc/vmcore file.
|
||||||
|
|
||||||
|
This has actually happened on a machine with 31TB of RAM and an LMB size
|
||||||
|
of 256MB.
|
||||||
|
|
||||||
|
However, since there is usually no memory hole between adjacent LMBs, the
|
||||||
|
map can be "compressed", combining multiple adjacent into a single LOAD
|
||||||
|
segment.
|
||||||
|
|
||||||
|
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/ppc64/crashdump-ppc64.c | 12 +++++++++++-
|
||||||
|
1 file changed, 11 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/ppc64/crashdump-ppc64.c b/kexec/arch/ppc64/crashdump-ppc64.c
|
||||||
|
index b3c89285a733..f62b1599c162 100644
|
||||||
|
--- a/kexec/arch/ppc64/crashdump-ppc64.c
|
||||||
|
+++ b/kexec/arch/ppc64/crashdump-ppc64.c
|
||||||
|
@@ -123,6 +123,7 @@ static void exclude_crash_region(uint64_t start, uint64_t end)
|
||||||
|
static int get_dyn_reconf_crash_memory_ranges(void)
|
||||||
|
{
|
||||||
|
uint64_t start, end;
|
||||||
|
+ uint64_t startrange, endrange;
|
||||||
|
char fname[128], buf[32];
|
||||||
|
FILE *file;
|
||||||
|
unsigned int i;
|
||||||
|
@@ -137,6 +138,7 @@ static int get_dyn_reconf_crash_memory_ranges(void)
|
||||||
|
}
|
||||||
|
|
||||||
|
fseek(file, 4, SEEK_SET);
|
||||||
|
+ startrange = endrange = 0;
|
||||||
|
for (i = 0; i < num_of_lmbs; i++) {
|
||||||
|
if ((n = fread(buf, 1, 24, file)) < 0) {
|
||||||
|
perror(fname);
|
||||||
|
@@ -162,8 +164,16 @@ static int get_dyn_reconf_crash_memory_ranges(void)
|
||||||
|
if ((flags & 0x80) || !(flags & 0x8))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
- exclude_crash_region(start, end);
|
||||||
|
+ if (start != endrange) {
|
||||||
|
+ if (startrange != endrange)
|
||||||
|
+ exclude_crash_region(startrange, endrange);
|
||||||
|
+ startrange = start;
|
||||||
|
+ }
|
||||||
|
+ endrange = end;
|
||||||
|
}
|
||||||
|
+ if (startrange != endrange)
|
||||||
|
+ exclude_crash_region(startrange, endrange);
|
||||||
|
+
|
||||||
|
fclose(file);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
31
0003-kexec-Increase-the-upper-limit-for-RAM-segments.patch
Normal file
31
0003-kexec-Increase-the-upper-limit-for-RAM-segments.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
From 24aa2d93cac316657a2c20f28b8687bbf7e22991 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Sameer Goel <sgoel@codeaurora.org>
|
||||||
|
Date: Wed, 18 Jan 2017 16:15:12 -0700
|
||||||
|
Subject: [PATCH 03/45] kexec: Increase the upper limit for RAM segments
|
||||||
|
|
||||||
|
On a newer UEFI based Qualcomm target the number of system ram regions
|
||||||
|
retrieved from /proc/iomem are ~40. So increasing the current hardcoded
|
||||||
|
values to 64 from 16.
|
||||||
|
|
||||||
|
Signed-off-by: Sameer Goel <sgoel@codeaurora.org>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/arm64/kexec-arm64.h | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/arm64/kexec-arm64.h b/kexec/arch/arm64/kexec-arm64.h
|
||||||
|
index bac62f8b19e0..bd4c20e76d15 100644
|
||||||
|
--- a/kexec/arch/arm64/kexec-arm64.h
|
||||||
|
+++ b/kexec/arch/arm64/kexec-arm64.h
|
||||||
|
@@ -11,7 +11,7 @@
|
||||||
|
#include "image-header.h"
|
||||||
|
#include "kexec.h"
|
||||||
|
|
||||||
|
-#define KEXEC_SEGMENT_MAX 16
|
||||||
|
+#define KEXEC_SEGMENT_MAX 64
|
||||||
|
|
||||||
|
#define BOOT_BLOCK_VERSION 17
|
||||||
|
#define BOOT_BLOCK_LAST_COMP_VERSION 16
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
27
0004-alpha-add-missing-__NR_kexec_load-definition.patch
Normal file
27
0004-alpha-add-missing-__NR_kexec_load-definition.patch
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
From 4eaa36cd01a972a602065ebade5ac46d1c81fba9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Simon Horman <horms@verge.net.au>
|
||||||
|
Date: Tue, 20 Dec 2016 09:29:18 +0100
|
||||||
|
Subject: [PATCH 04/45] alpha: add missing __NR_kexec_load definition
|
||||||
|
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/kexec-syscall.h | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
|
||||||
|
index c0d0beadf932..3b5c528d8aac 100644
|
||||||
|
--- a/kexec/kexec-syscall.h
|
||||||
|
+++ b/kexec/kexec-syscall.h
|
||||||
|
@@ -48,6 +48,9 @@
|
||||||
|
#ifdef __m68k__
|
||||||
|
#define __NR_kexec_load 313
|
||||||
|
#endif
|
||||||
|
+#ifdef __alpha__
|
||||||
|
+#define __NR_kexec_load 448
|
||||||
|
+#endif
|
||||||
|
#ifndef __NR_kexec_load
|
||||||
|
#error Unknown processor architecture. Needs a kexec_load syscall number.
|
||||||
|
#endif
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
345
0005-kexec-implemented-XEN-KEXEC-STATUS-to-determine-if-a.patch
Normal file
345
0005-kexec-implemented-XEN-KEXEC-STATUS-to-determine-if-a.patch
Normal file
@ -0,0 +1,345 @@
|
|||||||
|
From 2cf7cb9a60802cfdbd4ec51439b05b5ac6293ee6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Date: Wed, 25 Jan 2017 09:31:15 -0600
|
||||||
|
Subject: [PATCH 05/45] kexec: implemented XEN KEXEC STATUS to determine if an
|
||||||
|
image is loaded
|
||||||
|
|
||||||
|
Instead of the scripts having to poke at various fields we can
|
||||||
|
provide that functionality via the -S parameter.
|
||||||
|
|
||||||
|
kexec_loaded/kexec_crash_loaded exposes Linux kernel kexec/crash
|
||||||
|
state. It does not say anything about Xen kexec/crash state. So,
|
||||||
|
we need a special approach to get the latter. Though for
|
||||||
|
compatibility we provide similar functionality in kexec-tools
|
||||||
|
for the former.
|
||||||
|
|
||||||
|
This change enables the --status or -S option to work either
|
||||||
|
with or without Xen.
|
||||||
|
|
||||||
|
Returns 0 if the payload is loaded. Can be used in combination
|
||||||
|
with -l or -p to get the state of the proper kexec image.
|
||||||
|
|
||||||
|
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||||
|
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
configure.ac | 8 +++-
|
||||||
|
kexec/kexec-xen.c | 26 +++++++++++++
|
||||||
|
kexec/kexec.8 | 6 +++
|
||||||
|
kexec/kexec.c | 112 ++++++++++++++++++++++++++++++++++++++----------------
|
||||||
|
kexec/kexec.h | 5 ++-
|
||||||
|
5 files changed, 122 insertions(+), 35 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index 304418539be8..53fffc3a92ed 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -165,8 +165,14 @@ fi
|
||||||
|
dnl find Xen control stack libraries
|
||||||
|
if test "$with_xen" = yes ; then
|
||||||
|
AC_CHECK_HEADER(xenctrl.h,
|
||||||
|
- [AC_CHECK_LIB(xenctrl, xc_kexec_load, ,
|
||||||
|
+ [AC_CHECK_LIB(xenctrl, xc_kexec_load, [ have_xenctrl_h=yes ],
|
||||||
|
AC_MSG_NOTICE([Xen support disabled]))])
|
||||||
|
+ if test "$have_xenctrl_h" = yes ; then
|
||||||
|
+ AC_CHECK_LIB(xenctrl, xc_kexec_status,
|
||||||
|
+ AC_DEFINE(HAVE_KEXEC_CMD_STATUS, 1,
|
||||||
|
+ [The kexec_status call is available]),
|
||||||
|
+ AC_MSG_NOTICE([The kexec_status call is not available]))
|
||||||
|
+ fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl ---Sanity checks
|
||||||
|
diff --git a/kexec/kexec-xen.c b/kexec/kexec-xen.c
|
||||||
|
index 24a41919ce6a..2b448d39ba2a 100644
|
||||||
|
--- a/kexec/kexec-xen.c
|
||||||
|
+++ b/kexec/kexec-xen.c
|
||||||
|
@@ -105,6 +105,27 @@ int xen_kexec_unload(uint64_t kexec_flags)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
+int xen_kexec_status(uint64_t kexec_flags)
|
||||||
|
+{
|
||||||
|
+ xc_interface *xch;
|
||||||
|
+ uint8_t type;
|
||||||
|
+ int ret = -1;
|
||||||
|
+
|
||||||
|
+#ifdef HAVE_KEXEC_CMD_STATUS
|
||||||
|
+ xch = xc_interface_open(NULL, NULL, 0);
|
||||||
|
+ if (!xch)
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ type = (kexec_flags & KEXEC_ON_CRASH) ? KEXEC_TYPE_CRASH : KEXEC_TYPE_DEFAULT;
|
||||||
|
+
|
||||||
|
+ ret = xc_kexec_status(xch, type);
|
||||||
|
+
|
||||||
|
+ xc_interface_close(xch);
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void xen_kexec_exec(void)
|
||||||
|
{
|
||||||
|
xc_interface *xch;
|
||||||
|
@@ -130,6 +151,11 @@ int xen_kexec_unload(uint64_t kexec_flags)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+int xen_kexec_status(uint64_t kexec_flags)
|
||||||
|
+{
|
||||||
|
+ return -1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void xen_kexec_exec(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
diff --git a/kexec/kexec.8 b/kexec/kexec.8
|
||||||
|
index 4d0c1d1612e8..f4b39a656831 100644
|
||||||
|
--- a/kexec/kexec.8
|
||||||
|
+++ b/kexec/kexec.8
|
||||||
|
@@ -107,6 +107,12 @@ command:
|
||||||
|
.B \-d\ (\-\-debug)
|
||||||
|
Enable debugging messages.
|
||||||
|
.TP
|
||||||
|
+.B \-S\ (\-\-status)
|
||||||
|
+Return 0 if the type (by default crash) is loaded. Can be used in conjuction
|
||||||
|
+with -l or -p to toggle the type. Note this option supersedes other options
|
||||||
|
+and it will
|
||||||
|
+.BR not\ load\ or\ unload\ the\ kernel.
|
||||||
|
+.TP
|
||||||
|
.B \-e\ (\-\-exec)
|
||||||
|
Run the currently loaded kernel. Note that it will reboot into the loaded kernel without calling shutdown(8).
|
||||||
|
.TP
|
||||||
|
diff --git a/kexec/kexec.c b/kexec/kexec.c
|
||||||
|
index 500e5a9e422b..ec16247a427f 100644
|
||||||
|
--- a/kexec/kexec.c
|
||||||
|
+++ b/kexec/kexec.c
|
||||||
|
@@ -51,6 +51,9 @@
|
||||||
|
#include "kexec-lzma.h"
|
||||||
|
#include <arch/options.h>
|
||||||
|
|
||||||
|
+#define KEXEC_LOADED_PATH "/sys/kernel/kexec_loaded"
|
||||||
|
+#define KEXEC_CRASH_LOADED_PATH "/sys/kernel/kexec_crash_loaded"
|
||||||
|
+
|
||||||
|
unsigned long long mem_min = 0;
|
||||||
|
unsigned long long mem_max = ULONG_MAX;
|
||||||
|
static unsigned long kexec_flags = 0;
|
||||||
|
@@ -890,8 +893,6 @@ static int my_exec(void)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int kexec_loaded(void);
|
||||||
|
-
|
||||||
|
static int load_jump_back_helper_image(unsigned long kexec_flags, void *entry)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
@@ -902,6 +903,40 @@ static int load_jump_back_helper_image(unsigned long kexec_flags, void *entry)
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int kexec_loaded(const char *file)
|
||||||
|
+{
|
||||||
|
+ long ret = -1;
|
||||||
|
+ FILE *fp;
|
||||||
|
+ char *p;
|
||||||
|
+ char line[3];
|
||||||
|
+
|
||||||
|
+ /* No way to tell if an image is loaded under Xen, assume it is. */
|
||||||
|
+ if (xen_present())
|
||||||
|
+ return 1;
|
||||||
|
+
|
||||||
|
+ fp = fopen(file, "r");
|
||||||
|
+ if (fp == NULL)
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ p = fgets(line, sizeof(line), fp);
|
||||||
|
+ fclose(fp);
|
||||||
|
+
|
||||||
|
+ if (p == NULL)
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ ret = strtol(line, &p, 10);
|
||||||
|
+
|
||||||
|
+ /* Too long */
|
||||||
|
+ if (ret > INT_MAX)
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ /* No digits were found */
|
||||||
|
+ if (p == line)
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ return (int)ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* Jump back to the original kernel
|
||||||
|
*/
|
||||||
|
@@ -909,7 +944,7 @@ static int my_load_jump_back_helper(unsigned long kexec_flags, void *entry)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
|
||||||
|
- if (kexec_loaded()) {
|
||||||
|
+ if (kexec_loaded(KEXEC_LOADED_PATH)) {
|
||||||
|
fprintf(stderr, "There is kexec kernel loaded, make sure "
|
||||||
|
"you are in kexeced kernel.\n");
|
||||||
|
return -1;
|
||||||
|
@@ -970,6 +1005,7 @@ void usage(void)
|
||||||
|
" to original kernel.\n"
|
||||||
|
" -s, --kexec-file-syscall Use file based syscall for kexec operation\n"
|
||||||
|
" -d, --debug Enable debugging to help spot a failure.\n"
|
||||||
|
+ " -S, --status Return 0 if the type (by default crash) is loaded.\n"
|
||||||
|
"\n"
|
||||||
|
"Supported kernel file types and options: \n");
|
||||||
|
for (i = 0; i < file_types; i++) {
|
||||||
|
@@ -981,40 +1017,30 @@ void usage(void)
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int kexec_loaded(void)
|
||||||
|
+static int k_status(unsigned long kexec_flags)
|
||||||
|
{
|
||||||
|
- long ret = -1;
|
||||||
|
- FILE *fp;
|
||||||
|
- char *p;
|
||||||
|
- char line[3];
|
||||||
|
-
|
||||||
|
- /* No way to tell if an image is loaded under Xen, assume it is. */
|
||||||
|
- if (xen_present())
|
||||||
|
- return 1;
|
||||||
|
-
|
||||||
|
- fp = fopen("/sys/kernel/kexec_loaded", "r");
|
||||||
|
- if (fp == NULL)
|
||||||
|
- return -1;
|
||||||
|
-
|
||||||
|
- p = fgets(line, sizeof(line), fp);
|
||||||
|
- fclose(fp);
|
||||||
|
-
|
||||||
|
- if (p == NULL)
|
||||||
|
- return -1;
|
||||||
|
-
|
||||||
|
- ret = strtol(line, &p, 10);
|
||||||
|
-
|
||||||
|
- /* Too long */
|
||||||
|
- if (ret > INT_MAX)
|
||||||
|
- return -1;
|
||||||
|
+ int result;
|
||||||
|
+ long native_arch;
|
||||||
|
|
||||||
|
- /* No digits were found */
|
||||||
|
- if (p == line)
|
||||||
|
+ /* set the arch */
|
||||||
|
+ native_arch = physical_arch();
|
||||||
|
+ if (native_arch < 0) {
|
||||||
|
return -1;
|
||||||
|
+ }
|
||||||
|
+ kexec_flags |= native_arch;
|
||||||
|
|
||||||
|
- return (int)ret;
|
||||||
|
+ if (xen_present())
|
||||||
|
+ result = xen_kexec_status(kexec_flags);
|
||||||
|
+ else {
|
||||||
|
+ if (kexec_flags & KEXEC_ON_CRASH)
|
||||||
|
+ result = kexec_loaded(KEXEC_CRASH_LOADED_PATH);
|
||||||
|
+ else
|
||||||
|
+ result = kexec_loaded(KEXEC_LOADED_PATH);
|
||||||
|
+ }
|
||||||
|
+ return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* Remove parameter from a kernel command line. Helper function by get_command_line().
|
||||||
|
*/
|
||||||
|
@@ -1204,6 +1230,7 @@ int main(int argc, char *argv[])
|
||||||
|
int do_unload = 0;
|
||||||
|
int do_reuse_initrd = 0;
|
||||||
|
int do_kexec_file_syscall = 0;
|
||||||
|
+ int do_status = 0;
|
||||||
|
void *entry = 0;
|
||||||
|
char *type = 0;
|
||||||
|
char *endptr;
|
||||||
|
@@ -1345,6 +1372,9 @@ int main(int argc, char *argv[])
|
||||||
|
case OPT_KEXEC_FILE_SYSCALL:
|
||||||
|
/* We already parsed it. Nothing to do. */
|
||||||
|
break;
|
||||||
|
+ case OPT_STATUS:
|
||||||
|
+ do_status = 1;
|
||||||
|
+ break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
@@ -1355,6 +1385,20 @@ int main(int argc, char *argv[])
|
||||||
|
if (skip_sync)
|
||||||
|
do_sync = 0;
|
||||||
|
|
||||||
|
+ if (do_status) {
|
||||||
|
+ if (kexec_flags == 0)
|
||||||
|
+ kexec_flags = KEXEC_ON_CRASH;
|
||||||
|
+ do_load = 0;
|
||||||
|
+ do_reuse_initrd = 0;
|
||||||
|
+ do_unload = 0;
|
||||||
|
+ do_load = 0;
|
||||||
|
+ do_shutdown = 0;
|
||||||
|
+ do_sync = 0;
|
||||||
|
+ do_ifdown = 0;
|
||||||
|
+ do_exec = 0;
|
||||||
|
+ do_load_jump_back_helper = 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (do_load && (kexec_flags & KEXEC_ON_CRASH) &&
|
||||||
|
!is_crashkernel_mem_reserved()) {
|
||||||
|
die("Memory for crashkernel is not reserved\n"
|
||||||
|
@@ -1392,7 +1436,9 @@ int main(int argc, char *argv[])
|
||||||
|
check_reuse_initrd();
|
||||||
|
arch_reuse_initrd();
|
||||||
|
}
|
||||||
|
-
|
||||||
|
+ if (do_status) {
|
||||||
|
+ result = k_status(kexec_flags);
|
||||||
|
+ }
|
||||||
|
if (do_unload) {
|
||||||
|
if (do_kexec_file_syscall)
|
||||||
|
result = kexec_file_unload(kexec_file_flags);
|
||||||
|
@@ -1408,7 +1454,7 @@ int main(int argc, char *argv[])
|
||||||
|
kexec_flags, entry);
|
||||||
|
}
|
||||||
|
/* Don't shutdown unless there is something to reboot to! */
|
||||||
|
- if ((result == 0) && (do_shutdown || do_exec) && !kexec_loaded()) {
|
||||||
|
+ if ((result == 0) && (do_shutdown || do_exec) && !kexec_loaded(KEXEC_LOADED_PATH)) {
|
||||||
|
die("Nothing has been loaded!\n");
|
||||||
|
}
|
||||||
|
if ((result == 0) && do_shutdown) {
|
||||||
|
diff --git a/kexec/kexec.h b/kexec/kexec.h
|
||||||
|
index 9194f1c87c91..2b06f590b5ab 100644
|
||||||
|
--- a/kexec/kexec.h
|
||||||
|
+++ b/kexec/kexec.h
|
||||||
|
@@ -219,6 +219,7 @@ extern int file_types;
|
||||||
|
#define OPT_TYPE 't'
|
||||||
|
#define OPT_PANIC 'p'
|
||||||
|
#define OPT_KEXEC_FILE_SYSCALL 's'
|
||||||
|
+#define OPT_STATUS 'S'
|
||||||
|
#define OPT_MEM_MIN 256
|
||||||
|
#define OPT_MEM_MAX 257
|
||||||
|
#define OPT_REUSE_INITRD 258
|
||||||
|
@@ -245,8 +246,9 @@ extern int file_types;
|
||||||
|
{ "reuseinitrd", 0, 0, OPT_REUSE_INITRD }, \
|
||||||
|
{ "kexec-file-syscall", 0, 0, OPT_KEXEC_FILE_SYSCALL }, \
|
||||||
|
{ "debug", 0, 0, OPT_DEBUG }, \
|
||||||
|
+ { "status", 0, 0, OPT_STATUS }, \
|
||||||
|
|
||||||
|
-#define KEXEC_OPT_STR "h?vdfxyluet:ps"
|
||||||
|
+#define KEXEC_OPT_STR "h?vdfxyluet:psS"
|
||||||
|
|
||||||
|
extern void dbgprint_mem_range(const char *prefix, struct memory_range *mr, int nr_mr);
|
||||||
|
extern void die(const char *fmt, ...)
|
||||||
|
@@ -311,5 +313,6 @@ int xen_present(void);
|
||||||
|
int xen_kexec_load(struct kexec_info *info);
|
||||||
|
int xen_kexec_unload(uint64_t kexec_flags);
|
||||||
|
void xen_kexec_exec(void);
|
||||||
|
+int xen_kexec_status(uint64_t kexec_flags);
|
||||||
|
|
||||||
|
#endif /* KEXEC_H */
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
28
0006-kexec-Remove-redundant-space-from-help-message.patch
Normal file
28
0006-kexec-Remove-redundant-space-from-help-message.patch
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
From ceedb33e6cd34d26008ded67d5f0726719f73a39 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Date: Mon, 30 Jan 2017 12:14:25 -0600
|
||||||
|
Subject: [PATCH 06/45] kexec: Remove redundant space from help message
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/kexec.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/kexec.c b/kexec/kexec.c
|
||||||
|
index ec16247a427f..a2ba79d59006 100644
|
||||||
|
--- a/kexec/kexec.c
|
||||||
|
+++ b/kexec/kexec.c
|
||||||
|
@@ -1004,7 +1004,7 @@ void usage(void)
|
||||||
|
" preserve context)\n"
|
||||||
|
" to original kernel.\n"
|
||||||
|
" -s, --kexec-file-syscall Use file based syscall for kexec operation\n"
|
||||||
|
- " -d, --debug Enable debugging to help spot a failure.\n"
|
||||||
|
+ " -d, --debug Enable debugging to help spot a failure.\n"
|
||||||
|
" -S, --status Return 0 if the type (by default crash) is loaded.\n"
|
||||||
|
"\n"
|
||||||
|
"Supported kernel file types and options: \n");
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
From e49623b0787d23f8f4f15d3ee3a1c81eb1f0da77 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Date: Mon, 30 Jan 2017 12:14:24 -0600
|
||||||
|
Subject: [PATCH 07/45] purgatory: Add purgatory.map and purgatory.ro.sym to
|
||||||
|
clean recipe
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
purgatory/Makefile | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/purgatory/Makefile b/purgatory/Makefile
|
||||||
|
index 328904e24415..49ce80a638b2 100644
|
||||||
|
--- a/purgatory/Makefile
|
||||||
|
+++ b/purgatory/Makefile
|
||||||
|
@@ -34,7 +34,7 @@ PURGATORY_SRCS+=$($(ARCH)_PURGATORY_SRCS)
|
||||||
|
PURGATORY_OBJS = $(call objify, $(PURGATORY_SRCS)) purgatory/sha256.o
|
||||||
|
PURGATORY_DEPS = $(call depify, $(PURGATORY_OBJS))
|
||||||
|
|
||||||
|
-clean += $(PURGATORY_OBJS) $(PURGATORY_DEPS) $(PURGATORY)
|
||||||
|
+clean += $(PURGATORY_OBJS) $(PURGATORY_DEPS) $(PURGATORY) $(PURGATORY_MAP) $(PURGATORY).sym
|
||||||
|
|
||||||
|
-include $(PURGATORY_DEPS)
|
||||||
|
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
110
0008-kexec-Add-option-to-get-crash-kernel-region-size.patch
Normal file
110
0008-kexec-Add-option-to-get-crash-kernel-region-size.patch
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
From 76b31203222a9833f424e98a134603c2f840c82b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Date: Fri, 17 Feb 2017 16:47:25 -0600
|
||||||
|
Subject: [PATCH 08/45] kexec: Add option to get crash kernel region size
|
||||||
|
|
||||||
|
Crash kernel region size is available via sysfs on Linux running on
|
||||||
|
bare metal. However, this does not work when Linux runs as Xen dom0.
|
||||||
|
In this case Xen crash kernel region size should be established using
|
||||||
|
__HYPERVISOR_kexec_op hypercall (Linux kernel kexec functionality does
|
||||||
|
not make a lot of sense in Xen dom0). Sadly hypercalls are not easily
|
||||||
|
accessible using shell scripts or something like that. Potentially we
|
||||||
|
can check "xl dmesg" output for crashkernel option but this is not nice.
|
||||||
|
So, let's add this functionality, for Linux running on bare metal and
|
||||||
|
as Xen dom0, to kexec-tools. This way kdump scripts may establish crash
|
||||||
|
kernel region size in one way regardless of platform. All burden of
|
||||||
|
platform detection lies on kexec-tools.
|
||||||
|
|
||||||
|
Figure (and unit) displayed by this new kexec-tools functionality is
|
||||||
|
the same as one taken from /sys/kernel/kexec_crash_size.
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/kexec.8 | 3 +++
|
||||||
|
kexec/kexec.c | 16 ++++++++++++++++
|
||||||
|
kexec/kexec.h | 4 +++-
|
||||||
|
3 files changed, 22 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/kexec.8 b/kexec/kexec.8
|
||||||
|
index f4b39a656831..e0131b4ea827 100644
|
||||||
|
--- a/kexec/kexec.8
|
||||||
|
+++ b/kexec/kexec.8
|
||||||
|
@@ -179,6 +179,9 @@ Load a helper image to jump back to original kernel.
|
||||||
|
.TP
|
||||||
|
.BI \-\-reuseinitrd
|
||||||
|
Reuse initrd from first boot.
|
||||||
|
+.TP
|
||||||
|
+.BI \-\-print-ckr-size
|
||||||
|
+Print crash kernel region size, if available.
|
||||||
|
|
||||||
|
|
||||||
|
.SH SUPPORTED KERNEL FILE TYPES AND OPTIONS
|
||||||
|
diff --git a/kexec/kexec.c b/kexec/kexec.c
|
||||||
|
index a2ba79d59006..cfd837c1b6bb 100644
|
||||||
|
--- a/kexec/kexec.c
|
||||||
|
+++ b/kexec/kexec.c
|
||||||
|
@@ -995,6 +995,7 @@ void usage(void)
|
||||||
|
" --mem-max=<addr> Specify the highest memory address to\n"
|
||||||
|
" load code into.\n"
|
||||||
|
" --reuseinitrd Reuse initrd from first boot.\n"
|
||||||
|
+ " --print-ckr-size Print crash kernel region size.\n"
|
||||||
|
" --load-preserve-context Load the new kernel and preserve\n"
|
||||||
|
" context of current kernel during kexec.\n"
|
||||||
|
" --load-jump-back-helper Load a helper image to jump back\n"
|
||||||
|
@@ -1218,6 +1219,18 @@ static int do_kexec_file_load(int fileind, int argc, char **argv,
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void print_crashkernel_region_size(void)
|
||||||
|
+{
|
||||||
|
+ uint64_t start = 0, end = 0;
|
||||||
|
+
|
||||||
|
+ if (is_crashkernel_mem_reserved() &&
|
||||||
|
+ get_crash_kernel_load_range(&start, &end)) {
|
||||||
|
+ fprintf(stderr, "get_crash_kernel_load_range() failed.\n");
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ printf("%lu\n", (start != end) ? (end - start + 1) : 0UL);
|
||||||
|
+}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
@@ -1375,6 +1388,9 @@ int main(int argc, char *argv[])
|
||||||
|
case OPT_STATUS:
|
||||||
|
do_status = 1;
|
||||||
|
break;
|
||||||
|
+ case OPT_PRINT_CKR_SIZE:
|
||||||
|
+ print_crashkernel_region_size();
|
||||||
|
+ return 0;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
diff --git a/kexec/kexec.h b/kexec/kexec.h
|
||||||
|
index 2b06f590b5ab..52bef9b3c0f5 100644
|
||||||
|
--- a/kexec/kexec.h
|
||||||
|
+++ b/kexec/kexec.h
|
||||||
|
@@ -226,7 +226,8 @@ extern int file_types;
|
||||||
|
#define OPT_LOAD_PRESERVE_CONTEXT 259
|
||||||
|
#define OPT_LOAD_JUMP_BACK_HELPER 260
|
||||||
|
#define OPT_ENTRY 261
|
||||||
|
-#define OPT_MAX 262
|
||||||
|
+#define OPT_PRINT_CKR_SIZE 262
|
||||||
|
+#define OPT_MAX 263
|
||||||
|
#define KEXEC_OPTIONS \
|
||||||
|
{ "help", 0, 0, OPT_HELP }, \
|
||||||
|
{ "version", 0, 0, OPT_VERSION }, \
|
||||||
|
@@ -247,6 +248,7 @@ extern int file_types;
|
||||||
|
{ "kexec-file-syscall", 0, 0, OPT_KEXEC_FILE_SYSCALL }, \
|
||||||
|
{ "debug", 0, 0, OPT_DEBUG }, \
|
||||||
|
{ "status", 0, 0, OPT_STATUS }, \
|
||||||
|
+ { "print-ckr-size", 0, 0, OPT_PRINT_CKR_SIZE }, \
|
||||||
|
|
||||||
|
#define KEXEC_OPT_STR "h?vdfxyluet:psS"
|
||||||
|
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
@ -0,0 +1,33 @@
|
|||||||
|
From cfcf60c38182fb97df3817ee6192190e66eb62ec Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Date: Fri, 17 Feb 2017 16:47:15 -0600
|
||||||
|
Subject: [PATCH 09/45] crashdump/arm: Add get_crash_kernel_load_range()
|
||||||
|
function
|
||||||
|
|
||||||
|
Implement get_crash_kernel_load_range() in support of
|
||||||
|
print crash kernel region size option.
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/arm/crashdump-arm.c | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c
|
||||||
|
index 4a89b5ea9645..ac76e0a812d5 100644
|
||||||
|
--- a/kexec/arch/arm/crashdump-arm.c
|
||||||
|
+++ b/kexec/arch/arm/crashdump-arm.c
|
||||||
|
@@ -413,3 +413,8 @@ int is_crashkernel_mem_reserved(void)
|
||||||
|
|
||||||
|
return crash_kernel_mem.start != crash_kernel_mem.end;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+int get_crash_kernel_load_range(uint64_t *start, uint64_t *end)
|
||||||
|
+{
|
||||||
|
+ return parse_iomem_single("Crash kernel\n", start, end);
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
@ -0,0 +1,33 @@
|
|||||||
|
From d43610084164aec742f9ec9bd87d87575397d666 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Date: Fri, 17 Feb 2017 16:47:16 -0600
|
||||||
|
Subject: [PATCH 10/45] crashdump/arm64: Add get_crash_kernel_load_range()
|
||||||
|
function
|
||||||
|
|
||||||
|
Provide stub get_crash_kernel_load_range() in support of
|
||||||
|
print crash kernel region size option.
|
||||||
|
|
||||||
|
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/arm64/crashdump-arm64.c | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c
|
||||||
|
index d2272c8124d0..b0e4713f12c6 100644
|
||||||
|
--- a/kexec/arch/arm64/crashdump-arm64.c
|
||||||
|
+++ b/kexec/arch/arm64/crashdump-arm64.c
|
||||||
|
@@ -19,3 +19,9 @@ int is_crashkernel_mem_reserved(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+int get_crash_kernel_load_range(uint64_t *start, uint64_t *end)
|
||||||
|
+{
|
||||||
|
+ /* Crash kernel region size is not exposed by the system */
|
||||||
|
+ return -1;
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
@ -0,0 +1,37 @@
|
|||||||
|
From b6af22826f6055757446cae394a475d179fb0b8b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Date: Fri, 17 Feb 2017 16:47:17 -0600
|
||||||
|
Subject: [PATCH 11/45] crashdump/cris: Add get_crash_kernel_load_range()
|
||||||
|
function
|
||||||
|
|
||||||
|
Provide stub get_crash_kernel_load_range() in support of
|
||||||
|
print crash kernel region size option.
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/cris/kexec-cris.c | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/cris/kexec-cris.c b/kexec/arch/cris/kexec-cris.c
|
||||||
|
index 4ac2f8942996..3b69709d68cc 100644
|
||||||
|
--- a/kexec/arch/cris/kexec-cris.c
|
||||||
|
+++ b/kexec/arch/cris/kexec-cris.c
|
||||||
|
@@ -77,6 +77,12 @@ int is_crashkernel_mem_reserved(void)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+int get_crash_kernel_load_range(uint64_t *start, uint64_t *end)
|
||||||
|
+{
|
||||||
|
+ /* Crash kernel region size is not exposed by the system */
|
||||||
|
+ return -1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
unsigned long virt_to_phys(unsigned long addr)
|
||||||
|
{
|
||||||
|
return (addr) & 0x7fffffff;
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
@ -0,0 +1,33 @@
|
|||||||
|
From 5c80bd9be2959adba8520222ce3456b1bc25cb79 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Date: Fri, 17 Feb 2017 16:47:18 -0600
|
||||||
|
Subject: [PATCH 12/45] crashdump/ia64: Add get_crash_kernel_load_range()
|
||||||
|
function
|
||||||
|
|
||||||
|
Implement get_crash_kernel_load_range() in support of
|
||||||
|
print crash kernel region size option.
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/ia64/crashdump-ia64.c | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/ia64/crashdump-ia64.c b/kexec/arch/ia64/crashdump-ia64.c
|
||||||
|
index 726c9f4281ba..755ee5e98566 100644
|
||||||
|
--- a/kexec/arch/ia64/crashdump-ia64.c
|
||||||
|
+++ b/kexec/arch/ia64/crashdump-ia64.c
|
||||||
|
@@ -286,3 +286,8 @@ int is_crashkernel_mem_reserved(void)
|
||||||
|
return parse_iomem_single("Crash kernel\n", &start,
|
||||||
|
&end) == 0 ? (start != end) : 0;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+int get_crash_kernel_load_range(uint64_t *start, uint64_t *end)
|
||||||
|
+{
|
||||||
|
+ return parse_iomem_single("Crash kernel\n", start, end);
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
@ -0,0 +1,37 @@
|
|||||||
|
From 14d71e51e5c95f18b1a3ea2cb143d85f7fe23e43 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Date: Fri, 17 Feb 2017 16:47:19 -0600
|
||||||
|
Subject: [PATCH 13/45] crashdump/m68k: Add get_crash_kernel_load_range()
|
||||||
|
function
|
||||||
|
|
||||||
|
Provide stub get_crash_kernel_load_range() in support of
|
||||||
|
print crash kernel region size option.
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/m68k/kexec-m68k.c | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/m68k/kexec-m68k.c b/kexec/arch/m68k/kexec-m68k.c
|
||||||
|
index 372aa378f9a1..cb5492785886 100644
|
||||||
|
--- a/kexec/arch/m68k/kexec-m68k.c
|
||||||
|
+++ b/kexec/arch/m68k/kexec-m68k.c
|
||||||
|
@@ -89,6 +89,12 @@ int is_crashkernel_mem_reserved(void)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+int get_crash_kernel_load_range(uint64_t *start, uint64_t *end)
|
||||||
|
+{
|
||||||
|
+ /* Crash kernel region size is not exposed by the system */
|
||||||
|
+ return -1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
unsigned long virt_to_phys(unsigned long addr)
|
||||||
|
{
|
||||||
|
return addr + m68k_memoffset;
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
@ -0,0 +1,32 @@
|
|||||||
|
From d2caf4c4c43b300c3746d85791a650cdcf0ae733 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Date: Fri, 17 Feb 2017 16:47:20 -0600
|
||||||
|
Subject: [PATCH 14/45] crashdump/mips: Add get_crash_kernel_load_range()
|
||||||
|
function
|
||||||
|
|
||||||
|
Implement get_crash_kernel_load_range() in support of
|
||||||
|
print crash kernel region size option.
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/mips/crashdump-mips.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/mips/crashdump-mips.c b/kexec/arch/mips/crashdump-mips.c
|
||||||
|
index d6cff5ad8993..9c33599a34ed 100644
|
||||||
|
--- a/kexec/arch/mips/crashdump-mips.c
|
||||||
|
+++ b/kexec/arch/mips/crashdump-mips.c
|
||||||
|
@@ -385,3 +385,7 @@ int is_crashkernel_mem_reserved(void)
|
||||||
|
(start != end) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+int get_crash_kernel_load_range(uint64_t *start, uint64_t *end)
|
||||||
|
+{
|
||||||
|
+ return parse_iomem_single("Crash kernel\n", start, end);
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
113
0015-crashdump-ppc-Add-get_crash_kernel_load_range-functi.patch
Normal file
113
0015-crashdump-ppc-Add-get_crash_kernel_load_range-functi.patch
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
From 7fc80cfcd913897ea92889349d51c1dd33d2c4ed Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Date: Fri, 17 Feb 2017 16:47:21 -0600
|
||||||
|
Subject: [PATCH 15/45] crashdump/ppc: Add get_crash_kernel_load_range()
|
||||||
|
function
|
||||||
|
|
||||||
|
Implement get_crash_kernel_load_range() in support of
|
||||||
|
print crash kernel region size option.
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/ppc/crashdump-powerpc.c | 22 +++++++++++++++++++++-
|
||||||
|
kexec/arch/ppc/kexec-ppc.c | 24 ++++++++++++++++++++++++
|
||||||
|
kexec/arch/ppc/kexec-ppc.h | 1 +
|
||||||
|
3 files changed, 46 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/ppc/crashdump-powerpc.c b/kexec/arch/ppc/crashdump-powerpc.c
|
||||||
|
index 3dc35ebe8866..dde6de7ec7a1 100644
|
||||||
|
--- a/kexec/arch/ppc/crashdump-powerpc.c
|
||||||
|
+++ b/kexec/arch/ppc/crashdump-powerpc.c
|
||||||
|
@@ -16,6 +16,9 @@
|
||||||
|
#include "kexec-ppc.h"
|
||||||
|
#include "crashdump-powerpc.h"
|
||||||
|
|
||||||
|
+#define DEVTREE_CRASHKERNEL_BASE "/proc/device-tree/chosen/linux,crashkernel-base"
|
||||||
|
+#define DEVTREE_CRASHKERNEL_SIZE "/proc/device-tree/chosen/linux,crashkernel-size"
|
||||||
|
+
|
||||||
|
#ifdef CONFIG_PPC64
|
||||||
|
static struct crash_elf_info elf_info64 = {
|
||||||
|
class: ELFCLASS64,
|
||||||
|
@@ -397,11 +400,28 @@ void add_usable_mem_rgns(unsigned long long base, unsigned long long size)
|
||||||
|
usablemem_rgns.size, base, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
+int get_crash_kernel_load_range(uint64_t *start, uint64_t *end)
|
||||||
|
+{
|
||||||
|
+ unsigned long long value;
|
||||||
|
+
|
||||||
|
+ if (!get_devtree_value(DEVTREE_CRASHKERNEL_BASE, &value))
|
||||||
|
+ *start = value;
|
||||||
|
+ else
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ if (!get_devtree_value(DEVTREE_CRASHKERNEL_SIZE, &value))
|
||||||
|
+ *end = *start + value - 1;
|
||||||
|
+ else
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int is_crashkernel_mem_reserved(void)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
- fd = open("/proc/device-tree/chosen/linux,crashkernel-base", O_RDONLY);
|
||||||
|
+ fd = open(DEVTREE_CRASHKERNEL_BASE, O_RDONLY);
|
||||||
|
if (fd < 0)
|
||||||
|
return 0;
|
||||||
|
close(fd);
|
||||||
|
diff --git a/kexec/arch/ppc/kexec-ppc.c b/kexec/arch/ppc/kexec-ppc.c
|
||||||
|
index d04611092a1b..03bec36302f7 100644
|
||||||
|
--- a/kexec/arch/ppc/kexec-ppc.c
|
||||||
|
+++ b/kexec/arch/ppc/kexec-ppc.c
|
||||||
|
@@ -423,6 +423,30 @@ err_out:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* Return 0 if fname/value valid, -1 otherwise */
|
||||||
|
+int get_devtree_value(const char *fname, unsigned long long *value)
|
||||||
|
+{
|
||||||
|
+ FILE *file;
|
||||||
|
+ char buf[MAXBYTES];
|
||||||
|
+ int n = -1;
|
||||||
|
+
|
||||||
|
+ if ((file = fopen(fname, "r"))) {
|
||||||
|
+ n = fread(buf, 1, MAXBYTES, file);
|
||||||
|
+ fclose(file);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (n == sizeof(uint32_t))
|
||||||
|
+ *value = ((uint32_t *)buf)[0];
|
||||||
|
+ else if (n == sizeof(uint64_t))
|
||||||
|
+ *value = ((uint64_t *)buf)[0];
|
||||||
|
+ else {
|
||||||
|
+ fprintf(stderr, "%s node has invalid size: %d\n", fname, n);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* Get devtree details and create exclude_range array
|
||||||
|
* Also create usablemem_ranges for KEXEC_ON_CRASH
|
||||||
|
*/
|
||||||
|
diff --git a/kexec/arch/ppc/kexec-ppc.h b/kexec/arch/ppc/kexec-ppc.h
|
||||||
|
index 904cf48ffe98..f8fd67827e43 100644
|
||||||
|
--- a/kexec/arch/ppc/kexec-ppc.h
|
||||||
|
+++ b/kexec/arch/ppc/kexec-ppc.h
|
||||||
|
@@ -75,6 +75,7 @@ extern unsigned long dt_address_cells, dt_size_cells;
|
||||||
|
extern int init_memory_region_info(void);
|
||||||
|
extern int read_memory_region_limits(int fd, unsigned long long *start,
|
||||||
|
unsigned long long *end);
|
||||||
|
+extern int get_devtree_value(const char *fname, unsigned long long *pvalue);
|
||||||
|
#define COMMAND_LINE_SIZE 512 /* from kernel */
|
||||||
|
/*fs2dt*/
|
||||||
|
void reserve(unsigned long long where, unsigned long long length);
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
114
0016-crashdump-ppc64-Add-get_crash_kernel_load_range-func.patch
Normal file
114
0016-crashdump-ppc64-Add-get_crash_kernel_load_range-func.patch
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
From e4280e22c8c45cab1f86860f1fc0beddda77a3a9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Date: Fri, 17 Feb 2017 16:47:22 -0600
|
||||||
|
Subject: [PATCH 16/45] crashdump/ppc64: Add get_crash_kernel_load_range()
|
||||||
|
function
|
||||||
|
|
||||||
|
Implement get_crash_kernel_load_range() in support of
|
||||||
|
print crash kernel region size option.
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/ppc64/crashdump-ppc64.c | 22 +++++++++++++++++++++-
|
||||||
|
kexec/arch/ppc64/kexec-ppc64.c | 24 ++++++++++++++++++++++++
|
||||||
|
kexec/arch/ppc64/kexec-ppc64.h | 2 ++
|
||||||
|
3 files changed, 47 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/ppc64/crashdump-ppc64.c b/kexec/arch/ppc64/crashdump-ppc64.c
|
||||||
|
index f62b1599c162..5a71d5161c87 100644
|
||||||
|
--- a/kexec/arch/ppc64/crashdump-ppc64.c
|
||||||
|
+++ b/kexec/arch/ppc64/crashdump-ppc64.c
|
||||||
|
@@ -36,6 +36,9 @@
|
||||||
|
#include "../../fs2dt.h"
|
||||||
|
#include "crashdump-ppc64.h"
|
||||||
|
|
||||||
|
+#define DEVTREE_CRASHKERNEL_BASE "/proc/device-tree/chosen/linux,crashkernel-base"
|
||||||
|
+#define DEVTREE_CRASHKERNEL_SIZE "/proc/device-tree/chosen/linux,crashkernel-size"
|
||||||
|
+
|
||||||
|
static struct crash_elf_info elf_info64 =
|
||||||
|
{
|
||||||
|
class: ELFCLASS64,
|
||||||
|
@@ -526,11 +529,28 @@ void add_usable_mem_rgns(unsigned long long base, unsigned long long size)
|
||||||
|
usablemem_rgns.size, base, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
+int get_crash_kernel_load_range(uint64_t *start, uint64_t *end)
|
||||||
|
+{
|
||||||
|
+ unsigned long long value;
|
||||||
|
+
|
||||||
|
+ if (!get_devtree_value(DEVTREE_CRASHKERNEL_BASE, &value))
|
||||||
|
+ *start = value;
|
||||||
|
+ else
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ if (!get_devtree_value(DEVTREE_CRASHKERNEL_SIZE, &value))
|
||||||
|
+ *end = *start + value - 1;
|
||||||
|
+ else
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int is_crashkernel_mem_reserved(void)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
|
||||||
|
- fd = open("/proc/device-tree/chosen/linux,crashkernel-base", O_RDONLY);
|
||||||
|
+ fd = open(DEVTREE_CRASHKERNEL_BASE, O_RDONLY);
|
||||||
|
if (fd < 0)
|
||||||
|
return 0;
|
||||||
|
close(fd);
|
||||||
|
diff --git a/kexec/arch/ppc64/kexec-ppc64.c b/kexec/arch/ppc64/kexec-ppc64.c
|
||||||
|
index 09ee0256ed05..6e8c175878a4 100644
|
||||||
|
--- a/kexec/arch/ppc64/kexec-ppc64.c
|
||||||
|
+++ b/kexec/arch/ppc64/kexec-ppc64.c
|
||||||
|
@@ -356,6 +356,30 @@ void scan_reserved_ranges(unsigned long kexec_flags, int *range_index)
|
||||||
|
*range_index = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* Return 0 if fname/value valid, -1 otherwise */
|
||||||
|
+int get_devtree_value(const char *fname, unsigned long long *value)
|
||||||
|
+{
|
||||||
|
+ FILE *file;
|
||||||
|
+ char buf[MAXBYTES];
|
||||||
|
+ int n = -1;
|
||||||
|
+
|
||||||
|
+ if ((file = fopen(fname, "r"))) {
|
||||||
|
+ n = fread(buf, 1, MAXBYTES, file);
|
||||||
|
+ fclose(file);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (n == sizeof(uint32_t))
|
||||||
|
+ *value = ((uint32_t *)buf)[0];
|
||||||
|
+ else if (n == sizeof(uint64_t))
|
||||||
|
+ *value = ((uint64_t *)buf)[0];
|
||||||
|
+ else {
|
||||||
|
+ fprintf(stderr, "%s node has invalid size: %d\n", fname, n);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* Get devtree details and create exclude_range array
|
||||||
|
* Also create usablemem_ranges for KEXEC_ON_CRASH
|
||||||
|
*/
|
||||||
|
diff --git a/kexec/arch/ppc64/kexec-ppc64.h b/kexec/arch/ppc64/kexec-ppc64.h
|
||||||
|
index 89ee94279301..633ae776dcdd 100644
|
||||||
|
--- a/kexec/arch/ppc64/kexec-ppc64.h
|
||||||
|
+++ b/kexec/arch/ppc64/kexec-ppc64.h
|
||||||
|
@@ -14,6 +14,8 @@
|
||||||
|
#define HAVE_DYNAMIC_MEMORY
|
||||||
|
#define NEED_RESERVE_DTB
|
||||||
|
|
||||||
|
+extern int get_devtree_value(const char *fname, unsigned long long *pvalue);
|
||||||
|
+
|
||||||
|
int setup_memory_ranges(unsigned long kexec_flags);
|
||||||
|
|
||||||
|
int elf_ppc64_probe(const char *buf, off_t len);
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
@ -0,0 +1,33 @@
|
|||||||
|
From 796f0ffa134d94f48aa58c4f2f0f85a443b7a225 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Date: Fri, 17 Feb 2017 16:47:23 -0600
|
||||||
|
Subject: [PATCH 17/45] crashdump/s390: Add get_crash_kernel_load_range()
|
||||||
|
function
|
||||||
|
|
||||||
|
Implement get_crash_kernel_load_range() in support of
|
||||||
|
print crash kernel region size option.
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/s390/kexec-s390.c | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/s390/kexec-s390.c b/kexec/arch/s390/kexec-s390.c
|
||||||
|
index 074575e5d783..f863483ce808 100644
|
||||||
|
--- a/kexec/arch/s390/kexec-s390.c
|
||||||
|
+++ b/kexec/arch/s390/kexec-s390.c
|
||||||
|
@@ -262,3 +262,8 @@ int is_crashkernel_mem_reserved(void)
|
||||||
|
return parse_iomem_single("Crash kernel\n", &start, &end) == 0 ?
|
||||||
|
(start != end) : 0;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+int get_crash_kernel_load_range(uint64_t *start, uint64_t *end)
|
||||||
|
+{
|
||||||
|
+ return parse_iomem_single("Crash kernel\n", start, end);
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
@ -0,0 +1,33 @@
|
|||||||
|
From 05ae4fb2e354e0f640d77957ee4c7dcb0eddc5f3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Date: Fri, 17 Feb 2017 16:47:24 -0600
|
||||||
|
Subject: [PATCH 18/45] crashdump/sh: Add get_crash_kernel_load_range()
|
||||||
|
function
|
||||||
|
|
||||||
|
Implement get_crash_kernel_load_range() in support of
|
||||||
|
print crash kernel region size option.
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/sh/crashdump-sh.c | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/sh/crashdump-sh.c b/kexec/arch/sh/crashdump-sh.c
|
||||||
|
index 9e6af6bf54bf..aa25dea353c3 100644
|
||||||
|
--- a/kexec/arch/sh/crashdump-sh.c
|
||||||
|
+++ b/kexec/arch/sh/crashdump-sh.c
|
||||||
|
@@ -178,3 +178,8 @@ int is_crashkernel_mem_reserved(void)
|
||||||
|
return parse_iomem_single("Crash kernel\n", &start, &end) == 0 ?
|
||||||
|
(start != end) : 0;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+int get_crash_kernel_load_range(uint64_t *start, uint64_t *end)
|
||||||
|
+{
|
||||||
|
+ return parse_iomem_single("Crash kernel\n", start, end);
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
30
0019-gitignore-add-two-generated-files-in-purgatory.patch
Normal file
30
0019-gitignore-add-two-generated-files-in-purgatory.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
From 7dac152d5b47f5e505994026cbfec30dee1a0941 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Date: Fri, 10 Feb 2017 16:20:05 -0600
|
||||||
|
Subject: [PATCH 19/45] gitignore: add two generated files in purgatory
|
||||||
|
|
||||||
|
This patch adds the two generated files below to .gitignore.
|
||||||
|
|
||||||
|
purgatory/purgatory.map
|
||||||
|
purgatory/purgatory.ro.sym
|
||||||
|
|
||||||
|
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
.gitignore | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/.gitignore b/.gitignore
|
||||||
|
index 81e03abcb0b8..1ab52d952d49 100644
|
||||||
|
--- a/.gitignore
|
||||||
|
+++ b/.gitignore
|
||||||
|
@@ -17,3 +17,5 @@
|
||||||
|
/configure
|
||||||
|
/include/config.h.in
|
||||||
|
/include/config.h
|
||||||
|
+/purgatory/purgatory.map
|
||||||
|
+/purgatory/purgatory.ro.sym
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
@ -0,0 +1,39 @@
|
|||||||
|
From 263e45ccf27b21e9862cc538ed28978533d04e4b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Baoquan He <bhe@redhat.com>
|
||||||
|
Date: Fri, 3 Mar 2017 11:52:15 +0800
|
||||||
|
Subject: [PATCH 20/45] Only print debug message when failed to serach for
|
||||||
|
kernel symbol from /proc/kallsyms
|
||||||
|
|
||||||
|
Kernel symbol page_offset_base could be unavailable when mm KASLR code is
|
||||||
|
not compiled in kernel. It's inappropriate to print out error message
|
||||||
|
when failed to search for page_offset_base from /proc/kallsyms. Seems now
|
||||||
|
there is not a way to find out if mm KASLR is compiled in or not. An
|
||||||
|
alternative approach is only printing out debug message in get_kernel_sym
|
||||||
|
if failed to search a expected kernel symbol.
|
||||||
|
|
||||||
|
Do it in this patch, a simple fix.
|
||||||
|
|
||||||
|
Signed-off-by: Baoquan He <bhe@redhat.com>
|
||||||
|
Reviewed-by: Pratyush Anand <panand@redhat.com>
|
||||||
|
Acked-by: Dave Young <dyoung@redhat.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/i386/crashdump-x86.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
|
||||||
|
index 88aeee33572b..c4cf2013a001 100644
|
||||||
|
--- a/kexec/arch/i386/crashdump-x86.c
|
||||||
|
+++ b/kexec/arch/i386/crashdump-x86.c
|
||||||
|
@@ -127,7 +127,7 @@ static unsigned long long get_kernel_sym(const char *symbol)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- fprintf(stderr, "Cannot get kernel %s symbol address\n", symbol);
|
||||||
|
+ dbgprintf("Cannot get kernel %s symbol address\n", symbol);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
42
0021-build_mem_phdrs-check-if-p_paddr-is-invalid.patch
Normal file
42
0021-build_mem_phdrs-check-if-p_paddr-is-invalid.patch
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
From ed15ba1b9977e506637ff1697821d97127b2c919 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pratyush Anand <panand@redhat.com>
|
||||||
|
Date: Wed, 1 Mar 2017 11:19:42 +0530
|
||||||
|
Subject: [PATCH 21/45] build_mem_phdrs(): check if p_paddr is invalid
|
||||||
|
|
||||||
|
Currently, all the p_paddr of PT_LOAD headers are assigned to 0, which
|
||||||
|
is not correct and could be misleading, since 0 is a valid physical
|
||||||
|
address.
|
||||||
|
|
||||||
|
Upstream kernel commit "464920104bf7 /proc/kcore: update physical
|
||||||
|
address for kcore ram and text" fixed it and now invalid PT_LOAD is
|
||||||
|
assigned as -1.
|
||||||
|
|
||||||
|
kexec/arch/i386/crashdump-x86.c:get_kernel_vaddr_and_size() uses kcore
|
||||||
|
interface and so calls build_mem_phdrs() for kcore PT_LOAD headers.
|
||||||
|
|
||||||
|
This patch fixes build_mem_phdrs() to check if p_paddr is invalid.
|
||||||
|
|
||||||
|
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
||||||
|
Acked-by: Dave Young <dyoung@redhat.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/kexec-elf.c | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/kexec-elf.c b/kexec/kexec-elf.c
|
||||||
|
index 1d6320a2f0e6..be60bbd48486 100644
|
||||||
|
--- a/kexec/kexec-elf.c
|
||||||
|
+++ b/kexec/kexec-elf.c
|
||||||
|
@@ -432,7 +432,8 @@ static int build_mem_phdrs(const char *buf, off_t len, struct mem_ehdr *ehdr,
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- if ((phdr->p_paddr + phdr->p_memsz) < phdr->p_paddr) {
|
||||||
|
+ if (phdr->p_paddr != (unsigned long long)-1 &&
|
||||||
|
+ (phdr->p_paddr + phdr->p_memsz) < phdr->p_paddr) {
|
||||||
|
/* The memory address wraps */
|
||||||
|
if (probe_debug) {
|
||||||
|
fprintf(stderr, "ELF address wrap around\n");
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
41
0022-uImage-fix-realloc-pointer-confusion.patch
Normal file
41
0022-uImage-fix-realloc-pointer-confusion.patch
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
From 0cc1891c4dc84a2cbbd1f126134ce51538f260dc Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Date: Wed, 8 Mar 2017 22:41:08 +0000
|
||||||
|
Subject: [PATCH 22/45] uImage: fix realloc() pointer confusion
|
||||||
|
|
||||||
|
We carefully avoid the realloc() API trap by *not* using the
|
||||||
|
'ptr = realloc(ptr, new_size)' idiom which can lead to leaks on
|
||||||
|
failure. Very commendable, even though all we're going to do is
|
||||||
|
exit() on failure so it wouldn't have mattered.
|
||||||
|
|
||||||
|
What *does* matter is that we then ask zlib to continue
|
||||||
|
decompression... just past the end of the *old* buffer that just
|
||||||
|
got freed. Oops.
|
||||||
|
|
||||||
|
Apparently nobody has *ever* tested this code by booting a uImage
|
||||||
|
with a compressed payload larger than 10MiB.
|
||||||
|
|
||||||
|
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/kexec-uImage.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/kexec-uImage.c b/kexec/kexec-uImage.c
|
||||||
|
index 5e24629880bc..667cd932fd27 100644
|
||||||
|
--- a/kexec/kexec-uImage.c
|
||||||
|
+++ b/kexec/kexec-uImage.c
|
||||||
|
@@ -210,9 +210,9 @@ static int uImage_gz_load(const unsigned char *buf, off_t len,
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ uncomp_buf = new_buf;
|
||||||
|
strm.next_out = uncomp_buf + mem_alloc - inc_buf;
|
||||||
|
strm.avail_out = inc_buf;
|
||||||
|
- uncomp_buf = new_buf;
|
||||||
|
} else {
|
||||||
|
printf("Error during decompression %d\n", ret);
|
||||||
|
return -1;
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
27
0023-uImage-Fix-uImage_load-for-little-endian-machines.patch
Normal file
27
0023-uImage-Fix-uImage_load-for-little-endian-machines.patch
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
From 67234243bb91052b816cdc8b922cd4bab21f22dd Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Date: Wed, 8 Mar 2017 22:41:09 +0000
|
||||||
|
Subject: [PATCH 23/45] uImage: Fix uImage_load() for little-endian machines
|
||||||
|
|
||||||
|
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/kexec-uImage.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/kexec-uImage.c b/kexec/kexec-uImage.c
|
||||||
|
index 667cd932fd27..49f266aa4ecb 100644
|
||||||
|
--- a/kexec/kexec-uImage.c
|
||||||
|
+++ b/kexec/kexec-uImage.c
|
||||||
|
@@ -236,7 +236,7 @@ int uImage_load(const unsigned char *buf, off_t len, struct Image_info *image)
|
||||||
|
{
|
||||||
|
const struct image_header *header = (const struct image_header *)buf;
|
||||||
|
const unsigned char *img_buf = buf + sizeof(struct image_header);
|
||||||
|
- off_t img_len = header->ih_size;
|
||||||
|
+ off_t img_len = be32_to_cpu(header->ih_size);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Prevent loading a modified image.
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
32
0024-uImage-Add-new-IH_ARCH_xxx-definitions.patch
Normal file
32
0024-uImage-Add-new-IH_ARCH_xxx-definitions.patch
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
From b3d533c1f499dba5eb1fba57e08ff0c1059aed3f Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Date: Wed, 8 Mar 2017 22:41:10 +0000
|
||||||
|
Subject: [PATCH 24/45] uImage: Add new IH_ARCH_xxx definitions
|
||||||
|
|
||||||
|
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
include/image.h | 7 +++++++
|
||||||
|
1 file changed, 7 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/include/image.h b/include/image.h
|
||||||
|
index e742aae739fd..8e9d81e24a41 100644
|
||||||
|
--- a/include/image.h
|
||||||
|
+++ b/include/image.h
|
||||||
|
@@ -79,6 +79,13 @@
|
||||||
|
#define IH_ARCH_BLACKFIN 16 /* Blackfin */
|
||||||
|
#define IH_ARCH_AVR32 17 /* AVR32 */
|
||||||
|
#define IH_ARCH_ST200 18 /* STMicroelectronics ST200 */
|
||||||
|
+#define IH_ARCH_SANDBOX 19 /* Sandbox architecture (test only) */
|
||||||
|
+#define IH_ARCH_NDS32 20 /* ANDES Technology - NDS32 */
|
||||||
|
+#define IH_ARCH_OPENRISC 21 /* OpenRISC 1000 */
|
||||||
|
+#define IH_ARCH_ARM64 22 /* ARM64 */
|
||||||
|
+#define IH_ARCH_ARC 23 /* Synopsys DesignWare ARC */
|
||||||
|
+#define IH_ARCH_X86_64 24 /* AMD x86_64, Intel and Via */
|
||||||
|
+#define IH_ARCH_XTENSA 25 /* Xtensa */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Image Types
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
@ -0,0 +1,83 @@
|
|||||||
|
From f25146afc5a90bdaa5b518d05eda40410f6744a2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Date: Wed, 8 Mar 2017 22:41:11 +0000
|
||||||
|
Subject: [PATCH 25/45] uImage: use 'char *' instead of 'unsigned char *' for
|
||||||
|
uImage_load()
|
||||||
|
|
||||||
|
This was only ever used on PPC, where they are equivalent and we
|
||||||
|
never saw the resulting -Wpointer-sign warnings.
|
||||||
|
|
||||||
|
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
include/kexec-uImage.h | 4 ++--
|
||||||
|
kexec/arch/ppc/kexec-uImage-ppc.c | 2 +-
|
||||||
|
kexec/kexec-uImage.c | 6 +++---
|
||||||
|
3 files changed, 6 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/include/kexec-uImage.h b/include/kexec-uImage.h
|
||||||
|
index 4725157bd576..483b578adee1 100644
|
||||||
|
--- a/include/kexec-uImage.h
|
||||||
|
+++ b/include/kexec-uImage.h
|
||||||
|
@@ -2,7 +2,7 @@
|
||||||
|
#define __KEXEC_UIMAGE_H__
|
||||||
|
|
||||||
|
struct Image_info {
|
||||||
|
- const unsigned char *buf;
|
||||||
|
+ const char *buf;
|
||||||
|
off_t len;
|
||||||
|
unsigned int base;
|
||||||
|
unsigned int ep;
|
||||||
|
@@ -11,5 +11,5 @@ struct Image_info {
|
||||||
|
int uImage_probe(const unsigned char *buf, off_t len, unsigned int arch);
|
||||||
|
int uImage_probe_kernel(const unsigned char *buf, off_t len, unsigned int arch);
|
||||||
|
int uImage_probe_ramdisk(const unsigned char *buf, off_t len, unsigned int arch);
|
||||||
|
-int uImage_load(const unsigned char *buf, off_t len, struct Image_info *info);
|
||||||
|
+int uImage_load(const char *buf, off_t len, struct Image_info *info);
|
||||||
|
#endif
|
||||||
|
diff --git a/kexec/arch/ppc/kexec-uImage-ppc.c b/kexec/arch/ppc/kexec-uImage-ppc.c
|
||||||
|
index c89a1a77926d..5eec6e418a58 100644
|
||||||
|
--- a/kexec/arch/ppc/kexec-uImage-ppc.c
|
||||||
|
+++ b/kexec/arch/ppc/kexec-uImage-ppc.c
|
||||||
|
@@ -55,7 +55,7 @@ char *slurp_ramdisk_ppc(const char *filename, off_t *r_size)
|
||||||
|
{
|
||||||
|
struct Image_info img;
|
||||||
|
off_t size;
|
||||||
|
- const unsigned char *buf = slurp_file(filename, &size);
|
||||||
|
+ const char *buf = slurp_file(filename, &size);
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
/* Check if this is a uImage RAMDisk */
|
||||||
|
diff --git a/kexec/kexec-uImage.c b/kexec/kexec-uImage.c
|
||||||
|
index 49f266aa4ecb..2740a26b6d6c 100644
|
||||||
|
--- a/kexec/kexec-uImage.c
|
||||||
|
+++ b/kexec/kexec-uImage.c
|
||||||
|
@@ -136,7 +136,7 @@ int uImage_probe_ramdisk(const unsigned char *buf, off_t len, unsigned int arch)
|
||||||
|
#define COMMENT 0x10 /* bit 4 set: file comment present */
|
||||||
|
#define RESERVED 0xE0 /* bits 5..7: reserved */
|
||||||
|
|
||||||
|
-static int uImage_gz_load(const unsigned char *buf, off_t len,
|
||||||
|
+static int uImage_gz_load(const char *buf, off_t len,
|
||||||
|
struct Image_info *image)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
@@ -225,14 +225,14 @@ static int uImage_gz_load(const unsigned char *buf, off_t len,
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
-static int uImage_gz_load(const unsigned char *UNUSED(buf), off_t UNUSED(len),
|
||||||
|
+static int uImage_gz_load(const char *UNUSED(buf), off_t UNUSED(len),
|
||||||
|
struct Image_info *UNUSED(image))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-int uImage_load(const unsigned char *buf, off_t len, struct Image_info *image)
|
||||||
|
+int uImage_load(const char *buf, off_t len, struct Image_info *image)
|
||||||
|
{
|
||||||
|
const struct image_header *header = (const struct image_header *)buf;
|
||||||
|
const unsigned char *img_buf = buf + sizeof(struct image_header);
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
100
0026-uImage-use-char-instead-of-unsigned-char-for-uImage_.patch
Normal file
100
0026-uImage-use-char-instead-of-unsigned-char-for-uImage_.patch
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
From a0c575793b86ebdcf7260ffc7ebbebb912e7ecf4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Date: Wed, 8 Mar 2017 22:41:12 +0000
|
||||||
|
Subject: [PATCH 26/45] uImage: use 'char *' instead of 'unsigned char *' for
|
||||||
|
uImage_probe()
|
||||||
|
|
||||||
|
... and friends. Again, PPC never cared about the difference, while
|
||||||
|
ARM had to add an explicit cast to work around it, which we can remove
|
||||||
|
now.
|
||||||
|
|
||||||
|
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
include/kexec-uImage.h | 6 +++---
|
||||||
|
kexec/arch/arm/kexec-uImage-arm.c | 3 +--
|
||||||
|
kexec/kexec-uImage.c | 10 +++++-----
|
||||||
|
3 files changed, 9 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/include/kexec-uImage.h b/include/kexec-uImage.h
|
||||||
|
index 483b578adee1..983d63f7f420 100644
|
||||||
|
--- a/include/kexec-uImage.h
|
||||||
|
+++ b/include/kexec-uImage.h
|
||||||
|
@@ -8,8 +8,8 @@ struct Image_info {
|
||||||
|
unsigned int ep;
|
||||||
|
};
|
||||||
|
|
||||||
|
-int uImage_probe(const unsigned char *buf, off_t len, unsigned int arch);
|
||||||
|
-int uImage_probe_kernel(const unsigned char *buf, off_t len, unsigned int arch);
|
||||||
|
-int uImage_probe_ramdisk(const unsigned char *buf, off_t len, unsigned int arch);
|
||||||
|
+int uImage_probe(const char *buf, off_t len, unsigned int arch);
|
||||||
|
+int uImage_probe_kernel(const char *buf, off_t len, unsigned int arch);
|
||||||
|
+int uImage_probe_ramdisk(const char *buf, off_t len, unsigned int arch);
|
||||||
|
int uImage_load(const char *buf, off_t len, struct Image_info *info);
|
||||||
|
#endif
|
||||||
|
diff --git a/kexec/arch/arm/kexec-uImage-arm.c b/kexec/arch/arm/kexec-uImage-arm.c
|
||||||
|
index 8e0a9ac6d242..03c2f4ddca7b 100644
|
||||||
|
--- a/kexec/arch/arm/kexec-uImage-arm.c
|
||||||
|
+++ b/kexec/arch/arm/kexec-uImage-arm.c
|
||||||
|
@@ -11,8 +11,7 @@
|
||||||
|
|
||||||
|
int uImage_arm_probe(const char *buf, off_t len)
|
||||||
|
{
|
||||||
|
- return uImage_probe_kernel((const unsigned char *)buf, len,
|
||||||
|
- IH_ARCH_ARM);
|
||||||
|
+ return uImage_probe_kernel(buf, len, IH_ARCH_ARM);
|
||||||
|
}
|
||||||
|
|
||||||
|
int uImage_arm_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
diff --git a/kexec/kexec-uImage.c b/kexec/kexec-uImage.c
|
||||||
|
index 2740a26b6d6c..eeee4be10f41 100644
|
||||||
|
--- a/kexec/kexec-uImage.c
|
||||||
|
+++ b/kexec/kexec-uImage.c
|
||||||
|
@@ -24,7 +24,7 @@
|
||||||
|
*
|
||||||
|
* Returns 0 if this is not a uImage
|
||||||
|
*/
|
||||||
|
-int uImage_probe(const unsigned char *buf, off_t len, unsigned int arch)
|
||||||
|
+int uImage_probe(const char *buf, off_t len, unsigned int arch)
|
||||||
|
{
|
||||||
|
struct image_header header;
|
||||||
|
#ifdef HAVE_LIBZ
|
||||||
|
@@ -109,7 +109,7 @@ int uImage_probe(const unsigned char *buf, off_t len, unsigned int arch)
|
||||||
|
* 1 - If the image is not a uImage.
|
||||||
|
*/
|
||||||
|
|
||||||
|
-int uImage_probe_kernel(const unsigned char *buf, off_t len, unsigned int arch)
|
||||||
|
+int uImage_probe_kernel(const char *buf, off_t len, unsigned int arch)
|
||||||
|
{
|
||||||
|
int type = uImage_probe(buf, len, arch);
|
||||||
|
if (type < 0)
|
||||||
|
@@ -118,7 +118,7 @@ int uImage_probe_kernel(const unsigned char *buf, off_t len, unsigned int arch)
|
||||||
|
return !(type == IH_TYPE_KERNEL || type == IH_TYPE_KERNEL_NOLOAD);
|
||||||
|
}
|
||||||
|
|
||||||
|
-int uImage_probe_ramdisk(const unsigned char *buf, off_t len, unsigned int arch)
|
||||||
|
+int uImage_probe_ramdisk(const char *buf, off_t len, unsigned int arch)
|
||||||
|
{
|
||||||
|
int type = uImage_probe(buf, len, arch);
|
||||||
|
|
||||||
|
@@ -220,7 +220,7 @@ static int uImage_gz_load(const char *buf, off_t len,
|
||||||
|
} while (1);
|
||||||
|
|
||||||
|
inflateEnd(&strm);
|
||||||
|
- image->buf = uncomp_buf;
|
||||||
|
+ image->buf = (char *)uncomp_buf;
|
||||||
|
image->len = mem_alloc - strm.avail_out;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -235,7 +235,7 @@ static int uImage_gz_load(const char *UNUSED(buf), off_t UNUSED(len),
|
||||||
|
int uImage_load(const char *buf, off_t len, struct Image_info *image)
|
||||||
|
{
|
||||||
|
const struct image_header *header = (const struct image_header *)buf;
|
||||||
|
- const unsigned char *img_buf = buf + sizeof(struct image_header);
|
||||||
|
+ const char *img_buf = buf + sizeof(struct image_header);
|
||||||
|
off_t img_len = be32_to_cpu(header->ih_size);
|
||||||
|
|
||||||
|
/*
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
101
0027-arm64-add-uImage-support.patch
Normal file
101
0027-arm64-add-uImage-support.patch
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
From 896fb2aa30c6acf0c651ba80e4ef661517b4aac4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Date: Wed, 8 Mar 2017 22:41:13 +0000
|
||||||
|
Subject: [PATCH 27/45] arm64: add uImage support
|
||||||
|
|
||||||
|
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/arm64/Makefile | 3 +++
|
||||||
|
kexec/arch/arm64/kexec-arm64.c | 1 +
|
||||||
|
kexec/arch/arm64/kexec-arm64.h | 4 ++++
|
||||||
|
kexec/arch/arm64/kexec-uImage-arm64.c | 34 ++++++++++++++++++++++++++++++++++
|
||||||
|
4 files changed, 42 insertions(+)
|
||||||
|
create mode 100644 kexec/arch/arm64/kexec-uImage-arm64.c
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/arm64/Makefile b/kexec/arch/arm64/Makefile
|
||||||
|
index 74b677f7784e..a931f0e94012 100644
|
||||||
|
--- a/kexec/arch/arm64/Makefile
|
||||||
|
+++ b/kexec/arch/arm64/Makefile
|
||||||
|
@@ -12,8 +12,11 @@ arm64_KEXEC_SRCS += \
|
||||||
|
kexec/arch/arm64/crashdump-arm64.c \
|
||||||
|
kexec/arch/arm64/kexec-arm64.c \
|
||||||
|
kexec/arch/arm64/kexec-elf-arm64.c \
|
||||||
|
+ kexec/arch/arm64/kexec-uImage-arm64.c \
|
||||||
|
kexec/arch/arm64/kexec-image-arm64.c
|
||||||
|
|
||||||
|
+arm64_UIMAGE = kexec/kexec-uImage.c
|
||||||
|
+
|
||||||
|
arm64_ARCH_REUSE_INITRD =
|
||||||
|
arm64_ADD_SEGMENT =
|
||||||
|
arm64_VIRT_TO_PHYS =
|
||||||
|
diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
|
||||||
|
index 04fd3968bb52..c82293973936 100644
|
||||||
|
--- a/kexec/arch/arm64/kexec-arm64.c
|
||||||
|
+++ b/kexec/arch/arm64/kexec-arm64.c
|
||||||
|
@@ -40,6 +40,7 @@ const struct arch_map_entry arches[] = {
|
||||||
|
struct file_type file_type[] = {
|
||||||
|
{"vmlinux", elf_arm64_probe, elf_arm64_load, elf_arm64_usage},
|
||||||
|
{"Image", image_arm64_probe, image_arm64_load, image_arm64_usage},
|
||||||
|
+ {"uImage", uImage_arm64_probe, uImage_arm64_load, uImage_arm64_usage},
|
||||||
|
};
|
||||||
|
|
||||||
|
int file_types = sizeof(file_type) / sizeof(file_type[0]);
|
||||||
|
diff --git a/kexec/arch/arm64/kexec-arm64.h b/kexec/arch/arm64/kexec-arm64.h
|
||||||
|
index bd4c20e76d15..bf724ef16573 100644
|
||||||
|
--- a/kexec/arch/arm64/kexec-arm64.h
|
||||||
|
+++ b/kexec/arch/arm64/kexec-arm64.h
|
||||||
|
@@ -30,6 +30,10 @@ int image_arm64_probe(const char *kernel_buf, off_t kernel_size);
|
||||||
|
int image_arm64_load(int argc, char **argv, const char *kernel_buf,
|
||||||
|
off_t kernel_size, struct kexec_info *info);
|
||||||
|
void image_arm64_usage(void);
|
||||||
|
+int uImage_arm64_probe(const char *buf, off_t len);
|
||||||
|
+int uImage_arm64_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
+ struct kexec_info *info);
|
||||||
|
+void uImage_arm64_usage(void);
|
||||||
|
|
||||||
|
off_t initrd_base;
|
||||||
|
off_t initrd_size;
|
||||||
|
diff --git a/kexec/arch/arm64/kexec-uImage-arm64.c b/kexec/arch/arm64/kexec-uImage-arm64.c
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..022d7ee4693a
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/kexec/arch/arm64/kexec-uImage-arm64.c
|
||||||
|
@@ -0,0 +1,34 @@
|
||||||
|
+/*
|
||||||
|
+ * uImage support added by David Woodhouse <dwmw2@infradead.org>
|
||||||
|
+ */
|
||||||
|
+#include <stdint.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+#include <sys/types.h>
|
||||||
|
+#include <image.h>
|
||||||
|
+#include <kexec-uImage.h>
|
||||||
|
+#include "../../kexec.h"
|
||||||
|
+#include "kexec-arm64.h"
|
||||||
|
+
|
||||||
|
+int uImage_arm64_probe(const char *buf, off_t len)
|
||||||
|
+{
|
||||||
|
+ return uImage_probe_kernel(buf, len, IH_ARCH_ARM64);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int uImage_arm64_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
+ struct kexec_info *info)
|
||||||
|
+{
|
||||||
|
+ struct Image_info img;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = uImage_load(buf, len, &img);
|
||||||
|
+ if (ret)
|
||||||
|
+ return ret;
|
||||||
|
+
|
||||||
|
+ return image_arm64_load(argc, argv, img.buf, img.len, info);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void uImage_arm64_usage(void)
|
||||||
|
+{
|
||||||
|
+ printf(
|
||||||
|
+" An ARM64 U-boot uImage file, compressed or not, big or little endian.\n\n");
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
31
0028-vmcore-dmesg-Define-_GNU_SOURCE.patch
Normal file
31
0028-vmcore-dmesg-Define-_GNU_SOURCE.patch
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
From 2f6f6d6fef7872647cacc6741ac35ac2b4df7ed5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Khem Raj <raj.khem@gmail.com>
|
||||||
|
Date: Wed, 8 Mar 2017 22:41:14 +0000
|
||||||
|
Subject: [PATCH 28/45] vmcore-dmesg: Define _GNU_SOURCE
|
||||||
|
|
||||||
|
loff_t is guarded with _GNU_SOURCE on some C library implementations
|
||||||
|
e.g. musl since this type is not defined by POSIX. Define _GNU_SOURCE to
|
||||||
|
include this define, it should help compiling on musl while nothing
|
||||||
|
changes for glibc based systems since there _GNU_SOURCE is already
|
||||||
|
defined
|
||||||
|
|
||||||
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||||
|
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
vmcore-dmesg/vmcore-dmesg.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/vmcore-dmesg/vmcore-dmesg.c b/vmcore-dmesg/vmcore-dmesg.c
|
||||||
|
index 0364636af35d..a8f56dfbe51f 100644
|
||||||
|
--- a/vmcore-dmesg/vmcore-dmesg.c
|
||||||
|
+++ b/vmcore-dmesg/vmcore-dmesg.c
|
||||||
|
@@ -1,4 +1,5 @@
|
||||||
|
#define _XOPEN_SOURCE 600
|
||||||
|
+#define _GNU_SOURCE
|
||||||
|
#define _LARGEFILE_SOURCE 1
|
||||||
|
#define _FILE_OFFSET_BITS 64
|
||||||
|
#include <endian.h>
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
192
0029-Don-t-use-L-width-specifier-with-integer-values.patch
Normal file
192
0029-Don-t-use-L-width-specifier-with-integer-values.patch
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
From 47cc70157c6610d4c01a7ab4f8f0d24ab054b43b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philip Prindeville <philipp@redfish-solutions.com>
|
||||||
|
Date: Fri, 10 Mar 2017 20:12:15 -0700
|
||||||
|
Subject: [PATCH 29/45] Don't use %L width specifier with integer values
|
||||||
|
|
||||||
|
MUSL doesn't support %L except for floating-point arguments; therefore,
|
||||||
|
%ll must be used instead with integer arguments.
|
||||||
|
|
||||||
|
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/arm/kexec-arm.c | 2 +-
|
||||||
|
kexec/arch/i386/crashdump-x86.c | 8 ++++----
|
||||||
|
kexec/arch/i386/kexec-x86-common.c | 2 +-
|
||||||
|
kexec/arch/ia64/kexec-elf-rel-ia64.c | 2 +-
|
||||||
|
kexec/arch/mips/crashdump-mips.c | 2 +-
|
||||||
|
kexec/arch/mips/kexec-mips.c | 2 +-
|
||||||
|
kexec/arch/s390/kexec-s390.c | 2 +-
|
||||||
|
kexec/crashdump.c | 8 ++++----
|
||||||
|
kexec/kexec-iomem.c | 2 +-
|
||||||
|
9 files changed, 15 insertions(+), 15 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/arm/kexec-arm.c b/kexec/arch/arm/kexec-arm.c
|
||||||
|
index 2194b7cbfcb7..49f35b11b21c 100644
|
||||||
|
--- a/kexec/arch/arm/kexec-arm.c
|
||||||
|
+++ b/kexec/arch/arm/kexec-arm.c
|
||||||
|
@@ -47,7 +47,7 @@ int get_memory_ranges(struct memory_range **range, int *ranges,
|
||||||
|
int count;
|
||||||
|
if (memory_ranges >= MAX_MEMORY_RANGES)
|
||||||
|
break;
|
||||||
|
- count = sscanf(line, "%Lx-%Lx : %n",
|
||||||
|
+ count = sscanf(line, "%llx-%llx : %n",
|
||||||
|
&start, &end, &consumed);
|
||||||
|
if (count != 2)
|
||||||
|
continue;
|
||||||
|
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
|
||||||
|
index c4cf2013a001..285dea9abd4b 100644
|
||||||
|
--- a/kexec/arch/i386/crashdump-x86.c
|
||||||
|
+++ b/kexec/arch/i386/crashdump-x86.c
|
||||||
|
@@ -119,7 +119,7 @@ static unsigned long long get_kernel_sym(const char *symbol)
|
||||||
|
}
|
||||||
|
|
||||||
|
while(fgets(line, sizeof(line), fp) != NULL) {
|
||||||
|
- if (sscanf(line, "%Lx %c %s", &vaddr, &type, sym) != 3)
|
||||||
|
+ if (sscanf(line, "%llx %c %s", &vaddr, &type, sym) != 3)
|
||||||
|
continue;
|
||||||
|
if (strcmp(sym, symbol) == 0) {
|
||||||
|
dbgprintf("kernel symbol %s vaddr = %16llx\n", symbol, vaddr);
|
||||||
|
@@ -296,12 +296,12 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges,
|
||||||
|
|
||||||
|
if (memory_ranges >= CRASH_MAX_MEMORY_RANGES)
|
||||||
|
break;
|
||||||
|
- count = sscanf(line, "%Lx-%Lx : %n",
|
||||||
|
+ count = sscanf(line, "%llx-%llx : %n",
|
||||||
|
&start, &end, &consumed);
|
||||||
|
if (count != 2)
|
||||||
|
continue;
|
||||||
|
str = line + consumed;
|
||||||
|
- dbgprintf("%016Lx-%016Lx : %s",
|
||||||
|
+ dbgprintf("%016llx-%016llx : %s",
|
||||||
|
start, end, str);
|
||||||
|
/* Only Dumping memory of type System RAM. */
|
||||||
|
if (memcmp(str, "System RAM\n", 11) == 0) {
|
||||||
|
@@ -778,7 +778,7 @@ static int get_crash_notes(int cpu, uint64_t *addr, uint64_t *len)
|
||||||
|
*addr = x86__pa(vaddr + (cpu * MAX_NOTE_BYTES));
|
||||||
|
*len = MAX_NOTE_BYTES;
|
||||||
|
|
||||||
|
- dbgprintf("crash_notes addr = %Lx\n",
|
||||||
|
+ dbgprintf("crash_notes addr = %llx\n",
|
||||||
|
(unsigned long long)*addr);
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
|
diff --git a/kexec/arch/i386/kexec-x86-common.c b/kexec/arch/i386/kexec-x86-common.c
|
||||||
|
index 3e97239c0c78..be03618770f7 100644
|
||||||
|
--- a/kexec/arch/i386/kexec-x86-common.c
|
||||||
|
+++ b/kexec/arch/i386/kexec-x86-common.c
|
||||||
|
@@ -81,7 +81,7 @@ static int get_memory_ranges_proc_iomem(struct memory_range **range, int *ranges
|
||||||
|
int count;
|
||||||
|
if (memory_ranges >= MAX_MEMORY_RANGES)
|
||||||
|
break;
|
||||||
|
- count = sscanf(line, "%Lx-%Lx : %n",
|
||||||
|
+ count = sscanf(line, "%llx-%llx : %n",
|
||||||
|
&start, &end, &consumed);
|
||||||
|
if (count != 2)
|
||||||
|
continue;
|
||||||
|
diff --git a/kexec/arch/ia64/kexec-elf-rel-ia64.c b/kexec/arch/ia64/kexec-elf-rel-ia64.c
|
||||||
|
index 7f7c08cba4b1..500f2473ee38 100644
|
||||||
|
--- a/kexec/arch/ia64/kexec-elf-rel-ia64.c
|
||||||
|
+++ b/kexec/arch/ia64/kexec-elf-rel-ia64.c
|
||||||
|
@@ -155,6 +155,6 @@ void machine_apply_elf_rel(struct mem_ehdr *ehdr,
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
overflow:
|
||||||
|
- die("overflow in relocation type %lu val %Lx\n",
|
||||||
|
+ die("overflow in relocation type %lu val %llx\n",
|
||||||
|
r_type, value);
|
||||||
|
}
|
||||||
|
diff --git a/kexec/arch/mips/crashdump-mips.c b/kexec/arch/mips/crashdump-mips.c
|
||||||
|
index 9c33599a34ed..6308ec81276f 100644
|
||||||
|
--- a/kexec/arch/mips/crashdump-mips.c
|
||||||
|
+++ b/kexec/arch/mips/crashdump-mips.c
|
||||||
|
@@ -173,7 +173,7 @@ static int get_crash_memory_ranges(struct memory_range **range, int *ranges)
|
||||||
|
int type, consumed, count;
|
||||||
|
if (memory_ranges >= CRASH_MAX_MEMORY_RANGES)
|
||||||
|
break;
|
||||||
|
- count = sscanf(line, "%Lx-%Lx : %n",
|
||||||
|
+ count = sscanf(line, "%llx-%llx : %n",
|
||||||
|
&start, &end, &consumed);
|
||||||
|
if (count != 2)
|
||||||
|
continue;
|
||||||
|
diff --git a/kexec/arch/mips/kexec-mips.c b/kexec/arch/mips/kexec-mips.c
|
||||||
|
index ee3cd3a8b6eb..2e5b700da1ed 100644
|
||||||
|
--- a/kexec/arch/mips/kexec-mips.c
|
||||||
|
+++ b/kexec/arch/mips/kexec-mips.c
|
||||||
|
@@ -48,7 +48,7 @@ int get_memory_ranges(struct memory_range **range, int *ranges,
|
||||||
|
while (fgets(line, sizeof(line), fp) != 0) {
|
||||||
|
if (memory_ranges >= MAX_MEMORY_RANGES)
|
||||||
|
break;
|
||||||
|
- count = sscanf(line, "%Lx-%Lx : %n", &start, &end, &consumed);
|
||||||
|
+ count = sscanf(line, "%llx-%llx : %n", &start, &end, &consumed);
|
||||||
|
if (count != 2)
|
||||||
|
continue;
|
||||||
|
str = line + consumed;
|
||||||
|
diff --git a/kexec/arch/s390/kexec-s390.c b/kexec/arch/s390/kexec-s390.c
|
||||||
|
index f863483ce808..33ba6b970664 100644
|
||||||
|
--- a/kexec/arch/s390/kexec-s390.c
|
||||||
|
+++ b/kexec/arch/s390/kexec-s390.c
|
||||||
|
@@ -170,7 +170,7 @@ int get_memory_ranges_s390(struct memory_range memory_range[], int *ranges,
|
||||||
|
if (current_range == MAX_MEMORY_RANGES)
|
||||||
|
break;
|
||||||
|
|
||||||
|
- sscanf(line,"%Lx-%Lx : %n", &start, &end, &cons);
|
||||||
|
+ sscanf(line,"%llx-%llx : %n", &start, &end, &cons);
|
||||||
|
str = line+cons;
|
||||||
|
if ((memcmp(str, sys_ram, strlen(sys_ram)) == 0) ||
|
||||||
|
((memcmp(str, crash_kernel, strlen(crash_kernel)) == 0) &&
|
||||||
|
diff --git a/kexec/crashdump.c b/kexec/crashdump.c
|
||||||
|
index 15c11051fb98..0b363c503833 100644
|
||||||
|
--- a/kexec/crashdump.c
|
||||||
|
+++ b/kexec/crashdump.c
|
||||||
|
@@ -98,7 +98,7 @@ int get_crash_notes_per_cpu(int cpu, uint64_t *addr, uint64_t *len)
|
||||||
|
}
|
||||||
|
if (!fgets(line, sizeof(line), fp))
|
||||||
|
die("Cannot parse %s: %s\n", crash_notes, strerror(errno));
|
||||||
|
- count = sscanf(line, "%Lx", &temp);
|
||||||
|
+ count = sscanf(line, "%llx", &temp);
|
||||||
|
if (count != 1)
|
||||||
|
die("Cannot parse %s: %s\n", crash_notes, strerror(errno));
|
||||||
|
*addr = (uint64_t) temp;
|
||||||
|
@@ -112,7 +112,7 @@ int get_crash_notes_per_cpu(int cpu, uint64_t *addr, uint64_t *len)
|
||||||
|
if (!fgets(line, sizeof(line), fp))
|
||||||
|
die("Cannot parse %s: %s\n",
|
||||||
|
crash_notes_size, strerror(errno));
|
||||||
|
- count = sscanf(line, "%Lu", &temp);
|
||||||
|
+ count = sscanf(line, "%llu", &temp);
|
||||||
|
if (count != 1)
|
||||||
|
die("Cannot parse %s: %s\n",
|
||||||
|
crash_notes_size, strerror(errno));
|
||||||
|
@@ -120,7 +120,7 @@ int get_crash_notes_per_cpu(int cpu, uint64_t *addr, uint64_t *len)
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
- dbgprintf("%s: crash_notes addr = %Lx, size = %Lu\n", __FUNCTION__,
|
||||||
|
+ dbgprintf("%s: crash_notes addr = %llx, size = %llu\n", __FUNCTION__,
|
||||||
|
(unsigned long long)*addr, (unsigned long long)*len);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
@@ -141,7 +141,7 @@ static int get_vmcoreinfo(const char *kdump_info, uint64_t *addr, uint64_t *len)
|
||||||
|
|
||||||
|
if (!fgets(line, sizeof(line), fp))
|
||||||
|
die("Cannot parse %s: %s\n", kdump_info, strerror(errno));
|
||||||
|
- count = sscanf(line, "%Lx %Lx", &temp, &temp2);
|
||||||
|
+ count = sscanf(line, "%llx %llx", &temp, &temp2);
|
||||||
|
if (count != 2)
|
||||||
|
die("Cannot parse %s: %s\n", kdump_info, strerror(errno));
|
||||||
|
|
||||||
|
diff --git a/kexec/kexec-iomem.c b/kexec/kexec-iomem.c
|
||||||
|
index 485a2e810080..7ec385371a2c 100644
|
||||||
|
--- a/kexec/kexec-iomem.c
|
||||||
|
+++ b/kexec/kexec-iomem.c
|
||||||
|
@@ -44,7 +44,7 @@ int kexec_iomem_for_each_line(char *match,
|
||||||
|
die("Cannot open %s\n", iomem);
|
||||||
|
|
||||||
|
while(fgets(line, sizeof(line), fp) != 0) {
|
||||||
|
- count = sscanf(line, "%Lx-%Lx : %n", &start, &end, &consumed);
|
||||||
|
+ count = sscanf(line, "%llx-%llx : %n", &start, &end, &consumed);
|
||||||
|
if (count != 2)
|
||||||
|
continue;
|
||||||
|
str = line + consumed;
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
74
0030-x86-x86_64-Fix-format-warning-with-die.patch
Normal file
74
0030-x86-x86_64-Fix-format-warning-with-die.patch
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
From 1550f81bf1886aa0520da0b6181cd61c1a75d4ad Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pratyush Anand <panand@redhat.com>
|
||||||
|
Date: Tue, 14 Mar 2017 17:59:22 +0530
|
||||||
|
Subject: [PATCH 30/45] x86/x86_64: Fix format warning with die()
|
||||||
|
|
||||||
|
Fedora koji uses gcc version 7.0.1-0.12.fc27, and it generates a build
|
||||||
|
warning
|
||||||
|
|
||||||
|
kexec/arch/i386/kexec-elf-x86.c:299:3: error: format not a string
|
||||||
|
literal and no format arguments [-Werror=format-security]
|
||||||
|
die(error_msg);
|
||||||
|
^~~
|
||||||
|
cc1: some warnings being treated as errors
|
||||||
|
|
||||||
|
error_msg can have a format specifier as well in string. In such cases,
|
||||||
|
if there is no other arguments for the format variable then code will
|
||||||
|
try to access a non existing argument. Therefore, use 1st argument as
|
||||||
|
format specifier for string print and pass error_msg as the string to be
|
||||||
|
printed.
|
||||||
|
|
||||||
|
While doing that,also use const qualifier before "char *error_msg".
|
||||||
|
|
||||||
|
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/i386/kexec-elf-x86.c | 4 ++--
|
||||||
|
kexec/arch/x86_64/kexec-elf-x86_64.c | 4 ++--
|
||||||
|
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/i386/kexec-elf-x86.c b/kexec/arch/i386/kexec-elf-x86.c
|
||||||
|
index de00dcb869d7..fedf031cdf4a 100644
|
||||||
|
--- a/kexec/arch/i386/kexec-elf-x86.c
|
||||||
|
+++ b/kexec/arch/i386/kexec-elf-x86.c
|
||||||
|
@@ -91,7 +91,7 @@ int elf_x86_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
char *command_line = NULL, *modified_cmdline = NULL;
|
||||||
|
const char *append = NULL;
|
||||||
|
char *tmp_cmdline = NULL;
|
||||||
|
- char *error_msg = NULL;
|
||||||
|
+ const char *error_msg = NULL;
|
||||||
|
int result;
|
||||||
|
int command_line_len;
|
||||||
|
const char *ramdisk;
|
||||||
|
@@ -296,6 +296,6 @@ out:
|
||||||
|
free(command_line);
|
||||||
|
free(modified_cmdline);
|
||||||
|
if (error_msg)
|
||||||
|
- die(error_msg);
|
||||||
|
+ die("%s", error_msg);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
diff --git a/kexec/arch/x86_64/kexec-elf-x86_64.c b/kexec/arch/x86_64/kexec-elf-x86_64.c
|
||||||
|
index ae6569220bc8..ad2231193eb1 100644
|
||||||
|
--- a/kexec/arch/x86_64/kexec-elf-x86_64.c
|
||||||
|
+++ b/kexec/arch/x86_64/kexec-elf-x86_64.c
|
||||||
|
@@ -99,7 +99,7 @@ int elf_x86_64_load(int argc, char **argv, const char *buf, off_t len,
|
||||||
|
#define ARG_STYLE_NONE 2
|
||||||
|
int opt;
|
||||||
|
int result = 0;
|
||||||
|
- char *error_msg = NULL;
|
||||||
|
+ const char *error_msg = NULL;
|
||||||
|
|
||||||
|
/* See options.h and add any new options there too! */
|
||||||
|
static const struct option options[] = {
|
||||||
|
@@ -276,6 +276,6 @@ out:
|
||||||
|
free(command_line);
|
||||||
|
free(modified_cmdline);
|
||||||
|
if (error_msg)
|
||||||
|
- die(error_msg);
|
||||||
|
+ die("%s", error_msg);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
43
0031-ppc-Fix-format-warning-with-die.patch
Normal file
43
0031-ppc-Fix-format-warning-with-die.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
From 82a49747e5ad73cca14171e81df913f95fece161 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jussi Kukkonen <jussi.kukkonen@intel.com>
|
||||||
|
Date: Thu, 16 Mar 2017 16:11:18 +0200
|
||||||
|
Subject: [PATCH 31/45] ppc: Fix format warning with die()
|
||||||
|
|
||||||
|
Enable compiling kexec-tools for ppc with -Werror=format-security.
|
||||||
|
|
||||||
|
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/ppc/kexec-elf-ppc.c | 2 +-
|
||||||
|
kexec/arch/ppc/kexec-uImage-ppc.c | 2 +-
|
||||||
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/ppc/kexec-elf-ppc.c b/kexec/arch/ppc/kexec-elf-ppc.c
|
||||||
|
index 291f06d4d48f..ad43ad11f0cc 100644
|
||||||
|
--- a/kexec/arch/ppc/kexec-elf-ppc.c
|
||||||
|
+++ b/kexec/arch/ppc/kexec-elf-ppc.c
|
||||||
|
@@ -453,7 +453,7 @@ out:
|
||||||
|
if (!tmp_cmdline)
|
||||||
|
free(command_line);
|
||||||
|
if (error_msg)
|
||||||
|
- die(error_msg);
|
||||||
|
+ die("%s", error_msg);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
diff --git a/kexec/arch/ppc/kexec-uImage-ppc.c b/kexec/arch/ppc/kexec-uImage-ppc.c
|
||||||
|
index 5eec6e418a58..e8f7adccdc3f 100644
|
||||||
|
--- a/kexec/arch/ppc/kexec-uImage-ppc.c
|
||||||
|
+++ b/kexec/arch/ppc/kexec-uImage-ppc.c
|
||||||
|
@@ -306,7 +306,7 @@ out:
|
||||||
|
if (!tmp_cmdline)
|
||||||
|
free(command_line);
|
||||||
|
if (error_msg)
|
||||||
|
- die(error_msg);
|
||||||
|
+ die("%s", error_msg);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
@ -0,0 +1,27 @@
|
|||||||
|
From 0516f46adbf3da74da9971d39b4f8b50cd83d3f5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Date: Thu, 16 Mar 2017 11:12:24 +0100
|
||||||
|
Subject: [PATCH 32/45] crashdump: Remove stray get_crashkernel_region()
|
||||||
|
declaration
|
||||||
|
|
||||||
|
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/crashdump.h | 1 -
|
||||||
|
1 file changed, 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/crashdump.h b/kexec/crashdump.h
|
||||||
|
index 96219a81829e..86e1ef2523ca 100644
|
||||||
|
--- a/kexec/crashdump.h
|
||||||
|
+++ b/kexec/crashdump.h
|
||||||
|
@@ -1,7 +1,6 @@
|
||||||
|
#ifndef CRASHDUMP_H
|
||||||
|
#define CRASHDUMP_H
|
||||||
|
|
||||||
|
-int get_crashkernel_region(uint64_t *start, uint64_t *end);
|
||||||
|
extern int get_crash_notes_per_cpu(int cpu, uint64_t *addr, uint64_t *len);
|
||||||
|
extern int get_kernel_vmcoreinfo(uint64_t *addr, uint64_t *len);
|
||||||
|
extern int get_xen_vmcoreinfo(uint64_t *addr, uint64_t *len);
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
52
0033-x86-Support-large-number-of-memory-ranges.patch
Normal file
52
0033-x86-Support-large-number-of-memory-ranges.patch
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
From 4a6d67d9e938a7accf128aff23f8ad4bda67f729 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Xunlei Pang <xlpang@redhat.com>
|
||||||
|
Date: Thu, 23 Mar 2017 19:16:59 +0800
|
||||||
|
Subject: [PATCH 33/45] x86: Support large number of memory ranges
|
||||||
|
|
||||||
|
We got a problem on one SGI 64TB machine, the current kexec-tools
|
||||||
|
failed to work due to the insufficient ranges(MAX_MEMORY_RANGES)
|
||||||
|
allowed which is defined as 1024(less than the ranges on the machine).
|
||||||
|
The kcore header is insufficient due to the same reason as well.
|
||||||
|
|
||||||
|
To solve this, this patch simply doubles "MAX_MEMORY_RANGES" and
|
||||||
|
"KCORE_ELF_HEADERS_SIZE".
|
||||||
|
|
||||||
|
Signed-off-by: Xunlei Pang <xlpang@redhat.com>
|
||||||
|
Tested-by: Frank Ramsay <frank.ramsay@hpe.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/i386/kexec-x86.h | 2 +-
|
||||||
|
kexec/crashdump.h | 4 ++--
|
||||||
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/i386/kexec-x86.h b/kexec/arch/i386/kexec-x86.h
|
||||||
|
index 33df3524f4e2..51855f8db762 100644
|
||||||
|
--- a/kexec/arch/i386/kexec-x86.h
|
||||||
|
+++ b/kexec/arch/i386/kexec-x86.h
|
||||||
|
@@ -1,7 +1,7 @@
|
||||||
|
#ifndef KEXEC_X86_H
|
||||||
|
#define KEXEC_X86_H
|
||||||
|
|
||||||
|
-#define MAX_MEMORY_RANGES 1024
|
||||||
|
+#define MAX_MEMORY_RANGES 2048
|
||||||
|
|
||||||
|
enum coretype {
|
||||||
|
CORE_TYPE_UNDEF = 0,
|
||||||
|
diff --git a/kexec/crashdump.h b/kexec/crashdump.h
|
||||||
|
index 86e1ef2523ca..18bd691c33e2 100644
|
||||||
|
--- a/kexec/crashdump.h
|
||||||
|
+++ b/kexec/crashdump.h
|
||||||
|
@@ -7,8 +7,8 @@ extern int get_xen_vmcoreinfo(uint64_t *addr, uint64_t *len);
|
||||||
|
|
||||||
|
/* Need to find a better way to determine per cpu notes section size. */
|
||||||
|
#define MAX_NOTE_BYTES 1024
|
||||||
|
-/* Expecting ELF headers to fit in 32K. Increase it if you need more. */
|
||||||
|
-#define KCORE_ELF_HEADERS_SIZE 32768
|
||||||
|
+/* Expecting ELF headers to fit in 64K. Increase it if you need more. */
|
||||||
|
+#define KCORE_ELF_HEADERS_SIZE 65536
|
||||||
|
/* The address of the ELF header is passed to the secondary kernel
|
||||||
|
* using the kernel command line option memmap=nnn.
|
||||||
|
* The smallest unit the kernel accepts is in kilobytes,
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
40
0034-Fix-broken-Xen-support-in-configure.ac.patch
Normal file
40
0034-Fix-broken-Xen-support-in-configure.ac.patch
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
From 59d3e5b5ad6f0f33a9801bb69559d28efc62b4ce Mon Sep 17 00:00:00 2001
|
||||||
|
From: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Date: Fri, 7 Apr 2017 09:13:06 -0500
|
||||||
|
Subject: [PATCH 34/45] Fix broken Xen support in configure.ac
|
||||||
|
|
||||||
|
Commit 2cf7cb9a "kexec: implemented XEN KEXEC STATUS to determine
|
||||||
|
if an image is loaded" added configure-time detection of the
|
||||||
|
kexec_status() call, but in doing so had the unintended side
|
||||||
|
effect of disabling support for Xen altogether due to the
|
||||||
|
missing HAVE_LIBXENCTRL=1. This corrects the broken behavior
|
||||||
|
while still maintaining the original intention of detecting
|
||||||
|
support for kexec_status() call.
|
||||||
|
|
||||||
|
Reported-and-Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||||
|
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
configure.ac | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index 53fffc3a92ed..87a9ac8ccf88 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -165,9 +165,9 @@ fi
|
||||||
|
dnl find Xen control stack libraries
|
||||||
|
if test "$with_xen" = yes ; then
|
||||||
|
AC_CHECK_HEADER(xenctrl.h,
|
||||||
|
- [AC_CHECK_LIB(xenctrl, xc_kexec_load, [ have_xenctrl_h=yes ],
|
||||||
|
+ [AC_CHECK_LIB(xenctrl, xc_kexec_load, ,
|
||||||
|
AC_MSG_NOTICE([Xen support disabled]))])
|
||||||
|
- if test "$have_xenctrl_h" = yes ; then
|
||||||
|
+ if test "$ac_cv_lib_xenctrl_xc_kexec_load" = yes ; then
|
||||||
|
AC_CHECK_LIB(xenctrl, xc_kexec_status,
|
||||||
|
AC_DEFINE(HAVE_KEXEC_CMD_STATUS, 1,
|
||||||
|
[The kexec_status call is available]),
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
@ -0,0 +1,79 @@
|
|||||||
|
From c95df0e099b14757de483245d7b1b45e2d6e2c91 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
Date: Wed, 17 May 2017 14:51:41 +0900
|
||||||
|
Subject: [PATCH 35/45] kexec: extend the semantics of
|
||||||
|
kexec_iomem_for_each_line
|
||||||
|
|
||||||
|
The current kexec_iomem_for_each_line() counts up all the lines for which
|
||||||
|
a callback function returns zero(0) or positive, and otherwise it stops
|
||||||
|
further scanning.
|
||||||
|
This behavior is inconvenient in some cases. For instance, on arm64, we want
|
||||||
|
to count up "System RAM" entries, but need to skip "reserved" entries.
|
||||||
|
|
||||||
|
So this patch extends the semantics so that we will continue to scan
|
||||||
|
succeeding entries but not count lines for which a callback function
|
||||||
|
returns positive.
|
||||||
|
|
||||||
|
The current users of kexec_iomem_for_each_line(), arm, sh and x86, will not
|
||||||
|
be affected by this change because
|
||||||
|
* arm
|
||||||
|
The callback function only returns -1 or 0, and the return value of
|
||||||
|
kexec_iomem_for_each_line() will never be used.
|
||||||
|
* sh, x86
|
||||||
|
The callback function may return (-1 for sh,) 0 or 1, but always returns
|
||||||
|
1 once we have reached the maximum number of entries allowed.
|
||||||
|
Even so the current kexec_iomem_for_each_line() counts them up.
|
||||||
|
This change actually fixes this bug.
|
||||||
|
|
||||||
|
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
Tested-by: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Tested-by: Pratyush Anand <panand@redhat.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/kexec-iomem.c | 15 ++++++++++-----
|
||||||
|
1 file changed, 10 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/kexec-iomem.c b/kexec/kexec-iomem.c
|
||||||
|
index 7ec385371a2c..b5b52b1c0803 100644
|
||||||
|
--- a/kexec/kexec-iomem.c
|
||||||
|
+++ b/kexec/kexec-iomem.c
|
||||||
|
@@ -18,6 +18,9 @@
|
||||||
|
* Iterate over each line in the file returned by proc_iomem(). If match is
|
||||||
|
* NULL or if the line matches with our match-pattern then call the
|
||||||
|
* callback if non-NULL.
|
||||||
|
+ * If match is NULL, callback should return a negative if error.
|
||||||
|
+ * Otherwise the interation goes on, incrementing nr but only if callback
|
||||||
|
+ * returns 0 (matched).
|
||||||
|
*
|
||||||
|
* Return the number of lines matched.
|
||||||
|
*/
|
||||||
|
@@ -37,7 +40,7 @@ int kexec_iomem_for_each_line(char *match,
|
||||||
|
char *str;
|
||||||
|
int consumed;
|
||||||
|
int count;
|
||||||
|
- int nr = 0;
|
||||||
|
+ int nr = 0, ret;
|
||||||
|
|
||||||
|
fp = fopen(iomem, "r");
|
||||||
|
if (!fp)
|
||||||
|
@@ -50,11 +53,13 @@ int kexec_iomem_for_each_line(char *match,
|
||||||
|
str = line + consumed;
|
||||||
|
size = end - start + 1;
|
||||||
|
if (!match || memcmp(str, match, strlen(match)) == 0) {
|
||||||
|
- if (callback
|
||||||
|
- && callback(data, nr, str, start, size) < 0) {
|
||||||
|
- break;
|
||||||
|
+ if (callback) {
|
||||||
|
+ ret = callback(data, nr, str, start, size);
|
||||||
|
+ if (ret < 0)
|
||||||
|
+ break;
|
||||||
|
+ else if (ret == 0)
|
||||||
|
+ nr++;
|
||||||
|
}
|
||||||
|
- nr++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
187
0036-kexec-generalize-and-rename-get_kernel_stext_sym.patch
Normal file
187
0036-kexec-generalize-and-rename-get_kernel_stext_sym.patch
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
From 325804055e99dbf40af5e6fa546320b821d9d821 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pratyush Anand <panand@redhat.com>
|
||||||
|
Date: Wed, 17 May 2017 14:51:42 +0900
|
||||||
|
Subject: [PATCH 36/45] kexec: generalize and rename get_kernel_stext_sym()
|
||||||
|
|
||||||
|
get_kernel_stext_sym() has been defined for both arm and i386. Other
|
||||||
|
architecture might need some other kernel symbol address. Therefore rewrite
|
||||||
|
this function as generic function to get any kernel symbol address.
|
||||||
|
|
||||||
|
More over, kallsyms is not arch specific representation, therefore have
|
||||||
|
common function for all arches.
|
||||||
|
|
||||||
|
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
||||||
|
[created symbols.c]
|
||||||
|
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
Tested-by: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Tested-by: Pratyush Anand <panand@redhat.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/Makefile | 1 +
|
||||||
|
kexec/arch/arm/crashdump-arm.c | 40 +---------------------------------------
|
||||||
|
kexec/arch/i386/crashdump-x86.c | 29 -----------------------------
|
||||||
|
kexec/kexec.h | 2 ++
|
||||||
|
kexec/symbols.c | 34 ++++++++++++++++++++++++++++++++++
|
||||||
|
5 files changed, 38 insertions(+), 68 deletions(-)
|
||||||
|
create mode 100644 kexec/symbols.c
|
||||||
|
|
||||||
|
diff --git a/kexec/Makefile b/kexec/Makefile
|
||||||
|
index 39f365f543d7..2b4fb3d162ec 100644
|
||||||
|
--- a/kexec/Makefile
|
||||||
|
+++ b/kexec/Makefile
|
||||||
|
@@ -26,6 +26,7 @@ KEXEC_SRCS_base += kexec/kernel_version.c
|
||||||
|
KEXEC_SRCS_base += kexec/lzma.c
|
||||||
|
KEXEC_SRCS_base += kexec/zlib.c
|
||||||
|
KEXEC_SRCS_base += kexec/kexec-xen.c
|
||||||
|
+KEXEC_SRCS_base += kexec/symbols.c
|
||||||
|
|
||||||
|
KEXEC_GENERATED_SRCS += $(PURGATORY_HEX_C)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c
|
||||||
|
index ac76e0a812d5..daa478868b49 100644
|
||||||
|
--- a/kexec/arch/arm/crashdump-arm.c
|
||||||
|
+++ b/kexec/arch/arm/crashdump-arm.c
|
||||||
|
@@ -73,48 +73,10 @@ static struct crash_elf_info elf_info = {
|
||||||
|
|
||||||
|
extern unsigned long long user_page_offset;
|
||||||
|
|
||||||
|
-/* Retrieve kernel _stext symbol virtual address from /proc/kallsyms */
|
||||||
|
-static unsigned long long get_kernel_stext_sym(void)
|
||||||
|
-{
|
||||||
|
- const char *kallsyms = "/proc/kallsyms";
|
||||||
|
- const char *stext = "_stext";
|
||||||
|
- char sym[128];
|
||||||
|
- char line[128];
|
||||||
|
- FILE *fp;
|
||||||
|
- unsigned long long vaddr = 0;
|
||||||
|
- char type;
|
||||||
|
-
|
||||||
|
- fp = fopen(kallsyms, "r");
|
||||||
|
- if (!fp) {
|
||||||
|
- fprintf(stderr, "Cannot open %s\n", kallsyms);
|
||||||
|
- return 0;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- while(fgets(line, sizeof(line), fp) != NULL) {
|
||||||
|
- unsigned long long addr;
|
||||||
|
-
|
||||||
|
- if (sscanf(line, "%Lx %c %s", &addr, &type, sym) != 3)
|
||||||
|
- continue;
|
||||||
|
-
|
||||||
|
- if (strcmp(sym, stext) == 0) {
|
||||||
|
- dbgprintf("kernel symbol %s vaddr = %#llx\n", stext, addr);
|
||||||
|
- vaddr = addr;
|
||||||
|
- break;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- fclose(fp);
|
||||||
|
-
|
||||||
|
- if (vaddr == 0)
|
||||||
|
- fprintf(stderr, "Cannot get kernel %s symbol address\n", stext);
|
||||||
|
-
|
||||||
|
- return vaddr;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
static int get_kernel_page_offset(struct kexec_info *info,
|
||||||
|
struct crash_elf_info *elf_info)
|
||||||
|
{
|
||||||
|
- unsigned long long stext_sym_addr = get_kernel_stext_sym();
|
||||||
|
+ unsigned long long stext_sym_addr = get_kernel_sym("_stext");
|
||||||
|
if (stext_sym_addr == 0) {
|
||||||
|
if (user_page_offset != (-1ULL)) {
|
||||||
|
elf_info->page_offset = user_page_offset;
|
||||||
|
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
|
||||||
|
index 285dea9abd4b..69a063a5670b 100644
|
||||||
|
--- a/kexec/arch/i386/crashdump-x86.c
|
||||||
|
+++ b/kexec/arch/i386/crashdump-x86.c
|
||||||
|
@@ -102,35 +102,6 @@ static int get_kernel_paddr(struct kexec_info *UNUSED(info),
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
-/* Retrieve kernel symbol virtual address from /proc/kallsyms */
|
||||||
|
-static unsigned long long get_kernel_sym(const char *symbol)
|
||||||
|
-{
|
||||||
|
- const char *kallsyms = "/proc/kallsyms";
|
||||||
|
- char sym[128];
|
||||||
|
- char line[128];
|
||||||
|
- FILE *fp;
|
||||||
|
- unsigned long long vaddr;
|
||||||
|
- char type;
|
||||||
|
-
|
||||||
|
- fp = fopen(kallsyms, "r");
|
||||||
|
- if (!fp) {
|
||||||
|
- fprintf(stderr, "Cannot open %s\n", kallsyms);
|
||||||
|
- return 0;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- while(fgets(line, sizeof(line), fp) != NULL) {
|
||||||
|
- if (sscanf(line, "%llx %c %s", &vaddr, &type, sym) != 3)
|
||||||
|
- continue;
|
||||||
|
- if (strcmp(sym, symbol) == 0) {
|
||||||
|
- dbgprintf("kernel symbol %s vaddr = %16llx\n", symbol, vaddr);
|
||||||
|
- return vaddr;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- dbgprintf("Cannot get kernel %s symbol address\n", symbol);
|
||||||
|
- return 0;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
/* Retrieve info regarding virtual address kernel has been compiled for and
|
||||||
|
* size of the kernel from /proc/kcore. Current /proc/kcore parsing from
|
||||||
|
* from kexec-tools fails because of malformed elf notes. A kernel patch has
|
||||||
|
diff --git a/kexec/kexec.h b/kexec/kexec.h
|
||||||
|
index 52bef9b3c0f5..26225d2c002a 100644
|
||||||
|
--- a/kexec/kexec.h
|
||||||
|
+++ b/kexec/kexec.h
|
||||||
|
@@ -317,4 +317,6 @@ int xen_kexec_unload(uint64_t kexec_flags);
|
||||||
|
void xen_kexec_exec(void);
|
||||||
|
int xen_kexec_status(uint64_t kexec_flags);
|
||||||
|
|
||||||
|
+extern unsigned long long get_kernel_sym(const char *text);
|
||||||
|
+
|
||||||
|
#endif /* KEXEC_H */
|
||||||
|
diff --git a/kexec/symbols.c b/kexec/symbols.c
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..e88f7f342d3b
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/kexec/symbols.c
|
||||||
|
@@ -0,0 +1,34 @@
|
||||||
|
+#include <stdio.h>
|
||||||
|
+#include <string.h>
|
||||||
|
+#include "kexec.h"
|
||||||
|
+
|
||||||
|
+/* Retrieve kernel symbol virtual address from /proc/kallsyms */
|
||||||
|
+unsigned long long get_kernel_sym(const char *symbol)
|
||||||
|
+{
|
||||||
|
+ const char *kallsyms = "/proc/kallsyms";
|
||||||
|
+ char sym[128];
|
||||||
|
+ char line[128];
|
||||||
|
+ FILE *fp;
|
||||||
|
+ unsigned long long vaddr;
|
||||||
|
+ char type;
|
||||||
|
+
|
||||||
|
+ fp = fopen(kallsyms, "r");
|
||||||
|
+ if (!fp) {
|
||||||
|
+ fprintf(stderr, "Cannot open %s\n", kallsyms);
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ while (fgets(line, sizeof(line), fp) != NULL) {
|
||||||
|
+ if (sscanf(line, "%llx %c %s", &vaddr, &type, sym) != 3)
|
||||||
|
+ continue;
|
||||||
|
+ if (strcmp(sym, symbol) == 0) {
|
||||||
|
+ dbgprintf("kernel symbol %s vaddr = %16llx\n",
|
||||||
|
+ symbol, vaddr);
|
||||||
|
+ return vaddr;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ dbgprintf("Cannot get kernel %s symbol address\n", symbol);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
89
0037-arm64-identify-PHYS_OFFSET-correctly.patch
Normal file
89
0037-arm64-identify-PHYS_OFFSET-correctly.patch
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
From ef26cc33b8d66460c555600b0e388f55c5cd6f21 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
Date: Wed, 17 May 2017 14:51:43 +0900
|
||||||
|
Subject: [PATCH 37/45] arm64: identify PHYS_OFFSET correctly
|
||||||
|
|
||||||
|
Due to the kernel patch, commit e7cd190385d1 ("arm64: mark reserved
|
||||||
|
memblock regions explicitly in iomem"), the current code will not be able
|
||||||
|
to identify the correct value of PHYS_OFFSET if some "reserved" memory
|
||||||
|
region, which is likely to be UEFI runtime services code/data, exists at
|
||||||
|
an address below the first "System RAM" regions.
|
||||||
|
|
||||||
|
This patch fixes this issue.
|
||||||
|
|
||||||
|
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
Tested-by: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Tested-by: Pratyush Anand <panand@redhat.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/arm64/Makefile | 1 +
|
||||||
|
kexec/arch/arm64/iomem.h | 7 +++++++
|
||||||
|
kexec/arch/arm64/kexec-arm64.c | 12 ++++++++++--
|
||||||
|
3 files changed, 18 insertions(+), 2 deletions(-)
|
||||||
|
create mode 100644 kexec/arch/arm64/iomem.h
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/arm64/Makefile b/kexec/arch/arm64/Makefile
|
||||||
|
index a931f0e94012..91f6388e46a3 100644
|
||||||
|
--- a/kexec/arch/arm64/Makefile
|
||||||
|
+++ b/kexec/arch/arm64/Makefile
|
||||||
|
@@ -26,6 +26,7 @@ dist += $(arm64_KEXEC_SRCS) \
|
||||||
|
kexec/arch/arm64/include/arch/options.h \
|
||||||
|
kexec/arch/arm64/crashdump-arm64.h \
|
||||||
|
kexec/arch/arm64/image-header.h \
|
||||||
|
+ kexec/arch/arm64/iomem.h \
|
||||||
|
kexec/arch/arm64/kexec-arm64.h \
|
||||||
|
kexec/arch/arm64/Makefile
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/arm64/iomem.h b/kexec/arch/arm64/iomem.h
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..7fd66eb063e1
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/kexec/arch/arm64/iomem.h
|
||||||
|
@@ -0,0 +1,7 @@
|
||||||
|
+#ifndef IOMEM_H
|
||||||
|
+#define IOMEM_H
|
||||||
|
+
|
||||||
|
+#define SYSTEM_RAM "System RAM\n"
|
||||||
|
+#define IOMEM_RESERVED "reserved\n"
|
||||||
|
+
|
||||||
|
+#endif
|
||||||
|
diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
|
||||||
|
index c82293973936..7024f749f3f6 100644
|
||||||
|
--- a/kexec/arch/arm64/kexec-arm64.c
|
||||||
|
+++ b/kexec/arch/arm64/kexec-arm64.c
|
||||||
|
@@ -21,6 +21,7 @@
|
||||||
|
#include "crashdump-arm64.h"
|
||||||
|
#include "dt-ops.h"
|
||||||
|
#include "fs2dt.h"
|
||||||
|
+#include "iomem.h"
|
||||||
|
#include "kexec-syscall.h"
|
||||||
|
#include "arch/options.h"
|
||||||
|
|
||||||
|
@@ -477,7 +478,14 @@ static int get_memory_ranges_iomem_cb(void *data, int nr, char *str,
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
r = (struct memory_range *)data + nr;
|
||||||
|
- r->type = RANGE_RAM;
|
||||||
|
+
|
||||||
|
+ if (!strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)))
|
||||||
|
+ r->type = RANGE_RAM;
|
||||||
|
+ else if (!strncmp(str, IOMEM_RESERVED, strlen(IOMEM_RESERVED)))
|
||||||
|
+ r->type = RANGE_RESERVED;
|
||||||
|
+ else
|
||||||
|
+ return 1;
|
||||||
|
+
|
||||||
|
r->start = base;
|
||||||
|
r->end = base + length - 1;
|
||||||
|
|
||||||
|
@@ -496,7 +504,7 @@ static int get_memory_ranges_iomem_cb(void *data, int nr, char *str,
|
||||||
|
static int get_memory_ranges_iomem(struct memory_range *array,
|
||||||
|
unsigned int *count)
|
||||||
|
{
|
||||||
|
- *count = kexec_iomem_for_each_line("System RAM\n",
|
||||||
|
+ *count = kexec_iomem_for_each_line(NULL,
|
||||||
|
get_memory_ranges_iomem_cb, array);
|
||||||
|
|
||||||
|
if (!*count) {
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
182
0038-arm64-change-return-values-on-error-to-negative.patch
Normal file
182
0038-arm64-change-return-values-on-error-to-negative.patch
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
From a17234fe94bce780ac36a0ba9bfc9b6e8ffd84f0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
Date: Wed, 17 May 2017 14:51:44 +0900
|
||||||
|
Subject: [PATCH 38/45] arm64: change return values on error to negative
|
||||||
|
|
||||||
|
EFAILED is defined "-1" and so we don't need to negate it as a return value.
|
||||||
|
|
||||||
|
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
Tested-by: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Tested-by: Pratyush Anand <panand@redhat.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/arm64/kexec-arm64.c | 24 ++++++++++++------------
|
||||||
|
kexec/arch/arm64/kexec-elf-arm64.c | 6 +++---
|
||||||
|
kexec/arch/arm64/kexec-image-arm64.c | 4 ++--
|
||||||
|
3 files changed, 17 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
|
||||||
|
index 7024f749f3f6..153c96f73b3d 100644
|
||||||
|
--- a/kexec/arch/arm64/kexec-arm64.c
|
||||||
|
+++ b/kexec/arch/arm64/kexec-arm64.c
|
||||||
|
@@ -79,7 +79,7 @@ int arm64_process_image_header(const struct arm64_image_header *h)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!arm64_header_check_magic(h))
|
||||||
|
- return -EFAILED;
|
||||||
|
+ return EFAILED;
|
||||||
|
|
||||||
|
if (h->image_size) {
|
||||||
|
arm64_mem.text_offset = arm64_header_text_offset(h);
|
||||||
|
@@ -202,7 +202,7 @@ static int set_bootargs(struct dtb *dtb, const char *command_line)
|
||||||
|
if (result) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"kexec: Set device tree bootargs failed.\n");
|
||||||
|
- return -EFAILED;
|
||||||
|
+ return EFAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
@@ -222,7 +222,7 @@ static int read_proc_dtb(struct dtb *dtb)
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
dbgprintf("%s: %s\n", __func__, strerror(errno));
|
||||||
|
- return -EFAILED;
|
||||||
|
+ return EFAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
dtb->path = path;
|
||||||
|
@@ -245,7 +245,7 @@ static int read_sys_dtb(struct dtb *dtb)
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
dbgprintf("%s: %s\n", __func__, strerror(errno));
|
||||||
|
- return -EFAILED;
|
||||||
|
+ return EFAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
dtb->path = path;
|
||||||
|
@@ -275,7 +275,7 @@ static int read_1st_dtb(struct dtb *dtb)
|
||||||
|
goto on_success;
|
||||||
|
|
||||||
|
dbgprintf("%s: not found\n", __func__);
|
||||||
|
- return -EFAILED;
|
||||||
|
+ return EFAILED;
|
||||||
|
|
||||||
|
on_success:
|
||||||
|
dbgprintf("%s: found %s\n", __func__, dtb->path);
|
||||||
|
@@ -294,7 +294,7 @@ static int setup_2nd_dtb(struct dtb *dtb, char *command_line)
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
fprintf(stderr, "kexec: Invalid 2nd device tree.\n");
|
||||||
|
- return -EFAILED;
|
||||||
|
+ return EFAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = set_bootargs(dtb, command_line);
|
||||||
|
@@ -349,14 +349,14 @@ int arm64_load_other_segments(struct kexec_info *info,
|
||||||
|
if (result) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"kexec: Error: No device tree available.\n");
|
||||||
|
- return -EFAILED;
|
||||||
|
+ return EFAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result = setup_2nd_dtb(&dtb, command_line);
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
- return -EFAILED;
|
||||||
|
+ return EFAILED;
|
||||||
|
|
||||||
|
/* Put the other segments after the image. */
|
||||||
|
|
||||||
|
@@ -384,7 +384,7 @@ int arm64_load_other_segments(struct kexec_info *info,
|
||||||
|
|
||||||
|
if (_ALIGN_UP(initrd_end, GiB(1)) - _ALIGN_DOWN(image_base, GiB(1)) > GiB(32)) {
|
||||||
|
fprintf(stderr, "kexec: Error: image + initrd too big.\n");
|
||||||
|
- return -EFAILED;
|
||||||
|
+ return EFAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
dbgprintf("initrd: base %lx, size %lxh (%ld)\n",
|
||||||
|
@@ -395,7 +395,7 @@ int arm64_load_other_segments(struct kexec_info *info,
|
||||||
|
initrd_base + initrd_size);
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
- return -EFAILED;
|
||||||
|
+ return EFAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -403,7 +403,7 @@ int arm64_load_other_segments(struct kexec_info *info,
|
||||||
|
|
||||||
|
if (dtb.size > MiB(2)) {
|
||||||
|
fprintf(stderr, "kexec: Error: dtb too big.\n");
|
||||||
|
- return -EFAILED;
|
||||||
|
+ return EFAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
dtb_base = add_buffer_phys_virt(info, dtb.buf, dtb.size, dtb.size,
|
||||||
|
@@ -509,7 +509,7 @@ static int get_memory_ranges_iomem(struct memory_range *array,
|
||||||
|
|
||||||
|
if (!*count) {
|
||||||
|
dbgprintf("%s: failed: No RAM found.\n", __func__);
|
||||||
|
- return -EFAILED;
|
||||||
|
+ return EFAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
diff --git a/kexec/arch/arm64/kexec-elf-arm64.c b/kexec/arch/arm64/kexec-elf-arm64.c
|
||||||
|
index daf8bf0df9c4..2b6c127ebc92 100644
|
||||||
|
--- a/kexec/arch/arm64/kexec-elf-arm64.c
|
||||||
|
+++ b/kexec/arch/arm64/kexec-elf-arm64.c
|
||||||
|
@@ -48,7 +48,7 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
|
||||||
|
|
||||||
|
if (info->kexec_flags & KEXEC_ON_CRASH) {
|
||||||
|
fprintf(stderr, "kexec: kdump not yet supported on arm64\n");
|
||||||
|
- return -EFAILED;
|
||||||
|
+ return EFAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = build_elf_exec_info(kernel_buf, kernel_size, &ehdr, 0);
|
||||||
|
@@ -92,7 +92,7 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
|
||||||
|
|
||||||
|
if (i == ehdr.e_phnum) {
|
||||||
|
dbgprintf("%s: Valid arm64 header not found\n", __func__);
|
||||||
|
- result = -EFAILED;
|
||||||
|
+ result = EFAILED;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -100,7 +100,7 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
|
||||||
|
|
||||||
|
if (kernel_segment == ULONG_MAX) {
|
||||||
|
dbgprintf("%s: Kernel segment is not allocated\n", __func__);
|
||||||
|
- result = -EFAILED;
|
||||||
|
+ result = EFAILED;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/arm64/kexec-image-arm64.c b/kexec/arch/arm64/kexec-image-arm64.c
|
||||||
|
index 960ed9667a4d..e5f2a9befdb1 100644
|
||||||
|
--- a/kexec/arch/arm64/kexec-image-arm64.c
|
||||||
|
+++ b/kexec/arch/arm64/kexec-image-arm64.c
|
||||||
|
@@ -36,13 +36,13 @@ int image_arm64_load(int argc, char **argv, const char *kernel_buf,
|
||||||
|
header = (const struct arm64_image_header *)(kernel_buf);
|
||||||
|
|
||||||
|
if (arm64_process_image_header(header))
|
||||||
|
- return -1;
|
||||||
|
+ return EFAILED;
|
||||||
|
|
||||||
|
kernel_segment = arm64_locate_kernel_segment(info);
|
||||||
|
|
||||||
|
if (kernel_segment == ULONG_MAX) {
|
||||||
|
dbgprintf("%s: Kernel segment is not allocated\n", __func__);
|
||||||
|
- result = -EFAILED;
|
||||||
|
+ result = EFAILED;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
214
0039-arm64-kdump-identify-memory-regions.patch
Normal file
214
0039-arm64-kdump-identify-memory-regions.patch
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
From c0672c93edcb5bb32800f8d48afa05861ef32a79 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
Date: Wed, 17 May 2017 14:51:45 +0900
|
||||||
|
Subject: [PATCH 39/45] arm64: kdump: identify memory regions
|
||||||
|
|
||||||
|
The following regions need to be identified for later use:
|
||||||
|
a) memory regions which belong to the 1st kernel
|
||||||
|
b) usable memory reserved for crash dump kernel
|
||||||
|
|
||||||
|
We go through /proc/iomem to find out a) and b) which are marked
|
||||||
|
as "System RAM" and "Crash kernel", respectively.
|
||||||
|
|
||||||
|
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
Tested-by: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Tested-by: Pratyush Anand <panand@redhat.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/arm64/Makefile | 2 +
|
||||||
|
kexec/arch/arm64/crashdump-arm64.c | 109 +++++++++++++++++++++++++++++++++++--
|
||||||
|
kexec/arch/arm64/crashdump-arm64.h | 14 ++++-
|
||||||
|
kexec/arch/arm64/iomem.h | 1 +
|
||||||
|
4 files changed, 120 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/arm64/Makefile b/kexec/arch/arm64/Makefile
|
||||||
|
index 91f6388e46a3..9d9111caa8ed 100644
|
||||||
|
--- a/kexec/arch/arm64/Makefile
|
||||||
|
+++ b/kexec/arch/arm64/Makefile
|
||||||
|
@@ -6,6 +6,8 @@ arm64_FS2DT_INCLUDE += \
|
||||||
|
|
||||||
|
arm64_DT_OPS += kexec/dt-ops.c
|
||||||
|
|
||||||
|
+arm64_MEM_REGIONS = kexec/mem_regions.c
|
||||||
|
+
|
||||||
|
arm64_CPPFLAGS += -I $(srcdir)/kexec/
|
||||||
|
|
||||||
|
arm64_KEXEC_SRCS += \
|
||||||
|
diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c
|
||||||
|
index b0e4713f12c6..9267c9add291 100644
|
||||||
|
--- a/kexec/arch/arm64/crashdump-arm64.c
|
||||||
|
+++ b/kexec/arch/arm64/crashdump-arm64.c
|
||||||
|
@@ -1,5 +1,13 @@
|
||||||
|
/*
|
||||||
|
* ARM64 crashdump.
|
||||||
|
+ * partly derived from arm implementation
|
||||||
|
+ *
|
||||||
|
+ * Copyright (c) 2014-2017 Linaro Limited
|
||||||
|
+ * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
+ *
|
||||||
|
+ * This program is free software; you can redistribute it and/or modify
|
||||||
|
+ * it under the terms of the GNU General Public License version 2 as
|
||||||
|
+ * published by the Free Software Foundation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
@@ -10,18 +18,111 @@
|
||||||
|
#include "kexec.h"
|
||||||
|
#include "crashdump.h"
|
||||||
|
#include "crashdump-arm64.h"
|
||||||
|
+#include "iomem.h"
|
||||||
|
#include "kexec-arm64.h"
|
||||||
|
#include "kexec-elf.h"
|
||||||
|
+#include "mem_regions.h"
|
||||||
|
|
||||||
|
-struct memory_ranges usablemem_rgns = {};
|
||||||
|
+/* memory ranges on crashed kernel */
|
||||||
|
+static struct memory_range system_memory_ranges[CRASH_MAX_MEMORY_RANGES];
|
||||||
|
+static struct memory_ranges system_memory_rgns = {
|
||||||
|
+ .size = 0,
|
||||||
|
+ .max_size = CRASH_MAX_MEMORY_RANGES,
|
||||||
|
+ .ranges = system_memory_ranges,
|
||||||
|
+};
|
||||||
|
|
||||||
|
-int is_crashkernel_mem_reserved(void)
|
||||||
|
+/* memory range reserved for crashkernel */
|
||||||
|
+struct memory_range crash_reserved_mem;
|
||||||
|
+struct memory_ranges usablemem_rgns = {
|
||||||
|
+ .size = 0,
|
||||||
|
+ .max_size = 1,
|
||||||
|
+ .ranges = &crash_reserved_mem,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * iomem_range_callback() - callback called for each iomem region
|
||||||
|
+ * @data: not used
|
||||||
|
+ * @nr: not used
|
||||||
|
+ * @str: name of the memory region
|
||||||
|
+ * @base: start address of the memory region
|
||||||
|
+ * @length: size of the memory region
|
||||||
|
+ *
|
||||||
|
+ * This function is called once for each memory region found in /proc/iomem.
|
||||||
|
+ * It locates system RAM and crashkernel reserved memory and places these to
|
||||||
|
+ * variables, respectively, system_memory_ranges and crash_reserved_mem.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+static int iomem_range_callback(void *UNUSED(data), int UNUSED(nr),
|
||||||
|
+ char *str, unsigned long long base,
|
||||||
|
+ unsigned long long length)
|
||||||
|
{
|
||||||
|
+ if (strncmp(str, CRASH_KERNEL, strlen(CRASH_KERNEL)) == 0)
|
||||||
|
+ return mem_regions_add(&usablemem_rgns,
|
||||||
|
+ base, length, RANGE_RAM);
|
||||||
|
+ else if (strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)) == 0)
|
||||||
|
+ return mem_regions_add(&system_memory_rgns,
|
||||||
|
+ base, length, RANGE_RAM);
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+int is_crashkernel_mem_reserved(void)
|
||||||
|
+{
|
||||||
|
+ if (!usablemem_rgns.size)
|
||||||
|
+ kexec_iomem_for_each_line(NULL, iomem_range_callback, NULL);
|
||||||
|
+
|
||||||
|
+ return crash_reserved_mem.start != crash_reserved_mem.end;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * crash_get_memory_ranges() - read system physical memory
|
||||||
|
+ *
|
||||||
|
+ * Function reads through system physical memory and stores found memory
|
||||||
|
+ * regions in system_memory_ranges.
|
||||||
|
+ * Regions are sorted in ascending order.
|
||||||
|
+ *
|
||||||
|
+ * Returns 0 in case of success and a negative value otherwise.
|
||||||
|
+ */
|
||||||
|
+static int crash_get_memory_ranges(void)
|
||||||
|
+{
|
||||||
|
+ /*
|
||||||
|
+ * First read all memory regions that can be considered as
|
||||||
|
+ * system memory including the crash area.
|
||||||
|
+ */
|
||||||
|
+ if (!usablemem_rgns.size)
|
||||||
|
+ kexec_iomem_for_each_line(NULL, iomem_range_callback, NULL);
|
||||||
|
+
|
||||||
|
+ /* allow only a single region for crash dump kernel */
|
||||||
|
+ if (usablemem_rgns.size != 1)
|
||||||
|
+ return -EINVAL;
|
||||||
|
+
|
||||||
|
+ dbgprint_mem_range("Reserved memory range", &crash_reserved_mem, 1);
|
||||||
|
+
|
||||||
|
+ if (mem_regions_exclude(&system_memory_rgns, &crash_reserved_mem)) {
|
||||||
|
+ fprintf(stderr,
|
||||||
|
+ "Error: Number of crash memory ranges excedeed the max limit\n");
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * Make sure that the memory regions are sorted.
|
||||||
|
+ */
|
||||||
|
+ mem_regions_sort(&system_memory_rgns);
|
||||||
|
+
|
||||||
|
+ dbgprint_mem_range("Coredump memory ranges",
|
||||||
|
+ system_memory_rgns.ranges, system_memory_rgns.size);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int get_crash_kernel_load_range(uint64_t *start, uint64_t *end)
|
||||||
|
{
|
||||||
|
- /* Crash kernel region size is not exposed by the system */
|
||||||
|
- return -1;
|
||||||
|
+ if (!usablemem_rgns.size)
|
||||||
|
+ kexec_iomem_for_each_line(NULL, iomem_range_callback, NULL);
|
||||||
|
+
|
||||||
|
+ if (!crash_reserved_mem.end)
|
||||||
|
+ return -1;
|
||||||
|
+
|
||||||
|
+ *start = crash_reserved_mem.start;
|
||||||
|
+ *end = crash_reserved_mem.end;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
diff --git a/kexec/arch/arm64/crashdump-arm64.h b/kexec/arch/arm64/crashdump-arm64.h
|
||||||
|
index f33c7a25b454..ce9881eba67e 100644
|
||||||
|
--- a/kexec/arch/arm64/crashdump-arm64.h
|
||||||
|
+++ b/kexec/arch/arm64/crashdump-arm64.h
|
||||||
|
@@ -1,12 +1,22 @@
|
||||||
|
/*
|
||||||
|
* ARM64 crashdump.
|
||||||
|
+ *
|
||||||
|
+ * Copyright (c) 2014-2017 Linaro Limited
|
||||||
|
+ * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
+ *
|
||||||
|
+ * This program is free software; you can redistribute it and/or modify
|
||||||
|
+ * it under the terms of the GNU General Public License version 2 as
|
||||||
|
+ * published by the Free Software Foundation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
-#if !defined(CRASHDUMP_ARM64_H)
|
||||||
|
+#ifndef CRASHDUMP_ARM64_H
|
||||||
|
#define CRASHDUMP_ARM64_H
|
||||||
|
|
||||||
|
#include "kexec.h"
|
||||||
|
|
||||||
|
+#define CRASH_MAX_MEMORY_RANGES 32
|
||||||
|
+
|
||||||
|
extern struct memory_ranges usablemem_rgns;
|
||||||
|
+extern struct memory_range crash_reserved_mem;
|
||||||
|
|
||||||
|
-#endif
|
||||||
|
+#endif /* CRASHDUMP_ARM64_H */
|
||||||
|
diff --git a/kexec/arch/arm64/iomem.h b/kexec/arch/arm64/iomem.h
|
||||||
|
index 7fd66eb063e1..20cda87dbd02 100644
|
||||||
|
--- a/kexec/arch/arm64/iomem.h
|
||||||
|
+++ b/kexec/arch/arm64/iomem.h
|
||||||
|
@@ -2,6 +2,7 @@
|
||||||
|
#define IOMEM_H
|
||||||
|
|
||||||
|
#define SYSTEM_RAM "System RAM\n"
|
||||||
|
+#define CRASH_KERNEL "Crash kernel\n"
|
||||||
|
#define IOMEM_RESERVED "reserved\n"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
202
0040-arm64-kdump-add-elf-core-header-segment.patch
Normal file
202
0040-arm64-kdump-add-elf-core-header-segment.patch
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
From 0bd5219da953639276cd17e067c030ac97feca97 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
Date: Wed, 17 May 2017 14:51:46 +0900
|
||||||
|
Subject: [PATCH 40/45] arm64: kdump: add elf core header segment
|
||||||
|
|
||||||
|
Elf core header contains the information necessary for the coredump of
|
||||||
|
the 1st kernel, including its physcal memory layout as well as cpu register
|
||||||
|
states at the panic.
|
||||||
|
The segment is allocated inside the reserved memory of crash dump kernel.
|
||||||
|
|
||||||
|
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
Tested-by: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Tested-by: Pratyush Anand <panand@redhat.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/arm64/crashdump-arm64.c | 98 ++++++++++++++++++++++++++++++++++++++
|
||||||
|
kexec/arch/arm64/crashdump-arm64.h | 3 ++
|
||||||
|
kexec/arch/arm64/iomem.h | 2 +
|
||||||
|
kexec/arch/arm64/kexec-elf-arm64.c | 11 +++++
|
||||||
|
4 files changed, 114 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c
|
||||||
|
index 9267c9add291..d142435fa933 100644
|
||||||
|
--- a/kexec/arch/arm64/crashdump-arm64.c
|
||||||
|
+++ b/kexec/arch/arm64/crashdump-arm64.c
|
||||||
|
@@ -39,6 +39,39 @@ struct memory_ranges usablemem_rgns = {
|
||||||
|
.ranges = &crash_reserved_mem,
|
||||||
|
};
|
||||||
|
|
||||||
|
+struct memory_range elfcorehdr_mem;
|
||||||
|
+
|
||||||
|
+static struct crash_elf_info elf_info = {
|
||||||
|
+ .class = ELFCLASS64,
|
||||||
|
+#if (__BYTE_ORDER == __LITTLE_ENDIAN)
|
||||||
|
+ .data = ELFDATA2LSB,
|
||||||
|
+#else
|
||||||
|
+ .data = ELFDATA2MSB,
|
||||||
|
+#endif
|
||||||
|
+ .machine = EM_AARCH64,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * Note: The returned value is correct only if !CONFIG_RANDOMIZE_BASE.
|
||||||
|
+ */
|
||||||
|
+static uint64_t get_kernel_page_offset(void)
|
||||||
|
+{
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ if (elf_info.kern_vaddr_start == UINT64_MAX)
|
||||||
|
+ return UINT64_MAX;
|
||||||
|
+
|
||||||
|
+ /* Current max virtual memory range is 48-bits. */
|
||||||
|
+ for (i = 48; i > 0; i--)
|
||||||
|
+ if (!(elf_info.kern_vaddr_start & (1UL << i)))
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ if (i <= 0)
|
||||||
|
+ return UINT64_MAX;
|
||||||
|
+ else
|
||||||
|
+ return UINT64_MAX << i;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* iomem_range_callback() - callback called for each iomem region
|
||||||
|
* @data: not used
|
||||||
|
@@ -62,6 +95,10 @@ static int iomem_range_callback(void *UNUSED(data), int UNUSED(nr),
|
||||||
|
else if (strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)) == 0)
|
||||||
|
return mem_regions_add(&system_memory_rgns,
|
||||||
|
base, length, RANGE_RAM);
|
||||||
|
+ else if (strncmp(str, KERNEL_CODE, strlen(KERNEL_CODE)) == 0)
|
||||||
|
+ elf_info.kern_paddr_start = base;
|
||||||
|
+ else if (strncmp(str, KERNEL_DATA, strlen(KERNEL_DATA)) == 0)
|
||||||
|
+ elf_info.kern_size = base + length - elf_info.kern_paddr_start;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -111,6 +148,67 @@ static int crash_get_memory_ranges(void)
|
||||||
|
|
||||||
|
dbgprint_mem_range("Coredump memory ranges",
|
||||||
|
system_memory_rgns.ranges, system_memory_rgns.size);
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * For additional kernel code/data segment.
|
||||||
|
+ * kern_paddr_start/kern_size are determined in iomem_range_callback
|
||||||
|
+ */
|
||||||
|
+ elf_info.kern_vaddr_start = get_kernel_sym("_text");
|
||||||
|
+ if (!elf_info.kern_vaddr_start)
|
||||||
|
+ elf_info.kern_vaddr_start = UINT64_MAX;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * load_crashdump_segments() - load the elf core header
|
||||||
|
+ * @info: kexec info structure
|
||||||
|
+ *
|
||||||
|
+ * This function creates and loads an additional segment of elf core header
|
||||||
|
+ : which is used to construct /proc/vmcore on crash dump kernel.
|
||||||
|
+ *
|
||||||
|
+ * Return 0 in case of success and -1 in case of error.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+int load_crashdump_segments(struct kexec_info *info)
|
||||||
|
+{
|
||||||
|
+ unsigned long elfcorehdr;
|
||||||
|
+ unsigned long bufsz;
|
||||||
|
+ void *buf;
|
||||||
|
+ int err;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * First fetch all the memory (RAM) ranges that we are going to
|
||||||
|
+ * pass to the crash dump kernel during panic.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+ err = crash_get_memory_ranges();
|
||||||
|
+
|
||||||
|
+ if (err)
|
||||||
|
+ return EFAILED;
|
||||||
|
+
|
||||||
|
+ elf_info.page_offset = get_kernel_page_offset();
|
||||||
|
+ dbgprintf("%s: page_offset: %016llx\n", __func__,
|
||||||
|
+ elf_info.page_offset);
|
||||||
|
+
|
||||||
|
+ err = crash_create_elf64_headers(info, &elf_info,
|
||||||
|
+ system_memory_rgns.ranges, system_memory_rgns.size,
|
||||||
|
+ &buf, &bufsz, ELF_CORE_HEADER_ALIGN);
|
||||||
|
+
|
||||||
|
+ if (err)
|
||||||
|
+ return EFAILED;
|
||||||
|
+
|
||||||
|
+ elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 0,
|
||||||
|
+ crash_reserved_mem.start, crash_reserved_mem.end,
|
||||||
|
+ -1, 0);
|
||||||
|
+
|
||||||
|
+ elfcorehdr_mem.start = elfcorehdr;
|
||||||
|
+ elfcorehdr_mem.end = elfcorehdr + bufsz - 1;
|
||||||
|
+
|
||||||
|
+ dbgprintf("%s: elfcorehdr 0x%llx-0x%llx\n", __func__,
|
||||||
|
+ elfcorehdr_mem.start, elfcorehdr_mem.end);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_crash_kernel_load_range(uint64_t *start, uint64_t *end)
|
||||||
|
diff --git a/kexec/arch/arm64/crashdump-arm64.h b/kexec/arch/arm64/crashdump-arm64.h
|
||||||
|
index ce9881eba67e..64c677d2fce1 100644
|
||||||
|
--- a/kexec/arch/arm64/crashdump-arm64.h
|
||||||
|
+++ b/kexec/arch/arm64/crashdump-arm64.h
|
||||||
|
@@ -18,5 +18,8 @@
|
||||||
|
|
||||||
|
extern struct memory_ranges usablemem_rgns;
|
||||||
|
extern struct memory_range crash_reserved_mem;
|
||||||
|
+extern struct memory_range elfcorehdr_mem;
|
||||||
|
+
|
||||||
|
+extern int load_crashdump_segments(struct kexec_info *info);
|
||||||
|
|
||||||
|
#endif /* CRASHDUMP_ARM64_H */
|
||||||
|
diff --git a/kexec/arch/arm64/iomem.h b/kexec/arch/arm64/iomem.h
|
||||||
|
index 20cda87dbd02..d4864bb44922 100644
|
||||||
|
--- a/kexec/arch/arm64/iomem.h
|
||||||
|
+++ b/kexec/arch/arm64/iomem.h
|
||||||
|
@@ -2,6 +2,8 @@
|
||||||
|
#define IOMEM_H
|
||||||
|
|
||||||
|
#define SYSTEM_RAM "System RAM\n"
|
||||||
|
+#define KERNEL_CODE "Kernel code\n"
|
||||||
|
+#define KERNEL_DATA "Kernel data\n"
|
||||||
|
#define CRASH_KERNEL "Crash kernel\n"
|
||||||
|
#define IOMEM_RESERVED "reserved\n"
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/arm64/kexec-elf-arm64.c b/kexec/arch/arm64/kexec-elf-arm64.c
|
||||||
|
index 2b6c127ebc92..900c6939ab62 100644
|
||||||
|
--- a/kexec/arch/arm64/kexec-elf-arm64.c
|
||||||
|
+++ b/kexec/arch/arm64/kexec-elf-arm64.c
|
||||||
|
@@ -119,6 +119,16 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
|
||||||
|
dbgprintf("%s: PE format: %s\n", __func__,
|
||||||
|
(arm64_header_check_pe_sig(header) ? "yes" : "no"));
|
||||||
|
|
||||||
|
+ /* create and initialize elf core header segment */
|
||||||
|
+ if (info->kexec_flags & KEXEC_ON_CRASH) {
|
||||||
|
+ result = load_crashdump_segments(info);
|
||||||
|
+ if (result) {
|
||||||
|
+ dbgprintf("%s: Creating eflcorehdr failed.\n",
|
||||||
|
+ __func__);
|
||||||
|
+ goto exit;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* load the kernel */
|
||||||
|
result = elf_exec_load(&ehdr, info);
|
||||||
|
|
||||||
|
@@ -127,6 +137,7 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* load additional data */
|
||||||
|
result = arm64_load_other_segments(info, kernel_segment
|
||||||
|
+ arm64_mem.text_offset);
|
||||||
|
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
142
0041-arm64-kdump-set-up-kernel-image-segment.patch
Normal file
142
0041-arm64-kdump-set-up-kernel-image-segment.patch
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
From 1591926df5a602ffcbf55e99aa8a96fbebd0bafe Mon Sep 17 00:00:00 2001
|
||||||
|
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
Date: Wed, 17 May 2017 14:51:47 +0900
|
||||||
|
Subject: [PATCH 41/45] arm64: kdump: set up kernel image segment
|
||||||
|
|
||||||
|
On arm64, we can use the same kernel image as 1st kernel, but
|
||||||
|
we have to modify the entry point as well as segments' addresses
|
||||||
|
in the kernel's elf header in order to load them into correct places.
|
||||||
|
|
||||||
|
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
Tested-by: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Tested-by: Pratyush Anand <panand@redhat.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/arm64/crashdump-arm64.c | 24 ++++++++++++++++++++++++
|
||||||
|
kexec/arch/arm64/crashdump-arm64.h | 1 +
|
||||||
|
kexec/arch/arm64/kexec-arm64.c | 25 ++++++++++++++++++++-----
|
||||||
|
kexec/arch/arm64/kexec-elf-arm64.c | 11 ++++++++++-
|
||||||
|
4 files changed, 55 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c
|
||||||
|
index d142435fa933..4fd7aa8fd43c 100644
|
||||||
|
--- a/kexec/arch/arm64/crashdump-arm64.c
|
||||||
|
+++ b/kexec/arch/arm64/crashdump-arm64.c
|
||||||
|
@@ -211,6 +211,30 @@ int load_crashdump_segments(struct kexec_info *info)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * e_entry and p_paddr are actually in virtual address space.
|
||||||
|
+ * Those values will be translated to physcal addresses by using
|
||||||
|
+ * virt_to_phys() in add_segment().
|
||||||
|
+ * So let's fix up those values for later use so the memory base
|
||||||
|
+ * (arm64_mm.phys_offset) will be correctly replaced with
|
||||||
|
+ * crash_reserved_mem.start.
|
||||||
|
+ */
|
||||||
|
+void fixup_elf_addrs(struct mem_ehdr *ehdr)
|
||||||
|
+{
|
||||||
|
+ struct mem_phdr *phdr;
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ ehdr->e_entry += - arm64_mem.phys_offset + crash_reserved_mem.start;
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < ehdr->e_phnum; i++) {
|
||||||
|
+ phdr = &ehdr->e_phdr[i];
|
||||||
|
+ if (phdr->p_type != PT_LOAD)
|
||||||
|
+ continue;
|
||||||
|
+ phdr->p_paddr +=
|
||||||
|
+ (-arm64_mem.phys_offset + crash_reserved_mem.start);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int get_crash_kernel_load_range(uint64_t *start, uint64_t *end)
|
||||||
|
{
|
||||||
|
if (!usablemem_rgns.size)
|
||||||
|
diff --git a/kexec/arch/arm64/crashdump-arm64.h b/kexec/arch/arm64/crashdump-arm64.h
|
||||||
|
index 64c677d2fce1..880b83aa3d0f 100644
|
||||||
|
--- a/kexec/arch/arm64/crashdump-arm64.h
|
||||||
|
+++ b/kexec/arch/arm64/crashdump-arm64.h
|
||||||
|
@@ -21,5 +21,6 @@ extern struct memory_range crash_reserved_mem;
|
||||||
|
extern struct memory_range elfcorehdr_mem;
|
||||||
|
|
||||||
|
extern int load_crashdump_segments(struct kexec_info *info);
|
||||||
|
+extern void fixup_elf_addrs(struct mem_ehdr *ehdr);
|
||||||
|
|
||||||
|
#endif /* CRASHDUMP_ARM64_H */
|
||||||
|
diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
|
||||||
|
index 153c96f73b3d..6c2175672305 100644
|
||||||
|
--- a/kexec/arch/arm64/kexec-arm64.c
|
||||||
|
+++ b/kexec/arch/arm64/kexec-arm64.c
|
||||||
|
@@ -308,12 +308,27 @@ unsigned long arm64_locate_kernel_segment(struct kexec_info *info)
|
||||||
|
{
|
||||||
|
unsigned long hole;
|
||||||
|
|
||||||
|
- hole = locate_hole(info,
|
||||||
|
- arm64_mem.text_offset + arm64_mem.image_size,
|
||||||
|
- MiB(2), 0, ULONG_MAX, 1);
|
||||||
|
+ if (info->kexec_flags & KEXEC_ON_CRASH) {
|
||||||
|
+ unsigned long hole_end;
|
||||||
|
+
|
||||||
|
+ hole = (crash_reserved_mem.start < mem_min ?
|
||||||
|
+ mem_min : crash_reserved_mem.start);
|
||||||
|
+ hole = _ALIGN_UP(hole, MiB(2));
|
||||||
|
+ hole_end = hole + arm64_mem.text_offset + arm64_mem.image_size;
|
||||||
|
+
|
||||||
|
+ if ((hole_end > mem_max) ||
|
||||||
|
+ (hole_end > crash_reserved_mem.end)) {
|
||||||
|
+ dbgprintf("%s: Crash kernel out of range\n", __func__);
|
||||||
|
+ hole = ULONG_MAX;
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ hole = locate_hole(info,
|
||||||
|
+ arm64_mem.text_offset + arm64_mem.image_size,
|
||||||
|
+ MiB(2), 0, ULONG_MAX, 1);
|
||||||
|
|
||||||
|
- if (hole == ULONG_MAX)
|
||||||
|
- dbgprintf("%s: locate_hole failed\n", __func__);
|
||||||
|
+ if (hole == ULONG_MAX)
|
||||||
|
+ dbgprintf("%s: locate_hole failed\n", __func__);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
return hole;
|
||||||
|
}
|
||||||
|
diff --git a/kexec/arch/arm64/kexec-elf-arm64.c b/kexec/arch/arm64/kexec-elf-arm64.c
|
||||||
|
index 900c6939ab62..a9611474ef51 100644
|
||||||
|
--- a/kexec/arch/arm64/kexec-elf-arm64.c
|
||||||
|
+++ b/kexec/arch/arm64/kexec-elf-arm64.c
|
||||||
|
@@ -9,6 +9,7 @@
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <linux/elf.h>
|
||||||
|
|
||||||
|
+#include "crashdump-arm64.h"
|
||||||
|
#include "kexec-arm64.h"
|
||||||
|
#include "kexec-elf.h"
|
||||||
|
#include "kexec-syscall.h"
|
||||||
|
@@ -105,7 +106,8 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
|
||||||
|
}
|
||||||
|
|
||||||
|
arm64_mem.vp_offset = _ALIGN_DOWN(ehdr.e_entry, MiB(2));
|
||||||
|
- arm64_mem.vp_offset -= kernel_segment - get_phys_offset();
|
||||||
|
+ if (!(info->kexec_flags & KEXEC_ON_CRASH))
|
||||||
|
+ arm64_mem.vp_offset -= kernel_segment - get_phys_offset();
|
||||||
|
|
||||||
|
dbgprintf("%s: kernel_segment: %016lx\n", __func__, kernel_segment);
|
||||||
|
dbgprintf("%s: text_offset: %016lx\n", __func__,
|
||||||
|
@@ -130,6 +132,13 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
|
||||||
|
}
|
||||||
|
|
||||||
|
/* load the kernel */
|
||||||
|
+ if (info->kexec_flags & KEXEC_ON_CRASH)
|
||||||
|
+ /*
|
||||||
|
+ * offset addresses in elf header in order to load
|
||||||
|
+ * vmlinux (elf_exec) into crash kernel's memory
|
||||||
|
+ */
|
||||||
|
+ fixup_elf_addrs(&ehdr);
|
||||||
|
+
|
||||||
|
result = elf_exec_load(&ehdr, info);
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
35
0042-arm64-kdump-set-up-other-segments.patch
Normal file
35
0042-arm64-kdump-set-up-other-segments.patch
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
From defad947feff0d0135f79893e99ca94ec9a59e0f Mon Sep 17 00:00:00 2001
|
||||||
|
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
Date: Wed, 17 May 2017 14:51:48 +0900
|
||||||
|
Subject: [PATCH 42/45] arm64: kdump: set up other segments
|
||||||
|
|
||||||
|
We make sure that all the other segments, initrd and device-tree blob,
|
||||||
|
also be loaded into the reserved memory of crash dump kernel.
|
||||||
|
|
||||||
|
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
Tested-by: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Tested-by: Pratyush Anand <panand@redhat.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/arm64/kexec-arm64.c | 5 ++++-
|
||||||
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
|
||||||
|
index 6c2175672305..dfe16a626136 100644
|
||||||
|
--- a/kexec/arch/arm64/kexec-arm64.c
|
||||||
|
+++ b/kexec/arch/arm64/kexec-arm64.c
|
||||||
|
@@ -376,7 +376,10 @@ int arm64_load_other_segments(struct kexec_info *info,
|
||||||
|
/* Put the other segments after the image. */
|
||||||
|
|
||||||
|
hole_min = image_base + arm64_mem.image_size;
|
||||||
|
- hole_max = ULONG_MAX;
|
||||||
|
+ if (info->kexec_flags & KEXEC_ON_CRASH)
|
||||||
|
+ hole_max = crash_reserved_mem.end;
|
||||||
|
+ else
|
||||||
|
+ hole_max = ULONG_MAX;
|
||||||
|
|
||||||
|
if (arm64_opts.initrd) {
|
||||||
|
initrd_buf = slurp_file(arm64_opts.initrd, &initrd_size);
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
282
0043-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch
Normal file
282
0043-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch
Normal file
@ -0,0 +1,282 @@
|
|||||||
|
From 5f955585c7c9166da5b8f33e3d8a4c43845ee70b Mon Sep 17 00:00:00 2001
|
||||||
|
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
Date: Wed, 17 May 2017 14:51:49 +0900
|
||||||
|
Subject: [PATCH 43/45] arm64: kdump: add DT properties to crash dump kernel's
|
||||||
|
dtb
|
||||||
|
|
||||||
|
We pass the following properties to crash dump kernel:
|
||||||
|
linux,elfcorehdr: elf core header segment,
|
||||||
|
same as "elfcorehdr=" kernel parameter on other archs
|
||||||
|
linux,usable-memory-range: usable memory reserved for crash dump kernel
|
||||||
|
|
||||||
|
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
Tested-by: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Tested-by: Pratyush Anand <panand@redhat.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/arm64/kexec-arm64.c | 197 ++++++++++++++++++++++++++++++++++++-
|
||||||
|
kexec/arch/arm64/kexec-elf-arm64.c | 5 -
|
||||||
|
2 files changed, 192 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
|
||||||
|
index dfe16a626136..62f37585b788 100644
|
||||||
|
--- a/kexec/arch/arm64/kexec-arm64.c
|
||||||
|
+++ b/kexec/arch/arm64/kexec-arm64.c
|
||||||
|
@@ -25,6 +25,14 @@
|
||||||
|
#include "kexec-syscall.h"
|
||||||
|
#include "arch/options.h"
|
||||||
|
|
||||||
|
+#define ROOT_NODE_ADDR_CELLS_DEFAULT 1
|
||||||
|
+#define ROOT_NODE_SIZE_CELLS_DEFAULT 1
|
||||||
|
+
|
||||||
|
+#define PROP_ADDR_CELLS "#address-cells"
|
||||||
|
+#define PROP_SIZE_CELLS "#size-cells"
|
||||||
|
+#define PROP_ELFCOREHDR "linux,elfcorehdr"
|
||||||
|
+#define PROP_USABLE_MEM_RANGE "linux,usable-memory-range"
|
||||||
|
+
|
||||||
|
/* Global varables the core kexec routines expect. */
|
||||||
|
|
||||||
|
unsigned char reuse_initrd;
|
||||||
|
@@ -129,9 +137,6 @@ int arch_process_options(int argc, char **argv)
|
||||||
|
case OPT_INITRD:
|
||||||
|
arm64_opts.initrd = optarg;
|
||||||
|
break;
|
||||||
|
- case OPT_PANIC:
|
||||||
|
- die("load-panic (-p) not supported");
|
||||||
|
- break;
|
||||||
|
default:
|
||||||
|
break; /* Ignore core and unknown options. */
|
||||||
|
}
|
||||||
|
@@ -282,12 +287,115 @@ on_success:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int get_cells_size(void *fdt, uint32_t *address_cells,
|
||||||
|
+ uint32_t *size_cells)
|
||||||
|
+{
|
||||||
|
+ int nodeoffset;
|
||||||
|
+ const uint32_t *prop = NULL;
|
||||||
|
+ int prop_len;
|
||||||
|
+
|
||||||
|
+ /* default values */
|
||||||
|
+ *address_cells = ROOT_NODE_ADDR_CELLS_DEFAULT;
|
||||||
|
+ *size_cells = ROOT_NODE_SIZE_CELLS_DEFAULT;
|
||||||
|
+
|
||||||
|
+ /* under root node */
|
||||||
|
+ nodeoffset = fdt_path_offset(fdt, "/");
|
||||||
|
+ if (nodeoffset < 0)
|
||||||
|
+ goto on_error;
|
||||||
|
+
|
||||||
|
+ prop = fdt_getprop(fdt, nodeoffset, PROP_ADDR_CELLS, &prop_len);
|
||||||
|
+ if (prop) {
|
||||||
|
+ if (prop_len == sizeof(*prop))
|
||||||
|
+ *address_cells = fdt32_to_cpu(*prop);
|
||||||
|
+ else
|
||||||
|
+ goto on_error;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ prop = fdt_getprop(fdt, nodeoffset, PROP_SIZE_CELLS, &prop_len);
|
||||||
|
+ if (prop) {
|
||||||
|
+ if (prop_len == sizeof(*prop))
|
||||||
|
+ *size_cells = fdt32_to_cpu(*prop);
|
||||||
|
+ else
|
||||||
|
+ goto on_error;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ dbgprintf("%s: #address-cells:%d #size-cells:%d\n", __func__,
|
||||||
|
+ *address_cells, *size_cells);
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+on_error:
|
||||||
|
+ return EFAILED;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static bool cells_size_fitted(uint32_t address_cells, uint32_t size_cells,
|
||||||
|
+ struct memory_range *range)
|
||||||
|
+{
|
||||||
|
+ dbgprintf("%s: %llx-%llx\n", __func__, range->start, range->end);
|
||||||
|
+
|
||||||
|
+ /* if *_cells >= 2, cells can hold 64-bit values anyway */
|
||||||
|
+ if ((address_cells == 1) && (range->start >= (1ULL << 32)))
|
||||||
|
+ return false;
|
||||||
|
+
|
||||||
|
+ if ((size_cells == 1) &&
|
||||||
|
+ ((range->end - range->start + 1) >= (1ULL << 32)))
|
||||||
|
+ return false;
|
||||||
|
+
|
||||||
|
+ return true;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void fill_property(void *buf, uint64_t val, uint32_t cells)
|
||||||
|
+{
|
||||||
|
+ uint32_t val32;
|
||||||
|
+ int i;
|
||||||
|
+
|
||||||
|
+ if (cells == 1) {
|
||||||
|
+ val32 = cpu_to_fdt32((uint32_t)val);
|
||||||
|
+ memcpy(buf, &val32, sizeof(uint32_t));
|
||||||
|
+ } else {
|
||||||
|
+ for (i = 0;
|
||||||
|
+ i < (cells * sizeof(uint32_t) - sizeof(uint64_t)); i++)
|
||||||
|
+ *(char *)buf++ = 0;
|
||||||
|
+
|
||||||
|
+ val = cpu_to_fdt64(val);
|
||||||
|
+ memcpy(buf, &val, sizeof(uint64_t));
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int fdt_setprop_range(void *fdt, int nodeoffset,
|
||||||
|
+ const char *name, struct memory_range *range,
|
||||||
|
+ uint32_t address_cells, uint32_t size_cells)
|
||||||
|
+{
|
||||||
|
+ void *buf, *prop;
|
||||||
|
+ size_t buf_size;
|
||||||
|
+ int result;
|
||||||
|
+
|
||||||
|
+ buf_size = (address_cells + size_cells) * sizeof(uint32_t);
|
||||||
|
+ prop = buf = xmalloc(buf_size);
|
||||||
|
+
|
||||||
|
+ fill_property(prop, range->start, address_cells);
|
||||||
|
+ prop += address_cells * sizeof(uint32_t);
|
||||||
|
+
|
||||||
|
+ fill_property(prop, range->end - range->start + 1, size_cells);
|
||||||
|
+ prop += size_cells * sizeof(uint32_t);
|
||||||
|
+
|
||||||
|
+ result = fdt_setprop(fdt, nodeoffset, name, buf, buf_size);
|
||||||
|
+
|
||||||
|
+ free(buf);
|
||||||
|
+
|
||||||
|
+ return result;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* setup_2nd_dtb - Setup the 2nd stage kernel's dtb.
|
||||||
|
*/
|
||||||
|
|
||||||
|
-static int setup_2nd_dtb(struct dtb *dtb, char *command_line)
|
||||||
|
+static int setup_2nd_dtb(struct dtb *dtb, char *command_line, int on_crash)
|
||||||
|
{
|
||||||
|
+ uint32_t address_cells, size_cells;
|
||||||
|
+ int range_len;
|
||||||
|
+ int nodeoffset;
|
||||||
|
+ char *new_buf = NULL;
|
||||||
|
+ int new_size;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
result = fdt_check_header(dtb->buf);
|
||||||
|
@@ -299,8 +407,86 @@ static int setup_2nd_dtb(struct dtb *dtb, char *command_line)
|
||||||
|
|
||||||
|
result = set_bootargs(dtb, command_line);
|
||||||
|
|
||||||
|
+ if (on_crash) {
|
||||||
|
+ /* determine #address-cells and #size-cells */
|
||||||
|
+ result = get_cells_size(dtb->buf, &address_cells, &size_cells);
|
||||||
|
+ if (result) {
|
||||||
|
+ fprintf(stderr,
|
||||||
|
+ "kexec: cannot determine cells-size.\n");
|
||||||
|
+ result = -EINVAL;
|
||||||
|
+ goto on_error;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!cells_size_fitted(address_cells, size_cells,
|
||||||
|
+ &elfcorehdr_mem)) {
|
||||||
|
+ fprintf(stderr,
|
||||||
|
+ "kexec: elfcorehdr doesn't fit cells-size.\n");
|
||||||
|
+ result = -EINVAL;
|
||||||
|
+ goto on_error;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!cells_size_fitted(address_cells, size_cells,
|
||||||
|
+ &crash_reserved_mem)) {
|
||||||
|
+ fprintf(stderr,
|
||||||
|
+ "kexec: usable memory range doesn't fit cells-size.\n");
|
||||||
|
+ result = -EINVAL;
|
||||||
|
+ goto on_error;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* duplicate dt blob */
|
||||||
|
+ range_len = sizeof(uint32_t) * (address_cells + size_cells);
|
||||||
|
+ new_size = fdt_totalsize(dtb->buf)
|
||||||
|
+ + fdt_prop_len(PROP_ELFCOREHDR, range_len)
|
||||||
|
+ + fdt_prop_len(PROP_USABLE_MEM_RANGE, range_len);
|
||||||
|
+
|
||||||
|
+ new_buf = xmalloc(new_size);
|
||||||
|
+ result = fdt_open_into(dtb->buf, new_buf, new_size);
|
||||||
|
+ if (result) {
|
||||||
|
+ dbgprintf("%s: fdt_open_into failed: %s\n", __func__,
|
||||||
|
+ fdt_strerror(result));
|
||||||
|
+ result = -ENOSPC;
|
||||||
|
+ goto on_error;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* add linux,elfcorehdr */
|
||||||
|
+ nodeoffset = fdt_path_offset(new_buf, "/chosen");
|
||||||
|
+ result = fdt_setprop_range(new_buf, nodeoffset,
|
||||||
|
+ PROP_ELFCOREHDR, &elfcorehdr_mem,
|
||||||
|
+ address_cells, size_cells);
|
||||||
|
+ if (result) {
|
||||||
|
+ dbgprintf("%s: fdt_setprop failed: %s\n", __func__,
|
||||||
|
+ fdt_strerror(result));
|
||||||
|
+ result = -EINVAL;
|
||||||
|
+ goto on_error;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* add linux,usable-memory-range */
|
||||||
|
+ nodeoffset = fdt_path_offset(new_buf, "/chosen");
|
||||||
|
+ result = fdt_setprop_range(new_buf, nodeoffset,
|
||||||
|
+ PROP_USABLE_MEM_RANGE, &crash_reserved_mem,
|
||||||
|
+ address_cells, size_cells);
|
||||||
|
+ if (result) {
|
||||||
|
+ dbgprintf("%s: fdt_setprop failed: %s\n", __func__,
|
||||||
|
+ fdt_strerror(result));
|
||||||
|
+ result = -EINVAL;
|
||||||
|
+ goto on_error;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ fdt_pack(new_buf);
|
||||||
|
+ dtb->buf = new_buf;
|
||||||
|
+ dtb->size = fdt_totalsize(new_buf);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
dump_reservemap(dtb);
|
||||||
|
|
||||||
|
+
|
||||||
|
+ return result;
|
||||||
|
+
|
||||||
|
+on_error:
|
||||||
|
+ fprintf(stderr, "kexec: %s failed.\n", __func__);
|
||||||
|
+ if (new_buf)
|
||||||
|
+ free(new_buf);
|
||||||
|
+
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -368,7 +554,8 @@ int arm64_load_other_segments(struct kexec_info *info,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- result = setup_2nd_dtb(&dtb, command_line);
|
||||||
|
+ result = setup_2nd_dtb(&dtb, command_line,
|
||||||
|
+ info->kexec_flags & KEXEC_ON_CRASH);
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
return EFAILED;
|
||||||
|
diff --git a/kexec/arch/arm64/kexec-elf-arm64.c b/kexec/arch/arm64/kexec-elf-arm64.c
|
||||||
|
index a9611474ef51..fc83b42c9d2b 100644
|
||||||
|
--- a/kexec/arch/arm64/kexec-elf-arm64.c
|
||||||
|
+++ b/kexec/arch/arm64/kexec-elf-arm64.c
|
||||||
|
@@ -47,11 +47,6 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
|
||||||
|
int result;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
- if (info->kexec_flags & KEXEC_ON_CRASH) {
|
||||||
|
- fprintf(stderr, "kexec: kdump not yet supported on arm64\n");
|
||||||
|
- return EFAILED;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
result = build_elf_exec_info(kernel_buf, kernel_size, &ehdr, 0);
|
||||||
|
|
||||||
|
if (result < 0) {
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
58
0044-arm64-kdump-Add-support-for-binary-image-files.patch
Normal file
58
0044-arm64-kdump-Add-support-for-binary-image-files.patch
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
From c504ff5d85aa035aed9f14f5ce96c5d959952dd9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pratyush Anand <panand@redhat.com>
|
||||||
|
Date: Wed, 17 May 2017 14:51:50 +0900
|
||||||
|
Subject: [PATCH 44/45] arm64: kdump: Add support for binary image files
|
||||||
|
|
||||||
|
This patch adds support to use binary image ie arch/arm64/boot/Image with
|
||||||
|
kdump.
|
||||||
|
|
||||||
|
Signed-off-by: Pratyush Anand <panand@redhat.com>
|
||||||
|
[takahiro.akashi@linaro.org: a bit reworked]
|
||||||
|
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
|
||||||
|
Tested-by: David Woodhouse <dwmw@amazon.co.uk>
|
||||||
|
Tested-by: Pratyush Anand <panand@redhat.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/arch/arm64/kexec-image-arm64.c | 13 +++++++++++++
|
||||||
|
1 file changed, 13 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/kexec/arch/arm64/kexec-image-arm64.c b/kexec/arch/arm64/kexec-image-arm64.c
|
||||||
|
index e5f2a9befdb1..e1b1e54b149f 100644
|
||||||
|
--- a/kexec/arch/arm64/kexec-image-arm64.c
|
||||||
|
+++ b/kexec/arch/arm64/kexec-image-arm64.c
|
||||||
|
@@ -4,7 +4,9 @@
|
||||||
|
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
|
+#include "crashdump-arm64.h"
|
||||||
|
#include "kexec-arm64.h"
|
||||||
|
+#include "kexec-syscall.h"
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
int image_arm64_probe(const char *kernel_buf, off_t kernel_size)
|
||||||
|
@@ -58,11 +60,22 @@ int image_arm64_load(int argc, char **argv, const char *kernel_buf,
|
||||||
|
dbgprintf("%s: PE format: %s\n", __func__,
|
||||||
|
(arm64_header_check_pe_sig(header) ? "yes" : "no"));
|
||||||
|
|
||||||
|
+ /* create and initialize elf core header segment */
|
||||||
|
+ if (info->kexec_flags & KEXEC_ON_CRASH) {
|
||||||
|
+ result = load_crashdump_segments(info);
|
||||||
|
+ if (result) {
|
||||||
|
+ dbgprintf("%s: Creating eflcorehdr failed.\n",
|
||||||
|
+ __func__);
|
||||||
|
+ goto exit;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* load the kernel */
|
||||||
|
add_segment_phys_virt(info, kernel_buf, kernel_size,
|
||||||
|
kernel_segment + arm64_mem.text_offset,
|
||||||
|
arm64_mem.image_size, 0);
|
||||||
|
|
||||||
|
+ /* load additional data */
|
||||||
|
result = arm64_load_other_segments(info, kernel_segment
|
||||||
|
+ arm64_mem.text_offset);
|
||||||
|
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
39
0045-Handle-additional-e820-memmap-type-strings.patch
Normal file
39
0045-Handle-additional-e820-memmap-type-strings.patch
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
From fab91841c717150aca4bc73e4c54769305e27ade Mon Sep 17 00:00:00 2001
|
||||||
|
From: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Date: Wed, 10 May 2017 11:03:37 -0500
|
||||||
|
Subject: [PATCH 45/45] Handle additional e820 memmap type strings
|
||||||
|
|
||||||
|
Keep pace with changes to linux arch/x86/kernel/e820.c to
|
||||||
|
function e820_type_to_string(). With this change, the following
|
||||||
|
messages from kexec are eliminated (and allows kexec to load):
|
||||||
|
|
||||||
|
Unknown type (Reserved) while parsing /sys/firmware/memmap/8/type.
|
||||||
|
Please report this as bug. Using RANGE_RESERVED now.
|
||||||
|
|
||||||
|
Unknown type (Unknown E820 type) while parsing /sys/firmware/memmap/4/type.
|
||||||
|
Please report this as bug. Using RANGE_RESERVED now.
|
||||||
|
|
||||||
|
Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>
|
||||||
|
Signed-off-by: Simon Horman <horms@verge.net.au>
|
||||||
|
---
|
||||||
|
kexec/firmware_memmap.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/kexec/firmware_memmap.c b/kexec/firmware_memmap.c
|
||||||
|
index 4d84f0011c57..1ee214aa9316 100644
|
||||||
|
--- a/kexec/firmware_memmap.c
|
||||||
|
+++ b/kexec/firmware_memmap.c
|
||||||
|
@@ -164,6 +164,10 @@ static int parse_memmap_entry(const char *entry, struct memory_range *range)
|
||||||
|
range->type = RANGE_RESERVED;
|
||||||
|
else if (strcmp(type, "reserved") == 0)
|
||||||
|
range->type = RANGE_RESERVED;
|
||||||
|
+ else if (strcmp(type, "Reserved") == 0)
|
||||||
|
+ range->type = RANGE_RESERVED;
|
||||||
|
+ else if (strcmp(type, "Unknown E820 type") == 0)
|
||||||
|
+ range->type = RANGE_RESERVED;
|
||||||
|
else if (strcmp(type, "ACPI Non-volatile Storage") == 0)
|
||||||
|
range->type = RANGE_ACPI_NVS;
|
||||||
|
else if (strcmp(type, "Uncached RAM") == 0)
|
||||||
|
--
|
||||||
|
2.13.0
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:874baf421171dbfca0084af2da71ccf5a67749dd2a27c3023da5f72460bae5cc
|
|
||||||
size 276824
|
|
3
kexec-tools-2.0.14.tar.gz
Normal file
3
kexec-tools-2.0.14.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:fbfa2b603a1f422e04eb565251c10e53c16ad97096d7cc8e615abe7bc8270596
|
||||||
|
size 360647
|
@ -1,34 +0,0 @@
|
|||||||
From: Tony Jones <tonyj@suse.de>
|
|
||||||
Subject: fixup aarch64 libfdt
|
|
||||||
Upstream: no
|
|
||||||
|
|
||||||
LIBS change had global scope, fix.
|
|
||||||
|
|
||||||
---
|
|
||||||
kexec/arch/arm64/Makefile | 9 ++++++---
|
|
||||||
1 file changed, 6 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
--- a/kexec/arch/arm64/Makefile
|
|
||||||
+++ b/kexec/arch/arm64/Makefile
|
|
||||||
@@ -2,9 +2,14 @@
|
|
||||||
arm64_FS2DT += kexec/fs2dt.c
|
|
||||||
arm64_FS2DT_INCLUDE += -include $(srcdir)/kexec/arch/arm64/kexec-arm64.h
|
|
||||||
|
|
||||||
+libfdt_SRCS += $(LIBFDT_SRCS:%=kexec/libfdt/%)
|
|
||||||
+
|
|
||||||
arm64_KEXEC_SRCS += \
|
|
||||||
kexec/arch/arm64/kexec-arm64.c \
|
|
||||||
- kexec/arch/arm64/kexec-elf-arm64.c
|
|
||||||
+ kexec/arch/arm64/kexec-elf-arm64.c \
|
|
||||||
+ $(libfdt_SRCS)
|
|
||||||
+
|
|
||||||
+arm64_CPPFLAGS = -I$(srcdir)/kexec/libfdt
|
|
||||||
|
|
||||||
arm64_ARCH_REUSE_INITRD =
|
|
||||||
arm64_ADD_SEGMENT =
|
|
||||||
@@ -13,5 +18,3 @@ arm64_VIRT_TO_PHYS =
|
|
||||||
dist += $(arm64_KEXEC_SRCS) \
|
|
||||||
kexec/arch/arm64/Makefile \
|
|
||||||
kexec/arch/arm64/kexec-arm64.h
|
|
||||||
-
|
|
||||||
-LIBS += -lfdt
|
|
@ -1,535 +0,0 @@
|
|||||||
From: Geoff Levand <geoff@infradead.org>
|
|
||||||
Date: Mon, 15 Jul 2013 23:32:36 +0000 (-0700)
|
|
||||||
Subject: Add arm64 support
|
|
||||||
Git-repo: https://git.linaro.org/people/geoff.levand/kexec-tools.git
|
|
||||||
Git-commit: 44a50d00fa02dbb43d19a267039b53422a11eb6
|
|
||||||
Signed-off-by: Dirk Müller <dmueller@suse.com>
|
|
||||||
|
|
||||||
Add arm64 support
|
|
||||||
|
|
||||||
Signed-off-by: Geoff Levand <geoff@infradead.org>
|
|
||||||
|
|
||||||
---
|
|
||||||
configure.ac | 3
|
|
||||||
kexec/Makefile | 1
|
|
||||||
kexec/arch/arm64/Makefile | 17 ++
|
|
||||||
kexec/arch/arm64/include/arch/options.h | 30 ++++
|
|
||||||
kexec/arch/arm64/kexec-arm64.c | 223 ++++++++++++++++++++++++++++++++
|
|
||||||
kexec/arch/arm64/kexec-arm64.h | 28 ++++
|
|
||||||
kexec/arch/arm64/kexec-elf-arm64.c | 147 +++++++++++++++++++++
|
|
||||||
kexec/kexec-syscall.h | 9 +
|
|
||||||
8 files changed, 456 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
--- a/configure.ac
|
|
||||||
+++ b/configure.ac
|
|
||||||
@@ -34,6 +34,9 @@ case $target_cpu in
|
|
||||||
ARCH="ppc64"
|
|
||||||
SUBARCH="LE"
|
|
||||||
;;
|
|
||||||
+ aarch64 )
|
|
||||||
+ ARCH="arm64"
|
|
||||||
+ ;;
|
|
||||||
arm* )
|
|
||||||
ARCH="arm"
|
|
||||||
;;
|
|
||||||
--- a/kexec/Makefile
|
|
||||||
+++ b/kexec/Makefile
|
|
||||||
@@ -75,6 +75,7 @@ KEXEC_SRCS += $($(ARCH)_MEM_REGIONS)
|
|
||||||
|
|
||||||
include $(srcdir)/kexec/arch/alpha/Makefile
|
|
||||||
include $(srcdir)/kexec/arch/arm/Makefile
|
|
||||||
+include $(srcdir)/kexec/arch/arm64/Makefile
|
|
||||||
include $(srcdir)/kexec/arch/i386/Makefile
|
|
||||||
include $(srcdir)/kexec/arch/ia64/Makefile
|
|
||||||
include $(srcdir)/kexec/arch/m68k/Makefile
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/kexec/arch/arm64/Makefile
|
|
||||||
@@ -0,0 +1,17 @@
|
|
||||||
+
|
|
||||||
+arm64_FS2DT += kexec/fs2dt.c
|
|
||||||
+arm64_FS2DT_INCLUDE += -include $(srcdir)/kexec/arch/arm64/kexec-arm64.h
|
|
||||||
+
|
|
||||||
+arm64_KEXEC_SRCS += \
|
|
||||||
+ kexec/arch/arm64/kexec-arm64.c \
|
|
||||||
+ kexec/arch/arm64/kexec-elf-arm64.c
|
|
||||||
+
|
|
||||||
+arm64_ARCH_REUSE_INITRD =
|
|
||||||
+arm64_ADD_SEGMENT =
|
|
||||||
+arm64_VIRT_TO_PHYS =
|
|
||||||
+
|
|
||||||
+dist += $(arm64_KEXEC_SRCS) \
|
|
||||||
+ kexec/arch/arm64/Makefile \
|
|
||||||
+ kexec/arch/arm64/kexec-arm64.h
|
|
||||||
+
|
|
||||||
+LIBS += -lfdt
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/kexec/arch/arm64/include/arch/options.h
|
|
||||||
@@ -0,0 +1,30 @@
|
|
||||||
+#ifndef KEXEC_ARCH_ARM64_OPTIONS_H
|
|
||||||
+#define KEXEC_ARCH_ARM64_OPTIONS_H
|
|
||||||
+
|
|
||||||
+#define OPT_APPEND ((OPT_MAX)+0)
|
|
||||||
+#define OPT_RAMDISK ((OPT_MAX)+1)
|
|
||||||
+#define OPT_DTB ((OPT_MAX)+2)
|
|
||||||
+#define OPT_ARCH_MAX ((OPT_MAX)+3)
|
|
||||||
+
|
|
||||||
+#define KEXEC_ARCH_OPTIONS \
|
|
||||||
+ KEXEC_OPTIONS \
|
|
||||||
+ { "append", 1, NULL, OPT_APPEND }, \
|
|
||||||
+ { "command-line", 1, NULL, OPT_APPEND }, \
|
|
||||||
+ { "dtb", 1, NULL, OPT_DTB }, \
|
|
||||||
+ { "initrd", 1, NULL, OPT_RAMDISK }, \
|
|
||||||
+ { "ramdisk", 1, NULL, OPT_RAMDISK }, \
|
|
||||||
+
|
|
||||||
+#define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR /* Only accept long arch options. */
|
|
||||||
+
|
|
||||||
+#define KEXEC_ALL_OPTIONS KEXEC_ARCH_OPTIONS
|
|
||||||
+#define KEXEC_ALL_OPT_STR KEXEC_ARCH_OPT_STR
|
|
||||||
+
|
|
||||||
+struct arm64_opts {
|
|
||||||
+ const char *command_line;
|
|
||||||
+ const char *ramdisk;
|
|
||||||
+ const char *dtb;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+struct arm64_opts arm64_opts;
|
|
||||||
+
|
|
||||||
+#endif /* KEXEC_ARCH_ARM64_OPTIONS_H */
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/kexec/arch/arm64/kexec-arm64.c
|
|
||||||
@@ -0,0 +1,223 @@
|
|
||||||
+/*
|
|
||||||
+ * ARM64 kexec support.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#define _GNU_SOURCE
|
|
||||||
+
|
|
||||||
+#include <errno.h>
|
|
||||||
+#include <getopt.h>
|
|
||||||
+#include <stddef.h>
|
|
||||||
+
|
|
||||||
+//#include <linux/kexec.h>
|
|
||||||
+
|
|
||||||
+#include "../../kexec.h"
|
|
||||||
+#include "../../kexec-syscall.h"
|
|
||||||
+#include "kexec-arm64.h"
|
|
||||||
+#include "arch/options.h"
|
|
||||||
+
|
|
||||||
+/* Global varables the core kexec routines expect. */
|
|
||||||
+
|
|
||||||
+unsigned char reuse_initrd;
|
|
||||||
+off_t initrd_base = 0;
|
|
||||||
+off_t initrd_size = 0;
|
|
||||||
+
|
|
||||||
+struct memory_ranges usablemem_rgns = {
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+const struct arch_map_entry arches[] = {
|
|
||||||
+ { "aarch64", KEXEC_ARCH_ARM64 },
|
|
||||||
+ { NULL, 0 },
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+/* arm64 global varables. */
|
|
||||||
+
|
|
||||||
+struct arm64_opts arm64_opts;
|
|
||||||
+
|
|
||||||
+void arch_usage(void)
|
|
||||||
+{
|
|
||||||
+ fprintf(stderr, "%s:%d: ->\n", __func__, __LINE__);
|
|
||||||
+
|
|
||||||
+ printf(
|
|
||||||
+" --append=STRING Set the kernel command line to STRING.\n"
|
|
||||||
+" --command-line=STRING Set the kernel command line to STRING.\n"
|
|
||||||
+" --dtb=FILE Use FILE as the device tree blob.\n"
|
|
||||||
+" --initrd=FILE Use FILE as the kernel initial ramdisk.\n"
|
|
||||||
+" --ramdisk=FILE Use FILE as the kernel initial ramdisk.\n");
|
|
||||||
+
|
|
||||||
+ fprintf(stderr, "%s:%d: <-\n", __func__, __LINE__);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int arch_process_options(int argc, char **argv)
|
|
||||||
+{
|
|
||||||
+ static const char short_options[] = KEXEC_OPT_STR "";
|
|
||||||
+ static const struct option options[] = {
|
|
||||||
+ KEXEC_ARCH_OPTIONS
|
|
||||||
+ { 0 }
|
|
||||||
+ };
|
|
||||||
+ int opt;
|
|
||||||
+
|
|
||||||
+ for (opt = 0; opt != -1; ) {
|
|
||||||
+ opt = getopt_long(argc, argv, short_options, options, 0);
|
|
||||||
+
|
|
||||||
+ switch (opt) {
|
|
||||||
+ case OPT_APPEND:
|
|
||||||
+ arm64_opts.command_line = optarg;
|
|
||||||
+ break;
|
|
||||||
+ case OPT_RAMDISK:
|
|
||||||
+ arm64_opts.ramdisk = optarg;
|
|
||||||
+ break;
|
|
||||||
+ case OPT_DTB:
|
|
||||||
+ arm64_opts.dtb = optarg;
|
|
||||||
+ break;
|
|
||||||
+ default:
|
|
||||||
+ break; /* Ignore core and unknown options */
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ dbgprintf("%s:%d: command_line: %s\n", __func__, __LINE__,
|
|
||||||
+ arm64_opts.command_line);
|
|
||||||
+ dbgprintf("%s:%d: ramdisk: %s\n", __func__, __LINE__,
|
|
||||||
+ arm64_opts.ramdisk);
|
|
||||||
+ dbgprintf("%s:%d: dtb: %s\n", __func__, __LINE__, arm64_opts.dtb);
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int is_crashkernel_mem_reserved(void)
|
|
||||||
+{
|
|
||||||
+ return 0; /* TODO: kdump not implemented yet. */
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void arch_reuse_initrd(void)
|
|
||||||
+{
|
|
||||||
+ reuse_initrd = 1;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void arch_update_purgatory(struct kexec_info *UNUSED(info))
|
|
||||||
+{
|
|
||||||
+ fprintf(stderr, "%s:%d: do\n", __func__, __LINE__);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+unsigned long virt_to_phys(unsigned long addr)
|
|
||||||
+{
|
|
||||||
+ fprintf(stderr, "%s:%d: %016lx -> %016lx\n", __func__, __LINE__, addr,
|
|
||||||
+ addr + 0x080000000UL);
|
|
||||||
+ return addr + 0x080000000UL;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void add_segment(struct kexec_info *info, const void *buf, size_t bufsz,
|
|
||||||
+ unsigned long base, size_t memsz)
|
|
||||||
+{
|
|
||||||
+ fprintf(stderr, "%s:%d: ->\n", __func__, __LINE__);
|
|
||||||
+ add_segment_phys_virt(info, buf, bufsz, base, memsz, 1);
|
|
||||||
+ fprintf(stderr, "%s:%d: <-\n", __func__, __LINE__);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int get_memory_ranges_1(struct memory_range **range, int *ranges,
|
|
||||||
+ unsigned long kexec_flags)
|
|
||||||
+{
|
|
||||||
+ static struct memory_range memory_range[KEXEC_SEGMENT_MAX];
|
|
||||||
+ const char *iomem;
|
|
||||||
+ int range_count = 0;
|
|
||||||
+ char line[MAX_LINE];
|
|
||||||
+ FILE *fp;
|
|
||||||
+
|
|
||||||
+ iomem = proc_iomem();
|
|
||||||
+ fp = fopen(iomem, "r");
|
|
||||||
+
|
|
||||||
+ if (!fp) {
|
|
||||||
+ fprintf(stderr, "Cannot open %s: %s\n",
|
|
||||||
+ iomem, strerror(errno));
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ dbgprintf("memory ranges:\n");
|
|
||||||
+
|
|
||||||
+ while(fgets(line, sizeof(line), fp) != 0) {
|
|
||||||
+ struct memory_range r;
|
|
||||||
+ char *str;
|
|
||||||
+ int consumed;
|
|
||||||
+
|
|
||||||
+ if (range_count >= KEXEC_SEGMENT_MAX)
|
|
||||||
+ break;
|
|
||||||
+
|
|
||||||
+ if (sscanf(line, "%Lx-%Lx : %n", &r.start, &r.end, &consumed)
|
|
||||||
+ != 2)
|
|
||||||
+ continue;
|
|
||||||
+
|
|
||||||
+ str = line + consumed;
|
|
||||||
+ r.end++;
|
|
||||||
+
|
|
||||||
+ if (memcmp(str, "System RAM\n", 11)) {
|
|
||||||
+ dbgprintf(" Skip: %016Lx - %016Lx : %s", r.start, r.end,
|
|
||||||
+ str);
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ r.type = RANGE_RAM;
|
|
||||||
+ memory_range[range_count] = r;
|
|
||||||
+ range_count++;
|
|
||||||
+
|
|
||||||
+ dbgprintf(" Add: %016Lx - %016Lx : %s", r.start, r.end, str);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ fclose(fp);
|
|
||||||
+ *range = memory_range;
|
|
||||||
+ *ranges = range_count;
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int get_memory_ranges_2(struct memory_range **range, int *ranges,
|
|
||||||
+ unsigned long UNUSED(kexec_flags))
|
|
||||||
+{
|
|
||||||
+ static struct memory_range memory_range[2];
|
|
||||||
+
|
|
||||||
+ memory_range[0].start = 0x080000000;
|
|
||||||
+ memory_range[0].end = 0x100000000;
|
|
||||||
+ memory_range[0].type = RANGE_RAM;
|
|
||||||
+
|
|
||||||
+ memory_range[1].start = 0x900000000;
|
|
||||||
+ memory_range[1].end = 0x880000000;
|
|
||||||
+ memory_range[1].type = RANGE_RAM;
|
|
||||||
+
|
|
||||||
+ *range = memory_range;
|
|
||||||
+ *ranges = sizeof(memory_range) / sizeof(memory_range[0]);
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int get_memory_ranges(struct memory_range **range, int *ranges,
|
|
||||||
+ unsigned long kexec_flags)
|
|
||||||
+{
|
|
||||||
+ /* FIXME: Should get this info from device tree. */
|
|
||||||
+
|
|
||||||
+ return get_memory_ranges_1(range, ranges, kexec_flags);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+struct file_type file_type[] = {
|
|
||||||
+ { "elf-arm64", elf_arm64_probe, elf_arm64_load, elf_arm64_usage },
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+int file_types = sizeof(file_type) / sizeof(file_type[0]);
|
|
||||||
+
|
|
||||||
+int arch_compat_trampoline(struct kexec_info *info)
|
|
||||||
+{
|
|
||||||
+ fprintf(stderr, "%s:%d: do\n", __func__, __LINE__);
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+int machine_verify_elf_rel(struct mem_ehdr *UNUSED(ehdr))
|
|
||||||
+{
|
|
||||||
+ fprintf(stderr, "%s:%d: do\n", __func__, __LINE__);
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void machine_apply_elf_rel(struct mem_ehdr *UNUSED(ehdr),
|
|
||||||
+ struct mem_sym *UNUSED(sym), unsigned long UNUSED(r_type),
|
|
||||||
+ void *UNUSED(location), unsigned long UNUSED(address),
|
|
||||||
+ unsigned long UNUSED(value))
|
|
||||||
+{
|
|
||||||
+ fprintf(stderr, "%s:%d: do\n", __func__, __LINE__);
|
|
||||||
+}
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/kexec/arch/arm64/kexec-arm64.h
|
|
||||||
@@ -0,0 +1,28 @@
|
|
||||||
+/*
|
|
||||||
+ * ARM64 kexec support.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#if !defined(KEXEC_ARM64_H)
|
|
||||||
+#define KEXEC_ARM64_H
|
|
||||||
+
|
|
||||||
+/* #include <linux/kexec.h> FIXME: this is broken */
|
|
||||||
+#include <sys/types.h>
|
|
||||||
+
|
|
||||||
+#include "../../kexec.h"
|
|
||||||
+
|
|
||||||
+#define KEXEC_SEGMENT_MAX 16 /* FIXME: this should come from <linux/kexec.h> */
|
|
||||||
+
|
|
||||||
+#define BOOT_BLOCK_VERSION 17
|
|
||||||
+#define BOOT_BLOCK_LAST_COMP_VERSION 16
|
|
||||||
+#define COMMAND_LINE_SIZE 512
|
|
||||||
+
|
|
||||||
+int elf_arm64_probe(const char *buf, off_t len);
|
|
||||||
+int elf_arm64_load(int argc, char **argv, const char *buf, off_t len,
|
|
||||||
+ struct kexec_info *info);
|
|
||||||
+void elf_arm64_usage(void);
|
|
||||||
+
|
|
||||||
+struct memory_ranges usablemem_rgns;
|
|
||||||
+off_t initrd_base;
|
|
||||||
+off_t initrd_size;
|
|
||||||
+
|
|
||||||
+#endif
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/kexec/arch/arm64/kexec-elf-arm64.c
|
|
||||||
@@ -0,0 +1,147 @@
|
|
||||||
+/*
|
|
||||||
+ * ARM64 kexec support.
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#define _GNU_SOURCE
|
|
||||||
+
|
|
||||||
+#include <elf.h>
|
|
||||||
+#include <getopt.h>
|
|
||||||
+#include <libfdt.h>
|
|
||||||
+
|
|
||||||
+#include "kexec-arm64.h"
|
|
||||||
+
|
|
||||||
+#include "../../kexec-syscall.h"
|
|
||||||
+#include "../../fs2dt.h"
|
|
||||||
+
|
|
||||||
+#include "arch/options.h"
|
|
||||||
+
|
|
||||||
+#if !defined(EM_AARCH64)
|
|
||||||
+# define EM_AARCH64 183
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+int elf_arm64_probe(const char *buf, off_t len)
|
|
||||||
+{
|
|
||||||
+ int result;
|
|
||||||
+ struct mem_ehdr ehdr;
|
|
||||||
+
|
|
||||||
+ fprintf(stderr, "%s:%d: ->\n", __func__, __LINE__);
|
|
||||||
+
|
|
||||||
+ result = build_elf_exec_info(buf, len, &ehdr, 0);
|
|
||||||
+
|
|
||||||
+ if (result < 0) {
|
|
||||||
+ dbgprintf("Not an ELF executable\n");
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (ehdr.e_machine != EM_AARCH64) {
|
|
||||||
+ dbgprintf("Not an AARCH64 executable\n");
|
|
||||||
+ result = -1;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ result = 0;
|
|
||||||
+
|
|
||||||
+out:
|
|
||||||
+ free_elf_info(&ehdr);
|
|
||||||
+ fprintf(stderr, "%s:%d: <-\n", __func__, __LINE__);
|
|
||||||
+ return result;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static off_t round_up(off_t v)
|
|
||||||
+{
|
|
||||||
+ return _ALIGN_DOWN(v + getpagesize(), getpagesize());
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int elf_arm64_load(int argc, char **argv, const char *buf, off_t len,
|
|
||||||
+ struct kexec_info *info)
|
|
||||||
+{
|
|
||||||
+ char *dtb_buf;
|
|
||||||
+ off_t dtb_base;
|
|
||||||
+ off_t dtb_size;
|
|
||||||
+ struct mem_ehdr ehdr;
|
|
||||||
+ int result;
|
|
||||||
+ //unsigned int command_line_len = strlen(arm64_opts.command_line) + 1;
|
|
||||||
+
|
|
||||||
+ fprintf(stderr, "%s:%d: ->\n", __func__, __LINE__);
|
|
||||||
+
|
|
||||||
+ if (info->kexec_flags & KEXEC_ON_CRASH) {
|
|
||||||
+ fprintf(stderr, "kexec: kdump not yet supported on arm64\n");
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ result = build_elf_exec_info(buf, len, &ehdr, 0);
|
|
||||||
+
|
|
||||||
+ if (result < 0) {
|
|
||||||
+ free_elf_info(&ehdr);
|
|
||||||
+ fprintf(stderr, "%s:%d: build_elf_exec_info failed\n", __func__,
|
|
||||||
+ __LINE__);
|
|
||||||
+ return result;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ elf_exec_build_load(info, &ehdr, buf, len, 0);
|
|
||||||
+
|
|
||||||
+ info->entry = (void*)0x80080000UL; // FIXME
|
|
||||||
+
|
|
||||||
+ initrd_base = 0;
|
|
||||||
+ initrd_size = 0;
|
|
||||||
+
|
|
||||||
+ if (arm64_opts.ramdisk) {
|
|
||||||
+ char *buf;
|
|
||||||
+
|
|
||||||
+ buf = slurp_file(arm64_opts.ramdisk, &initrd_size);
|
|
||||||
+
|
|
||||||
+ if (!buf)
|
|
||||||
+ fprintf(stderr, "kexec: empty ramdisk file\n");
|
|
||||||
+ else {
|
|
||||||
+ initrd_base = locate_hole(info, initrd_size, 0, 0, -1, -1);
|
|
||||||
+
|
|
||||||
+ add_segment_phys_virt(info, buf, initrd_size, initrd_base,
|
|
||||||
+ initrd_size, 0);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ fprintf(stderr, "%s:%d: initrd_base: %lx, initrd_size: %lx\n", __func__,
|
|
||||||
+ __LINE__, (unsigned long)initrd_base, (unsigned long)initrd_size);
|
|
||||||
+
|
|
||||||
+ if (arm64_opts.dtb)
|
|
||||||
+ dtb_buf = slurp_file(arm64_opts.dtb, &dtb_size);
|
|
||||||
+ else
|
|
||||||
+ create_flatten_tree(&dtb_buf, &dtb_size,
|
|
||||||
+ arm64_opts.command_line);
|
|
||||||
+
|
|
||||||
+ fprintf(stderr, "%s:%d: dt magic: %x : %x\n", __func__, __LINE__,
|
|
||||||
+ fdt32_to_cpu(*(uint32_t*)dtb_buf), *(uint32_t*)dtb_buf);
|
|
||||||
+
|
|
||||||
+ result = fdt_check_header(dtb_buf);
|
|
||||||
+
|
|
||||||
+ if (result) {
|
|
||||||
+ fprintf(stderr, "Invalid FDT.\n");
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (arm64_opts.command_line) {
|
|
||||||
+ // FIXME: need to handle command line...
|
|
||||||
+ fprintf(stderr, "%s:%d: command line support TODO\n", __func__, __LINE__);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+if (1) {
|
|
||||||
+ dtb_base = (unsigned long)info->entry + round_up(0xA43FA0); // computed kernel mem size.
|
|
||||||
+
|
|
||||||
+ fprintf(stderr, "%s:%d: dtb_base: %lx, dtb_size: %lx\n", __func__,
|
|
||||||
+ __LINE__, (unsigned long)dtb_base, (unsigned long)dtb_size);
|
|
||||||
+} else {
|
|
||||||
+ dtb_base = locate_hole(info, dtb_size, 0, 0, -1, -1);
|
|
||||||
+
|
|
||||||
+ fprintf(stderr, "%s:%d: dtb_base: %lx, dtb_size: %lx\n", __func__,
|
|
||||||
+ __LINE__, (unsigned long)dtb_base, (unsigned long)dtb_size);
|
|
||||||
+}
|
|
||||||
+ add_segment_phys_virt(info, dtb_buf, dtb_size, dtb_base, dtb_size, 0);
|
|
||||||
+
|
|
||||||
+ fprintf(stderr, "%s:%d: <-\n", __func__, __LINE__);
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void elf_arm64_usage(void)
|
|
||||||
+{
|
|
||||||
+ fprintf(stderr, "%s:%d\n", __func__, __LINE__);
|
|
||||||
+}
|
|
||||||
--- a/kexec/kexec-syscall.h
|
|
||||||
+++ b/kexec/kexec-syscall.h
|
|
||||||
@@ -39,8 +39,8 @@
|
|
||||||
#ifdef __s390__
|
|
||||||
#define __NR_kexec_load 277
|
|
||||||
#endif
|
|
||||||
-#ifdef __arm__
|
|
||||||
-#define __NR_kexec_load __NR_SYSCALL_BASE + 347
|
|
||||||
+#if defined(__arm__) || defined(__arm64__)
|
|
||||||
+#define __NR_kexec_load __NR_SYSCALL_BASE + 347
|
|
||||||
#endif
|
|
||||||
#if defined(__mips__)
|
|
||||||
#define __NR_kexec_load 4311
|
|
||||||
@@ -108,6 +108,8 @@ static inline long kexec_file_load(int k
|
|
||||||
#define KEXEC_ARCH_PPC64 (21 << 16)
|
|
||||||
#define KEXEC_ARCH_IA_64 (50 << 16)
|
|
||||||
#define KEXEC_ARCH_ARM (40 << 16)
|
|
||||||
+#define KEXEC_ARCH_ARM64 (183 << 16)
|
|
||||||
+/* #define KEXEC_ARCH_AARCH64 (183 << 16) */
|
|
||||||
#define KEXEC_ARCH_S390 (22 << 16)
|
|
||||||
#define KEXEC_ARCH_SH (42 << 16)
|
|
||||||
#define KEXEC_ARCH_MIPS_LE (10 << 16)
|
|
||||||
@@ -153,5 +155,8 @@ static inline long kexec_file_load(int k
|
|
||||||
#ifdef __m68k__
|
|
||||||
#define KEXEC_ARCH_NATIVE KEXEC_ARCH_68K
|
|
||||||
#endif
|
|
||||||
+#if defined(__arm64__)
|
|
||||||
+#define KEXEC_ARCH_NATIVE KEXEC_ARCH_ARM64
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
#endif /* KEXEC_SYSCALL_H */
|
|
@ -179,7 +179,7 @@ Disable ballooning before doing kexec.
|
|||||||
unsigned long machine = elf_info->machine;
|
unsigned long machine = elf_info->machine;
|
||||||
--- a/kexec/kexec.c
|
--- a/kexec/kexec.c
|
||||||
+++ b/kexec/kexec.c
|
+++ b/kexec/kexec.c
|
||||||
@@ -1168,6 +1168,7 @@ int main(int argc, char *argv[])
|
@@ -1240,6 +1240,7 @@ int main(int argc, char *argv[])
|
||||||
int do_shutdown = 1;
|
int do_shutdown = 1;
|
||||||
int do_sync = 1, skip_sync = 0;
|
int do_sync = 1, skip_sync = 0;
|
||||||
int do_ifdown = 0, skip_ifdown = 0;
|
int do_ifdown = 0, skip_ifdown = 0;
|
||||||
@ -187,7 +187,7 @@ Disable ballooning before doing kexec.
|
|||||||
int do_unload = 0;
|
int do_unload = 0;
|
||||||
int do_reuse_initrd = 0;
|
int do_reuse_initrd = 0;
|
||||||
int do_kexec_file_syscall = 0;
|
int do_kexec_file_syscall = 0;
|
||||||
@@ -1225,6 +1226,7 @@ int main(int argc, char *argv[])
|
@@ -1298,6 +1299,7 @@ int main(int argc, char *argv[])
|
||||||
do_shutdown = 0;
|
do_shutdown = 0;
|
||||||
do_sync = 1;
|
do_sync = 1;
|
||||||
do_ifdown = 1;
|
do_ifdown = 1;
|
||||||
@ -195,7 +195,7 @@ Disable ballooning before doing kexec.
|
|||||||
do_exec = 1;
|
do_exec = 1;
|
||||||
break;
|
break;
|
||||||
case OPT_LOAD:
|
case OPT_LOAD:
|
||||||
@@ -1245,6 +1247,7 @@ int main(int argc, char *argv[])
|
@@ -1318,6 +1320,7 @@ int main(int argc, char *argv[])
|
||||||
do_shutdown = 0;
|
do_shutdown = 0;
|
||||||
do_sync = 1;
|
do_sync = 1;
|
||||||
do_ifdown = 1;
|
do_ifdown = 1;
|
||||||
@ -203,7 +203,7 @@ Disable ballooning before doing kexec.
|
|||||||
do_exec = 1;
|
do_exec = 1;
|
||||||
break;
|
break;
|
||||||
case OPT_LOAD_JUMP_BACK_HELPER:
|
case OPT_LOAD_JUMP_BACK_HELPER:
|
||||||
@@ -1387,6 +1390,9 @@ int main(int argc, char *argv[])
|
@@ -1482,6 +1485,9 @@ int main(int argc, char *argv[])
|
||||||
if ((result == 0) && do_ifdown) {
|
if ((result == 0) && do_ifdown) {
|
||||||
ifdown();
|
ifdown();
|
||||||
}
|
}
|
||||||
@ -215,10 +215,11 @@ Disable ballooning before doing kexec.
|
|||||||
}
|
}
|
||||||
--- a/kexec/kexec.h
|
--- a/kexec/kexec.h
|
||||||
+++ b/kexec/kexec.h
|
+++ b/kexec/kexec.h
|
||||||
@@ -307,5 +307,6 @@ int xen_present(void);
|
@@ -316,6 +316,7 @@ int xen_kexec_load(struct kexec_info *in
|
||||||
int xen_kexec_load(struct kexec_info *info);
|
|
||||||
int xen_kexec_unload(uint64_t kexec_flags);
|
int xen_kexec_unload(uint64_t kexec_flags);
|
||||||
void xen_kexec_exec(void);
|
void xen_kexec_exec(void);
|
||||||
|
int xen_kexec_status(uint64_t kexec_flags);
|
||||||
+int xen_balloon_up(void);
|
+int xen_balloon_up(void);
|
||||||
|
|
||||||
#endif /* KEXEC_H */
|
extern unsigned long long get_kernel_sym(const char *text);
|
||||||
|
|
||||||
|
@ -10,14 +10,12 @@ Signed-off-by: Bernhard Walle <bwalle@suse.de>
|
|||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
---
|
---
|
||||||
configure.ac | 10 +++++++++-
|
configure.ac | 17 ++++++++++++++++-
|
||||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
1 file changed, 16 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
Index: kexec-tools-2.0.13/configure.ac
|
--- a/configure.ac
|
||||||
===================================================================
|
+++ b/configure.ac
|
||||||
--- kexec-tools-2.0.13.orig/configure.ac
|
@@ -164,8 +164,10 @@ fi
|
||||||
+++ kexec-tools-2.0.13/configure.ac
|
|
||||||
@@ -161,9 +161,24 @@ fi
|
|
||||||
|
|
||||||
dnl find Xen control stack libraries
|
dnl find Xen control stack libraries
|
||||||
if test "$with_xen" = yes ; then
|
if test "$with_xen" = yes ; then
|
||||||
@ -27,6 +25,12 @@ Index: kexec-tools-2.0.13/configure.ac
|
|||||||
+ [AC_CHECK_LIB(xenctrl, xc_kexec_load,
|
+ [AC_CHECK_LIB(xenctrl, xc_kexec_load,
|
||||||
+ [AC_DEFINE([HAVE_LIBXENCTRL], [1], [libxenctrl]) [LIBS="-Wl,-Bstatic -lxenctrl -lxencall -lxentoollog -lxendevicemodel -lxenforeignmemory -Wl,-Bdynamic -lpthread -ldl $LIBS"]],
|
+ [AC_DEFINE([HAVE_LIBXENCTRL], [1], [libxenctrl]) [LIBS="-Wl,-Bstatic -lxenctrl -lxencall -lxentoollog -lxendevicemodel -lxenforeignmemory -Wl,-Bdynamic -lpthread -ldl $LIBS"]],
|
||||||
AC_MSG_NOTICE([Xen support disabled]))])
|
AC_MSG_NOTICE([Xen support disabled]))])
|
||||||
|
if test "$ac_cv_lib_xenctrl_xc_kexec_load" = yes ; then
|
||||||
|
AC_CHECK_LIB(xenctrl, xc_kexec_status,
|
||||||
|
@@ -173,6 +175,19 @@ if test "$with_xen" = yes ; then
|
||||||
|
[The kexec_status call is available]),
|
||||||
|
AC_MSG_NOTICE([The kexec_status call is not available]))
|
||||||
|
fi
|
||||||
+ else
|
+ else
|
||||||
+ if pkg-config --exists 'xenlight > 4.6.0' ; then
|
+ if pkg-config --exists 'xenlight > 4.6.0' ; then
|
||||||
+ AC_CHECK_HEADER(xenctrl.h,
|
+ AC_CHECK_HEADER(xenctrl.h,
|
||||||
|
@ -1,3 +1,63 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed May 31 10:47:33 CEST 2017 - tiwai@suse.de
|
||||||
|
|
||||||
|
- Update to version 2.0.14 (bsc#1039937, FATE#320672, FATE#320671)
|
||||||
|
Changelog: http://git.kernel.org/cgit/utils/kernel/kexec/kexec-tools.git/log/?id=refs/tags/v2.0.13..v2.0.14
|
||||||
|
- Backport upstream fixes (bsc#1039937, FATE#320672, FATE#320671)
|
||||||
|
0001-kexec-tools-2.0.14.git.patch
|
||||||
|
0002-ppc64-Reduce-number-of-ELF-LOAD-segments.patch
|
||||||
|
0003-kexec-Increase-the-upper-limit-for-RAM-segments.patch
|
||||||
|
0004-alpha-add-missing-__NR_kexec_load-definition.patch
|
||||||
|
0005-kexec-implemented-XEN-KEXEC-STATUS-to-determine-if-a.patch
|
||||||
|
0006-kexec-Remove-redundant-space-from-help-message.patch
|
||||||
|
0007-purgatory-Add-purgatory.map-and-purgatory.ro.sym-to-.patch
|
||||||
|
0008-kexec-Add-option-to-get-crash-kernel-region-size.patch
|
||||||
|
0009-crashdump-arm-Add-get_crash_kernel_load_range-functi.patch
|
||||||
|
0010-crashdump-arm64-Add-get_crash_kernel_load_range-func.patch
|
||||||
|
0011-crashdump-cris-Add-get_crash_kernel_load_range-funct.patch
|
||||||
|
0012-crashdump-ia64-Add-get_crash_kernel_load_range-funct.patch
|
||||||
|
0013-crashdump-m68k-Add-get_crash_kernel_load_range-funct.patch
|
||||||
|
0014-crashdump-mips-Add-get_crash_kernel_load_range-funct.patch
|
||||||
|
0015-crashdump-ppc-Add-get_crash_kernel_load_range-functi.patch
|
||||||
|
0016-crashdump-ppc64-Add-get_crash_kernel_load_range-func.patch
|
||||||
|
0017-crashdump-s390-Add-get_crash_kernel_load_range-funct.patch
|
||||||
|
0018-crashdump-sh-Add-get_crash_kernel_load_range-functio.patch
|
||||||
|
0019-gitignore-add-two-generated-files-in-purgatory.patch
|
||||||
|
0020-Only-print-debug-message-when-failed-to-serach-for-k.patch
|
||||||
|
0021-build_mem_phdrs-check-if-p_paddr-is-invalid.patch
|
||||||
|
0022-uImage-fix-realloc-pointer-confusion.patch
|
||||||
|
0023-uImage-Fix-uImage_load-for-little-endian-machines.patch
|
||||||
|
0024-uImage-Add-new-IH_ARCH_xxx-definitions.patch
|
||||||
|
0025-uImage-use-char-instead-of-unsigned-char-for-uImage_.patch
|
||||||
|
0026-uImage-use-char-instead-of-unsigned-char-for-uImage_.patch
|
||||||
|
0027-arm64-add-uImage-support.patch
|
||||||
|
0028-vmcore-dmesg-Define-_GNU_SOURCE.patch
|
||||||
|
0029-Don-t-use-L-width-specifier-with-integer-values.patch
|
||||||
|
0030-x86-x86_64-Fix-format-warning-with-die.patch
|
||||||
|
0031-ppc-Fix-format-warning-with-die.patch
|
||||||
|
0032-crashdump-Remove-stray-get_crashkernel_region-declar.patch
|
||||||
|
0033-x86-Support-large-number-of-memory-ranges.patch
|
||||||
|
0034-Fix-broken-Xen-support-in-configure.ac.patch
|
||||||
|
0035-kexec-extend-the-semantics-of-kexec_iomem_for_each_l.patch
|
||||||
|
0036-kexec-generalize-and-rename-get_kernel_stext_sym.patch
|
||||||
|
0037-arm64-identify-PHYS_OFFSET-correctly.patch
|
||||||
|
0038-arm64-change-return-values-on-error-to-negative.patch
|
||||||
|
0039-arm64-kdump-identify-memory-regions.patch
|
||||||
|
0040-arm64-kdump-add-elf-core-header-segment.patch
|
||||||
|
0041-arm64-kdump-set-up-kernel-image-segment.patch
|
||||||
|
0042-arm64-kdump-set-up-other-segments.patch
|
||||||
|
0043-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch
|
||||||
|
0044-arm64-kdump-Add-support-for-binary-image-files.patch
|
||||||
|
0045-Handle-additional-e820-memmap-type-strings.patch
|
||||||
|
- Refreshed patches:
|
||||||
|
kexec-tools-xen-static.patch
|
||||||
|
kexec-tools-xen-balloon-up.patch
|
||||||
|
- Drop obsoleted arm64 patches:
|
||||||
|
kexec-tools-enable-aarch64-fixup.patch
|
||||||
|
kexec-tools-enable-aarch64.patch
|
||||||
|
- Fix source URL, as ftp was discontinued on korg
|
||||||
|
- Sync changelog with SLE12 packages
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed May 10 15:51:43 MDT 2017 - carnold@suse.com
|
Wed May 10 15:51:43 MDT 2017 - carnold@suse.com
|
||||||
|
|
||||||
@ -42,10 +102,16 @@ Fri Jun 3 18:16:51 UTC 2016 - tonyj@suse.com
|
|||||||
|
|
||||||
- Specifically name Files in specfile rather than using glob.
|
- Specifically name Files in specfile rather than using glob.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon May 30 08:47:49 UTC 2016 - ptesarik@suse.com
|
||||||
|
|
||||||
|
- kexec-tools-ppc64-reduce-elf-loads.patch: ppc64: Reduce number of
|
||||||
|
ELF LOAD segments (bsc#981339).
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue May 3 15:17:15 UTC 2016 - olaf@aepfle.de
|
Tue May 3 15:17:15 UTC 2016 - olaf@aepfle.de
|
||||||
|
|
||||||
- Adjust linking to libxenctrl to xen-4.7 API
|
- Adjust linking to libxenctrl to xen-4.7 API (fate#319989)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Dec 10 16:33:20 CET 2015 - tiwai@suse.de
|
Thu Dec 10 16:33:20 CET 2015 - tiwai@suse.de
|
||||||
@ -53,6 +119,20 @@ Thu Dec 10 16:33:20 CET 2015 - tiwai@suse.de
|
|||||||
- Fix missing dependency on coreutils for initrd macros (boo#958562)
|
- Fix missing dependency on coreutils for initrd macros (boo#958562)
|
||||||
- Call missing initrd macro at postun (boo#958562)
|
- Call missing initrd macro at postun (boo#958562)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Oct 26 09:33:04 UTC 2015 - ptesarik@suse.cz
|
||||||
|
|
||||||
|
- kexec-tools-vmcoreinfo-in-xen.patch: Store XEN_VMCOREINFO in
|
||||||
|
panic kernel ELF notes.
|
||||||
|
(bsc#951740)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Oct 14 04:11:05 UTC 2015 - jlee@suse.com
|
||||||
|
|
||||||
|
- kexec-tools-xen-inhibit-file-based-syscall.patch: To inhibit file
|
||||||
|
based syscall on XEN, using old syscall to load crash kernel.
|
||||||
|
(bsc#947172)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Oct 6 09:34:20 UTC 2015 - ptesarik@suse.com
|
Tue Oct 6 09:34:20 UTC 2015 - ptesarik@suse.com
|
||||||
|
|
||||||
@ -70,6 +150,12 @@ Fri Jun 26 07:33:16 UTC 2015 - ptesarik@suse.cz
|
|||||||
- Dropped patches (now upstream):
|
- Dropped patches (now upstream):
|
||||||
* kexec-tools-callback-function-proto.patch
|
* kexec-tools-callback-function-proto.patch
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon May 4 08:36:01 UTC 2015 - jlee@suse.com
|
||||||
|
|
||||||
|
- Add 'kexec-tools/kexec-tools-Provide-an-option-to-use-new-kexec-system-call.patch'
|
||||||
|
to support kdump on secure boot. (fate#315018, bnc#884453)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun Mar 29 01:53:16 UTC 2015 - crrodriguez@opensuse.org
|
Sun Mar 29 01:53:16 UTC 2015 - crrodriguez@opensuse.org
|
||||||
|
|
||||||
@ -148,6 +234,9 @@ Fri Apr 11 18:08:41 UTC 2014 - tonyj@suse.com
|
|||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Mar 18 16:45:14 UTC 2014 - tonyj@suse.com
|
Tue Mar 18 16:45:14 UTC 2014 - tonyj@suse.com
|
||||||
|
|
||||||
|
- Reserve mmconf areas for kdump kernel via memmap=X$Y in cmdline
|
||||||
|
(bnc#819777 [original: bnc#804800]: fix still needed for SGI UV systems).
|
||||||
|
New patch: kexec-tools-set-mmconf-reserved.patch
|
||||||
- Disable stack protector for ppc64le (bnc#869161)
|
- Disable stack protector for ppc64le (bnc#869161)
|
||||||
New patch: kexec-tools-ppc64-purgatory-disabling-gcc-stack-protection.patch
|
New patch: kexec-tools-ppc64-purgatory-disabling-gcc-stack-protection.patch
|
||||||
- Disable erroneous (efi memory descriptor version) message (bnc#867785c5)
|
- Disable erroneous (efi memory descriptor version) message (bnc#867785c5)
|
||||||
|
100
kexec-tools.spec
100
kexec-tools.spec
@ -28,9 +28,9 @@ Requires(postun): coreutils
|
|||||||
Summary: Tools for fast kernel loading
|
Summary: Tools for fast kernel loading
|
||||||
License: GPL-2.0+
|
License: GPL-2.0+
|
||||||
Group: System/Kernel
|
Group: System/Kernel
|
||||||
Version: 2.0.13
|
Version: 2.0.14
|
||||||
Release: 0
|
Release: 0
|
||||||
Source: ftp://kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.xz
|
Source: https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/snapshot/%{name}-%{version}.tar.gz
|
||||||
Source1: kexec-bootloader
|
Source1: kexec-bootloader
|
||||||
Source2: kexec-bootloader.8.txt
|
Source2: kexec-bootloader.8.txt
|
||||||
Source3: kexec-load.service
|
Source3: kexec-load.service
|
||||||
@ -38,8 +38,52 @@ Source4: %{name}-rpmlintrc
|
|||||||
Patch1: %{name}-xen-static.patch
|
Patch1: %{name}-xen-static.patch
|
||||||
Patch2: %{name}-xen-balloon-up.patch
|
Patch2: %{name}-xen-balloon-up.patch
|
||||||
Patch3: %{name}-disable-test.patch
|
Patch3: %{name}-disable-test.patch
|
||||||
Patch4: %{name}-enable-aarch64.patch
|
# upstream fixes
|
||||||
Patch5: %{name}-enable-aarch64-fixup.patch
|
Patch101: 0001-kexec-tools-2.0.14.git.patch
|
||||||
|
Patch102: 0002-ppc64-Reduce-number-of-ELF-LOAD-segments.patch
|
||||||
|
Patch103: 0003-kexec-Increase-the-upper-limit-for-RAM-segments.patch
|
||||||
|
Patch104: 0004-alpha-add-missing-__NR_kexec_load-definition.patch
|
||||||
|
Patch105: 0005-kexec-implemented-XEN-KEXEC-STATUS-to-determine-if-a.patch
|
||||||
|
Patch106: 0006-kexec-Remove-redundant-space-from-help-message.patch
|
||||||
|
Patch107: 0007-purgatory-Add-purgatory.map-and-purgatory.ro.sym-to-.patch
|
||||||
|
Patch108: 0008-kexec-Add-option-to-get-crash-kernel-region-size.patch
|
||||||
|
Patch109: 0009-crashdump-arm-Add-get_crash_kernel_load_range-functi.patch
|
||||||
|
Patch110: 0010-crashdump-arm64-Add-get_crash_kernel_load_range-func.patch
|
||||||
|
Patch111: 0011-crashdump-cris-Add-get_crash_kernel_load_range-funct.patch
|
||||||
|
Patch112: 0012-crashdump-ia64-Add-get_crash_kernel_load_range-funct.patch
|
||||||
|
Patch113: 0013-crashdump-m68k-Add-get_crash_kernel_load_range-funct.patch
|
||||||
|
Patch114: 0014-crashdump-mips-Add-get_crash_kernel_load_range-funct.patch
|
||||||
|
Patch115: 0015-crashdump-ppc-Add-get_crash_kernel_load_range-functi.patch
|
||||||
|
Patch116: 0016-crashdump-ppc64-Add-get_crash_kernel_load_range-func.patch
|
||||||
|
Patch117: 0017-crashdump-s390-Add-get_crash_kernel_load_range-funct.patch
|
||||||
|
Patch118: 0018-crashdump-sh-Add-get_crash_kernel_load_range-functio.patch
|
||||||
|
Patch119: 0019-gitignore-add-two-generated-files-in-purgatory.patch
|
||||||
|
Patch120: 0020-Only-print-debug-message-when-failed-to-serach-for-k.patch
|
||||||
|
Patch121: 0021-build_mem_phdrs-check-if-p_paddr-is-invalid.patch
|
||||||
|
Patch122: 0022-uImage-fix-realloc-pointer-confusion.patch
|
||||||
|
Patch123: 0023-uImage-Fix-uImage_load-for-little-endian-machines.patch
|
||||||
|
Patch124: 0024-uImage-Add-new-IH_ARCH_xxx-definitions.patch
|
||||||
|
Patch125: 0025-uImage-use-char-instead-of-unsigned-char-for-uImage_.patch
|
||||||
|
Patch126: 0026-uImage-use-char-instead-of-unsigned-char-for-uImage_.patch
|
||||||
|
Patch127: 0027-arm64-add-uImage-support.patch
|
||||||
|
Patch128: 0028-vmcore-dmesg-Define-_GNU_SOURCE.patch
|
||||||
|
Patch129: 0029-Don-t-use-L-width-specifier-with-integer-values.patch
|
||||||
|
Patch130: 0030-x86-x86_64-Fix-format-warning-with-die.patch
|
||||||
|
Patch131: 0031-ppc-Fix-format-warning-with-die.patch
|
||||||
|
Patch132: 0032-crashdump-Remove-stray-get_crashkernel_region-declar.patch
|
||||||
|
Patch133: 0033-x86-Support-large-number-of-memory-ranges.patch
|
||||||
|
Patch134: 0034-Fix-broken-Xen-support-in-configure.ac.patch
|
||||||
|
Patch135: 0035-kexec-extend-the-semantics-of-kexec_iomem_for_each_l.patch
|
||||||
|
Patch136: 0036-kexec-generalize-and-rename-get_kernel_stext_sym.patch
|
||||||
|
Patch137: 0037-arm64-identify-PHYS_OFFSET-correctly.patch
|
||||||
|
Patch138: 0038-arm64-change-return-values-on-error-to-negative.patch
|
||||||
|
Patch139: 0039-arm64-kdump-identify-memory-regions.patch
|
||||||
|
Patch140: 0040-arm64-kdump-add-elf-core-header-segment.patch
|
||||||
|
Patch141: 0041-arm64-kdump-set-up-kernel-image-segment.patch
|
||||||
|
Patch142: 0042-arm64-kdump-set-up-other-segments.patch
|
||||||
|
Patch143: 0043-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch
|
||||||
|
Patch144: 0044-arm64-kdump-Add-support-for-binary-image-files.patch
|
||||||
|
Patch145: 0045-Handle-additional-e820-memmap-type-strings.patch
|
||||||
|
|
||||||
Url: ftp://kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.bz2
|
Url: ftp://kernel.org/pub/linux/utils/kernel/kexec/%{name}-%{version}.tar.bz2
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
@ -63,11 +107,55 @@ the loaded kernel after it panics.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n kexec-tools-%{version}
|
%setup -q -n kexec-tools-%{version}
|
||||||
|
%patch101 -p1
|
||||||
|
%patch102 -p1
|
||||||
|
%patch103 -p1
|
||||||
|
%patch104 -p1
|
||||||
|
%patch105 -p1
|
||||||
|
%patch106 -p1
|
||||||
|
%patch107 -p1
|
||||||
|
%patch108 -p1
|
||||||
|
%patch109 -p1
|
||||||
|
%patch110 -p1
|
||||||
|
%patch111 -p1
|
||||||
|
%patch112 -p1
|
||||||
|
%patch113 -p1
|
||||||
|
%patch114 -p1
|
||||||
|
%patch115 -p1
|
||||||
|
%patch116 -p1
|
||||||
|
%patch117 -p1
|
||||||
|
%patch118 -p1
|
||||||
|
%patch119 -p1
|
||||||
|
%patch120 -p1
|
||||||
|
%patch121 -p1
|
||||||
|
%patch122 -p1
|
||||||
|
%patch123 -p1
|
||||||
|
%patch124 -p1
|
||||||
|
%patch125 -p1
|
||||||
|
%patch126 -p1
|
||||||
|
%patch127 -p1
|
||||||
|
%patch128 -p1
|
||||||
|
%patch129 -p1
|
||||||
|
%patch130 -p1
|
||||||
|
%patch131 -p1
|
||||||
|
%patch132 -p1
|
||||||
|
%patch133 -p1
|
||||||
|
%patch134 -p1
|
||||||
|
%patch135 -p1
|
||||||
|
%patch136 -p1
|
||||||
|
%patch137 -p1
|
||||||
|
%patch138 -p1
|
||||||
|
%patch139 -p1
|
||||||
|
%patch140 -p1
|
||||||
|
%patch141 -p1
|
||||||
|
%patch142 -p1
|
||||||
|
%patch143 -p1
|
||||||
|
%patch144 -p1
|
||||||
|
%patch145 -p1
|
||||||
|
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
%patch3 -p1
|
%patch3 -p1
|
||||||
%patch4 -p1
|
|
||||||
%patch5 -p1
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# disable as-needed
|
# disable as-needed
|
||||||
|
Loading…
Reference in New Issue
Block a user