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