mini2440系统移植篇之init启动流程-u球体育app下载

单片机 > 单片机程序设计 > 详情

mini2440系统移植篇之init启动流程

发布时间:2025-06-30 发布时间:
|

1. 启动

内核启动应用程序/linuxrc

busybox ini.c

init_main

设置信号处理函数

初始化控制台

parse_inittab解析inittab

1.1. 解析inittab

file = open(inittab, “r”); //打开配置文件/etc/inittab

new_init_action

//1 创建一个init_action结构,填充

//2 把结构放入init_action_list链表

默认配置

::sysinit:/etc/init.d/rcs

::askfirst:/bin/sh

tty2::askfirst:/bin/sh

tty3::askfirst:/bin/sh

tty4::askfirst:/bin/sh

::ctrlaltdel:/sbin/reboot

::shutdown:/sbin/swapoff -a

::shutdown:/bin/umount -a -r

::restart:/sbin/init


1.2. 运行


  1. /* first run the sysinit command */  

  2. run_actions(sysinit);  

  3.   

  4. /* next run anything that wants to block */  

  5. run_actions(wait);  

  6.   

  7. /* next run anything to be run only once */  

  8. run_actions(once);  

  9.   

  10. /* now run the looping stuff for the rest of forever */  

  11. while (1) {  

  12.     /* run the respawn/askfirst stuff */  

  13.     run_actions(respawn | askfirst);  

  14.   

  15.     /* don't consume all cpu time -- sleep a bit */  

  16.     sleep(1);  

  17.   

  18.     /* wait for any child process to exit */  

  19.     wpid = wait(null);  

  20.     while (wpid > 0) {  

  21.         /* find out who died and clean up their corpse */  

  22.         for (a = init_action_list; a; a = a->next) {  

  23.             if (a->pid == wpid) {  

  24.                 /* set the pid to 0 so that the process gets 

  25.                  * restarted by run_actions() */  

  26.                 a->pid = 0;  

  27.                 message(l_log, "process '%s' (pid %d) exited. "  

  28.                         "scheduling for restart.",  

  29.                         a->command, wpid);  

  30.             }  

  31.         }  

  32.         /* see if anyone else is waiting to be reaped */  

  33.         wpid = wait_any_nohang(null);  

  34.     }  

  35. }  



关键字:mini2440  系统移植  init  启动流程 

『本文转载自网络,u球体育app下载的版权归原作者所有,如有侵权请联系删除』

热门文章 更多
stm32cubemx新建工程 基本io配置过程
网站地图