码迷,mamicode.com
首页 > 系统相关 > 详细

linux启动过程中的几个重要文件的详解

时间:2014-10-16 01:11:01      阅读:211      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   文件   sp   div   on   log   工作   

/Linuxrc 执行init 进程初始化文件。主要工作是把已安装根文件系统中的/etc 挂载为ramfs,并拷贝/mnt/etc/目录下所有文件到/etc,这里存放系统启动后的许多特殊文件;接着Linuxrc 重新构建文件分配表inittab;之后执行系统初始化进程/sbin/init。

Linuxrc 
#!/bin/sh
echo "mount /etc as ramfs"
/bin/mount -n -t ramfs ramfs /etc
/bin/cp -a /mnt/etc/* /etc
echo "re-create the /etc/mtab entries"
# re-create the /etc/mtab entries
/bin/mount -f -t cramfs -o remount,ro /dev/mtdblock/3 /
/bin/mount -f -t ramfs ramfs /etc
exec /sbin/init

etc/init.d/rcS 完成各个文件系统的 mount,再执行/usr/etc/rc.local;通过rcS 可以调用 dhcp 程序配置网络。rcS 执行完了以后,init 就会在一个 console 上,按照 inittab 的指示开一个 shell,或者是开 getty + login,这样用户就会看到提示输入用户名的提示符。

rc.local
/usr/etc/
#!/bin/sh
. /usr/etc/profile
echo "HELLO! Embest"
echo "ifconfig eth0 192.168.0.10"
ifconfig eth0 192.168.0.10 #可自行配置开发板IP

/usr/etc/rc.local 这是被init.d/rcS 文件调用执行的特殊文件,与Linux 系统硬件平台相关,如安装核心模块、进行网络配置、运行应用程序、启动图形界面等。

rcS
/mnt/etc/init.
d/
#!/bin/sh
/bin/mount -a
exec /usr/etc/rc.local

/usr/etc/profile 执行该文件配置需要的环境变量等。

Profile
/usr/etc/
#!/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin ?? 设置命令工具所在位置 

 

 

linux启动过程中的几个重要文件的详解

标签:style   blog   color   文件   sp   div   on   log   工作   

原文地址:http://www.cnblogs.com/achsnw/p/4027609.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!