busybox rootfs 启动脚本分析(一)
imx6文件系统启动脚本分析。开机运行/sbin/init,读取/etc/inittab文件,进行初始化。
参考链接
http://blog.163.com/wghbeyond@126/blog/static/35166181201051483723579/
/etc/inittab
# see busybox-1.00rc2/examples/inittab for more examples
::sysinit:/etc/rc.d/rcS # 系统启动的时候运行/etc/rc.d/rcS脚本
#::respawn:/etc/rc.d/rc_mxc.S
ttymxc0::once:/bin/login root # debug口使用ttymxc0,之运行一次/bin/login,root是传入的参数。
# 这就是为什么登录之后退出就不能再登录。如果想再次运行/bin/login,将once改为respawn
#::once:/sbin/getty 115200 ttymxc0 # 也可以采用这种形式设置串口,不过这样就需要输入账户密码
::sysinit:/etc/rc.d/rc_gpu.S # 系统启动的时候运行rc_gpu.S
::ctrlaltdel:/sbin/reboot # ctrl + alt + del 组合键是运行/sbin/reboot程序。
::shutdown:/etc/rc.d/rcS stop # 关机的时候运行 /etc/rc.d/rcS stop
::restart:/sbin/init # 重启时运行/sbin/init
/etc/rc.d/rcS
#!/bin/sh
# minimal startup script, will work with msh (this is best available in
# MMUless format).
# load the configuration information
. /etc/rc.d/rc.conf # 运行/etc/rc.d/rc.conf 脚本
mode=${1:-start} # 当$1的值不存在或者为空,那么mode=start,否者mode=$1
if [ $mode = "start" ]
then
services=$cfg_services
else
services=$cfg_services_r
fi
cfg_services=${2:-$services}
# run the configured sequence
for i in $cfg_services
do
if [ -x /etc/rc.d/init.d/$i ] # 判断/etc/rc.d/init.d/中是否存在$i表示的可执行文件
then
/etc/rc.d/init.d/$i $mode # 运行/etc/rc.d/init.d中的shell脚本,start or stop
fi
done
if [ $# -ge 2 ] # 如果传入脚本的参数个数大于 2
then
exit 0 # 退出, 返回值为 0
fi
# show all kernel log messages
#echo 8 > /proc/sys/kernel/printk
# run rc.local if present and executable
if [ -x /etc/rc.d/rc.local ] # 判断rc.local是否存在,并且可执行
then
/etc/rc.d/rc.local $mode # 运行rc.local, mode= start/stop
fi
/etc/rc.d/rc.conf
all_services="mount-proc-sys mdev udev hostname devfsd depmod modules filesystems syslog network inetd portmap dropbear sshd boa smb dhcpd settime fslgnome watchdog bluetooth gtk2 pango"
all_services_r="pango gtk2 bluetooth watchdog fslgnome settime dhcpd smb boa sshd dropbear portmap inetd network syslog filesystems modules depmod devfsd hostname udev mdev mount-proc-sys"
# 启动,运行顺序
cfg_services="mount-proc-sys udev hostname depmod modules filesystems inetd "
# 停止,停止顺序与启动顺序相反
cfg_services_r=" inetd filesystems modules depmod hostname udev mount-proc-sys"
export HOSTNAME="freescale"
export NTP_SERVER=""
export MODLIST=""
export RAMDIRS=""
export TMPFS="tmpfs"
export TMPFS_SIZE="512k"
export READONLY_FS=""
export INETD_ARGS=""
export BOA_ARGS=""
export SMBD_ARGS=""
export NMBD_ARGS=""
export DHCP_ARG=""
export DEPLOYMENT_STYLE="RAMDISK"
export SYSCFG_DHCPC_CMD="udhcpc -b -i "
export DROPBEAR_ARGS=""
/etc/rc.d/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here
if [ -x "/usr/bin/rpm" -a -e "/tmp/ltib" ] # 是否存在可执行文件/usr/bin/rpm,以及/tmp/ltib
then
echo "rebuilding rpm database"
rm -rf /tmp/ltib # 重新创建rpm数据库
rpm --rebuilddb
fi
# fix up permissions
if [ -d /home/user ] # 是否存在/home/user目录
then
chown -R user.user /home/user # 更改所有者,所在组
fi
# Add nodes when running under the hypervisor and static devices
if [ -r /sys/class/misc/fsl-hv/dev -a ! -r /dev/fsl-hv ] # 查看/sys/class/misc/fsl-hv/dev是否可读,并且/dev/fsl-hv不可读
then
echo "creating hypervisor nodes"
DEVID=`cat /sys/class/misc/fsl-hv/dev`
if [ -n "$DEVID" ] # 判断是否为空
then
MAJOR="${DEVID%:*}"
MINOR="${DEVID##*:}"
if [ \( "$MAJOR" -gt 0 \) -a \( "$MINOR" -gt 0 \) ]
then
rm -f /dev/fsl-hv
mknod /dev/fsl-hv c $MAJOR $MINOR
fi
fi
for i in 0 1 2 3 4 5 6 7
do
mknod /dev/hvc$i c 229 $i
done
fi
# add the fm device nodes
if [ -n "$(cat /proc/devices | grep fm | sed 's/\([0-9]*\).*/\1/')" -a ! -r /dev/fm0 ]
then
echo "creating fman device nodes"
cd /usr/share/doc/fmd-uspace-01.01/test/
sh fm_dev_create
cd -
fi
for i in 0 1 2; do
if [ -e /sys/class/graphics/fb$i ]; then
chmod 0666 /sys/class/graphics/fb$i/pan
fi
done
/etc/rc.d/rc_gpu.S
#!/bin/bash
CPUREV=$(cat /proc/cpuinfo | grep Revision | awk '{print $3}' | awk '{print substr($0,1,2)}') # 查看cpu的版本,mx6dl读取的是61
FILEVG=/usr/lib/libOpenVG.so
FILEVG3D=/usr/lib/libOpenVG_3D.so
FILEVG355=/usr/lib/libOpenVG_355.so
echo 4 > /sys/module/galcore/parameters/gpu3DMinClock
if [ -e $FILEVG3D ] && [ -e $FILEVG355 ]
then
if [ $CPUREV == "61" ] || [ $CPUREV == "63" ] || [ $CPUREV == "60" ] && [ -e $FILEVG ]
then
rm -f $FILEVG
fi
if [ $CPUREV == "61" ]
then
ln -s $FILEVG3D $FILEVG # 创建软连接
fi
if [ $CPUREV == "63" ]
then
ln -s $FILEVG355 $FILEVG
fi
if [ $CPUREV == "60" ]
then
ln -s $FILEVG355 $FILEVG
fi
fi
/etc/profile
登录的时候,输入完账户密码之后,调用/etc/profile
Tony Liu
2016-12-13, Shenzhen
busybox rootfs 启动脚本分析(一)的更多相关文章
- busybox rootfs 启动脚本分析(二)
上次分析了busybox的启动脚本,这次分析一下init.d中一些脚本的内容. 参考链接 http://www.cnblogs.com/helloworldtoyou/p/6169678.html h ...
- HBase配置&启动脚本分析
本文档基于hbase-0.96.1.1-cdh5.0.2,对HBase配置&启动脚本进行分析 date:2016/8/4 author:wangxl HBase配置&启动脚本分析 剔除 ...
- Spark配置&启动脚本分析
本文档基于Spark2.0,对spark启动脚本进行分析. date:2016/8/3 author:wangxl Spark配置&启动脚本分析 我们主要关注3类文件,配置文件,启动脚本文件以 ...
- Hadoop启动脚本分析
Hadoop启动脚本分析 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 能看到这篇博客的你估计对Hadoop已经有一个系统的了解了,最起码各种搭建方式你应该是会的,不会也没有关系, ...
- 4. hadoop启动脚本分析
4. hadoop启动脚本分析 1. hadoop的端口 ``` 50070 //namenode http port 50075 //datanode http port 50090 //2name ...
- hadoop启动脚本分析及常见命令
进程------------------ [hdfs]start-dfs.sh NameNode NN DataNode DN SecondaryNamenode 2NN [yarn]start-ya ...
- linux系统 initrd.img中init启动脚本分析
概述:这篇文章主体内容来源于网上转载.前面几篇文章倾向于制作initrd.img,这篇文章更倾向于initrd.img的运行过程:加载framebuff驱动 ide驱动和文件系统驱动,最后进入到真正的 ...
- 内核启动文件系统后第一个执行的文件(inittab启动脚本分析)
Linux 开机脚本启动顺序: 第一步:启动内核 第二步:执行init (配置文件/etc/inittab) 第三步:启动相应的脚本,执行inittab脚本,并且执行里面的脚本/etc/init.d ...
- Hadoop 2.0+YARN启动脚本分析与实战经验
start-all.sh脚本现在已经废弃,推荐使用start-dfs.sh和start-yarn.sh分别启动HDFS和YARN. 在新一代的Hadoop里面HDFS称为了统一存储的平台,而YARN成 ...
随机推荐
- BZOJ1946 : [Ceoi2006]ANTENNA
首先通过随机增量法求出最小覆盖圆,作为答案的上界. 然后二分答案,检验的时候枚举每个点作为原点,求出其他每个点被包括在圆内的角度区间,然后扫描线即可. 时间复杂度$O(Tn^2\log n)$. #i ...
- pig相关
1. 重命名pig job name: 在Pig脚本中的一开始处,写上这一句: set job.name 'This is my job'; 2. 设置pig参数: 允许pig时,输入如下: pig ...
- Iterable(迭代器)的用法
一.前言 在开发中,经常使用的还是for-each循环来遍历来Collection,不经常使用Iterable(迭代器)的,下面记录一下terable是一般用法: 二.说明 迭代器是一种设计模式,它是 ...
- spring3.0注解
一.前言 在日常的开发过程中,我们基本上都是采用注解的方式进行开发,提升开发的效率.不管是struts2.spring.hibernate.或者ibatis,这样方便开发,减少配置文件的数量:有益于团 ...
- 隐式调用 Intent 大全, 很全
http://ming-fanglin.iteye.com/blog/1061312 //调用浏览器 Uri uri = Uri.parse(""); Intent it = n ...
- GridView合并表头、多重表头(转)
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { switch (e.Row.RowType) ...
- 地理数据库的类型geodatabase类型
地理数据库的类型geodatabase类型 地理数据库是用于保存数据集集合的“容器”.有以下三种类型: 文件地理数据库 - 在文件系统中以文件夹形式存储.每个数据集都以文件形式保存,该文件大小最多可扩 ...
- github提交失败并报错java.io.IOException: Authentication failed:
一.概述 我最近在写一个android的项目. 软件:android studio.Android studio VCS integration(插件) Android studio VCS inte ...
- [LintCode] House Robber III 打家劫舍之三
The thief has found himself a new place for his thievery again. There is only one entrance to this a ...
- cat命令在文件中插入内容
eg: cat>> xxx <<EOFinsert 1insert 2 EOF