[PATCH 5/5] LoongArch: Remove redundant cmdline parameters when using --reuse-cmdline option
Youling Tang
tangyouling at loongson.cn
Tue Sep 27 19:28:26 PDT 2022
In LoongArch, when using the --reuse-cmdline option to reuse the current
command line, it may lead to redundancy (like kexec, initrd command line
arguments). In order to avoid the possible impact of initrd removal on other
architectures, remove_parameter will be called in a specific architecture
for processing.
Signed-off-by: Youling Tang <tangyouling at loongson.cn>
---
kexec/arch/loongarch/kexec-loongarch.c | 2 ++
kexec/kexec.c | 2 +-
kexec/kexec.h | 1 +
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/kexec/arch/loongarch/kexec-loongarch.c b/kexec/arch/loongarch/kexec-loongarch.c
index 3fdba01..4c7361c 100644
--- a/kexec/arch/loongarch/kexec-loongarch.c
+++ b/kexec/arch/loongarch/kexec-loongarch.c
@@ -219,6 +219,8 @@ int arch_process_options(int argc, char **argv)
break;
case OPT_REUSE_CMDLINE:
cmdline = get_command_line();
+ remove_parameter(cmdline, "kexec");
+ remove_parameter(cmdline, "initrd");
break;
case OPT_INITRD:
arch_options.initrd_file = optarg;
diff --git a/kexec/kexec.c b/kexec/kexec.c
index 829a6ea..0e92d96 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -1095,7 +1095,7 @@ static int k_status(unsigned long kexec_flags)
/*
* Remove parameter from a kernel command line. Helper function by get_command_line().
*/
-static void remove_parameter(char *line, const char *param_name)
+void remove_parameter(char *line, const char *param_name)
{
char *start, *end;
diff --git a/kexec/kexec.h b/kexec/kexec.h
index 8a05644..0d820ad 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -304,6 +304,7 @@ int arch_compat_trampoline(struct kexec_info *info);
void arch_update_purgatory(struct kexec_info *info);
int is_crashkernel_mem_reserved(void);
int get_crash_kernel_load_range(uint64_t *start, uint64_t *end);
+void remove_parameter(char *line, const char *param_name);
char *get_command_line(void);
int kexec_iomem_for_each_line(char *match,
--
2.36.0
More information about the kexec
mailing list