Boot fails with self-build u-boot

As i see you use a modified version of my environment…

If you call newboot, buildargs is used to override buildargs you see…here console var is used…

console=earlyprintk console=ttyS0,115200 console=tty1 fbcon=map:0

Just try change this before loading kernel

Sorry excuse my ignorance I’m not very familiar with U-boot Uenv.txt file syntax. Is this the way how I should configure it and run it ?

setenv newboot "console=earlyprintk console=ttyS0,115200 console=tty1 fbcon=map:0"
run newboot

In uenv.txt:

console=earlyprintk console=ttyS2,115200 console=tty1 fbcon=map:0

Or in uboot itself

setenv console "earlyprintk console=ttyS2,115200 console=tty1 fbcon=map:0"

Before calling newboot you have to set kernel var…maybe also by uenv.txt…

How have you configured it?

I see the console line is already set and has all options from this output

bootargs=console=earlyprintk console=ttyS0,115200 console=tty1 fbcon=map:0 root=/dev/mmcblk1p2 rootfstype=ext4 rootwait vmalloc=496M debug=7 7
3154366 bytes read in 163 ms (18.5 MiB/s)
## Booting kernel from Legacy Image at 80200000 ...
Image Name:   ARM OpenWrt Linux-5.4.31
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    3154302 Bytes = 3 MiB
Load Address: 80008000
Entry Point:  80008000
Verifying Checksum ... OK
Loading Kernel Image

Starting kernel ...

I tried also manually to boot the kernel using U-boot menu and below is the output:

 4586   uEnv.txt
3154366   uImage

2 file(s), 0 dir(s)

enter uImage-name: uImage
kernelinput=uImage
enter dtb-name: 
## Error: "dtbinput" not defined

It does not have any dtb file. This might be the issue why it freezes ?

Your bootargs showing ttyS0…you need dtb only if it is not appended to kernel binary…

Ok i got a little further. I enabled earlyprintk and debug and after booting I see the kernel boots fine but no console

bootargs=console=earlyprintk console=ttyS0,115200 console=tty1 fbcon=map:0 root=/dev/mmcblk1p2 rootfstype=ext4 rootwait vmalloc=496M debug=7 7
3152846 bytes read in 163 ms (18.4 MiB/s)
## Booting kernel from Legacy Image at 80200000 ...
Image Name:   ARM OpenWrt Linux-5.4.31
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    3152782 Bytes = 3 MiB
Load Address: 80008000
Entry Point:  80008000
Verifying Checksum ... OK
Loading Kernel Image

Starting kernel ...

Uncompressing Linux... done, booting the kernel.

Also I modified in this patch 0006-dts-fix-bpi2-console.patch on the bootargs line the console value from ttyS2 to ttyS0 but no luck yet

— a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts +++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts @@ -19,6 +19,7 @@

chosen {
	stdout-path = "serial2:115200n8";
  •   bootargs = "console=ttyS0,115200n8";
    

    };

    cpus {

I guess you use mainline kernel where debuguart is (not moved) uart2. Why you change choosen-node? And ttyS2 is right for mainline… Your uboot still shows ttyS0 before starting kernel

Yes you are right I change it back to ttyS2 and managed to boot it successfully but now I’m back to that issue that after booting I cannot see the console prompt.

I guess that is because I need to change also tty1 with ttyS0 also as you mentioned in the below post

No,this swaps only serial console and hdmi…

You need to set console var as i wrote above…best way should be uenv.txt else you need to set it on every boot

Or you swap uart like i do in my kernels…put uart2 first in mt7623.dtsi

So when looking at this line in uEnv.txt

setenv console "earlyprintk console=ttyS2,115200 console=tty1 fbcon=map:0"

First console entry should be ttyS2 which is good but the second should be tty1 ? or should be other tty like 0 or 2 ?

tty1 (without S) is right as this is hdmi-console…there is no 0.

Does serial console work now?

Serial console works up to where the kernel messages finish with no prompt being displayed

[   13.673373] mt7530 mdio-bus:00 wan: Link is Up - 1Gbps/Full - flow control rx/tx
[   13.680794] IPv6: ADDRCONF(NETDEV_CHANGE): wan: link becomes ready
[   32.472893] vusb: disabling
[   32.475706] vmc: disabling
[   32.478411] vmch: disabling
[   32.481205] vgp1: disabling
[   32.484050] vcamaf: disabling

^C

Was os loaded? Which one do you try (openwrt,debian,…)?

It’s OpenWRT trunk kernel 5.4.31

In openwrt you have to put ttyS2 first and no setenv in uenv.txt…see my post above for uenv-format…

console=ttyS2,115200 ....

I do not have setenv configured in my uEnv.txt file. I have uploaded it here uEnv-default.txt (4.5 KB)

I also attached the full serial console boot log openwrt-serial-console-boot-log.txt (32.4 KB)

I managed to connect to OpenWRT using ssh and default IP/credentials, but the CLI prompt on the serial console still cannot be accessed.

Have you tried pressing enter? Bootlog looks good so far…

Btw. If you use my uboot you do not need full environment in uenv.txt…only parts that you want to change

Ok I have managed to fix the serial console issue. I had a look at @lexa2 OpenWRT fork and he has a patch to fix the serial console access

I applied it to my repo and change it to ttyS2 and then it worked fine.

1 Like

I wondering why i do not run into this issue while booting my kernel with actual openwrt rootfs :thinking:

have tested the rootfs-method on r64 too :wink: got working console

looked in my /etc/inittab and have only the first 3 entries (sysinit,shutdown,askconsole) (on r64)

It remains a kind-a-mistery for me too, check my commit message that @cioby23 refferenced. “::askconsole” is expected to work out of the box providing login on the /dev/console but for some unknown reason it wasn’t working for me in OpenWRT 18.06 fork. As my time working on that was really limited I preferred not to waste it investigating what’s the deal and simply implemented a workaround by adding an explicit line into inittab.