嵌入式linux修改启动脚本,嵌入式Linux启动脚本整理

这几周一直在研究目标机上Linux系统启动过程,先将涉及到的脚本内容及启动具体操作整理一下。

系统启动参数设定启动脚本为/linuxrc,内容如下:

#!/bin/bash

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/insmod /usr/sd_mod.ko                         //加载驱动

/bin/insmod /usr/usb-storage.ko

# /bin/insmod /usr/videodev.o

/bin/insmod /usr/usbvideo.ko

/bin/insmod /usr/ov511.ko

/bin/mknod /dev/video0 c 81 0

/bin/mount -f -t cramfs -o remount,ro /dev/bon/2 /

/bin/mount -t ramfs ramfs /var

/bin/mkdir -p /var/tmp

/bin/mkdir -p /var/run

/bin/mkdir -p /var/log

/bin/mkdir -p /var/lock

/bin/mkdir -p /var/empty

#/bin/mount -t usbdevfs none /proc/bus/usb

exec /sbin/init

接下来启动init进程,init进程是系统的第一个进程,它的PID为1,是所有进程的父进程。Init进程将用到系统引导配置文件/etc/inittab中的信息,根据该信息完成操作系统初始化工作。

# This is run first except when booting

::sysinit:/etc/init.d/rcS           //      ①

# Start an “askfirst” shell on the console

#::askfirst:-/bin/bash

::askfirst:/bin/bash

# Stuff to do when restarting the init process

::restart:/sbin/init

#::once:/sbin/raja.sh

#::respawn:/sbin/iom

::once:/usr/etc/rc.local      //       ②

# Stuff to do before rebooting

::ctrlaltdel:/sbin/reboot

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

①     /etc/init.d/rcS内容:

#!/bin/bash

/bin/mount -a

/usr/etc/profile

/************************** profile内容*********************

#!/bin/bash

DISPLAY=unix:0.0

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin

LD_LIBRARY_PATH=/lib:/usr/lib:/Qtopia/qt-2.3.2/lib

#QWS_KEYBOARD=TTY

LANG=C

HOME=/tmp                          //路径设置

KMOD=/lib/modules/2.4.19-rmk4-pxa2

export PATH LD_LIBRARY_PATH QTDIR LINUETTEDIR QWS_KEYBOARD LANG HOME DISPLAY KDEDIR KMOD

***********************************************************/

#echo “make /var,/tmp in /dev/shm”

#mkdir /dev/shm/tmp

#cp -a /etc/var /dev/shm

grep -q ‘dnmode=multi’ /proc/cmdline 2>/dev/null     // grep为查找函数,不太明白

if [ “$?” = “0” ]; then

/bin/canna

exit 0

fi

grep -q ‘dnmode=single’ /proc/cmdline 2>/dev/null

if [ “$?” = “0” ]; then

/bin/canna -s

exit 0

fi

grep -q ‘resetmode=hard’ /proc/cmdline 2>/dev/null

② /usr/etc/rc.local内容,用户可以把自己的初始化脚本程序放在这里:

#!/bin/bash

. /usr/etc/profile

/sbin/ifconfig lo 127.0.0.1 up

/sbin/ifconfig eth0 192.168.2.223 netmask 255.255.255.0 up

/bin/route add default gw 192.168.2.1 eth0

/sbin/inetd

/usr/sbin/makelinks

source /.bashrc

/bin/cp -rf /Qtopia/qtopia-free-1.7.0/wjluv/* /tmp/

# /bin/cp -rf /usr/config/* /tmp/

/bin/boa -c /home/httpd

/bin/mkdir /tmp/udisk

/bin/mkdir /tmp/images

/bin/mkdir /tmp/flashdisk

/bin/mkdir /tmp/sdcard

/bin/mkdir /tmp/mplayer

#/bin/mount -t yaffs /dev/mtdblock/3 /tmp/flashdisk/     //可挂载FLASH

#/bin/mount -t yaffs /dev/nfblock/4 /tmp/mplayer/

if test -e “/tmp/flashdisk/userconfig”; then

/bin/chmod u+x /tmp/flashdisk/userconfig

. /tmp/flashdisk/userconfig

fi

. /testshell

# /Qtopia/demo/bin/transerver 1800 -stopplay

./testshell内容,qpe启动。

#!/bin/sh

if test -e “/dev/input/mouse0″; then

export QWS_MOUSE_PROTO=MouseMan:/dev/input/mice

exec /Qtopia/qtopia-free-1.7.0/bin/qpe-mouse -qws

else

exec /Qtopia/qtopia-free-1.7.0/bin/qpe -qws

fi

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值