您的位置:首页 > 运维架构 > Linux

彻底屏蔽linux启动打印信息

2013-06-03 15:43 330 查看
static int __init console_setup(char *str)

{

char buf[sizeof(console_cmdline[0].name) + 4]; /* 4 for index */

char *s, *options, *brl_options = NULL;

int idx;



//weed stop printk to console

// printk("weed test console setup %s\r\n",str);

str="/dev/null";//屏蔽掉init启动信息,grub.cfg里加console=/dev/null

#ifdef CONFIG_A11Y_BRAILLE_CONSOLE

if (!memcmp(str, "brl,", 4)) {

brl_options = "";

str += 4;

} else if (!memcmp(str, "brl=", 4)) {

brl_options = str + 4;

str = strchr(brl_options, ',');

if (!str) {

printk(KERN_ERR "need port name after brl=\n");

return 1;

}

*(str++) = 0;

}

#endif

/*

* Decode str into name, index, options.

*/

if (str[0] >= '0' && str[0] <= '9') {

strcpy(buf, "ttyS");

strncpy(buf + 4, str, sizeof(buf) - 5);

} else {

strncpy(buf, str, sizeof(buf) - 1);

}

buf[sizeof(buf) - 1] = 0;

if ((options = strchr(str, ',')) != NULL)

*(options++) = 0;

#ifdef __sparc__

if (!strcmp(str, "ttya"))

strcpy(buf, "ttyS0");

if (!strcmp(str, "ttyb"))

strcpy(buf, "ttyS1");

#endif

。。。。。。

}

#define DEFAULT_CONSOLE_LOGLEVEL 0//屏蔽掉内核打印信息
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: