public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [PATCH] fdt_support.c: Allow late kernel cmdline modification
Date: Mon, 22 Feb 2021 15:21:24 -0500	[thread overview]
Message-ID: <20210222202124.GP10169@bill-the-cat> (raw)
In-Reply-To: <20210222191851.8009-1-niko.mauno@vaisala.com>

On Mon, Feb 22, 2021 at 07:18:51PM +0000, Niko Mauno wrote:

> By declaring board-specific board_fdt_chosen_bootargs() the kernel
> command line arguments can be adjusted before injecting to flat dt
> chosen node.
> 
> Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
> ---
>  common/fdt_support.c  | 12 +++++++++++-
>  include/fdt_support.h | 10 ++++++++++
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/common/fdt_support.c b/common/fdt_support.c
> index 08d540bfc8..4379507e30 100644
> --- a/common/fdt_support.c
> +++ b/common/fdt_support.c
> @@ -269,6 +269,15 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end)
>  	return 0;
>  }
>  
> +/**
> + * board_fdt_chosen_bootargs - boards may override this function to use
> + *                             alternative kernel command line arguments
> + */
> +__weak char *board_fdt_chosen_bootargs(void)
> +{
> +	return env_get("bootargs");
> +}
> +
>  int fdt_chosen(void *fdt)
>  {
>  	int   nodeoffset;
> @@ -286,7 +295,8 @@ int fdt_chosen(void *fdt)
>  	if (nodeoffset < 0)
>  		return nodeoffset;
>  
> -	str = env_get("bootargs");
> +	str = board_fdt_chosen_bootargs();
> +
>  	if (str) {
>  		err = fdt_setprop(fdt, nodeoffset, "bootargs", str,
>  				  strlen(str) + 1);

What's this look like in practice?  I'm very wary about changing "set
bootargs to what you pass to the kernel" logic that's been there for
forever and a constant of every platform.  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210222/2d2084e9/attachment.sig>

  reply	other threads:[~2021-02-22 20:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-22 19:18 [PATCH] fdt_support.c: Allow late kernel cmdline modification Niko Mauno
2021-02-22 20:21 ` Tom Rini [this message]
2021-02-23  6:33   ` Niko Mauno
2021-02-24 13:51     ` Tom Rini
2021-02-25 16:09       ` Niko Mauno
2021-03-11  7:34         ` Niko Mauno
2021-03-15  5:28           ` Simon Glass
2021-05-06 15:02 ` Tom Rini

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=20210222202124.GP10169@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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