日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

busybox rootfs 启动脚本分析(一)

發布時間:2023/12/20 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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" ] thenservices=$cfg_services elseservices=$cfg_services_r fi cfg_services=${2:-$services}# run the configured sequence for i in $cfg_services doif [ -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 doneif [ $# -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 thenecho "rebuilding rpm database"rm -rf /tmp/ltib # 重新創建rpm數據庫rpm --rebuilddb fi# fix up permissions if [ -d /home/user ] # 是否存在/home/user目錄 thenchown -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不可讀 thenecho "creating hypervisor nodes"DEVID=`cat /sys/class/misc/fsl-hv/dev`if [ -n "$DEVID" ] # 判斷是否為空thenMAJOR="${DEVID%:*}"MINOR="${DEVID##*:}"if [ \( "$MAJOR" -gt 0 \) -a \( "$MINOR" -gt 0 \) ]thenrm -f /dev/fsl-hvmknod /dev/fsl-hv c $MAJOR $MINORfififor i in 0 1 2 3 4 5 6 7domknod /dev/hvc$i c 229 $idone fi# add the fm device nodes if [ -n "$(cat /proc/devices | grep fm | sed 's/\([0-9]*\).*/\1/')" -a ! -r /dev/fm0 ] thenecho "creating fman device nodes"cd /usr/share/doc/fmd-uspace-01.01/test/sh fm_dev_createcd - fifor i in 0 1 2; doif [ -e /sys/class/graphics/fb$i ]; thenchmod 0666 /sys/class/graphics/fb$i/panfi 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 ] thenif [ $CPUREV == "61" ] || [ $CPUREV == "63" ] || [ $CPUREV == "60" ] && [ -e $FILEVG ]thenrm -f $FILEVGfi if [ $CPUREV == "61" ]thenln -s $FILEVG3D $FILEVG # 創建軟連接fi if [ $CPUREV == "63" ]thenln -s $FILEVG355 $FILEVGfi if [ $CPUREV == "60" ]thenln -s $FILEVG355 $FILEVGfi fi

/etc/profile

登錄的時候,輸入完賬戶密碼之后,調用/etc/profile


Tony Liu

2016-12-13, Shenzhen

總結

以上是生活随笔為你收集整理的busybox rootfs 启动脚本分析(一)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。