Chinaunix首页 | 论坛 | 博客
  • 博客访问: 100286
  • 博文数量: 54
  • 博客积分: 1920
  • 博客等级: 上尉
  • 技术积分: 480
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-08 13:46
文章分类

全部博文(54)

文章存档

2011年(1)

2010年(8)

2009年(45)

我的朋友

分类: LINUX

2009-12-22 16:50:39

  1. Linux kernel mounts the root filesystem.
  2. The kernel starts the first user process /sbin/init provided by Busybox.
  3. /sbin/init reads /etc/inittab (From the SDK: linux/embedded_rootfs/etc-files/inittab).
  4. /etc/inittab starts the shell script /sbin/rc (From the SDK: linux/embedded_rootfs/etc-files/rc).
  5. /sbin/rc mounts the kernel pseudo filesystems /proc, /dev/shm, and /dev/pts.
  6. /sbin/rc brings up the loopback network device with the IP address 127.0.0.1.
  7. /sbin/rc starts syslogd provided by Busybox.
  8. /sbin/rc starts telnetd provided by Busybox.
  9. /sbin/rc exits returning control in /sbin/init.
  10. /etc/inittab tells /sbin/init to spawn an interactive shell.
  11. The user interactive shell prompt appears.

修改rc文件即可设定linux自启动的程序,即启动linux后便会自己执行的程序或者shell脚步

 

static int noinline init_post(void)
{
 free_initmem();
 unlock_kernel();
 mark_rodata_ro();
 system_state = SYSTEM_RUNNING;
 numa_default_policy();
 if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
  printk(KERN_WARNING "Warning: unable to open an initial console.\n");
 (void) sys_dup(0);
 (void) sys_dup(0);
 if (ramdisk_execute_command) {
  run_init_process(ramdisk_execute_command);
  printk(KERN_WARNING "Failed to execute %s\n",
    ramdisk_execute_command);
 }

 /*
  * 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);
 }
 run_init_process("/sbin/init");
 run_init_process("/etc/init");
 run_init_process("/bin/init");
 run_init_process("/bin/sh");
 panic("No init found.  Try passing init= option to kernel.");
阅读(1031) | 评论(0) | 转发(0) |
0

上一篇:嵌入式系统终端分析

下一篇:2440 clock

给主人留下些什么吧!~~