Rebase makedumpfile to 1.6.8

makedumpfile have moved to Github, so update the upstream URLs.
This commit is contained in:
Kairui Song 2020-11-30 16:48:02 +08:00
parent 7a77d5a267
commit 7d861422fa
3 changed files with 4 additions and 338 deletions

View File

@ -1,255 +0,0 @@
From 989152e113bfcb4fbfbad6f3aed6f43be4455919 Mon Sep 17 00:00:00 2001
From: Kazuhito Hagio <k-hagio-ab@nec.com>
Date: Tue, 25 Feb 2020 16:04:55 -0500
Subject: [PATCH] Introduce --check-params option
Currently it's difficult to check whether a makedumpfile command-line
is valid or not without an actual panic. This is inefficient and if
a wrong configuration is not tested, you will miss the vmcore when an
actual panic occurs.
In order for kdump facilities like kexec-tools to be able to check
the specified command-line parameters in advance, introduce the
--check-params option that only checks them and exits immediately.
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
---
makedumpfile.8 | 5 ++++
makedumpfile.c | 75 ++++++++++++++++++++++++++++++++++++++------------
print_info.c | 4 +++
4 files changed, 69 insertions(+), 17 deletions(-)
diff --git a/makedumpfile-1.6.7/makedumpfile.8 b/makedumpfile-1.6.7/makedumpfile.8
index bf156a8..c5d4806 100644
--- a/makedumpfile-1.6.7/makedumpfile.8
+++ b/makedumpfile-1.6.7/makedumpfile.8
@@ -632,6 +632,11 @@ Show help message and LZO/snappy support status (enabled/disabled).
\fB\-v\fR
Show the version of makedumpfile.
+.TP
+\fB\-\-check-params\fR
+Only check whether the command-line parameters are valid or not, and exit.
+Preferable to be given as the first parameter.
+
.SH ENVIRONMENT VARIABLES
.TP 8
diff --git a/makedumpfile-1.6.7/makedumpfile.c b/makedumpfile-1.6.7/makedumpfile.c
index 607e07f..f5860a1 100644
--- a/makedumpfile-1.6.7/makedumpfile.c
+++ b/makedumpfile-1.6.7/makedumpfile.c
@@ -10978,12 +10978,6 @@ check_param_for_creating_dumpfile(int argc, char *argv[])
if (info->flag_generate_vmcoreinfo || info->flag_rearrange)
return FALSE;
- if ((message_level < MIN_MSG_LEVEL)
- || (MAX_MSG_LEVEL < message_level)) {
- message_level = DEFAULT_MSG_LEVEL;
- MSG("Message_level is invalid.\n");
- return FALSE;
- }
if ((info->flag_compress && info->flag_elf_dumpfile)
|| (info->flag_read_vmcoreinfo && info->name_vmlinux)
|| (info->flag_read_vmcoreinfo && info->name_xen_syms))
@@ -11013,6 +11007,11 @@ check_param_for_creating_dumpfile(int argc, char *argv[])
if (info->flag_partial_dmesg && !info->flag_dmesg)
return FALSE;
+ if (info->flag_excludevm && !info->working_dir) {
+ MSG("-%c requires --work-dir\n", OPT_EXCLUDE_UNUSED_VM);
+ return FALSE;
+ }
+
if ((argc == optind + 2) && !info->flag_flatten
&& !info->flag_split
&& !info->flag_sadump_diskset) {
@@ -11408,6 +11407,23 @@ int show_mem_usage(void)
return TRUE;
}
+static int set_message_level(char *str_ml)
+{
+ int ml;
+
+ ml = atoi(str_ml);
+ if ((ml < MIN_MSG_LEVEL) || (MAX_MSG_LEVEL < ml)) {
+ message_level = DEFAULT_MSG_LEVEL;
+ MSG("Message_level(%d) is invalid.\n", ml);
+ return FALSE;
+ }
+
+ if (info->flag_check_params)
+ return TRUE;
+
+ message_level = ml;
+ return TRUE;
+}
static struct option longopts[] = {
{"split", no_argument, NULL, OPT_SPLIT},
@@ -11429,6 +11445,7 @@ static struct option longopts[] = {
{"splitblock-size", required_argument, NULL, OPT_SPLITBLOCK_SIZE},
{"work-dir", required_argument, NULL, OPT_WORKING_DIR},
{"num-threads", required_argument, NULL, OPT_NUM_THREADS},
+ {"check-params", no_argument, NULL, OPT_CHECK_PARAMS},
{0, 0, 0, 0}
};
@@ -11527,7 +11544,8 @@ main(int argc, char *argv[])
info->flag_compress = DUMP_DH_COMPRESSED_LZO;
break;
case OPT_MESSAGE_LEVEL:
- message_level = atoi(optarg);
+ if (!set_message_level(optarg))
+ goto out;
break;
case OPT_DUMP_DMESG:
info->flag_dmesg = 1;
@@ -11590,6 +11608,10 @@ main(int argc, char *argv[])
case OPT_NUM_THREADS:
info->num_threads = MAX(atoi(optarg), 0);
break;
+ case OPT_CHECK_PARAMS:
+ info->flag_check_params = TRUE;
+ message_level = DEFAULT_MSG_LEVEL;
+ break;
case '?':
MSG("Commandline parameter is invalid.\n");
MSG("Try `makedumpfile --help' for more information.\n");
@@ -11599,11 +11621,9 @@ main(int argc, char *argv[])
if (flag_debug)
message_level |= ML_PRINT_DEBUG_MSG;
- if (info->flag_excludevm && !info->working_dir) {
- ERRMSG("Error: -%c requires --work-dir\n", OPT_EXCLUDE_UNUSED_VM);
- ERRMSG("Try `makedumpfile --help' for more information\n");
- return COMPLETED;
- }
+ if (info->flag_check_params)
+ /* suppress debugging messages */
+ message_level = DEFAULT_MSG_LEVEL;
if (info->flag_show_usage) {
print_usage();
@@ -11634,6 +11654,9 @@ main(int argc, char *argv[])
MSG("Try `makedumpfile --help' for more information.\n");
goto out;
}
+ if (info->flag_check_params)
+ goto check_ok;
+
if (!open_files_for_generating_vmcoreinfo())
goto out;
@@ -11657,6 +11680,9 @@ main(int argc, char *argv[])
MSG("Try `makedumpfile --help' for more information.\n");
goto out;
}
+ if (info->flag_check_params)
+ goto check_ok;
+
if (!check_dump_file(info->name_dumpfile))
goto out;
@@ -11677,6 +11703,9 @@ main(int argc, char *argv[])
MSG("Try `makedumpfile --help' for more information.\n");
goto out;
}
+ if (info->flag_check_params)
+ goto check_ok;
+
if (!check_dump_file(info->name_dumpfile))
goto out;
@@ -11690,6 +11719,9 @@ main(int argc, char *argv[])
MSG("Try `makedumpfile --help' for more information.\n");
goto out;
}
+ if (info->flag_check_params)
+ goto check_ok;
+
if (!check_dump_file(info->name_dumpfile))
goto out;
if (!dump_dmesg())
@@ -11703,6 +11735,9 @@ main(int argc, char *argv[])
MSG("Try `makedumpfile --help' for more information.\n");
goto out;
}
+ if (info->flag_check_params)
+ goto check_ok;
+
if (!populate_kernel_version())
goto out;
@@ -11721,6 +11756,9 @@ main(int argc, char *argv[])
MSG("Try `makedumpfile --help' for more information.\n");
goto out;
}
+ if (info->flag_check_params)
+ goto check_ok;
+
if (info->flag_split) {
for (i = 0; i < info->num_dumpfile; i++) {
SPLITTING_FD_BITMAP(i) = -1;
@@ -11748,13 +11786,16 @@ main(int argc, char *argv[])
MSG("The dumpfile is saved to %s.\n", info->name_dumpfile);
}
}
+check_ok:
retcd = COMPLETED;
out:
- MSG("\n");
- if (retcd != COMPLETED)
- MSG("makedumpfile Failed.\n");
- else if (!info->flag_mem_usage)
- MSG("makedumpfile Completed.\n");
+ if (!info->flag_check_params) {
+ MSG("\n");
+ if (retcd != COMPLETED)
+ MSG("makedumpfile Failed.\n");
+ else if (!info->flag_mem_usage)
+ MSG("makedumpfile Completed.\n");
+ }
free_for_parallel();
diff --git a/makedumpfile-1.6.7/makedumpfile.h b/makedumpfile-1.6.7/makedumpfile.h
index 7217407..03fb4ce 100644
--- a/makedumpfile-1.6.7/makedumpfile.h
+++ b/makedumpfile-1.6.7/makedumpfile.h
@@ -1303,6 +1303,7 @@ struct DumpInfo {
int flag_read_vmcoreinfo; /* flag of reading vmcoreinfo file */
int flag_show_usage; /* flag of showing usage */
int flag_show_version; /* flag of showing version */
+ int flag_check_params; /* only check parameters */
int flag_flatten; /* flag of outputting flattened
format to a standard out */
int flag_rearrange; /* flag of creating dumpfile from
@@ -2364,6 +2365,7 @@ struct elf_prstatus {
#define OPT_WORKING_DIR OPT_START+15
#define OPT_NUM_THREADS OPT_START+16
#define OPT_PARTIAL_DMESG OPT_START+17
+#define OPT_CHECK_PARAMS OPT_START+18
/*
* Function Prototype.
diff --git a/makedumpfile-1.6.7/print_info.c b/makedumpfile-1.6.7/print_info.c
index 0be12ea..e0c38b4 100644
--- a/makedumpfile-1.6.7/print_info.c
+++ b/makedumpfile-1.6.7/print_info.c
@@ -321,6 +321,10 @@ print_usage(void)
MSG(" [-v]:\n");
MSG(" Show the version of makedumpfile.\n");
MSG("\n");
+ MSG(" [--check-params]:\n");
+ MSG(" Only check whether the command-line parameters are valid or not, and exit.\n");
+ MSG(" Preferable to be given as the first parameter.\n");
+ MSG("\n");
MSG(" VMLINUX:\n");
MSG(" This is a pathname to the first kernel's vmlinux.\n");
MSG(" This file must have the debug information of the first kernel to analyze\n");
--
2.24.1

View File

@ -1,76 +0,0 @@
From efa29d476996a20052be80878767cfe09e4b6224 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Wed, 29 Jan 2020 10:59:08 +0800
Subject: [PATCH] makedumpfile: Remove duplicated variable declarations
When building on Fedora 32, following error is observed:
/usr/bin/ld: erase_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:2010:
multiple definition of `crash_reserved_mem_nr'; elf_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:2010: first defined here
/usr/bin/ld: erase_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:2009:
multiple definition of `crash_reserved_mem'; elf_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:2009: first defined here
/usr/bin/ld: erase_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:1278:
multiple definition of `parallel_info_t'; elf_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:1278: first defined here
/usr/bin/ld: erase_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:1265:
multiple definition of `splitting_info_t'; elf_info.o:/builddir/build/BUILD/kexec-tools-2.0.20/makedumpfile-1.6.7/makedumpfile.h:1265: first defined here
And apparently, these variables are wrongly declared multiple times. So
remove duplicated declaration.
Signed-off-by: Kairui Song <kasong@redhat.com>
---
makedumpfile.c | 2 ++
makedumpfile.h | 10 ++++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/makedumpfile.c b/makedumpfile.c
index e290fbd..9aad77b 100644
--- a/makedumpfile-1.6.7/makedumpfile.c
+++ b/makedumpfile-1.6.7/makedumpfile.c
@@ -34,6 +34,8 @@ struct array_table array_table;
struct number_table number_table;
struct srcfile_table srcfile_table;
struct save_control sc;
+struct parallel_info parallel_info_t;
+struct splitting_info splitting_info_t;
struct vm_table vt = { 0 };
struct DumpInfo *info = NULL;
diff --git a/makedumpfile.h b/makedumpfile.h
index 68d9691..614764c 100644
--- a/makedumpfile-1.6.7/makedumpfile.h
+++ b/makedumpfile-1.6.7/makedumpfile.h
@@ -1262,7 +1262,8 @@ struct splitting_info {
mdf_pfn_t end_pfn;
off_t offset_eraseinfo;
unsigned long size_eraseinfo;
-} splitting_info_t;
+};
+extern struct splitting_info splitting_info_t;
struct parallel_info {
int fd_memory;
@@ -1275,7 +1276,8 @@ struct parallel_info {
#ifdef USELZO
lzo_bytep wrkmem;
#endif
-} parallel_info_t;
+};
+extern struct parallel_info parallel_info_t;
struct ppc64_vmemmap {
unsigned long phys;
@@ -2006,8 +2008,8 @@ struct memory_range {
};
#define CRASH_RESERVED_MEM_NR 8
-struct memory_range crash_reserved_mem[CRASH_RESERVED_MEM_NR];
-int crash_reserved_mem_nr;
+extern struct memory_range crash_reserved_mem[CRASH_RESERVED_MEM_NR];
+extern int crash_reserved_mem_nr;
unsigned long read_vmcoreinfo_symbol(char *str_symbol);
int readmem(int type_addr, unsigned long long addr, void *bufptr, size_t size);
--
2.24.1

View File

@ -1,6 +1,7 @@
%global eppic_ver d84c3541035d95077aa8571f5d5c3e07c6ef510b
%global eppic_shortver %(c=%{eppic_ver}; echo ${c:0:7})
%global mkdf_ver 1.6.7
%global mkdf_ver 1.6.8
%global mkdf_shortver %(c=%{mkdf_ver}; echo ${c:0:7})
Name: kexec-tools
Version: 2.0.20
@ -16,7 +17,7 @@ Source4: kdump.sysconfig.i386
Source5: kdump.sysconfig.ppc64
Source7: mkdumprd
Source8: kdump.conf
Source9: http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/%{mkdf_ver}/makedumpfile-%{mkdf_ver}.tar.gz
Source9: https://github.com/makedumpfile/makedumpfile/archive/%{mkdf_ver}/makedumpfile-%{mkdf_shortver}.tar.gz
Source10: kexec-kdump-howto.txt
Source11: fadump-howto.txt
Source12: mkdumprd.8
@ -100,9 +101,7 @@ Patch0: kexec-tools-2.0.20-fix-broken-multiboot2-buliding-for-i386.patch
# Patches 601 onward are generic patches
#
Patch601: ./kexec-tools-2.0.20-eppic-Remove-duplicated-variable-declaration.patch
Patch602: ./kexec-tools-2.0.20-makedumpfile-Remove-duplicated-variable-declarations.patch
Patch603: ./kexec-tools-2.0.20-Remove-duplicated-variable-declarations.patch
Patch604: ./kexec-tools-2.0.20-makedumpfile-Introduce-check-params-option.patch
Patch602: ./kexec-tools-2.0.20-Remove-duplicated-variable-declarations.patch
%description
kexec-tools provides /sbin/kexec binary that facilitates a new
@ -122,8 +121,6 @@ tar -z -x -v -f %{SOURCE19}
%patch601 -p1
%patch602 -p1
%patch603 -p1
%patch604 -p1
%ifarch ppc
%define archdef ARCH=ppc