summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYouling Tang <tangyouling@loongson.cn>2021-02-24 13:29:41 +0800
committerSimon Horman <horms@verge.net.au>2021-04-02 11:55:20 +0200
commit15ee19f187ecbe43a2fad0834b91b0d70c413852 (patch)
tree4d3492c8922cb4029c1933753ad8f414b6b088f1
parentb4feb36985d76ef7f4c74a7c51f4843c71c728e8 (diff)
downloadkexec-tools-15ee19f187ecbe43a2fad0834b91b0d70c413852.tar.gz
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 <tangyouling@loongson.cn> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/arch/mips/include/arch/options.h12
-rw-r--r--kexec/arch/mips/kexec-mips.c4
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;