System-V initialization script
Hi,
Here is a patch that adds a System-V init script to the distribution. This script creates/deletes the devices in /dev and sets the latency through /proc/xenomai/latency. Please re-run automake before committing (if committing).
Is there anything more it should do? For instance, is there a way to start the timer through one of the /proc/xenomai/* pseudo-files?
Signature · 1 line
Romain LENGLET
ChangeLog +6 -0
@@ -1,3 +1,9 @@ +2006-03-06 Romain Lenglet <[email protected]> + + * scripts/etc/init.d/xenomai, scripts/etc/default/xenomai, + scripts/etc/README scripts/Makefile.am: Add a System-V-like init script + for creating devices and setting the scheduling latency at boot time. + 2006-03-05 Philippe Gerum <[email protected]> * ksrc/skins/vxworks/taskLib.c (taskPrioritySet): Return ERROR
scripts/Makefile.am +1 -0
@@ -8,4 +8,5 @@ EXTRA_DIST = bootstrap prepare-kernel.sh xeno-info \ Kconfig.frag Modules.frag defconfig.frag \ + etc/init.d/xenomai etc/default/xenomai etc/README \ $(wildcard postinstall.sh)
scripts/etc/default/xenomai +6 -0
@@ -0,0 +1,6 @@ +# The group that owns the Xenomai devices in /dev/. +GROUP=root +# The access mode to the Xenomai devices in /dev/. +MODE=0770 +# The real-time scheduling latency. +LATENCY=0
scripts/etc/init.d/xenomai +98 -0
98 lines not on this page · raw message
scripts/etc/README +22 -0
@@ -0,0 +1,22 @@ +This directory contains a System-V-style initialization script for Xenomai. +That script creates the real-time devices in /dev/, and sets the scheduling +latency through the /proc/xenomai/latency interface. + +To install this script, as root: +> cp init.d/xenomai /etc/init.d/xenomai +> chown root:root /etc/init.d/xenomai +> chmod 0755 /etc/init.d/xenomai + +The configuration values are stored in the /etc/default/xenomai file. +A skeleton is provided in this directory. To install it: +> cp default/xenomai /etc/default/xenomai +> chown root:root /etc/default/xenomai +> chmod 0644 /etc/default/xenomai +And adapt the values in /etc/default/xenomai. + +Then, make the initialization script start in the required runlevels. +On Debian, you can use update-rc.d(8) or rcconf(8) to do so. +Or you can also do it manually: +> for L in 0 1 6; do (cd /etc/rc${L}.d ; ln -s ../init.d/xenomai K20xenomai) ; done +> for L in 2 3 4 5; do (cd /etc/rc${L}.d ; ln -s ../init.d/xenomai S20xenomai) ; done +
Quoted 5 lines · Romain Lenglet
Hi,
Here is a patch that adds a System-V init script to the distribution. This script creates/deletes the devices in /dev and sets the latency through
/proc/xenomai/latency. Please re-run automake before committing (if committing).
Ok, queued for 2.1.1. Thanks.
Quoted 2 lines
Is there anything more it should do? For instance, is there a way to start the timer through one of the
/proc/xenomai/*pseudo-files?
v2.1 starts the timer as part of the nucleus startup procedure, so it should not be needed to do so on boot. This said, providing a write side to /proc/xenomai/timer so that we could change the setup on-the-fly looks like a good idea.
Quoted 170 lines
------------------------------------------------------------------------
ChangeLog +6
-0@@ -1,3 +1,9 @@ +2006-03-06 Romain Lenglet <[email protected]> + + * scripts/etc/init.d/xenomai, scripts/etc/default/xenomai, + scripts/etc/README scripts/Makefile.am: Add a System-V-like init script + for creating devices and setting the scheduling latency at boot time. + 2006-03-05 Philippe Gerum <[email protected]> * ksrc/skins/vxworks/taskLib.c (taskPrioritySet): Return ERRORscripts/Makefile.am +1
-0@@ -8,4 +8,5 @@ EXTRA_DIST = bootstrap prepare-kernel.sh xeno-info \ Kconfig.frag Modules.frag defconfig.frag \ + etc/init.d/xenomai etc/default/xenomai etc/README \ $(wildcard postinstall.sh)diff -Naurd xenomai/scripts/etc/default/xenomai xenomai-new/scripts/etc/default/xenomai
scripts/etc/default/xenomai +6
-0@@ -0,0 +1,6 @@ +# The group that owns the Xenomai devices in /dev/. +GROUP=root +# The access mode to the Xenomai devices in /dev/. +MODE=0770 +# The real-time scheduling latency. +LATENCY=0diff -Naurd xenomai/scripts/etc/init.d/xenomai xenomai-new/scripts/etc/init.d/xenomai
scripts/etc/init.d/xenomai +98
-0@@ -0,0 +1,98 @@ +#! /bin/sh +# +# xenomai Xenomai Real-time framework for Linux. +# This script sets up devices in /dev if Udev is not running, +# and sets the real-time scheduling latency. +# +# Written by Romain Lenglet <[email protected]>. +# + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +NAME=xenomai +DESC=Xenomai + +# Include xenomai defaults if available +if [ -f /etc/default/xenomai ] ; then + . /etc/default/xenomai +fi + +# Set default values in case /etc/default/xenomai does not exist or is not +# correctly specified +GROUP=${GROUP:=root} +MODE=${MODE:=0770} +LATENCY=${LATENCY:=0} + +set -e + +case "$1" in + start|reload|restart|force-reload) + echo -n "Starting $DESC: " + + # Create devices if Udev is not running (otherwise, Udev should have + # been configured to create the devices itself). + UDEV_STARTED="N" + if [ -e /dev/.udev ]; then + if mountpoint -q /dev/; then + UDEV_STARTED="Y" + fi + fi + if [ "$UDEV_STARTED" = "N" ]; then + for N in `seq 0 31`; do + F="/dev/rtp$n" + if [ ! -c "$F" ]; then + /bin/mknod -m 666 "$F" c 150 "$N" + /bin/chown ":$GROUP" "$F" + /bin/chmod "$MODE" "$F" + fi + done + F=/dev/rtheap + if [ ! -c "$F" ]; then + /bin/mknod -m 666 "$F" c 10 254 + /bin/chown ":$GROUP" "$F" + /bin/chmod "$MODE" "$F" + fi + echo -n "devices, " + fi + + # Set the scheduling latency. + if [ -w /proc/xenomai/latency ]; then + echo "$LATENCY" > /proc/xenomai/latency + echo -n "latency, " + fi + + echo "done." + ;; + stop) + echo -n "Stopping $DESC: " + + # Delete devices if Udev is not running. + UDEV_STARTED="N" + if [ -e /dev/.udev ]; then + if mountpoint -q /dev/; then + UDEV_STARTED="Y" + fi + fi + if [ "$UDEV_STARTED" = "N" ]; then + for N in `seq 0 31`; do + F="/dev/rtp$n" + if [ -c "$F" ]; then + rm -f "$F" + fi + done + F=/dev/rtheap + if [ -c "$F" ]; then + rm -f "$F" + fi + echo -n "devices, " + fi + + echo "done." + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|reload|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0diff -Naurd xenomai/scripts/etc/README xenomai-new/scripts/etc/README
scripts/etc/README +22
-1@@ -0,0 +1,22 @@ +This directory contains a System-V-style initialization script for Xenomai. +That script creates the real-time devices in /dev/, and sets the scheduling +latency through the /proc/xenomai/latency interface. + +To install this script, as root: +> cp init.d/xenomai /etc/init.d/xenomai +> chown root:root /etc/init.d/xenomai +> chmod 0755 /etc/init.d/xenomai + +The configuration values are stored in the /etc/default/xenomai file. +A skeleton is provided in this directory. To install it: +> cp default/xenomai /etc/default/xenomai +> chown root:root /etc/default/xenomai +> chmod 0644 /etc/default/xenomai +And adapt the values in /etc/default/xenomai. + +Then, make the initialization script start in the required runlevels. +On Debian, you can use update-rc.d(8) or rcconf(8) to do so. +Or you can also do it manually: +> for L in 0 1 6; do (cd /etc/rc${L}.d ; ln -s ../init.d/xenomai K20xenomai) ; done +> for L in 2 3 4 5; do (cd /etc/rc${L}.d ; ln -s ../init.d/xenomai S20xenomai) ; done + ------------------------------------------------------------------------_______________________________________________
Xenomai-core mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-core
Signature · 1 line
Philippe.