Issue
I try to boot precompiled kernel in QEMU self-created machine.
Serial peripherial is configured and I sucessfully can boot precompiled U-boot image for this machine.
In U-Boot all serial IO works great (memory adressing and UART address is also prepared in machine setup). Using option -nographic i can read and write in UBoot command prompt.
I can issue a bootm command in Uboot to load kernel to RAM and boot it. Last string i see is "Uncompressing Linux...done. Booting kernel...".
And there i have a black screen.
The main difference is that kernel WORKS because using a remote GDB session i see that it prints output like Banner and more information using printk functions. But on a QEMU screen i have none.
Question: Where in kernel in early stage is a setup of console=ttyS0,115200 setup being done? I tried to search in kernel sources and cannot find a place to debug the problem.
How kernel knows what to pass to serial before setting one up? Is there a RAM Ring buffer?
Any clues?
Solution
When you boot your precompiled U-Boot image for an ARM machine, it already includes: a kernel, an initramfs/initrd file, and a compiled device tree binary (.dtb) file rolled into an image format which U-Boot can recognise, unpack, load into memory and use to kick off the booting process. In this case, the console=ttyS0,115200 information is included in the .dtb file from the original device tree specification (DTS) file which will contain a section that looks like:
chosen {
bootargs = "console=ttyS0,115200n8 maxcpus=2, envaddr = <0xfa0f0000>";
};
Ultimately U-Boot loads the binary .dtb file into memory and passes a pointer to it to the kernel, which can then deduce the console parameters and display console output.
When instead you prefer to load the kernel into memory and use the U-Boot bootm command, you must yourself ensure that the initramfs/initrd and .dtb file have been loaded into memory (perhaps via tftp) and that the addresses are passed as arguments to bootm. Once that has been done, the kernel has the opportunity to fetch the console parameters from the .dtb as it did in the U-Boot image case and you should then see your console output. The kernel code to do this was, in the 4.19 kernel, located in drivers/of/base.c of_console_check().
Answered By - Frank Hoeflich
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.