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
本文档详细介绍了如何创建init.d脚本来启动和停止remserial服务,并通过编辑配置文件实现服务的自动启动。
1万+

被折叠的 条评论
为什么被折叠?



