为freescale MX28包设置自动启动

1. 首先制作init.d脚本,如:

$ vi dist/lfs-5.1/remserial/remserial.spec 

 

cat << EOF > $RPM_BUILD_ROOT/%{pfx}/etc/rc.d/init.d/remserial
#!/bin/sh

if [ ! -x /sbin/remserial ]
then
    exit 0
fi

if [ "$1" = "stop" -o "$1" = "restart" ]
then
    echo "Stopping the remserial: "
    killall remserial
fi
if [ "$1" = "start" -o "$1" = "restart" ]
then
    echo "Starting the remserial: "
    /sbin/remserial -d -p 23000 -s "9600 raw" /dev/ttyS0 &
fi
EOF

 

 2 编辑config/userspace/sysconfig.lkc,增加:

 

config SYSCFG_START_REMSERIAL
    depends PKG_REMSERIAL
    bool "start remserail"
    default y

 

 3 编辑dist/lfs-5.1/sysconfig/sysconfig-mx.spec增加新的服务:

 

if [ "$SYSCFG_START_REMSERIAL" = "y" ] then
    remserial=remserial
fi
all_services = 后面增加 remserial
all_services_r = 后面增加 remserial
cfg_services = 后面增加 $remserial
cfg_services_r = 后面增加 $remserail
  

 

你可能感兴趣的:(脚本)