diff --git a/kexec-tools-2.0.23-05-s390_add_support_for_reuse_cmdline.patch b/kexec-tools-2.0.23-05-s390_add_support_for_reuse_cmdline.patch new file mode 100644 index 0000000..155ac7b --- /dev/null +++ b/kexec-tools-2.0.23-05-s390_add_support_for_reuse_cmdline.patch @@ -0,0 +1,75 @@ + commit 2e1ec106dc5aac951ba884ebe4cca036e9a2d45f + Author: Sven Schnelle + Date: Thu Dec 16 12:43:56 2021 +0100 + + s390: add support for --reuse-cmdline + + --reuse-cmdline reads the command line of the currently + running kernel from /proc/cmdline and uses that for the + kernel that should be kexec'd. + + Signed-off-by: Sven Schnelle + Reviewed-by: Alexander Egorenkov + Signed-off-by: Simon Horman + + diff --git a/kexec/arch/s390/include/arch/options.h b/kexec/arch/s390/include/arch/options.h + index 76044a301ceb3cca013f70dff330a8ad343d808a..c150244996c79165cf1e83e331f728432b752652 100644 + --- a/kexec/arch/s390/include/arch/options.h + +++ b/kexec/arch/s390/include/arch/options.h + @@ -1,9 +1,10 @@ + #ifndef KEXEC_ARCH_S390_OPTIONS_H + #define KEXEC_ARCH_S390_OPTIONS_H + + -#define OPT_ARCH_MAX (OPT_MAX+0) + -#define OPT_APPEND OPT_MAX+0 + -#define OPT_RAMDISK OPT_MAX+1 + +#define OPT_ARCH_MAX (OPT_MAX+0) + +#define OPT_APPEND (OPT_MAX+0) + +#define OPT_RAMDISK (OPT_MAX+1) + +#define OPT_REUSE_CMDLINE (OPT_MAX+2) + + /* Options relevant to the architecture (excluding loader-specific ones), + * in this case none: + @@ -31,7 +32,8 @@ + KEXEC_ARCH_OPTIONS \ + {"command-line", 1, 0, OPT_APPEND}, \ + {"append", 1, 0, OPT_APPEND}, \ + - {"initrd", 1, 0, OPT_RAMDISK}, + + {"initrd", 1, 0, OPT_RAMDISK}, \ + + {"reuse-cmdline", 0, 0, OPT_REUSE_CMDLINE }, + + #define KEXEC_ALL_OPT_STR KEXEC_ARCH_OPT_STR + + diff --git a/kexec/arch/s390/kexec-image.c b/kexec/arch/s390/kexec-image.c + index 209ab77ddccbd60f10989e2d9fc273324aefa76d..69aaf96812f741110bf323b4bb8d5dda155f293a 100644 + --- a/kexec/arch/s390/kexec-image.c + +++ b/kexec/arch/s390/kexec-image.c + @@ -71,6 +71,10 @@ int image_s390_load_file(int argc, char **argv, struct kexec_info *info) + case OPT_RAMDISK: + ramdisk = optarg; + break; + + case OPT_REUSE_CMDLINE: + + free(info->command_line); + + info->command_line = get_command_line(); + + break; + } + } + + @@ -123,6 +127,10 @@ image_s390_load(int argc, char **argv, const char *kernel_buf, + if (command_line_add(info, optarg)) + return -1; + break; + + case OPT_REUSE_CMDLINE: + + free(info->command_line); + + info->command_line = get_command_line(); + + break; + case OPT_RAMDISK: + ramdisk = optarg; + break; + @@ -223,5 +231,6 @@ image_s390_usage(void) + printf("--command-line=STRING Set the kernel command line to STRING.\n" + "--append=STRING Set the kernel command line to STRING.\n" + "--initrd=FILENAME Use the file FILENAME as a ramdisk.\n" + + "--reuse-cmdline Use kernel command line from running system.\n" + ); + } diff --git a/kexec-tools.spec b/kexec-tools.spec index 5e9ff1c..b3825dd 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -108,6 +108,7 @@ Patch401: ./kexec-tools-2.0.23-01-s390_add_variable_command_line_size.patch Patch402: ./kexec-tools-2.0.23-02-s390_use_KEXEC_ALL_OPTIONS.patch Patch403: ./kexec-tools-2.0.23-03-add_slurp_proc_file_.patch Patch404: ./kexec-tools-2.0.23-04-use_slurp_proc_file_in_get_command_line_.patch +Patch405: ./kexec-tools-2.0.23-05-s390_add_support_for_reuse_cmdline.patch # # Patches 501 through 600 are meant for ARM kexec-tools enablement @@ -142,6 +143,7 @@ tar -z -x -v -f %{SOURCE19} %patch402 -p1 %patch403 -p1 %patch404 -p1 +%patch405 -p1 %patch601 -p1 %patch602 -p1 %patch603 -p1