系统启动自动加载驱动或者运行程序


在etc/rc.d/rcS.d目录下增加一个启动文件,如S91startuserp:

root@EPC-8900:/etc/rc.d/rcS.d# cat S91startuserp

#! /bin/sh
# chkconfig: S 91 0

# Init script information
INIT_NAME=startuserp

# Load init script configuration
[ -f /etc/default/$INIT_NAME ] && . /etc/default/$INIT_NAME

# Source the init script functions
. /etc/init.d/init-functions

RET=0 ERROR=""

cat /etc/hostname > /proc/sys/kernel/hostname

#echo "################## S91S91S91"
#/root/startuserp
echo "ssh-server: start sshd"
mknod /dev/random c 1 8 > /dev/null 2>&1
mknod /dev/urandom c 1 9 > /dev/null 2>&1
/usr/sbin/sshd

echo "start insmod drivers"
insmod /root/gpiodrv.ko
udevstart&
insmod /root/zlg-sja1000-0.ko
udevstart&
insmod /root/zlg-sja1000-1.ko
udevstart&

echo "config network"
ifconfig eth0 192.168.1.136
ifconfig eth0 netmask 255.255.255.0

exit 0


作者: chenxibing008   发布时间: 2010-12-01