diff options
author | Marcin Nowakowski <marcin.nowakowski@imgtec.com> | 2016-12-02 10:49:08 +0100 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2016-12-09 08:56:16 +0100 |
commit | fecd481fbe6102dac2beb467a616401a0cb8ab2e (patch) | |
tree | d8c5da5d6fd719146b31093121560977c73d2a62 /kexec/arch/mips/kexec-mips.c | |
parent | b5f715e98eac3025273d64685b511a97f817100b (diff) |
mips: move arch option parsing from elf loader to common arch code
At the moment only commandline handling is implemented and there is
nothing elf-specific about it, so all of the commandline parsing logic
can be moved to common arch code.
getopt() options are moved to KEXEC_ARCH_OPTIONS macro (as many
platforms currently do) to avoid unnecessary duplication.
Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/arch/mips/kexec-mips.c')
-rw-r--r-- | kexec/arch/mips/kexec-mips.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/kexec/arch/mips/kexec-mips.c b/kexec/arch/mips/kexec-mips.c index de9019a..867e9c3 100644 --- a/kexec/arch/mips/kexec-mips.c +++ b/kexec/arch/mips/kexec-mips.c @@ -74,6 +74,10 @@ int file_types = sizeof(file_type) / sizeof(file_type[0]); void arch_usage(void) { + printf( + " --command-line=STRING Set the kernel command line to STRING.\n" + " --append=STRING Set the kernel command line to STRING.\n" + ); } struct arch_options_t arch_options = { @@ -86,6 +90,24 @@ struct arch_options_t arch_options = { int arch_process_options(int argc, char **argv) { + static const struct option options[] = { + KEXEC_ARCH_OPTIONS + { 0 }, + }; + static const char short_options[] = KEXEC_ARCH_OPT_STR; + int opt; + + while ((opt = getopt_long(argc, argv, short_options, + options, 0)) != -1) { + switch (opt) { + case OPT_APPEND: + arch_options.command_line = optarg; + break; + default: + break; + } + } + return 0; } |