From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754743AbcLYWIc (ORCPT ); Sun, 25 Dec 2016 17:08:32 -0500 Received: from mail-wj0-f196.google.com ([209.85.210.196]:34575 "EHLO mail-wj0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754604AbcLYWIY (ORCPT ); Sun, 25 Dec 2016 17:08:24 -0500 From: Pali =?utf-8?q?Roh=C3=A1r?= To: "Russell King - ARM Linux" Subject: Re: [PATCH] arm: dt: Initialize boot_command_line from CONFIG_CMDLINE in case DT does not provide /chosen/bootargs Date: Sun, 25 Dec 2016 23:08:15 +0100 User-Agent: KMail/1.13.7 (Linux/3.13.0-106-generic; KDE/4.14.2; x86_64; ; ) Cc: Arnd Bergmann , Robin Murphy , Linus Walleij , Ben Dooks , Tony Lindgren , Ivaylo Dimitrov , Sebastian Reichel , Aaro Koskinen , Pavel Machek , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <1481749963-8664-1-git-send-email-pali.rohar@gmail.com> <20161215100931.GJ14217@n2100.armlinux.org.uk> <201612161242.34764@pali> In-Reply-To: <201612161242.34764@pali> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart98853318.n21OjkEMts"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201612252308.15324@pali> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --nextPart98853318.n21OjkEMts Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Friday 16 December 2016 12:42:34 Pali Roh=C3=A1r wrote: > On Thursday 15 December 2016 11:09:32 Russell King - ARM Linux wrote: > > > What is reason that CONFIG_CMDLINE is not supported for DT? > >=20 > > 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. > >=20 > > This patch (untested) should solve it: > > drivers/of/fdt.c | 40 ++++++++++++++++++++-------------------- > > 1 file changed, 20 insertions(+), 20 deletions(-) > >=20 > > 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 !=3D NULL && l > 0) > >=20 > > strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); > >=20 > > - /* > > - * 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); > > - > >=20 > > /* break now */ > > return 1; > > =20 > > } > >=20 > > @@ -1205,6 +1185,26 @@ void __init early_init_dt_scan_nodes(void) > >=20 > > /* Retrieve various information from the /chosen node */ > > of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line); > >=20 > > + /* > > + * 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); > > + > >=20 > > /* Initialize {size,address}-cells info */ > > of_scan_flat_dt(early_init_dt_scan_root, NULL); >=20 > Patch is working fine and fixes my problem. You can add my Tested-by. Russell, are you going to use your patch? Or original my? Or any other? If you need more testing or other data, let me know. I would like to see this problem (non working CONFIG_CMDLINE) fixed... =2D-=20 Pali Roh=C3=A1r pali.rohar@gmail.com --nextPart98853318.n21OjkEMts Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEABECAAYFAlhgQ08ACgkQi/DJPQPkQ1Ls6wCgm8jZ/ygvCPF7naHUioAkhC5H yOwAoIDBXBOfYy5kbSBvfD9MkNQfyp6l =7x7E -----END PGP SIGNATURE----- --nextPart98853318.n21OjkEMts--