Module: xenomai-gch
Branch: for-forge
Commit: 467f604aca8439875e5ec9f47b15fed38d07b341
URL:    
http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=467f604aca8439875e5ec9f47b15fed38d07b341

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Thu Nov 13 18:55:58 2014 +0100

rtnet: compile and install tools

---

 configure.ac            |    9 +-
 utils/Makefile.am       |    2 +-
 utils/net/rtnet.conf.in |    4 +-
 utils/net/rtnet.in      |  468 +++++++++++++++++++++++------------------------
 4 files changed, 243 insertions(+), 240 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3bf0147..fe647e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,12 +182,12 @@ AC_ARG_ENABLE(debug,
                debug_symbols=y
                ;;
        y | yes | partial)
-               debug_mode=partial
-               debug_symbols=y
+               debug_mode=partial
+               debug_symbols=y
                ;;
        full)
                debug_mode=full
-               debug_symbols=y
+               debug_symbols=y
                ;;
        n | no)
                debug_mode=
@@ -934,6 +934,9 @@ AC_CONFIG_FILES([ \
        utils/ps/Makefile \
        utils/slackspot/Makefile \
        utils/autotune/Makefile \
+       utils/net/rtnet \
+       utils/net/rtnet.conf \
+       utils/net/Makefile \
        demo/Makefile \
        demo/posix/Makefile \
        demo/posix/cobalt/Makefile \
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 62c5e70..e9241b7 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -1,3 +1,3 @@
 if XENO_COBALT
-SUBDIRS = can analogy ps slackspot autotune
+SUBDIRS = analogy autotune can net ps slackspot
 endif
diff --git a/utils/net/rtnet.conf.in b/utils/net/rtnet.conf.in
index aacc513..12335d2 100644
--- a/utils/net/rtnet.conf.in
+++ b/utils/net/rtnet.conf.in
@@ -5,13 +5,13 @@
 # RTnet installation path
 prefix="@prefix@"
 exec_prefix="@exec_prefix@"
-RTNET_MOD="@RTNET_MODULE_DIR@"
+RTNET_MOD="/lib/modules/`uname -r`/kernel/drivers/xenomai/net"
 RTIFCONFIG="@sbindir@/rtifconfig"
 RTCFG="@sbindir@/rtcfg"
 TDMACFG="@sbindir@/tdmacfg"
 
 # Module suffix: ".o" for 2.4 kernels, ".ko" for later versions
-MODULE_EXT="@RTNET_MODULE_EXT@"
+MODULE_EXT=".ko"
 
 
 
diff --git a/utils/net/rtnet.in b/utils/net/rtnet.in
index b04e410..f81a7bb 100755
--- a/utils/net/rtnet.in
+++ b/utils/net/rtnet.in
@@ -16,109 +16,109 @@ usage() {
     cat << EOF
 Usage:
     $0 [-cf <config-file>] [-v] [-c] {start|stop}
-        Start or stop station according to configuration file
+       Start or stop station according to configuration file
 
     $0 [-cf <config-file>] [-v] [-c] master <slave_ip1> [<slave_ip2> ...]
-        Start station as master for given list of slaves
+       Start station as master for given list of slaves
 
     $0 [-cf <config-file>] [-v] capture
-        Start only passive realtime capturing
+       Start only passive realtime capturing
 
     The additional switch -v enables verbose output.
     The additional switch -c enables capturing mode to allow use of a network
-        analyzer such as Wireshark (if rtnet was built with --enable-rtcap).
+       analyzer such as Wireshark (if rtnet was built with --enable-rtcap).
 EOF
 }
 
 init_rtnet() {
-    insmod $RTNET_MOD/rtnet$MODULE_EXT >/dev/null || exit 1
-    insmod $RTNET_MOD/rtipv4$MODULE_EXT >/dev/null || exit 1
-    insmod $RTNET_MOD/$RT_DRIVER$MODULE_EXT $RT_DRIVER_OPTIONS >/dev/null || 
exit 1
+    modprobe rtnet >/dev/null || exit 1
+    modprobe rtipv4 >/dev/null || exit 1
+    modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
 
     for dev in $REBIND_RT_NICS; do
-        if [ -d /sys/bus/pci/devices/$dev/driver ]; then
-            echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
-        fi
-        echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
+       if [ -d /sys/bus/pci/devices/$dev/driver ]; then
+           echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
+       fi
+       echo $dev > /sys/bus/pci/drivers/$RT_DRIVER/bind
     done
 
     for PROTOCOL in $RT_PROTOCOLS; do
-        insmod $RTNET_MOD/rt$PROTOCOL$MODULE_EXT >/dev/null || exit 1
+       modprobe rt$PROTOCOL >/dev/null || exit 1
     done
 
     if [ $RT_LOOPBACK = "yes" ]; then
-        insmod $RTNET_MOD/rt_loopback$MODULE_EXT >/dev/null || exit 1
+       modprobe rt_loopback >/dev/null || exit 1
     fi
 
     if [ $RTCAP = "yes" ]; then
-        insmod $RTNET_MOD/rtcap$MODULE_EXT >/dev/null || exit 1
+       modprobe rtcap >/dev/null || exit 1
     fi
 
     if [ $RT_LOOPBACK = "yes" ]; then
-        $RTIFCONFIG rtlo up 127.0.0.1
+       $RTIFCONFIG rtlo up 127.0.0.1
     fi
 
     if [ $RTCAP = "yes" ]; then
-        ifconfig rteth0 up
-        ifconfig rteth0-mac up
-        if [ $RT_LOOPBACK = "yes" ]; then
-            ifconfig rtlo up
-        fi
+       ifconfig rteth0 up
+       ifconfig rteth0-mac up
+       if [ $RT_LOOPBACK = "yes" ]; then
+           ifconfig rtlo up
+       fi
     fi
 
-    insmod $RTNET_MOD/rtcfg$MODULE_EXT >/dev/null
-    insmod $RTNET_MOD/rtmac$MODULE_EXT >/dev/null
-    insmod $RTNET_MOD/tdma$MODULE_EXT >/dev/null
+    modprobe rtcfg >/dev/null
+    modprobe rtmac >/dev/null
+    modprobe tdma >/dev/null
 }
 
 submit_cfg() {
     case "$STATION_TYPE" in
-        master)
-            $RTIFCONFIG rteth0 up $STATION_IP
-
-            $TDMACFG rteth0 master $TDMA_CYCLE
-            eval "$TDMA_SLOTS"
-
-            IPADDR=$STATION_IP
-            NETMASK_OPT=
-            ;;
-        slave)
-            if [ ! "$STATION_IP" = "" ]; then
-                if [ ! "$STATION_MAC" = "" ]; then
-                    RTCFG_CLIENT="$STATION_IP -hw $STATION_MAC"
-                else
-                    RTCFG_CLIENT="$STATION_IP"
-                fi
-            else
-                RTCFG_CLIENT="$STATION_MAC"
-            fi
-
-            ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
-
-            echo "$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
-                $RTCFG rteth0 add $RTCFG_CLIENT -stage1 -
-            ;;
-        backup-master)
-            if [ ! "$STATION_IP" = "" ]; then
-                if [ ! "$STATION_MAC" = "" ]; then
-                    RTCFG_CLIENT="$STATION_IP -hw $STATION_MAC"
-                else
-                    RTCFG_CLIENT="$STATION_IP"
-                fi
-            else
-                RTCFG_CLIENT="$STATION_MAC"
-            fi
-
-            ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
-
-            STAGE_2_OPT=
-            if [ ! "$STATION_STAGE_2_SRC" = "" ]; then
-                STAGE_2_OPT="-stage2 $STATION_STAGE_2_SRC"
-            fi
-
-            echo "\$TDMACFG rteth0 detach;\$TDMACFG rteth0 master $TDMA_CYCLE 
-b $TDMA_BACKUP_OFFS;$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
-                $RTCFG rteth0 add $RTCFG_CLIENT -stage1 - $STAGE_2_OPT
-            ;;
+       master)
+           $RTIFCONFIG rteth0 up $STATION_IP
+
+           $TDMACFG rteth0 master $TDMA_CYCLE
+           eval "$TDMA_SLOTS"
+
+           IPADDR=$STATION_IP
+           NETMASK_OPT=
+           ;;
+       slave)
+           if [ ! "$STATION_IP" = "" ]; then
+               if [ ! "$STATION_MAC" = "" ]; then
+                   RTCFG_CLIENT="$STATION_IP -hw $STATION_MAC"
+               else
+                   RTCFG_CLIENT="$STATION_IP"
+               fi
+           else
+               RTCFG_CLIENT="$STATION_MAC"
+           fi
+
+           ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
+
+           echo "$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
+               $RTCFG rteth0 add $RTCFG_CLIENT -stage1 -
+           ;;
+       backup-master)
+           if [ ! "$STATION_IP" = "" ]; then
+               if [ ! "$STATION_MAC" = "" ]; then
+                   RTCFG_CLIENT="$STATION_IP -hw $STATION_MAC"
+               else
+                   RTCFG_CLIENT="$STATION_IP"
+               fi
+           else
+               RTCFG_CLIENT="$STATION_MAC"
+           fi
+
+           ADD_STAGE1_CMDS="ifconfig vnic0 up $STATION_IP"
+
+           STAGE_2_OPT=
+           if [ ! "$STATION_STAGE_2_SRC" = "" ]; then
+               STAGE_2_OPT="-stage2 $STATION_STAGE_2_SRC"
+           fi
+
+           echo "\$TDMACFG rteth0 detach;\$TDMACFG rteth0 master $TDMA_CYCLE 
-b $TDMA_BACKUP_OFFS;$TDMA_SLOTS$ADD_STAGE1_CMDS" | \
+               $RTCFG rteth0 add $RTCFG_CLIENT -stage1 - $STAGE_2_OPT
+           ;;
     esac
 
     STATION_TYPE=
