if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) 0)
printk(KERN_WARNING "Warning: unable to open an initial console.\n");
所以,应该在/dev下包含console设备文件,否则的话,会出现无法打开初始化终端的提示。
/*
* We try each of these until one succeeds.
*
* The Bourne shell can be used instead of init if we are
* trying to recover a really broken machine.
*/
if (execute_command) {
run_init_process(execute_command);
printk(KERN_WARNING "Failed to execute %s. Attempting "
"defaults...\n", execute_command);
这里的execute_command是一个全局变量,在解析传递进内核的命令行参数时确定的。
static int __init init_setup(char *str)
{
unsigned int i;
execute_command = str;
/*
* In case LILO is going to boot us with default command line,
* it prepends "auto" before the whole cmdline which makes
* the shell think it should execute a script with such name.
* So we ignore all arguments entered _before_ init=... [MJ]
*/
for (i = 1; i MAX_INIT_ARGS; i++)
argv_init = NULL;
return 1;
}
__setup("init=", init_setup);