From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: "Pali Rohár" <pali.rohar@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Robin Murphy <robin.murphy@arm.com>,
Linus Walleij <linus.walleij@linaro.org>,
Ben Dooks <ben-linux@fluff.org>, Tony Lindgren <tony@atomide.com>,
Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>,
Sebastian Reichel <sre@kernel.org>,
Aaro Koskinen <aaro.koskinen@iki.fi>, Pavel Machek <pavel@ucw.cz>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm: dt: Initialize boot_command_line from CONFIG_CMDLINE in case DT does not provide /chosen/bootargs
Date: Thu, 15 Dec 2016 10:09:32 +0000 [thread overview]
Message-ID: <20161215100931.GJ14217@n2100.armlinux.org.uk> (raw)
In-Reply-To: <201612150109.20868@pali>
On Thu, Dec 15, 2016 at 01:09:20AM +0100, Pali Rohár wrote:
> If cmdline is not in DT, but /chosen exists, then function
> early_init_dt_scan_chosen() use cmdline from CONFIG_CMDLINE.
Ah, yes. Looks to me then as if the bug exists there, and not in arch
code then. early_init_dt_scan_chosen() completely ignores the CMDLINE
options if the chosen node is not found.
> What is reason that CONFIG_CMDLINE is not supported for DT?
Sorry, that's my mistake - as you've pointed out above, it is supported
but via generic code. I was only looking at arch code when I made the
statement.
This patch (untested) should solve it:
drivers/of/fdt.c | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index c89d5d231a0e..fb89157332c6 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1073,26 +1073,6 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
if (p != NULL && l > 0)
strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE));
- /*
- * CONFIG_CMDLINE is meant to be a default in case nothing else
- * managed to set the command line, unless CONFIG_CMDLINE_FORCE
- * is set in which case we override whatever was found earlier.
- */
-#ifdef CONFIG_CMDLINE
-#if defined(CONFIG_CMDLINE_EXTEND)
- strlcat(data, " ", COMMAND_LINE_SIZE);
- strlcat(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
-#elif defined(CONFIG_CMDLINE_FORCE)
- strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
-#else
- /* No arguments from boot loader, use kernel's cmdl*/
- if (!((char *)data)[0])
- strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
-#endif
-#endif /* CONFIG_CMDLINE */
-
- pr_debug("Command line is: %s\n", (char*)data);
-
/* break now */
return 1;
}
@@ -1205,6 +1185,26 @@ void __init early_init_dt_scan_nodes(void)
/* Retrieve various information from the /chosen node */
of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
+ /*
+ * CONFIG_CMDLINE is meant to be a default in case nothing else
+ * managed to set the command line, unless CONFIG_CMDLINE_FORCE
+ * is set in which case we override whatever was found earlier.
+ */
+#ifdef CONFIG_CMDLINE
+#if defined(CONFIG_CMDLINE_EXTEND)
+ strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
+ strlcat(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
+#elif defined(CONFIG_CMDLINE_FORCE)
+ strlcpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
+#else
+ /* No arguments from boot loader, use kernel's cmdline */
+ if (!boot_command_line[0])
+ strlcpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
+#endif
+#endif /* CONFIG_CMDLINE */
+
+ pr_debug("Command line is: %s\n", boot_command_line);
+
/* Initialize {size,address}-cells info */
of_scan_flat_dt(early_init_dt_scan_root, NULL);
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
next prev parent reply other threads:[~2016-12-15 10:19 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-14 21:12 Pali Rohár
2016-12-14 21:25 ` Pavel Machek
2016-12-14 21:46 ` Tony Lindgren
2016-12-14 22:22 ` Javier Martinez Canillas
2016-12-14 23:52 ` Russell King - ARM Linux
2016-12-15 0:09 ` Pali Rohár
2016-12-15 0:18 ` Robin Murphy
2016-12-15 10:09 ` Russell King - ARM Linux [this message]
2016-12-16 11:42 ` Pali Rohár
2016-12-25 22:08 ` Pali Rohár
2017-01-02 13:54 ` Russell King - ARM Linux
2016-12-16 11:46 ` Pali Rohár
2016-12-16 12:13 ` Javier Martinez Canillas
2016-12-16 12:32 ` Pali Rohár
2016-12-16 12:38 ` Javier Martinez Canillas
2016-12-16 12:48 ` Pali Rohár
2016-12-16 12:53 ` Javier Martinez Canillas
2016-12-16 15:40 ` Tony Lindgren
2016-12-16 16:13 ` Pali Rohár
2016-12-16 16:21 ` Tony Lindgren
2016-12-16 16:27 ` Russell King - ARM Linux
2016-12-16 16:57 ` Mark Rutland
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=20161215100931.GJ14217@n2100.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=aaro.koskinen@iki.fi \
--cc=arnd@arndb.de \
--cc=ben-linux@fluff.org \
--cc=ivo.g.dimitrov.75@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pali.rohar@gmail.com \
--cc=pavel@ucw.cz \
--cc=robin.murphy@arm.com \
--cc=sre@kernel.org \
--cc=tony@atomide.com \
/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
all inboxes | Powered by JetHome®