summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYouling Tang <tangyouling@loongson.cn>2022-09-28 10:28:26 +0800
committerSimon Horman <horms@kernel.org>2022-10-10 13:36:01 +0200
commit834be38cc0444799dff4809f69d3eac5eeac9a63 (patch)
treeeaee8a32272f16a3df0979d6426fdf77f0dd025d
parent84138f41efd53434ede8aaa052763270eff45357 (diff)
downloadkexec-tools-834be38cc0444799dff4809f69d3eac5eeac9a63.tar.gz
LoongArch: Remove redundant cmdline parameters when using --reuse-cmdline option
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@loongson.cn> Signed-off-by: Simon Horman <horms@kernel.org>
-rw-r--r--kexec/arch/loongarch/kexec-loongarch.c2
-rw-r--r--kexec/kexec.c2
-rw-r--r--kexec/kexec.h1
3 files changed, 4 insertions, 1 deletions
diff --git a/kexec/arch/loongarch/kexec-loongarch.c b/kexec/arch/loongarch/kexec-loongarch.c
index 3fdba01f..4c7361ca 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 829a6eac..0e92d967 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 8a056447..0d820ada 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,