[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241011224812.25763-3-jonathan@marek.ca>
Date: Fri, 11 Oct 2024 18:48:02 -0400
From: Jonathan Marek <jonathan@...ek.ca>
To: linux-efi@...r.kernel.org
Cc: Ard Biesheuvel <ardb@...nel.org>,
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH 3/3] efi/libstub: consider CONFIG_CMDLINE for initrd= and dtb= options
Replace cmdline with CONFIG_CMDLINE when it should be used instead of
load_options.
In the EXTEND case, it may be necessary to combine both CONFIG_CMDLINE and
load_options. In that case, keep the old behavior and print a warning about
the incorrect behavior.
Signed-off-by: Jonathan Marek <jonathan@...ek.ca>
---
drivers/firmware/efi/libstub/file.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/firmware/efi/libstub/file.c b/drivers/firmware/efi/libstub/file.c
index d6a025df07dcf..2a69e2b3583d4 100644
--- a/drivers/firmware/efi/libstub/file.c
+++ b/drivers/firmware/efi/libstub/file.c
@@ -208,6 +208,18 @@ efi_status_t handle_cmdline_files(efi_loaded_image_t *image,
if (IS_ENABLED(CONFIG_X86) && !efi_nochunk)
efi_chunk_size = EFI_READ_CHUNK_SIZE;
+ if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) ||
+ IS_ENABLED(CONFIG_CMDLINE_FORCE) ||
+ cmdline_len == 0) {
+ if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && cmdline_len > 0) {
+ /* both CONFIG_CMDLINE and load_options should be used */
+ efi_warn("ignoring %ls from CONFIG_CMDLINE\n", optstr);
+ } else {
+ cmdline = L"" CONFIG_CMDLINE;
+ cmdline_len = ARRAY_SIZE(L"" CONFIG_CMDLINE) - 1;
+ }
+ }
+
alloc_addr = alloc_size = 0;
do {
struct finfo fi;
--
2.45.1
Powered by blists - more mailing lists