From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: will@kernel.org, danielwa@cisco.com, robh@kernel.org,
daniel@gimpelevich.san-francisco.ca.us, arnd@kernel.org,
akpm@linux-foundation.org
Cc: linux-arch@vger.kernel.org, devicetree@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org,
microblaze <monstr@monstr.eu>,
linux-mips@vger.kernel.org, nios2 <ley.foon.tan@intel.com>,
openrisc@lists.librecores.org, linux-hexagon@vger.kernel.org,
linux-riscv@lists.infradead.org, x86@kernel.org,
linux-xtensa@linux-xtensa.org, linux-sh@vger.kernel.org,
sparclinux@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH v4 05/20] cmdline: Gives architectures opportunity to use generically defined boot cmdline manipulation
Date: Fri, 2 Apr 2021 15:18:06 +0000 (UTC) [thread overview]
Message-ID: <9cf63d0419bb51d91c5b1c83ce250dff1e7107cc.1617375802.git.christophe.leroy@csgroup.eu> (raw)
In-Reply-To: <cover.1617375802.git.christophe.leroy@csgroup.eu>
Most architectures have similar boot command line manipulation
options. This patchs adds the definition in init/Kconfig, gated by
CONFIG_HAVE_CMDLINE that the architectures can select to use them.
CONFIG_CMDLINE_EXTEND is understood differently by architectures.
For some of them it appends built-in CMDLINE to bootloader provided
line. For others it appends the bootloader provided CMDLINE to the
built-in one.
To avoid confusion, this commit brings to different options:
- CONFIG_CMDLINE_APPEND to append the built-in CMDLINE to the
bootloader line.
- CONFIG_CMDLINE_PREPEND to prepend the built-in CMDLINE in front of
the bootloader line.
For compatibility with existing architecture which uses CONFIG_OF, as
OF has already been converted to generic cmdline, we keep
CONFIG_CMDLINE_EXTEND as a synonym to CONFIG_CMDLINE_APPEND until
arm, powerpc, riscv and sh architectures have been converted.
A few differences are identified and will have to be taken
into account when converting the architecture to generic cmdline:
- riscv has CMDLINE_FALLBACK instead of CMDLINE_FROM_BOOTLOADER
- Some architectures are using CONFIG_CMDLINE_OVERRIDE or
CONFIG_CMDLINE_OVERWRITE instead of CONFIG_CMDLINE_FORCE.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
v3:
- Comments from Will.
- Remove CONFIG_CMDLINE_BOOL. Using CONFIG_CMDLINE != "" instead, like arm and powerpc.
- Changed EXTEND to APPEND. Keep EXTEND for backward compatibility.
v4:
- Added CMDLINE_PREPEND as a dependency for INITRAMFS_FORCE
- Removed the EXTEND || APPEND in cmdline.h, keep EXTEND as it
will always exit and switch to APPEND in last patch.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
init/Kconfig | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
usr/Kconfig | 2 +-
2 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/init/Kconfig b/init/Kconfig
index 5f5c776ef192..af0d84662cc2 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -117,6 +117,58 @@ config INIT_ENV_ARG_LIMIT
Maximum of each of the number of arguments and environment
variables passed to init from the kernel command line.
+config GENERIC_CMDLINE
+ bool
+
+config CMDLINE
+ string "Default kernel command string" if GENERIC_CMDLINE
+ default ""
+ help
+ Defines a default kernel command string.
+ If this string is not empty, additional choices are proposed
+ below to determine how it will be used by the kernel.
+
+choice
+ prompt "Kernel command line type" if CMDLINE != ""
+ default CMDLINE_PREPEND if ARCH_WANT_CMDLINE_PREPEND_BY_DEFAULT
+ default CMDLINE_FROM_BOOTLOADER
+ depends on GENERIC_CMDLINE
+ help
+ Determine how the default kernel arguments are combined with any
+ arguments passed by the bootloader if any.
+
+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_APPEND
+ bool "Append to the bootloader kernel arguments"
+ help
+ The default kernel command string will be appended to the
+ command-line arguments provided by the bootloader.
+
+config CMDLINE_PREPEND
+ bool "Prepend to the bootloader kernel arguments"
+ help
+ The default kernel command string will be prepended to the
+ command-line arguments provided by the bootloader.
+
+config CMDLINE_FORCE
+ bool "Always use the default kernel command string"
+ help
+ Always use the default kernel command string, ignoring any
+ arguments provided by the bootloader.
+endchoice
+
+config CMDLINE_EXTEND
+ bool
+ default CMDLINE_APPEND
+ help
+ To be removed once all architectures are converted to generic CMDLINE
+
config COMPILE_TEST
bool "Compile also drivers which will not load"
depends on HAS_IOMEM
diff --git a/usr/Kconfig b/usr/Kconfig
index 8bbcf699fe3b..b397e6b114d1 100644
--- a/usr/Kconfig
+++ b/usr/Kconfig
@@ -24,7 +24,7 @@ config INITRAMFS_SOURCE
config INITRAMFS_FORCE
bool "Ignore the initramfs passed by the bootloader"
- depends on CMDLINE_EXTEND || CMDLINE_FORCE
+ depends on CMDLINE_PREPEND || CMDLINE_APPEND || CMDLINE_FORCE
help
This option causes the kernel to ignore the initramfs image
(or initrd image) passed to it by the bootloader. This is
--
2.25.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-04-02 15:20 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-02 15:18 [PATCH v4 00/20] Implement GENERIC_CMDLINE Christophe Leroy
2021-04-02 15:18 ` [PATCH v4 01/20] cmdline: Add generic function to build command line Christophe Leroy
2021-04-02 15:18 ` [PATCH v4 02/20] drivers: of: use cmdline building function Christophe Leroy
2021-04-02 15:18 ` [PATCH v4 03/20] x86/efi: Replace CONFIG_CMDLINE_OVERRIDE by CONFIG_CMDLINE_FORCE Christophe Leroy
2021-04-02 15:18 ` [PATCH v4 04/20] drivers: firmware: efi: use cmdline building function Christophe Leroy
2021-04-02 15:18 ` Christophe Leroy [this message]
2021-04-02 15:18 ` [PATCH v4 06/20] powerpc: convert strcpy to strlcpy in prom_init Christophe Leroy
2021-04-02 15:18 ` [PATCH v4 07/20] powerpc: Convert to GENERIC_CMDLINE Christophe Leroy
2021-04-02 15:18 ` [PATCH v4 08/20] arm: " Christophe Leroy
2021-04-02 15:18 ` [PATCH v4 09/20] arm64: " Christophe Leroy
2021-04-02 15:18 ` [PATCH v4 10/20] hexagon: " Christophe Leroy
2021-04-02 15:18 ` [PATCH v4 11/20] microblaze: " Christophe Leroy
2021-04-02 15:18 ` [PATCH v4 12/20] nios2: " Christophe Leroy
2021-04-02 15:18 ` [PATCH v4 13/20] openrisc: " Christophe Leroy
2021-04-02 15:18 ` [PATCH v4 14/20] riscv: " Christophe Leroy
2021-04-02 15:18 ` [PATCH v4 15/20] sh: " Christophe Leroy
2021-04-02 15:18 ` [PATCH v4 16/20] sparc: " Christophe Leroy
2021-04-02 15:18 ` [PATCH v4 17/20] xtensa: " Christophe Leroy
2021-04-02 15:18 ` [PATCH v4 18/20] x86: " Christophe Leroy
2021-04-08 19:41 ` Rob Herring
2021-04-09 10:20 ` Christophe Leroy
2021-04-02 15:18 ` [PATCH v4 19/20] mips: " Christophe Leroy
2021-04-06 17:38 ` Daniel Walker
2021-04-08 19:04 ` Rob Herring
2021-04-09 1:23 ` Daniel Walker
2021-04-20 16:05 ` Christophe Leroy
2021-04-02 15:18 ` [PATCH v4 20/20] cmdline: Remove CONFIG_CMDLINE_EXTEND Christophe Leroy
2021-04-06 16:56 ` [PATCH v4 00/20] Implement GENERIC_CMDLINE Daniel Walker
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=9cf63d0419bb51d91c5b1c83ce250dff1e7107cc.1617375802.git.christophe.leroy@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=akpm@linux-foundation.org \
--cc=arnd@kernel.org \
--cc=daniel@gimpelevich.san-francisco.ca.us \
--cc=danielwa@cisco.com \
--cc=devicetree@vger.kernel.org \
--cc=ley.foon.tan@intel.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-hexagon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux-xtensa@linux-xtensa.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=monstr@monstr.eu \
--cc=openrisc@lists.librecores.org \
--cc=robh@kernel.org \
--cc=sparclinux@vger.kernel.org \
--cc=will@kernel.org \
--cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).