Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: dyoung@redhat.com
To: kexec@lists.infradead.org
Cc: jstodola@redhat.com, horms@verge.net.au
Subject: [kexec-tools PATCH 2/3] arm: add arch option --dt-no-old-root
Date: Wed, 28 Oct 2015 13:41:36 +0800	[thread overview]
Message-ID: <20151028054359.980394494@redhat.com> (raw)
In-Reply-To: 20151028054134.200833741@redhat.com

[-- Attachment #1: arm-arch-no-root.patch --]
[-- Type: text/plain, Size: 2792 bytes --]

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>
---
 kexec/arch/arm/include/arch/options.h |    4 +++-
 kexec/arch/arm/kexec-arm.c            |   29 ++++++++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 2 deletions(-)

--- kexec-tools.orig/kexec/arch/arm/include/arch/options.h
+++ kexec-tools/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 ""
 
--- kexec-tools.orig/kexec/arch/arm/kexec-arm.c
+++ kexec-tools/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;
 }
 



_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  parent reply	other threads:[~2015-10-28  5:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-28  5:41 [kexec-tools PATCH 0/3] New option to avoid copying old root param from 1st kernel cmdline dyoung
2015-10-28  5:41 ` [kexec-tools PATCH 1/3] fs2dt.c: move copy old root param as a new function dyoung
2015-10-28  5:41 ` dyoung [this message]
2015-10-28  5:41 ` [kexec-tools PATCH 3/3] ppc64: add arch option --dt-no-old-root dyoung
2015-10-29 23:49 ` [kexec-tools PATCH 0/3] New option to avoid copying old root param from 1st kernel cmdline Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151028054359.980394494@redhat.com \
    --to=dyoung@redhat.com \
    --cc=horms@verge.net.au \
    --cc=jstodola@redhat.com \
    --cc=kexec@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox