mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "‎ donmor" <donmor3000@hotmail.com>
To: "chenhuacai@kernel.org" <chenhuacai@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"loongarch@lists.linux.dev" <loongarch@lists.linux.dev>,
	"kernel@xen0n.name" <kernel@xen0n.name>
Subject: [PATCH] loongarch: Fix broken CONFIG_CMDLINE
Date: Sun, 9 Jul 2023 08:12:32 +0000	[thread overview]
Message-ID: <3ddf48d97c90e4203e328180763a0d8124890216.camel@hotmail.com> (raw)

From e00182944fee67301c3ebade3147b25d9f1555aa Mon Sep 17 00:00:00 2001
From: donmor <donmor3000@hotmail.com>
Date: Sat, 8 Jul 2023 10:45:21 +0800
Subject: [PATCH] loongarch: Fix broken CONFIG_CMDLINE

This patch tends to fix CONFIG_CMDLINE, which is not working with
CONFIG_CMDLINE_EXTEND or CONFIG_CMDLINE_BOOTLOADER. Some code is absent
in
arch/loongarch/kernel/setup.c, which should handle built-in command
lines
in CONFIG_CMDLINE. The absence of such code causes CONFIG_CMDLINE not
working if CONFIG_CMDLINE_EXTEND or CONFIG_CMDLINE_BOOTLOADER is set to
Y.
CONFIG_CMDLINE_FORCE is not affected.

Signed-off-by: donmor <donmor3000@hotmail.com>
---
 arch/loongarch/kernel/setup.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/loongarch/kernel/setup.c
b/arch/loongarch/kernel/setup.c
index 78a00359bde3..dc6e01c340bb 100644
--- a/arch/loongarch/kernel/setup.c
+++ b/arch/loongarch/kernel/setup.c
@@ -335,6 +335,22 @@ static void __init bootcmdline_init(char
**cmdline_p)
 	}
 #endif
 
+#ifdef CONFIG_CMDLINE
+	/*
+	 * If CONFIG_CMDLINE_BOOTLOADER is enabled then we use the
built-in
+	 * command line if no command line given, or we append given
command
+	 * line to the built-in one if CONFIG_CMDLINE_EXTEND is
enabled.
+	 */
+	if (IS_ENABLED(CONFIG_CMDLINE_EXTEND)) {
+		strscpy(boot_command_line, CONFIG_CMDLINE,
COMMAND_LINE_SIZE);
+		strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
+		strlcat(boot_command_line, init_command_line,
COMMAND_LINE_SIZE);
+	}
+
+	if (IS_ENABLED(CONFIG_CMDLINE_BOOTLOADER) &&
!boot_command_line[0])
+		strscpy(boot_command_line, CONFIG_CMDLINE,
COMMAND_LINE_SIZE);
+#endif
+
 out:
 	*cmdline_p = boot_command_line;
 }

             reply	other threads:[~2023-07-09  8:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-09  8:12 ‎ donmor [this message]
2023-07-09  8:25 ` WANG Xuerui
     [not found] ` <6011256b-f4a9-a410-dc62-cb7a308bf07f@web.de>
2023-07-09 13:43   ` [PATCH] loongarch: Fix broken CONFIG_CMDLINE (RESEND 2) ‎ donmor

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=3ddf48d97c90e4203e328180763a0d8124890216.camel@hotmail.com \
    --to=donmor3000@hotmail.com \
    --cc=chenhuacai@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    /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

all inboxes | Powered by JetHome®