init参数解析是在: linux-2.6.30.4\init\Main.c 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[i] = NULL; return 1; } __setup("init=", init_setup);
37行:如果rdinit和init都未设置,则直接调用/sbin/init。如果没找到/sbin/init,则一次回去寻找/etc/init、/bin/init、/bin/sh,如果都没找到,则会打印“No init found. Try passing init= option to kernel”
运行多次的(在运行一次的程序运行完之后才运行这里的程序): respawn:如果这里的程序被终止了,init会自动重启它的 askfirst:和respawn功能类似,但会在启动程序之前在控制台打印“Please press Enter to activate this console”。 和respawn不同在于,respawn能够直接启动一个程序,而askfirst要等用户敲了Enter键后才能启动程序