Why is kernel boot too late?

前端 未结 1 1068
情书的邮戳
情书的邮戳 2021-01-17 03:37

I have zynq-microzed board and my log messages are following...

[Mon Jun 09 19:28:38.231 2014] SF: Detected S25FL129P_64K/S25FL128S_64K with         


        
相关标签:
1条回答
  • 2021-01-17 03:47

    Your method of calculating elapsed time is using flawed data.
    What you think is a 0.5 sec "delay" is actually U-Boot outputting "Starting kernel ..." in real time, while the kernel buffers and postpones outputting its "Booting Linux..." until the system and console are initialized. That's comparing apples to oranges.
    At the very least you have to get the kernel to output in realtime (just like U-Boot). Then your timestamps will better indicate actual elapsed time.

    While the kernel is performing the early initialization, interrupts are disabled and any output to the console (including that "Booting Linux on..." message) is held in a buffer until console_init() is performed at line 572 in Linux/init/main.c. Note that the salient "Booting Linux on..." text was "output" at the beginning of this start_kernel() procedure from the routine smp_setup_processor_id(), line 478. Most of the "delay" that you notice before the "Booting Linux on..." text appears as the kernel starts up is caused by this buffering of the console output.

    You can overcome this apparent delay due to buffering by enabling the kernel debugging feature early printk.
    Two steps are required:

    1. Enable this feature in configuration:

      make menuconfig
      Kernel hacking
      Kernel low-level debugging functions
      Early printk

    2. Add the parameter "earlyprintk" to the kernel command line, which is usually stored in the U-Boot environment variable bootargs or in the Device Tree.

    The kernel boot log should indicate that this feature is enabled:

    Booting Linux on physical CPU 0x0
    Linux version 3.10...
    CPU: ARMv7 Processor [410fc051] revision 1 (ARMv7), cr=10c53c7d
    CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
    Machine: Atmel SAMA5 (Device Tree), model: Atmel SAMA5D36-EK
    bootconsole [earlycon0] enabled
    Memory policy: ECC disabled, Data cache writeback
    ...
    Kernel command line: console=ttyS0,115200 earlyprintk rootfstype=ubifs ...

    0 讨论(0)
提交回复
热议问题