linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Dave Martin <Dave.Martin@arm.com>
To: Matija Glavinic Pecotic <matija.glavinic-pecotic.ext@nokia.com>
Cc: "Sverdlin,
	Alexander \(Nokia - DE/Ulm\)" <alexander.sverdlin@nokia.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] arm64: Make CONFIG_CMDLINE behavior configurable
Date: Tue, 29 Sep 2020 11:41:20 +0100	[thread overview]
Message-ID: <20200929104118.GK6642@arm.com> (raw)
In-Reply-To: <55be67bb-338c-afa1-d863-7a82f9ba803f@nokia.com>

On Tue, Sep 29, 2020 at 10:46:09AM +0200, Matija Glavinic Pecotic wrote:
> arm64 has no means to define behavior if CONFIG_CMDLINE is set as e.g.
> arm32 has. Parts of the kernel will ignore CMDLINE if behavior on how
> to treat is not specified, e.g.:
> 
> drivers/of/fdt.c:early_init_dt_scan_chosen:
>   #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 */
> 
> Sync behavior of arm64 with arm32 (and other platforms).
> 
> Signed-off-by: Matija Glavinic Pecotic <matija.glavinic-pecotic.ext@nokia.com>
> ---
>  arch/arm64/Kconfig | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 6d232837cbee..0a03db76aa5a 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -1824,14 +1824,32 @@ config CMDLINE
>  	  entering them here. As a minimum, you should specify the the
>  	  root device (e.g. root=/dev/nfs).
>  
> +choice
> +	prompt "Kernel command line type" if CMDLINE != ""
> +	default CMDLINE_FROM_BOOTLOADER
> +	depends on ATAGS
> +
> +config CMDLINE_FROM_BOOTLOADER
> +	bool "Use bootloader kernel arguments if available"
> +	help
> +	  Uses the command-line options passed by the boot loader. If
> +	  the boot loader doesn't provide any, the default kernel command
> +	  string provided in CMDLINE will be used.
> +
> +config CMDLINE_EXTEND
> +	bool "Extend bootloader kernel arguments"
> +	help
> +	  The command-line arguments provided by the boot loader will be
> +	  appended to the default kernel command string.
> +
>  config CMDLINE_FORCE
>  	bool "Always use the default kernel command string"
> -	depends on CMDLINE != ""
>  	help
>  	  Always use the default kernel command string, even if the boot
>  	  loader passes other arguments to the kernel.
>  	  This is useful if you cannot or don't want to change the
>  	  command-line options your boot loader passes to the kernel.
> +endchoice

If multiple arches do the same thing, can we factor this out into a
common Kconfig file somehow?

Cheers
---Dave

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-09-29 10:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-29  8:46 [PATCH] arm64: Make CONFIG_CMDLINE behavior configurable Matija Glavinic Pecotic
2020-09-29 10:41 ` Dave Martin [this message]
2020-09-29 12:34   ` Matija Glavinic Pecotic
2020-09-29 17:43 ` Catalin Marinas
2020-09-29 19:12   ` Matija Glavinic Pecotic
2020-09-29 19:09 ` Matija Glavinic Pecotic

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=20200929104118.GK6642@arm.com \
    --to=dave.martin@arm.com \
    --cc=alexander.sverdlin@nokia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=matija.glavinic-pecotic.ext@nokia.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;
as well as URLs for NNTP newsgroup(s).