Blob Blame History Raw
From 83a65e2e13af2041b2816712475e3fec6fdc9e68 Mon Sep 17 00:00:00 2001
From: "dyoung@redhat.com" <dyoung@redhat.com>
Date: Wed, 28 Oct 2015 13:41:37 +0800
Subject: [PATCH 3/3] ppc64: 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.

Reported-by: Jan Stodola <jstodola@redhat.com>
Signed-off-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
 kexec/arch/ppc64/include/arch/options.h | 4 +++-
 kexec/arch/ppc64/kexec-ppc64.c          | 5 +++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/kexec/arch/ppc64/include/arch/options.h b/kexec/arch/ppc64/include/arch/options.h
index 4ad9b75..71632ec 100644
--- a/kexec/arch/ppc64/include/arch/options.h
+++ b/kexec/arch/ppc64/include/arch/options.h
@@ -2,7 +2,8 @@
 #define KEXEC_ARCH_PPC64_OPTIONS_H
 
 #define OPT_ELF64_CORE		(OPT_MAX+0)
-#define OPT_ARCH_MAX		(OPT_MAX+1)
+#define OPT_DT_NO_OLD_ROOT	(OPT_MAX+1)
+#define OPT_ARCH_MAX		(OPT_MAX+2)
 
 /* All 'local' loader options: */
 #define OPT_APPEND		(OPT_ARCH_MAX+0)
@@ -14,6 +15,7 @@
 #define KEXEC_ARCH_OPTIONS \
 	KEXEC_OPTIONS \
 	{ "elf64-core-headers", 0, 0, OPT_ELF64_CORE }, \
+	{ "dt-no-old-root",	0, 0, OPT_DT_NO_OLD_ROOT }, \
 
 #define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR ""
 
diff --git a/kexec/arch/ppc64/kexec-ppc64.c b/kexec/arch/ppc64/kexec-ppc64.c
index 6e79f52..09ee025 100644
--- a/kexec/arch/ppc64/kexec-ppc64.c
+++ b/kexec/arch/ppc64/kexec-ppc64.c
@@ -869,6 +869,8 @@ int file_types = sizeof(file_type) / sizeof(file_type[0]);
 void arch_usage(void)
 {
 	fprintf(stderr, "     --elf64-core-headers Prepare core headers in ELF64 format\n");
+	fprintf(stderr, "     --dt-no-old-root Do not reuse old kernel root= param.\n" \
+	                "                      while creating flatten device tree.\n");
 }
 
 struct arch_options_t arch_options = {
@@ -895,6 +897,9 @@ int arch_process_options(int argc, char **argv)
 		case OPT_ELF64_CORE:
 			arch_options.core_header_type = CORE_TYPE_ELF64;
 			break;
+		case OPT_DT_NO_OLD_ROOT:
+			dt_no_old_root = 1;
+			break;
 		}
 	}
 	/* Reset getopt for the next pass; called in other source modules */
-- 
2.5.0