From 15ee19f187ecbe43a2fad0834b91b0d70c413852 Mon Sep 17 00:00:00 2001 From: Youling Tang Date: Wed, 24 Feb 2021 13:29:41 +0800 Subject: mips: Add '--reuse-cmdline' optional parameter support This patch adds an option "--reuse-cmdline" for people that are lazy in typing --append="$(cat /proc/cmdline)", which will directly use the command line of the currently running system. Signed-off-by: Youling Tang Signed-off-by: Simon Horman --- kexec/arch/mips/include/arch/options.h | 12 +++++++----- kexec/arch/mips/kexec-mips.c | 4 ++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/kexec/arch/mips/include/arch/options.h b/kexec/arch/mips/include/arch/options.h index 416e2249..ba2f346e 100644 --- a/kexec/arch/mips/include/arch/options.h +++ b/kexec/arch/mips/include/arch/options.h @@ -1,10 +1,11 @@ #ifndef KEXEC_ARCH_MIPS_OPTIONS_H #define KEXEC_ARCH_MIPS_OPTIONS_H -#define OPT_ARCH_MAX (OPT_MAX+0) -#define OPT_APPEND (OPT_ARCH_MAX+0) -#define OPT_DTB (OPT_ARCH_MAX+1) -#define OPT_RAMDISK (OPT_ARCH_MAX+2) +#define OPT_ARCH_MAX (OPT_MAX+0) +#define OPT_APPEND (OPT_ARCH_MAX+0) +#define OPT_DTB (OPT_ARCH_MAX+1) +#define OPT_RAMDISK (OPT_ARCH_MAX+2) +#define OPT_REUSE_CMDLINE (OPT_ARCH_MAX+3) /* Options relevant to the architecture (excluding loader-specific ones), * in this case none: @@ -14,7 +15,8 @@ {"command-line", 1, 0, OPT_APPEND}, \ {"append", 1, 0, OPT_APPEND}, \ {"dtb", 1, 0, OPT_DTB }, \ - {"initrd", 1, 0, OPT_RAMDISK }, + {"initrd", 1, 0, OPT_RAMDISK }, \ + { "reuse-cmdline", 0, NULL, OPT_REUSE_CMDLINE }, #define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR "" diff --git a/kexec/arch/mips/kexec-mips.c b/kexec/arch/mips/kexec-mips.c index 415c2ed4..a9c6a096 100644 --- a/kexec/arch/mips/kexec-mips.c +++ b/kexec/arch/mips/kexec-mips.c @@ -89,6 +89,7 @@ void arch_usage(void) " --append=STRING Set the kernel command line to STRING.\n" " --dtb=FILE Use FILE as the device tree blob.\n" " --initrd=FILE Use FILE as initial ramdisk.\n" + " --reuse-cmdline Use kernel command line from running system.\n" ); } @@ -115,6 +116,9 @@ int arch_process_options(int argc, char **argv) case OPT_APPEND: arch_options.command_line = optarg; break; + case OPT_REUSE_CMDLINE: + arch_options.command_line = get_command_line(); + break; case OPT_DTB: arch_options.dtb_file = optarg; break; -- cgit 1.2.3-korg