ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

2011年9月27日 星期二

early_printk, DEBUG_LL

http://r40eubuntu.blogspot.com/2011/09/initcall.html

單看 console 的部份。

在 start_kernel 的最後 reset_init 用 kernel_thread 執行 kernel_init

console 好像是 kernel 中很重要的東西(?),在 kerne/printk.c 中。
說明 cosole 依照開機的階段,分為兩種,這說明寫在 regisgter_console( ) 的前面: /* * The console driver calls this routine during kernel initialization * to register the console printing procedure with printk() and to * print any messages that were printed by the kernel before the * console driver was initialized. * * This can happen pretty early during the boot process (because of * early_printk) - sometimes before setup_arch() completes - be careful * of what kernel features are used - they may not be initialised yet. * * There are two types of consoles - bootconsoles (early_printk) and * "real" consoles (everything which is not a bootconsole) which are * handled differently. * - Any number of bootconsoles can be registered at any time. * - As soon as a "real" console is registered, all bootconsoles * will be unregistered automatically. * - Once a "real" console is registered, any attempt to register a * bootconsoles will be rejected */ 大概翻譯一下:
為了要讓 printk, early_printk能正常送出 message,要儘早 call register_console( ) 把 console 掛起來。
console 分為兩種:
1. bootconsole : 為了應付kernel boot 前段,真正的 (real) console 還沒決定的時候,所使用的 console
2. real consol : 就真正的 console。
在real console 被 register 後,bootconsole 就會自動被 unregister,然後就再也不允許有人註冊 boot_console 了。
在 arch/arm/kernal/ 下有 early_prink.c,但是要 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 才會 build 進去。

在 arch/arm/Kconfig include 的 Kconfig.debug 有option:
config EARLY_PRINTK
 bool "Early printk"
 depends on DEBUG_LL
 help
   Say Y here if you want to have an early console using the
   kernel low-level debugging functions. Add earlyprintk to your
   kernel parameters to enable this console.
所以要 enable DEBUG_LL (Kernel low-level debugging functions),才會顯示出來。

沒有留言:

標籤

網誌存檔