1. 程式人生 > >控制Linux kernel啟動console的列印級別

控制Linux kernel啟動console的列印級別

235 /*
236  * This should be approx 2 Bo*oMips to start (note initial shift), and will
237  * still work even if initially too large, it will just take slightly longer
238  */
239 unsigned long loops_per_jiffy = (1<<12);
240 
241 EXPORT_SYMBOL(loops_per_jiffy);
242 
243 static int __init debug_kernel(char *str)
244 {
245     console_loglevel = 10;
246     return 0;
247 }
248 
249 static int __init quiet_kernel(char *str)
250 {
251     console_loglevel = 4;
252     return 0;
253 }
254 
255 early_param("debug", debug_kernel);
256 early_param("quiet", quiet_kernel);
257 
258 static int __init loglevel(char *str)
259 {
260     get_option(&str, &console_loglevel);
261     return 0;
262 }
263 
264 early_param("loglevel", loglevel);
注意:在系統啟動時,可以從bootloader中將CONFIG_CMDLINE引數傳遞給kernel。