kexec: sh: Fixed command line management.
Subsystems (2)
PATCH 1/1 kexec: sh: Fixed command line management.
This fixes the command line management to be rightly used by elf-sh and zImage-sh type formats. Basically, the issue was on use of --append option for both set and append the STRING at the cmdline. With this patch we correctly manage the cmdline by means of:
--append=STRING Append STRING to the current kernel command line
--command-line=STRING Set the kernel command line to STRING
Kexec by default gets and runs new kernel using the current kernel command line. Running kexec -h you will see its default options.
--- kexec/arch/sh/include/arch/options.h | 5 +++-- kexec/arch/sh/kexec-elf-sh.c | 11 ++++++++--- kexec/arch/sh/kexec-sh.c | 8 ++++---- kexec/arch/sh/kexec-zImage-sh.c | 16 ++++++++-------- 4 files changed, 23 insertions(+), 17 deletions(-)
kexec/arch/sh/include/arch/options.h +3 -2
@@ -6,13 +6,14 @@#define OPT_EMPTYZERO (OPT_ARCH_MAX+2)#define OPT_NBSD_HOWTO (OPT_ARCH_MAX+3)#define OPT_NBSD_MROOT (OPT_ARCH_MAX+4) +#define OPT_CMDLINE (OPT_ARCH_MAX+5)/* Options relevant to the architecture (excluding loader-specific ones): */ #define KEXEC_ARCH_OPTIONS \ KEXEC_OPTIONS \ - {"command-line", 1, 0, OPT_APPEND}, \ + {"command-line", 1, 0, OPT_CMDLINE}, \ {"append", 1, 0, OPT_APPEND}, \ - {"empty-zero", 1, 0, OPT_APPEND}, \ + {"empty-zero", 1, 0, OPT_EMPTYZERO}, \ {"howto", 1, 0, OPT_NBSD_HOWTO}, \ {"miniroot", 1, 0, OPT_NBSD_MROOT},/* These options seem to be loader-specific rather than cris-specific, so
kexec/arch/sh/kexec-elf-sh.c +8 -3
@@ -62,7 +62,8 @@ int elf_sh_probe(const char *buf, off_t len)void elf_sh_usage (void ) { -printf (" --append=STRING Set the kernel command line to STRING\n" +printf (" --command-line=STRING Set the kernel command line to STRING\n" +" --append=STRING Append STRING to the current kernel command line\n" ); }
@@ -84,7 +85,8 @@ int elf_sh_load(int argc, char **argv, const char *buf, off_t len,/* * Parse the command line arguments */ - command_line = modified_cmdline =0 ; + modified_cmdline =0 ; + command_line =get_command_line ();while ((opt =getopt_long (argc, argv, short_options, options,0 )) !=-1 ) {switch (opt) {default :
@@ -95,9 +97,12 @@ int elf_sh_load(int argc, char **argv, const char *buf, off_t len,case '?' :usage ();return -1 ; -case OPT_APPEND : +case OPT_CMDLINE : command_line = optarg;break ; +case OPT_APPEND : + command_line =concat_cmdline (command_line, optarg); +break ; } }
kexec/arch/sh/kexec-sh.c +4 -4
@@ -89,10 +89,9 @@ void arch_usage(void)printf (" none\n\n" "Default options:\n" -" --append=\"%s\"\n" -" STRING of --append is set from /proc/cmdline as default.\n" - ,get_append ()); - +" --command-line=\"%s\"\n" +" STRING of --command-line is set from /proc/cmdline as default.\n" + ,get_command_line ()); }int arch_process_options (int argc,char **argv)
@@ -120,6 +119,7 @@ int arch_process_options(int argc, char **argv)case '?' :usage ();return -1 ; +case OPT_CMDLINE :case OPT_APPEND :case OPT_NBSD_HOWTO :case OPT_NBSD_MROOT :
kexec/arch/sh/kexec-zImage-sh.c +8 -8
@@ -64,9 +64,9 @@ int zImage_sh_probe(const char *buf, off_t UNUSED(len))void zImage_sh_usage (void ) { -printf ( -" --append=STRING Set the kernel command line to STRING.\n" -" --empty-zero=ADDRESS Set the kernel top ADDRESS. \n\n" ); +printf (" --command-line=STRING Set the kernel command line to STRING\n" +" --append=STRING Append STRING to the current kernel command line\n" +" --empty-zero=ADDRESS Set the kernel top ADDRESS. \n\n" ); }
@@ -86,7 +86,7 @@ int zImage_sh_load(int argc, char **argv, const char *buf, off_t len,static const char short_options[] =KEXEC_ARCH_OPT_STR "" ; - command_line =0 ; + command_line =get_command_line ();while ((opt =getopt_long (argc, argv, short_options, options,0 )) !=-1 ) {switch (opt) {default :
@@ -97,15 +97,15 @@ int zImage_sh_load(int argc, char **argv, const char *buf, off_t len,case '?' :usage ();return -1 ; -case OPT_APPEND : +case OPT_CMDLINE : command_line = optarg;break ; +case OPT_APPEND : + command_line =concat_cmdline (command_line, optarg); +break ; } } -if (!command_line) - command_line =get_append (); -/* assume the zero page is the page before the vmlinux entry point. * we don't know the page size though, but 64k seems to be max. * put several 4k zero page copies before the entry point to cover
Signature · 7 lines
1.7.4.4 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Quoted 8 lines · Angelo CASTELLO
This fixes the command line management to be rightly used by elf-sh and zImage-sh type formats. Basically, the issue was on use of --append option for both set and append the STRING at the cmdline. With this patch we correctly manage the cmdline by means of:
--append=STRING Append STRING to the current kernel command line
--command-line=STRING Set the kernel command line to STRING
Kexec by default gets and runs new kernel using the current kernel command line. Running kexec -h you will see its default options.
Hi Angelo,
I don't believe that the changes to the processing of command-line that you have made are consistent with the implementation on other architectures.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 18 lines
-----Original Message-----
From: [email protected] [mailto:kexec- [email protected]] On Behalf Of Simon Horman
Sent: martedì 6 settembre 2011 0.30
To: Angelo CASTELLO
Cc: [email protected]
Subject: Re: [PATCH] kexec: sh: Fixed command line management.Quoted 5 lines · Angelo CASTELLO
This fixes the command line management to be rightly used by elf-sh and zImage-sh type formats. Basically, the issue was on use of --append option for both set and append the STRING at the cmdline. With this patch we correctly manage the cmdline by means of:
--append=STRING Append STRING to the current kernelcommand line
Quoted 3 lines
--command-line=STRING Set the kernel command line to STRING
Kexec by default gets and runs new kernel using the current kernel command line. Running kexec -h you will see its default
Quoted 7 lines
options.
Hi Angelo,
I don't believe that the changes to the processing of command-line that you have made are consistent with the implementation on other architectures.
Hi Simon,
To be consistent with the concepts of --append and --command-line, can I use the guide line implemented by the x86_64 ? Where we have:
{ "command-line", 1, NULL, OPT_APPEND },
{ "append", 1, NULL, OPT_APPEND },
{ "reuse-cmdline", 0, NULL, OPT_REUSE_CMDLINE },But from my point of view, one of them is redundant. Could be appropriate to change the meant of '--append' from 'set' to 'append',
for all architectures.
What do you think ?
Quoted 5 lines
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec