From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH 1/3] console: Add plumbing to expose earlycon/bootconsole parameter
Date: Tue, 12 Mar 2019 00:45:23 -0700 [thread overview]
Message-ID: <20190312074525.6153-2-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <20190312074525.6153-1-andrew.smirnov@gmail.com>
Similar to what we already do to kernel's "console" parameter, add
code to allow serial drivers to expose their "earlycon"
setting. Unlike the plumbing for "console", "earlycon" is not
automatically added to kernel command line and has to be enabled by
the user.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
Documentation/user/variables.rst | 1 +
common/console.c | 25 +++++++++++++++++++++++++
include/console.h | 1 +
3 files changed, 27 insertions(+)
diff --git a/Documentation/user/variables.rst b/Documentation/user/variables.rst
index ddfd48574..f3bcaa3a8 100644
--- a/Documentation/user/variables.rst
+++ b/Documentation/user/variables.rst
@@ -114,5 +114,6 @@ of all variables with special meaning along with a short description:
bootsource The source barebox has been booted from
bootsource_instance The instance of the source barebox has been booted from
global.boot.default default boot order
+ global.linux.bootconsole current console's "earlycon" setting for Linux kernel
...
diff --git a/common/console.c b/common/console.c
index 47ccf2e54..29d0f2779 100644
--- a/common/console.c
+++ b/common/console.c
@@ -253,6 +253,30 @@ static void console_set_stdoutpath(struct console_device *cdev)
free(str);
}
+static void console_set_boot_stdoutpath(struct console_device *cdev)
+{
+ char *str;
+
+ if (!cdev->linux_bootconsole_name)
+ return;
+
+ str = basprintf("earlycon=%s,%dn8", cdev->linux_bootconsole_name,
+ cdev->baudrate);
+ /*
+ * linux.bootconsole is used instead of
+ * linux.bootargs.bootconsole in orger to make this feature
+ * optional. To enable, add
+ *
+ * global linux.bootargs.bootconsole
+ * global.linux.bootargs.bootconsole=${global.linux.bootconsole}
+ *
+ * somwhere in your boot scripts
+ */
+ globalvar_add_simple("linux.bootconsole", str);
+
+ free(str);
+}
+
static int __console_puts(struct console_device *cdev, const char *s)
{
int n = 0;
@@ -360,6 +384,7 @@ int console_register(struct console_device *newcdev)
if (newcdev->dev && of_device_is_stdout_path(newcdev->dev)) {
activate = 1;
console_set_stdoutpath(newcdev);
+ console_set_boot_stdoutpath(newcdev);
}
list_add_tail(&newcdev->list, &console_list);
diff --git a/include/console.h b/include/console.h
index 673921331..09d7ebae5 100644
--- a/include/console.h
+++ b/include/console.h
@@ -64,6 +64,7 @@ struct console_device {
unsigned int baudrate_param;
const char *linux_console_name;
+ const char *linux_bootconsole_name;
struct cdev devfs;
struct cdev_operations fops;
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-03-12 7:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-12 7:45 [PATCH 0/3] Earlycon command line option support Andrey Smirnov
2019-03-12 7:45 ` Andrey Smirnov [this message]
2019-03-12 7:45 ` [PATCH 2/3] serial: i.MX: Add code to export "earlycon" setting Andrey Smirnov
2019-03-12 7:45 ` [PATCH 3/3] serial: lpuart: " Andrey Smirnov
2019-03-12 9:43 ` [PATCH 0/3] Earlycon command line option support Lucas Stach
2019-03-13 8:45 ` Sascha Hauer
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=20190312074525.6153-2-andrew.smirnov@gmail.com \
--to=andrew.smirnov@gmail.com \
--cc=barebox@lists.infradead.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