@@ -134,107 +134,107 @@ start_master() {
 
     STAGE_2_OPT=
     if [ ! "$STAGE_2_SRC" = "" ]; then
-        STAGE_2_OPT="-stage2 $STAGE_2_SRC"
+       STAGE_2_OPT="-stage2 $STAGE_2_SRC"
     fi
 
     if [ ! "$TDMA_SLAVES" = "" ]; then
-        # Simple setup:
-        #   Sync / Master Slot / + TDMA_OFFSET us / Slave 1 /
-        #   + TDMA_OFFSET us / Slave 2 / + TDMA_OFFSET us / ... / Slave n
+       # Simple setup:
+       #   Sync / Master Slot / + TDMA_OFFSET us / Slave 1 /
+       #   + TDMA_OFFSET us / Slave 2 / + TDMA_OFFSET us / ... / Slave n
 
-        $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
+       $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
 
-        $TDMACFG rteth0 master $TDMA_CYCLE
-        $TDMACFG rteth0 slot 0 0
+       $TDMACFG rteth0 master $TDMA_CYCLE
+       $TDMACFG rteth0 slot 0 0
 
-        OFFSET=$TDMA_OFFSET
-        for SLAVE in $TDMA_SLAVES; do
-            echo "\$TDMACFG rteth0 slot 0 $OFFSET;ifconfig vnic0 up \$IPADDR 
\$NETMASK_OPT" | \
-                $RTCFG rteth0 add $SLAVE -stage1 - $STAGE_2_OPT
-            OFFSET=$(($OFFSET+$TDMA_OFFSET))
-        done
+       OFFSET=$TDMA_OFFSET
+       for SLAVE in $TDMA_SLAVES; do
+           echo "\$TDMACFG rteth0 slot 0 $OFFSET;ifconfig vnic0 up \$IPADDR 
\$NETMASK_OPT" | \
+               $RTCFG rteth0 add $SLAVE -stage1 - $STAGE_2_OPT
+           OFFSET=$(($OFFSET+$TDMA_OFFSET))
+       done
     else
-        # Get setup from TDMA_CONFIG file:
-        #
-        # master:
-        # [ip 1.2.3.4]
-        # cycle <cycle_in_us>
-        # slot <id> <offset_in_us> [<phasing>/<period> [<size> 
[<joint_slot_id>]]]
-        # slot ...
-        #
-        # slave:
-        # ip 1.2.3.4
-        # mac AA:BB:CC:DD:EE:FF
-        # [stage2 <file>]
-        # slot ...
-        #
-        # slave:
-        # ip 1.2.3.4
-        # [stage2 <file>]
-        # slot ...
-        #
-        # slave:
-        # mac AA:BB:CC:DD:EE:FF
-        # [stage2 <file>]
-        # slot ...
-        #
-        # backup-master:
-        # ip 1.2.3.4    (or ip+mac or mac only, just like slaves)
-        # backup-slot <offset_in_us>
-        # [stage2 <file>]
-        # slot ...
-        #
-
-        if [ ! -r $TDMA_CONFIG ]; then
-            echo "Could not read $TDMA_CONFIG"
-            exit 1
-        fi
-
-        while read ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
-            case "$ARG1" in
-                "master:")
-                    submit_cfg
-                    STATION_TYPE=master
-                    ;;
-                "cycle")
-                    TDMA_CYCLE="$ARG2"
-                    ;;
-                "backup-master:")
-                    submit_cfg
-                    STATION_TYPE=backup-master
-                    ;;
-                "backup-offset")
-                    TDMA_BACKUP_OFFS="$ARG2"
-                    ;;
-                "slave:")
-                    submit_cfg
-                    STATION_TYPE=slave
-                    ;;
-                "ip")
-                    STATION_IP="$ARG2"
-                    ;;
-                "mac")
-                    STATION_MAC="$ARG2"
-                    ;;
-                "stage2")
-                    STATION_STAGE_2="$ARG2"
-                    ;;
-                "slot")
-                    TDMA_SLOTS="$TDMA_SLOTS\$TDMACFG rteth0 slot $ARG2 $ARG3"
-                    if [ ! "$ARG4" = "" ]; then
-                        TDMA_SLOTS="$TDMA_SLOTS -p $ARG4"
-                    fi
-                    if [ ! "$ARG5" = "" ]; then
-                        TDMA_SLOTS="$TDMA_SLOTS -s $ARG5"
-                    fi
-                    if [ ! "$ARG6" = "" ]; then
-                        TDMA_SLOTS="$TDMA_SLOTS -j $ARG6"
-                    fi
-                    TDMA_SLOTS="$TDMA_SLOTS;"
-                    ;;
-            esac
-        done < $TDMA_CONFIG
-        submit_cfg
+       # Get setup from TDMA_CONFIG file:
+       #
+       # master:
+       # [ip 1.2.3.4]
+       # cycle <cycle_in_us>
+       # slot <id> <offset_in_us> [<phasing>/<period> [<size> 
[<joint_slot_id>]]]
+       # slot ...
+       #
+       # slave:
+       # ip 1.2.3.4
+       # mac AA:BB:CC:DD:EE:FF
+       # [stage2 <file>]
+       # slot ...
+       #
+       # slave:
+       # ip 1.2.3.4
+       # [stage2 <file>]
+       # slot ...
+       #
+       # slave:
+       # mac AA:BB:CC:DD:EE:FF
+       # [stage2 <file>]
+       # slot ...
+       #
+       # backup-master:
+       # ip 1.2.3.4    (or ip+mac or mac only, just like slaves)
+       # backup-slot <offset_in_us>
+       # [stage2 <file>]
+       # slot ...
+       #
+
+       if [ ! -r $TDMA_CONFIG ]; then
+           echo "Could not read $TDMA_CONFIG"
+           exit 1
+       fi
+
+       while read ARG1 ARG2 ARG3 ARG4 ARG5 ARG6; do
+           case "$ARG1" in
+               "master:")
+                   submit_cfg
+                   STATION_TYPE=master
+                   ;;
+               "cycle")
+                   TDMA_CYCLE="$ARG2"
+                   ;;
+               "backup-master:")
+                   submit_cfg
+                   STATION_TYPE=backup-master
+                   ;;
+               "backup-offset")
+                   TDMA_BACKUP_OFFS="$ARG2"
+                   ;;
+               "slave:")
+                   submit_cfg
+                   STATION_TYPE=slave
+                   ;;
+               "ip")
+                   STATION_IP="$ARG2"
+                   ;;
+               "mac")
+                   STATION_MAC="$ARG2"
+                   ;;
+               "stage2")
+                   STATION_STAGE_2="$ARG2"
+                   ;;
+               "slot")
+                   TDMA_SLOTS="$TDMA_SLOTS\$TDMACFG rteth0 slot $ARG2 $ARG3"
+                   if [ ! "$ARG4" = "" ]; then
+                       TDMA_SLOTS="$TDMA_SLOTS -p $ARG4"
+                   fi
+                   if [ ! "$ARG5" = "" ]; then
+                       TDMA_SLOTS="$TDMA_SLOTS -s $ARG5"
+                   fi
+                   if [ ! "$ARG6" = "" ]; then
+                       TDMA_SLOTS="$TDMA_SLOTS -j $ARG6"
+                   fi
+                   TDMA_SLOTS="$TDMA_SLOTS;"
+                   ;;
+           esac
+       done < $TDMA_CONFIG
+       submit_cfg
     fi
 
     ifconfig vnic0 up $IPADDR $NETMASK_OPT
