Davidinos / rtnet-geek

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

# rtnet-geek

Contents
====
1. beaglebone-black
2. x86_64 qemu
3. rtnet-test
4. contact


1. beaglebone-black
====
  I ported to xenomai 3.0.9 linux kernel 4.14.71
the beaglebone-black rtnet drivers. The story is the following:
- Hidde Verstoep port the beaglebone-drivers to linux 3.x
https://github.com/hiddeate2m/rtnet
- Geoffrey Bonneville port Hidde's drivers to linux 4.1
https://github.com/G-Ray/xenomai-boneblack-rtnet-drivers
- I ported to linux 4.14.71

  The easiest way to test it is using buildroot to build
a beaglebone-black rootfs and the arm-linux-gcc toolchain,
then build separately the kernel image using the toolchain
and xenomai ipipe patch.

  Please note that all beaglebone-black boards have a problem with the ethernet phy:
https://wp.josh.com/2018/06/04/a-software-only-solution-to-the-vexing-beagle-bone-black-phy-issue


2. x86_64 qemu
====
  The kernel image bzImage and rootfs are all that one needs
to simulate with qemu.
  rootfs can be mounted with
mount rootfs /media/username
and the copy all the files needed to /root
(the files are already copied).

  To setup qemu networking,
a) cat /etc/network/interfaces
auto lo
iface lo inet loopback
iface enp2s0 inet manual
auto br0
iface br0 inet static
    address 192.168.1.100
    netmask 255.255.255.0
    gateway 192.168.1.1
    dns-nameserver 8.8.8.8
    dns-nameserver 8.8.4.4
    bridge_ports enp2s0
    bridge_stp      off
    bridge_maxwait  0
    bridge_fd       0
b) cat /etc/qemu/bridge.conf 
allow virbr0
allow br0

  The virtual machine can be started with:
a) If you have kvm installed:
sudo qemu-system-x86_64 -m 1G --enable-kvm -M q35 -kernel bzImage -hda rootfs -append "console=tty1 console=ttyS0 root=/dev/sda rw" -device rtl8139,netdev=bridgeid,mac=52:54:00:11:22:33 -netdev bridge,br=br0,id=bridgeid -serial stdio
b) Without kvm:
sudo qemu-system-x86_64 -m 1G              -M q35 -kernel bzImage -hda rootfs -append "console=tty1 console=ttyS0 root=/dev/sda rw" -device rtl8139,netdev=bridgeid,mac=52:54:00:11:22:33 -netdev bridge,br=br0,id=bridgeid -serial stdio

Note: One can copy rootfs as rootfs-2nd for example and start another rtnet virtual machine,
but must set a unique mac address per virtual machine.
  
  Login with root and password "student"
  
  
3. rtnet-test
====

  To compile rtnet-test sources one should set the compiler path
and the RTNet include folder in Makefile.
Note: in beaglebone-black rtnet-test Makefile my arm-linux-gcc pathname
contains "raspberry-pi" for historycal reasons. It has nothing to do with raspberry-pi now.

  The folder on target machine /root contains rtnet-test preinstalled.
To run tests in xenomai-rtnet, one should first load rtnet:
/root/start_modules.sh
An example of start_modules.sh (here for beaglebone-black) is:
modprobe rt_smsc && modprobe rt_davinci_mdio && modprobe rt_ticpsw
modprobe rtipv4 && modprobe rtpacket && modprobe rtudp
modprobe rtmac
modprobe nomac
/usr/xenomai/sbin/rtifconfig rteth0 up 192.168.1.20

Then verify that the network was properly setup (rteth0 is up and running):
/usr/xenomai/rtifconfig -a
Now, using rtroute, one should set the partner <IP,mac>:
/usr/xenomai/sbin/rtroute solicit <partner-IP> dev rteth0
or
/usr/xenomai/sbin/rtroute add <partner-IP> <partner-MAC> dev rteth0
then verify that it was successfully stored:
/usr/xenomai/sbin/rtroute

  rtping:
/usr/xenomai/sbin/rtping <partner-IP>

  Note: Before running the following examples one should:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.:/usr/xenomai/lib

  udp with alchemy skin
/root/frag-ip.out -d <dest-ip> -s <size>
where size is the packet size, for example 80 or 100 or 120.

  udp with posix skin
on one machine:
/root/rtt-responder.out
on the other machine
/root/rtt-sender.out -d <dest-ip>
Note: rtt-responder.out from beaglebone-black has ipipe-trace test enabled
for the recvmsg() function by using xntrace_user_start() and xntrace_user_freeze().
I wanted to see that the test runs in xenomai domain.

  rtnet-tests can be stopped with CTRL-C followed by CTRL-Z
and then writing the command: 
fg %1

  tcp was not tested. First one should uncomment the Kconfig
TCP comment from xenomai kernel configuration and enable it, 
then load the RTNet tcp module.

  tftp-1.0 is a GNU GPLv2 tftp server and client.
To transfer a file from host to target
one should copy the file to /tmp/
and start the server like this
tftpd -d -P <port>
From target one can use tftpc to transfer from server:
/root/tftpc.out <host-IP> -P <port> -g <filename> -o
From target one can use tftpc to transfer to server:
/root/tftpc.out <host-IP> -P <port> -p <filename> -o

  rtnet targets can ping and ssh each other via vnic0:
/usr/xenomai/sbin/rtifconfig rteth0 up 192.168.1.30
/usr/xenomai/sbin/nomaccfg rteth0 attach
ifconfig vnic0 up 192.168.1.30
/root/S50dropbear restart
And now from another rtnet station:
ping 192.168.1.30
ssh root@192.168.1.30


4. Contact
====
Please provide feedback,
Laurentiu-Cristian Duca
laurentiu [dot] duca [at] gmail [dot] com

This README document is released with CC-BY-SA license.

About


Languages

Language:C 95.7%Language:C++ 2.4%Language:Makefile 1.6%Language:Objective-C 0.2%Language:Shell 0.0%