On Fri, Oct 30, 2026 at 10:36:55AM +0300, Yalçın Can wrote: > With CONSOLE_MUX but without SYS_CONSOLE_IS_IN_ENV, console_init_r() calls > console_devices_set() before anything has allocated console_devices[file] > (only iomux_doenv() does). The stdout device pointer is then written to > address 0 and read back from there by console_puts_select(). > > That goes unnoticed while address 0 is RAM. On the RK3066 started from > the boot ROM, address 0 is the ROM (GRF soc_remap = 0): the write is > lost and the console calls ROM words as a stdio_dev, hanging in > console_announce_r(). > > Allocate the one-entry list when it is missing. > > Tested on an MK808B (RK3066) with U-Boot started from the NAND ID blocks: > boots to autoboot with the USB ACM console; before, it hung at the banner. > > Co-Authored-By: Claude Opus 5.5 <[email protected]> > Signed-off-by: Yalçın Can <[email protected]>
Thank you for disclosing that you used AI here. As a project, we
generally discourage its use.
> ---
> common/console.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/common/console.c b/common/console.c
> index 54d12494..b436868f 100644
> --- a/common/console.c
> +++ b/common/console.c
> @@ -248,6 +248,19 @@ int cd_count[MAX_FILES];
>
> static void console_devices_set(int file, struct stdio_dev *dev)
> {
> + /*
> + * Only iomux_doenv() allocates the device list. Without
> SYS_CONSOLE_IS_IN_ENV,
> + * console_init_r() gets here first and the list is still NULL: the
> device went to address 0
> + * and was read back from there. That only works while 0 is RAM
> (MK808B: after the vendor
> + * loader's soc_remap); from the boot ROM, 0 is the ROM and the console
> calls garbage.
> + */
> + if (!console_devices[file]) {
> + console_devices[file] = calloc(1, sizeof(struct stdio_dev *));
> + if (!console_devices[file]) {
> + cd_count[file] = 0;
> + return;
> + }
> + }
> console_devices[file][0] = dev;
> cd_count[file] = 1;
> }
How you found the issue is interesting. But we support plenty of
platforms already where 0x0 is not valid memory. So this is one of those
cases where it's impossible to know, without someone spending time to
verify the details, if what Claude deduced makes any sense, or not, if
this is the right fix.
--
Tom
signature.asc
Description: PGP signature