@@ -279,93 +279,93 @@ fi
 
 case "$1" in
     start)
-        init_rtnet
-
-        if [ $TDMA_MODE = "master" ]; then
-            start_master
-        else
-            $TDMACFG rteth0 slave
-
-            $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
-
-            echo -n "Stage 1: searching for master..."
-            eval "`$RTCFG rteth0 client -c`"
-            echo
-
-            echo -n "Stage 2: waiting for other slaves..."
-            if [ ! "$STAGE_2_DST" = "" ]; then
-                $RTCFG rteth0 announce -f $STAGE_2_DST
-                echo
-                eval "$STAGE_2_CMDS"
-            else
-                $RTCFG rteth0 announce
-                echo
-            fi
-
-            echo -n "Stage 3: waiting for common setup completion..."
-            $RTCFG rteth0 ready
-            echo
-        fi
-        ;;
+       init_rtnet
+
+       if [ $TDMA_MODE = "master" ]; then
+           start_master
+       else
+           $TDMACFG rteth0 slave
+
+           $RTIFCONFIG rteth0 up $IPADDR $NETMASK_OPT
+
+           echo -n "Stage 1: searching for master..."
+           eval "`$RTCFG rteth0 client -c`"
+           echo
+
+           echo -n "Stage 2: waiting for other slaves..."
+           if [ ! "$STAGE_2_DST" = "" ]; then
+               $RTCFG rteth0 announce -f $STAGE_2_DST
+               echo
+               eval "$STAGE_2_CMDS"
+           else
+               $RTCFG rteth0 announce
+               echo
+           fi
+
+           echo -n "Stage 3: waiting for common setup completion..."
+           $RTCFG rteth0 ready
+           echo
+       fi
+       ;;
 
     stop)
