Skip to content

Commit

Permalink
create cifx0 LAN if not exist already
Browse files Browse the repository at this point in the history
  • Loading branch information
hilschernetpi committed Jun 25, 2020
1 parent 909dfb1 commit 99a8db8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.vcs-ref=$VCS_REF

#version
ENV HILSCHERNETPI_CODESYS_BASIS_VERSION 1.3.4
ENV HILSCHERNETPI_CODESYS_BASIS_VERSION 1.3.5

#execute all commands as root
USER root
Expand Down
34 changes: 22 additions & 12 deletions init.d/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ fi
# SIGNAL-handler
term_handler() {

#remove cifx0 interface from system if created by the container
if ps -A | grep -q "cifx0daemon" ; then
killall cifx0deamon
ip link delete cifx0
fi

if [ -f /etc/init.d/edgegateway ]
then
echo "Terminating CODESYS Edge Gateway ..."
Expand Down Expand Up @@ -58,22 +64,26 @@ fi
#check presence of device spi0.0 and net device register
if [[ -e "/dev/spidev0.0" ]]&& [[ -e "/dev/net/tun" ]]; then

echo "cifx0 hardware support (TCP/IP over RTE LAN ports) configured."
#check if cifx0 interface is not running already
if ! ip addr show | grep -q "cifx0" ; then

#pre-configure GPIO 24 to serve as interrupt pin between netX chip and BCM CPU
if [[ ! -e "/sys/class/gpio/gpio24" ]]; then
echo 24 > /sys/class/gpio/export
fi
echo rising > /sys/class/gpio/gpio24/edge
echo in > /sys/class/gpio/gpio24/direction
echo 1 > /sys/class/gpio/gpio24/active_low
echo "cifx0 hardware support (TCP/IP over RTE LAN ports) configured."

#pre-configure GPIO 24 to serve as interrupt pin between netX chip and BCM CPU
if [[ ! -e "/sys/class/gpio/gpio24" ]]; then
echo 24 > /sys/class/gpio/export
fi
echo rising > /sys/class/gpio/gpio24/edge
echo in > /sys/class/gpio/gpio24/direction
echo 1 > /sys/class/gpio/gpio24/active_low

# create netx "cifx0" ethernet network interface
/opt/cifx/cifx0daemon
# create netx "cifx0" ethernet network interface
/opt/cifx/cifx0daemon

# bring interface up first of all
ip link set cifx0 up
# bring interface up first of all
ip link set cifx0 up

fi
else
echo "cifx0 hardware support (TCP/IP over RTE LAN ports) not configured."
fi
Expand Down

0 comments on commit 99a8db8

Please sign in to comment.