Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Young <dyoung@redhat.com>
To: kexec@lists.infradead.org
Cc: jstodola@redhat.com
Subject: [PATCH] kexec-tools: do not copy 1st kernel root= param in fs2dt.c
Date: Fri, 9 Oct 2015 13:57:22 +0800	[thread overview]
Message-ID: <20151009055722.GA6248@dhcp-129-237.nay.redhat.com> (raw)

Jan Stodola <jstodola@redhat.com> reported ppc64 root= is always added in kexec
kernel cmdline. But sometimes we need boot without root= for example we use
kexec to boot into installation initramfs image like below:
kexec --load vmlinuz --initrd=initrd.img --command-line=\
"inst.repo=http://<server>/<path>/Server/ppc64le/os/"

While creating dtb, in case there's no root= in user provided cmdline params 
kexec-tools will find the original root= param used in 1st kernel and pass it
to 2nd kernel. This caused that user have no way to remove root= cmdline.

Dropping that part of code so that one can get chance to kexec into 2nd kernel
without root= param. One can still provide root= in --command-line=""

Signed-off-by: Dave Young <dyoung@redhat.com>
---
 kexec/fs2dt.c |   31 +------------------------------
 1 file changed, 1 insertion(+), 30 deletions(-)

--- kexec-tools.orig/kexec/fs2dt.c
+++ kexec-tools/kexec/fs2dt.c
@@ -579,8 +579,7 @@ static void putnode(void)
 		reserve(initrd_base, initrd_size);
 	}
 
-	/* Add cmdline to the second kernel.  Check to see if the new
-	 * cmdline has a root=.  If not, use the old root= cmdline.  */
+	/* Add cmdline to the second kernel. */
 	if (!strcmp(basename,"chosen/")) {
 		size_t result;
 		size_t cmd_len = 0;
@@ -594,36 +593,8 @@ static void putnode(void)
 			param = strstr(local_cmdline, "crashkernel=");
 			if (param)
 				crash_param = 1;
-			/* does the new cmdline have a root= ? ... */
-			param = strstr(local_cmdline, "root=");
 		}
 
-		/* ... if not, grab root= from the old command line */
-		if (!param) {
-			FILE *fp;
-			char *last_cmdline = NULL;
-			char *old_param;
-
-			strcpy(filename, pathname);
-			strcat(filename, "bootargs");
-			fp = fopen(filename, "r");
-			if (fp) {
-				if (getline(&last_cmdline, &cmd_len, fp) == -1)
-					die("unable to read %s\n", filename);
-
-				param = strstr(last_cmdline, "root=");
-				if (param) {
-					old_param = strtok(param, " ");
-					if (cmd_len != 0)
-						strcat(local_cmdline, " ");
-					strcat(local_cmdline, old_param);
-				}
-			}
-			if (last_cmdline)
-				free(last_cmdline);
-		}
-		strcat(local_cmdline, " ");
-		cmd_len = strlen(local_cmdline);
 		cmd_len = cmd_len + 1;
 
 		/* add new bootargs */

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

             reply	other threads:[~2015-10-09  5:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-09  5:57 Dave Young [this message]
2015-10-16  1:33 ` [PATCH] kexec-tools: do not copy 1st kernel root= param in fs2dt.c Simon Horman
2015-10-19  8:22   ` Dave Young
2015-10-23  3:19     ` Dave Young
2015-10-23  9:23       ` Dave Young
2015-10-26  4:32         ` Simon Horman
2015-10-26  7:32           ` Dave Young
2015-10-26  4:31     ` 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=20151009055722.GA6248@dhcp-129-237.nay.redhat.com \
    --to=dyoung@redhat.com \
    --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