-        ifconfig vnic0 down 2>/dev/null
-        ifconfig rteth0 down 2>/dev/null
-        ifconfig rteth0-mac down 2>/dev/null
-        ifconfig rtlo down 2>/dev/null
+       ifconfig vnic0 down 2>/dev/null
+       ifconfig rteth0 down 2>/dev/null
+       ifconfig rteth0-mac down 2>/dev/null
+       ifconfig rtlo down 2>/dev/null
 
-        $RTIFCONFIG rteth0 down 2>/dev/null
-        $RTIFCONFIG rtlo down 2>/dev/null
+       $RTIFCONFIG rteth0 down 2>/dev/null
+       $RTIFCONFIG rtlo down 2>/dev/null
 
-        rmmod tdma rtmac rtcfg rtcap rt_loopback $RT_DRIVER rtpacket rtudp 
rttcp rtipv4 rtnet 2>/dev/null
+       rmmod tdma rtmac rtcfg rtcap rt_loopback $RT_DRIVER rtpacket rtudp 
rttcp rtipv4 rtnet 2>/dev/null
 
-        for dev in $REBIND_RT_NICS; do
-            echo 1 > /sys/bus/pci/devices/$dev/remove
-        done
-        if [ ! "$REBIND_RT_NICS" = "" ]; then
-            sleep 1
-            echo 1 > /sys/bus/pci/rescan
-        fi
-        ;;
+       for dev in $REBIND_RT_NICS; do
+           echo 1 > /sys/bus/pci/devices/$dev/remove
+       done
+       if [ ! "$REBIND_RT_NICS" = "" ]; then
+           sleep 1
+           echo 1 > /sys/bus/pci/rescan
+       fi
+       ;;
 
     master)
