Blame SOURCES/kexec-tools-2.0.8-arm64-Add-support-for-reuse-cmdline-option.patch

de80c6
From 0a94e5bfd2a050f266e897d930914428ff92d1a8 Mon Sep 17 00:00:00 2001
de80c6
Message-Id: <0a94e5bfd2a050f266e897d930914428ff92d1a8.1429703426.git.panand@redhat.com>
de80c6
In-Reply-To: <de1db775d6e9b51f014442677863b57b8566c510.1429703426.git.panand@redhat.com>
de80c6
References: <de1db775d6e9b51f014442677863b57b8566c510.1429703426.git.panand@redhat.com>
de80c6
From: Pratyush Anand <panand@redhat.com>
de80c6
Date: Fri, 17 Apr 2015 10:54:55 -0700
de80c6
Subject: [PATCH 03/15] arm64: Add support for --reuse-cmdline option
de80c6
de80c6
Signed-off-by: Pratyush Anand <panand@redhat.com>
de80c6
Signed-off-by: Geoff Levand <geoff@infradead.org>
de80c6
---
de80c6
 kexec/arch/arm64/include/arch/options.h | 7 +++++--
de80c6
 kexec/arch/arm64/kexec-arm64.c          | 8 +++++++-
de80c6
 2 files changed, 12 insertions(+), 3 deletions(-)
de80c6
de80c6
diff --git a/kexec/arch/arm64/include/arch/options.h b/kexec/arch/arm64/include/arch/options.h
de80c6
index 51afc5f1f6f2..903b4a1fbd7f 100644
de80c6
--- a/kexec/arch/arm64/include/arch/options.h
de80c6
+++ b/kexec/arch/arm64/include/arch/options.h
de80c6
@@ -6,7 +6,8 @@
de80c6
 #define OPT_INITRD	((OPT_MAX)+2)
de80c6
 #define OPT_LITE	((OPT_MAX)+3)
de80c6
 #define OPT_PORT	((OPT_MAX)+4)
de80c6
-#define OPT_ARCH_MAX	((OPT_MAX)+5)
de80c6
+#define OPT_REUSE_CMDLINE	((OPT_MAX+5))
de80c6
+#define OPT_ARCH_MAX	((OPT_MAX)+6)
de80c6
 
de80c6
 #define KEXEC_ARCH_OPTIONS \
de80c6
 	KEXEC_OPTIONS \
de80c6
@@ -17,6 +18,7 @@
de80c6
 	{ "lite",         0, NULL, OPT_LITE }, \
de80c6
 	{ "port",         1, NULL, OPT_PORT }, \
de80c6
 	{ "ramdisk",      1, NULL, OPT_INITRD }, \
de80c6
+	{ "reuse-cmdline", 0, NULL, OPT_REUSE_CMDLINE }, \
de80c6
 
de80c6
 #define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR /* Only accept long arch options. */
de80c6
 #define KEXEC_ALL_OPTIONS KEXEC_ARCH_OPTIONS
de80c6
@@ -29,7 +31,8 @@ static const char arm64_opts_usage[] __attribute__ ((unused)) =
de80c6
 "     --initrd=FILE         Use FILE as the kernel initial ramdisk.\n"
de80c6
 "     --lite                Fast reboot, no memory integrity checks - currently NOT SUPPORTED.\n");
de80c6
 "     --port=ADDRESS        Purgatory output to port ADDRESS.\n"
de80c6
-"     --ramdisk=FILE        Use FILE as the kernel initial ramdisk.\n";
de80c6
+"     --ramdisk=FILE        Use FILE as the kernel initial ramdisk.\n"
de80c6
+"     --reuse-cmdline       Use command line arg of primary kernel.\n";
de80c6
 
de80c6
 struct arm64_opts {
de80c6
 	const char *command_line;
de80c6
diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
de80c6
index 0860810b6e86..22d70244f8db 100644
de80c6
--- a/kexec/arch/arm64/kexec-arm64.c
de80c6
+++ b/kexec/arch/arm64/kexec-arm64.c
de80c6
@@ -75,13 +75,18 @@ int arch_process_options(int argc, char **argv)
de80c6
 		{ 0 }
de80c6
 	};
de80c6
 	int opt;
de80c6
+	const char *append = NULL;
de80c6
+	char *tmp_cmdline = NULL;
de80c6
 
de80c6
 	for (opt = 0; opt != -1; ) {
de80c6
 		opt = getopt_long(argc, argv, short_options, options, 0);
de80c6
 
de80c6
 		switch (opt) {
de80c6
 		case OPT_APPEND:
de80c6
-			arm64_opts.command_line = optarg;
de80c6
+			append = optarg;
de80c6
+			break;
de80c6
+		case OPT_REUSE_CMDLINE:
de80c6
+			tmp_cmdline = get_command_line();
de80c6
 			break;
de80c6
 		case OPT_DTB:
de80c6
 			arm64_opts.dtb = optarg;
de80c6
@@ -101,6 +106,7 @@ int arch_process_options(int argc, char **argv)
de80c6
 		}
de80c6
 	}
de80c6
 
de80c6
+	arm64_opts.command_line = concat_cmdline(tmp_cmdline, append);
de80c6
 	kexec_debug = 1; // FIXME: for debugging only.
de80c6
 
de80c6
 	dbgprintf("%s:%d: command_line: %s\n", __func__, __LINE__,
de80c6
-- 
de80c6
2.1.0
de80c6