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: [RFC PATCH v6 1/1] cmdline: Add capability to both append and prepend at the same time
Date: Sun, 4 Apr 2021 17:20:48 +0000 (UTC) [thread overview]
Message-ID: <34d20d1dbb88f26d418b33985557b0475374a1a5.1617556785.git.christophe.leroy@csgroup.eu> (raw)
One user has expressed the need to both append and prepend some
built-in parameters to the command line provided by the bootloader.
Allthough it is a corner case, it is easy to implement so let's do it.
When the user chooses to prepend the bootloader provided command line
with the built-in command line, he is offered the possibility to enter
an additionnal built-in command line to be appended after the
bootloader provided command line.
It is a complementary feature which has no impact on the already
existing ones and/or the existing defconfig.
Suggested-by: Daniel Walker <danielwa@cisco.com>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
Sending this out as an RFC, applies on top of the series
("Implement GENERIC_CMDLINE"). I will add it to the series next spin
unless someone is against it.
---
include/linux/cmdline.h | 3 +++
init/Kconfig | 12 +++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/include/linux/cmdline.h b/include/linux/cmdline.h
index 020028e2bdf0..fb274a4d5519 100644
--- a/include/linux/cmdline.h
+++ b/include/linux/cmdline.h
@@ -36,6 +36,9 @@ static __always_inline bool __cmdline_build(char *dst, const char *src)
len = cmdline_strlcat(dst, src, COMMAND_LINE_SIZE);
+ if (IS_ENABLED(CONFIG_CMDLINE_PREPEND))
+ len = cmdline_strlcat(dst, " " CONFIG_CMDLINE_MORE, COMMAND_LINE_SIZE);
+
if (IS_ENABLED(CONFIG_CMDLINE_APPEND))
len = cmdline_strlcat(dst, " " CONFIG_CMDLINE, COMMAND_LINE_SIZE);
diff --git a/init/Kconfig b/init/Kconfig
index fa002e3765ab..cd3087ff4f28 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -128,6 +128,14 @@ config CMDLINE
If this string is not empty, additional choices are proposed
below to determine how it will be used by the kernel.
+config CMDLINE_MORE
+ string "Additional default kernel command string" if GENERIC_CMDLINE && CMDLINE_PREPEND
+ default ""
+ help
+ Defines an additional default kernel command string.
+ If this string is not empty, it is appended to the
+ command-line arguments provided by the bootloader
+
choice
prompt "Kernel command line type" if CMDLINE != ""
default CMDLINE_PREPEND if ARCH_WANT_CMDLINE_PREPEND_BY_DEFAULT
@@ -154,7 +162,9 @@ 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.
+ command-line arguments provided by the bootloader. When this
+ option is selected, another string can be added which will
+ be appended.
config CMDLINE_FORCE
bool "Always use the default kernel command string"
--
2.25.0
next reply other threads:[~2021-04-04 17:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-04 17:20 Christophe Leroy [this message]
2021-04-08 20:08 ` [RFC PATCH v6 1/1] cmdline: Add capability to both append and prepend at the same time Rob Herring
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=34d20d1dbb88f26d418b33985557b0475374a1a5.1617556785.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).