summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordyoung@redhat.com <dyoung@redhat.com>2015-10-28 13:41:36 +0800
committerSimon Horman <horms@verge.net.au>2015-10-30 08:35:36 +0900
commit1d13b61a6ae456c1de384f81ae862c216143bf44 (patch)
tree5f1a1665d65433fa191c62478d17e4f95692fc3f
parenta1ae68d19b6e3534ead0aab04ca84de24962def7 (diff)
arm: add arch option --dt-no-old-root
When createing fdt from /proc/device-tree, if there's local --command-line option provided but there's no root= specified, kexec-tools will copy the root= param from 1st kernel cmdline by default. In case one want kexec boot without root= it will be impossible. Thus add the new option so that one can provide --dt-no-old-root for above mentioned case. Signed-off-by: Dave Young <dyoung@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/arch/arm/include/arch/options.h4
-rw-r--r--kexec/arch/arm/kexec-arm.c29
2 files changed, 31 insertions, 2 deletions
diff --git a/kexec/arch/arm/include/arch/options.h b/kexec/arch/arm/include/arch/options.h
index 6437c7d..abbf349 100644
--- a/kexec/arch/arm/include/arch/options.h
+++ b/kexec/arch/arm/include/arch/options.h
@@ -1,7 +1,8 @@
#ifndef KEXEC_ARCH_ARM_OPTIONS_H
#define KEXEC_ARCH_ARM_OPTIONS_H
-#define OPT_ARCH_MAX (OPT_MAX+0)
+#define OPT_DT_NO_OLD_ROOT (OPT_MAX+0)
+#define OPT_ARCH_MAX (OPT_MAX+1)
#define OPT_APPEND 'a'
#define OPT_RAMDISK 'r'
@@ -15,6 +16,7 @@
*/
#define KEXEC_ARCH_OPTIONS \
KEXEC_OPTIONS \
+ { "dt-no-old-root", 0, 0, OPT_DT_NO_OLD_ROOT }, \
#define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR ""
diff --git a/kexec/arch/arm/kexec-arm.c b/kexec/arch/arm/kexec-arm.c
index 6e8e320..10035f2 100644
--- a/kexec/arch/arm/kexec-arm.c
+++ b/kexec/arch/arm/kexec-arm.c
@@ -16,6 +16,7 @@
#include "../../kexec-syscall.h"
#include "kexec-arm.h"
#include <arch/options.h>
+#include "../../fs2dt.h"
#define MAX_MEMORY_RANGES 64
#define MAX_LINE 160
@@ -89,11 +90,37 @@ void arch_usage(void)
" including the .bss section, as reported\n"
" by 'arm-linux-size vmlinux'. If not\n"
" specified, this value is implicitly set\n"
- " to the compressed images size * 4.\n");
+ " to the compressed images size * 4.\n"
+ " --dt-no-old-root\n"
+ " do not reuse old kernel root= param.\n"
+ " while creating flatten device tree.\n");
}
int arch_process_options(int argc, char **argv)
{
+ /* We look for all options so getopt_long doesn't start reordering
+ * argv[] before file_type[n].load() gets a look in.
+ */
+ static const struct option options[] = {
+ KEXEC_ALL_OPTIONS
+ { 0, 0, NULL, 0 },
+ };
+ static const char short_options[] = KEXEC_ALL_OPT_STR;
+ int opt;
+
+ opterr = 0; /* Don't complain about unrecognized options here */
+ while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
+ switch(opt) {
+ case OPT_DT_NO_OLD_ROOT:
+ dt_no_old_root = 1;
+ break;
+ default:
+ break;
+ }
+ }
+ /* Reset getopt for the next pass; called in other source modules */
+ opterr = 1;
+ optind = 1;
return 0;
}