If you are not lucky, start the kernel for the first time.
Uncompressing Linux... OK, booting the kernel
From the serial port ttys0, and then you have nothing to do. There are still many opportunities in this situation. Most of the reason is that the kernel is stuck. You may ask, it doesn't matter if the kernel gets stuck. At least it's not.CodePrintk in. You think so, that is, you have not read the printk code.
The printk statement before the start of the serial port driver is not instantly typed, but is stored in memory. After the serial port Initialization is complete, these messages are rushed out.
The problem is that if the kernel gets stuck before the serial port Initialization is complete, you will not see any message.
Therefore, the problem is to solve the problem of instant printing. Linux kernel actually provides this mechanism, and its related code is wrapped in config_debug_ll.
Once opened, printk calls the printascii () function.
Printacii is written in assembly language and defined in kernel/ARCH/ARM/kernel/debug. S.
It does not take any substantive action and mainly determines the end of the string. This function calls several functions.
Addruart
Waituart
Senduart
Busyuart
These functions must be written in an assembly and related to the architecture. They must be stored in the following file.
Kernel/ARCH/ARM/Mach-xxx/include/Mach/debug-macro.S
In addition, this file will not be compiled independently. It is actually included in kernel/ARCH/ARM/kernel/debug. S:
# Include <Mach/debug-macro.S>
After the config_debug_ll flag is enabled, you can get the instant debug message.