-        shift
-        init_rtnet
-        TDMA_SLAVES=$*
-        start_master
-        ;;
+       shift
+       init_rtnet
+       TDMA_SLAVES=$*
+       start_master
+       ;;
 
     capture)
-        insmod $RTNET_MOD/rtnet$MODULE_EXT >/dev/null || exit 1
-        insmod $RTNET_MOD/$RT_DRIVER$MODULE_EXT $RT_DRIVER_OPTIONS >/dev/null 
|| exit 1
-        insmod $RTNET_MOD/rtcap$MODULE_EXT >/dev/null || exit 1
-        $RTIFCONFIG rteth0 up promisc
-        ifconfig rteth0 up
-        ifconfig rteth0-mac up
-        ;;
+       modprobe rtnet >/dev/null || exit 1
+       modprobe $RT_DRIVER $RT_DRIVER_OPTIONS >/dev/null || exit 1
+       modprobe rtcap >/dev/null || exit 1
+       $RTIFCONFIG rteth0 up promisc
+       ifconfig rteth0 up
+       ifconfig rteth0-mac up
+       ;;
 
     loopback)
-        insmod $RTNET_MOD/rtnet$MODULE_EXT >/dev/null || exit 1
-        insmod $RTNET_MOD/rtipv4$MODULE_EXT >/dev/null || exit 1
+       modprobe rtnet >/dev/null || exit 1
+       modprobe rtipv4 >/dev/null || exit 1
 
-        for PROTOCOL in $RT_PROTOCOLS; do
-            insmod $RTNET_MOD/rt$PROTOCOL$MODULE_EXT >/dev/null || exit 1
-        done
+       for PROTOCOL in $RT_PROTOCOLS; do
+           modprobe rt$PROTOCOL >/dev/null || exit 1
+       done
 
-        insmod $RTNET_MOD/rt_loopback$MODULE_EXT >/dev/null || exit 1
+       modprobe rt_loopback >/dev/null || exit 1
 
-        if [ $RTCAP = "yes" ]; then
-            insmod $RTNET_MOD/rtcap$MODULE_EXT >/dev/null || exit 1
-        fi
+       if [ $RTCAP = "yes" ]; then
+           modprobe rtcap >/dev/null || exit 1
+       fi
 
-        $RTIFCONFIG rtlo up 127.0.0.1
+       $RTIFCONFIG rtlo up 127.0.0.1
 
-        if [ $RTCAP = "yes" ]; then
-            ifconfig rtlo up
-        fi
-        ;;
+       if [ $RTCAP = "yes" ]; then
+           ifconfig rtlo up
+       fi
+       ;;
 
     *)
-        usage
-        exit 1
+       usage
+       exit 1
 esac


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to