Search code examples
raspberry-pilinux-kernelembedded-linuxuartu-boot

Kernel no serial console output if started through U-Boot


How does U-Boot change how the kernel is communicating through UART?

I'm trying to add U-Boot to our project. We build a custom Linux 64 bit kernel with initRAM linked into the kernel.

I have access to the U-Boot shell but when I'm trying to boot the uncompressed Image

mmc dev 0
fatload mmc 0:1 ${kernel_addr_r} Image
fatload mmc 0:1 ${fdt_addr} bcm2710-rpi-cm3.dtb
setenv bootargs console=serial0,115200 console=tty1
booti ${kernel_addr_r} - ${fdt_addr}

I get no kernel output after Starting kernel ...

What confuses me is that if I start the kernel directly through config.txt I do get the expected behavior.

The kernel command line is in both cases console=serial0,115200 console=tty1 Set either by cmdline.txt or through boot.scr.

Is U-Boot changing somehow the routing of the UART's? Why would the kernel have different behavior solely by starting it through U-Boot? Shouldn't U-Boot be completely out of the picture after the kernel is started, thus have no impact on the kernel output?


Solution

  • After some time with other tasks at hand I revisited the problem and literally magically found a working config. I still don't understand how the same kernel command line worked coming from cmdline.txt but not from u-boot's bootargs. Until further proof I'll assume gross negligence on my side. ^^

    So now I'll post my boot.cmd for our cm3 and 3B+ in hopes it helps others.

    cm3

    setenv fdtfile bcm2710-rpi-cm3.dtb
    
    mmc dev 0
    fatload mmc 0:1 ${kernel_addr_r} Image
    fatload mmc 0:1 ${fdt_addr} ${fdtfile}
    setenv bootargs console=ttyAMA0,115200 printk.devkmsg=on usbcore.autosuspend=-1 fsck.mode=force fsck.repair=yes
    booti ${kernel_addr_r} - ${fdt_addr}
    

    3B+

    setenv fdtfile bcm2710-rpi-3-b.dtb
    
    fatload mmc 0:1 ${kernel_addr_r} Image
    fatload mmc 0:1 ${fdt_addr} ${fdtfile}
    setenv bootargs 8250.nr_uarts=1 console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
    booti ${kernel_addr_r} - ${fdt_addr}
    

    Disclaimer: This is a rough cut. But as I fell into despair making this work I wanna get this solution out as fast as possible