[PATCH] boot: Pass baud rate to stdout-path

John Watts contact at jookia.org
Thu Apr 11 07:03:20 CEST 2024


Linux might use the wrong baud rate such as 9600 by default, make sure
to specify it when passing the serial port over.

Signed-off-by: John Watts <contact at jookia.org>
---
On my board at least (a sunxi T113) the serial console will initialize
as 9600 baud instead of the set baud. Pass the baud with the serial
device to Linux to solve this issue.
---
 boot/fdt_support.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/boot/fdt_support.c b/boot/fdt_support.c
index 090d82ee80..83e62f47b5 100644
--- a/boot/fdt_support.c
+++ b/boot/fdt_support.c
@@ -153,9 +153,9 @@ static int fdt_fixup_stdout(void *fdt, int chosenoff)
 	}
 
 	/* fdt_setprop may break "path" so we copy it to tmp buffer */
-	memcpy(tmp, path, len);
+	len = sprintf(tmp, "%.*s:%d", len, (char *)path, CONFIG_BAUDRATE);
 
-	err = fdt_setprop(fdt, chosenoff, "linux,stdout-path", tmp, len);
+	err = fdt_setprop(fdt, chosenoff, "linux,stdout-path", tmp, len + 1);
 	if (err < 0)
 		printf("WARNING: could not set linux,stdout-path %s.\n",
 		       fdt_strerror(err));

---
base-commit: 777c28460947371ada40868dc994dfe8537d7115
change-id: 20240411-stdout-4f91b566a0f2

Best regards,
-- 
John Watts <contact at jookia.org>



More information about the U-Boot mailing list