Linux Kernel low level debug

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.