[openwrt/openwrt] armsr: add patch (hack) to enable all "default" consoles
LEDE Commits
lede-commits at lists.infradead.org
Mon May 26 01:31:26 PDT 2025
robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/3697022ce34cb6be196d62f1dbdf677bf6cabc22
commit 3697022ce34cb6be196d62f1dbdf677bf6cabc22
Author: Mathew McBride <matt at traverse.com.au>
AuthorDate: Thu Jan 16 12:20:56 2025 +1100
armsr: add patch (hack) to enable all "default" consoles
A previous change added 'console=tty1' to the default kernel command
line on armsr, in order to ensure the framebuffer console is enabled
on systems capable of graphics output.
Unfortunately, this change broke boards that used device tree
(DT) firmware with serial consoles, as the serial console
specified by the system firmware (stdout-path) was no longer
setup by the kernel.
A bit of probing determined that the SPCR (serial port console
direction table) on ACPI systems was preventing Linux from setting
up a default framebuffer console on these systems (which is why
console=tty1 was added).
(The affected ACPI systems are usually VMs using QEMU's
'virt' machine and EDK2 firmware. The firmware on these systems
does not remove the SPCR when a screen is present)
So to ensure all possible systems are setup correctly, we modify
the kernel so all "default" console types (serial and screen)
are setup when no console= arguments are specified on the kernel
command line.
Signed-off-by: Mathew McBride <matt at traverse.com.au>
Fixes: c099523d66a3 ("use console=tty1 to make console more
readily available")
Link: https://github.com/openwrt/openwrt/pull/17012
Signed-off-by: Robert Marko <robimarko at gmail.com>
---
.../300-printk-always-setup-default-consoles.patch | 47 ++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/target/linux/armsr/patches-6.6/300-printk-always-setup-default-consoles.patch b/target/linux/armsr/patches-6.6/300-printk-always-setup-default-consoles.patch
new file mode 100644
index 0000000000..c7a119cff1
--- /dev/null
+++ b/target/linux/armsr/patches-6.6/300-printk-always-setup-default-consoles.patch
@@ -0,0 +1,47 @@
+From 0059efbd0f9c291795078fb4e50722641d525f38 Mon Sep 17 00:00:00 2001
+From: Mathew McBride <matt at traverse.com.au>
+Date: Thu, 16 Jan 2025 11:48:44 +1100
+Subject: [PATCH] printk: always setup default (tty0 + stdout / SPCR) consoles
+ when no console= present
+
+(This is a hack specific to OpenWrt's armsr target)
+
+This change resolves a difference in behaviour between arm64 ACPI
+and DT systems.
+Our usecase is to ensure the system console is always present
+regardless of display mode (serial port or screen).
+
+Both ACPI and DT have mechanisms to setup a serial console from
+information passed by firmware (SPCR and stdout-path respectively).
+
+On ACPI systems, the SPCR table is parsed very early on in the kernel
+boot which prevents the screen console (tty0) from appearing if it is
+not explicitly set.
+
+We would like to avoid specifying console= arguments as there are many
+possible configurations on the serial side (like ttyS0, ttyAMA0, ttymxc0
+etc.).
+
+If the kernel does not consume the serial port in SPCR/stdout-path,
+then the 'default' settings from the firmware (baud rate etc.) are lost.
+
+If the system administrator explicitly specifies a console= argument,
+then the old behaviour is returned.
+
+Signed-off-by: Mathew McBride <matt at traverse.com.au>
+Link: https://github.com/openwrt/openwrt/pull/17012#issuecomment-2591751115
+---
+ kernel/printk/printk.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/kernel/printk/printk.c
++++ b/kernel/printk/printk.c
+@@ -3505,7 +3505,7 @@ void register_console(struct console *ne
+ * Note that a console with tty binding will have CON_CONSDEV
+ * flag set and will be first in the list.
+ */
+- if (preferred_console < 0) {
++ if (!console_set_on_cmdline) {
+ if (hlist_empty(&console_list) || !console_first()->device ||
+ console_first()->flags & CON_BOOT) {
+ try_enable_default_console(newcon);
More information about the lede-commits
mailing list