Trace kernel boot process config_debug_ll "turn from"

Source: Internet
Author: User

Transferred from: http://bbs.chinaunix.net/thread-3642079-1-1.html recently debugging the Linux kernel, tracking the boot process. It is found that the physical address can be used before the turn on MMU to output debug information by losing data to the serial FIFO. But once the code runs to the open MMU, in the assembler phase, the MMU only does the physical memory mapping, and does not map Io, so it cannot access the serial port. The data that should be output through the serial port is stored in the serial buffer pool until the IO map is established and the console is initialized in the C language stage. But what if I want to track the kernel boot process in real time? This is a reference to the Linux lowlevel Debug feature. This option is located at: Kernel Hacking---> [*] Kernel debugging [*] Kernel low-level debugging functions opening this option will add config_d in. config EBUG_LL macro defines a preliminary estimate, where the impact is as follows: (1) Arch/arm/kernel/head.s __create_page_tables part (2) arch/arc/mach-processor/ Processor. C in the Macro definition section (3) Kernel/prink.c in order to provide DEBUG_LL functionality, the arch/arc/mach-processor/include/mach/debug-macro must also be perfected. S first to say the benefits, why open kernel low-level debugging functions function. After opening this macro definition, a portion of the IO map is established in the __create_page_tables of the Head.s function, as follows: #ifdef CONFIG_DEBUG_LLLdr R7, [R10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags /** Map in IO space for serial debugging.* This allows debug messages to be output* via a serial console before paging_init.  */LDR R3, [R8, #MACHINFO_PGOFFIO] add r0, R4, R3 RSB R3, R3, #0x4000 @ ptrs_per_pgd*sizeof (long) CMP R3, #0x0800 @ limit to 512MB Movhi R3, #0x0800 add R6, R0, R3 LDR R3, [R8, #MACHINFO_PHYSIO] Orr R3, R3, R7 1:STR R3, [R0], #4 Add R3, R3, #1 << Teq r0, R6 BNE 1b The code also mentions that the role of the mapping IO is used for serial debugging. Where does the physical address and virtual address used in this code come from? arch/arc/mach-Processor/processor. The macro definition in C is part of the following processor: Machine_start (EASIC0718, "SEP0718 Board"). Phys_io = 0x10005000, . Io_pg_offst = ((0xe005000) >>) & 0XFFFC, . Boot_params = 0x30000100, . Fixup = fixup_gfd0718, . Map_io = sep0718_map_io, . Init_irq = SEP0718_INIT_IRQ, . Init_machine = sep0718_init, . Timer = &sep0718_timer, Machine_end Middle. Phys_io = 0x10005000, . Io_pg_offst = ((0xe005000) >>) & 0XFFFC, is for the __create_page_tables config_debug_ll in the use of IO mapping is the last change to PRINTK.C, mainly more defined void printascii (char *) can be directly output. Perfected the Debug-macro. S can be used after printascii. Once the memory map has been built, it can be used wherever it is compiled or C, either before or after the MMU is opened. The code will determine if the MMU is open. At the same time Prink will keep a copy of the data in the buffer pool, and also call printkasii direct output, so the kernel starts to see the information output two times. Finally put on the Debug-macro. S,writed by Leeming, note that the IO address is related to the processor architecture and cannot be used directly. /* Linux/include/asm-arm/arch-sep0718/debug-macro. S * * Debugging macro Include header * * This program is free software; Can redistribute it and/or modify * it under the terms of the GNU general public License version 2 as * published by T He free software Foundation. **/#include <asm/hardware.h>. Macro addruart,rx MRC P15, 0, \rx, C1, C0 TST \rx, #1 @ MMU enabled? Moveq \rx, #0x10000000 movne \rx, #0xe0000000 add \rx, \rx, #0x5000 . ENDM. Macro senduart,rd,rx str \rd, [\rx] @ uartdr . ENDM. Macro waituart,rd,rx 1001:Ldr \rd, [\rx, #0x14] @ sysflgx TST \rd, #1 << 6 @ ubusyx beq 1001b . ENDM. Macro busyuart,rd,rx 1001:Ldr \rd, [\rx, #0x14] @ sysflgx TST \rd, #1 << 6 @ ubusyx beq 1001b . ENDM

Trace kernel boot process config_debug_ll "turn from"

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.