Search code examples
linuxlinux-kernelembeddedembedded-linuxboot

How to get time stamps in boot log messages untill the login prompt?


How do I get the time stamps in the bootlog like the following?

[Tue Mar 19 13:46:28.140 2013] U-Boot 1.4.0XXXXXX (Mar 04 2013 - 08:41:02)MPC83XX  
[Tue Mar 19 13:46:28.156 2013]  
[Tue Mar 19 13:46:28.156 2013] Reset Status:  
[Tue Mar 19 13:46:28.156 2013]   
[Tue Mar 19 13:46:28.156 2013] CPU:   e300c3, MPC8308, Rev: 1.0 at 333.333 MHz, CSB:     133.333 MHz  
[Tue Mar 19 13:46:28.187 2013] Board: XXXXX  
[Tue Mar 19 13:46:28.187 2013] I2C:   ready  
[Tue Mar 19 13:46:28.187 2013] ZDRAM:  256 MiB (DDR2, 32-bit, ECC off, 266.667 MHz)  
[Tue Mar 19 13:46:28.203 2013] ZDRAM Test Started ... DRAM Test Passed.  
[Tue Mar 19 13:46:28.312 2013] ZFlash: 4 MiB  
[Tue Mar 19 13:46:28.312 2013] ZNAND:  512 MiB  
[Tue Mar 19 13:46:28.312 2013] Using default environment  
.  
.  
[Tue Mar 19 13:49:58.640 2013] Jan  1 04:41:28 localhost kernel: device xxxx-1 entered promiscuous mode  
[Tue Mar 19 13:49:58.656 2013] Jan  1 04:41:28 localhost kernel: device xxxx-2 entered promiscuous mode  
[Tue Mar 19 13:49:58.671 2013] Jan  1 04:41:28 localhost kernel: device xxxx-3 entered promiscuous mode  
[Tue Mar 19 13:49:58.687 2013] Jan  1 04:41:28 localhost kernel: device xxxx-4 entered promiscuous mode  
[Tue Mar 19 13:49:58.703 2013] Jan  1 04:41:32 localhost kernel: linux-xxx_port_mode(0, 2)  
[Tue Mar 19 13:49:58.734 2013] Jan  1 04:41:32 localhost kernel: linux-xxx interface [2]  
[Tue Mar 19 13:49:58.750 2013] Jan  1 04:41:48 localhost kernel: xxxx_ioctl(284): xxx.  
[Tue Mar 19 13:49:58.765 2013] root@localhost:/root>   

How do get the boot log and kernel initialization log till the login prompt?
Some expert has taken the above log in my project for a product earlier.
Can someone help how this needs to be done?


Solution

  • You might also look at the kernel config parameter CONFIG_PRINTK_TIME. If you compile the kernel with this support (CONFIG_PRINTK_TIME=y) the kernel will prepend an accurate timestamp to each kernel message that it generates. The output looks like this example:

    [    2.226780] NET: Registered protocol family 2
    [    2.227345] TCP established hash table entries: 8192 (order: 4, 65536 bytes)
    

    Good luck!!