Skip to content

Commit 99a8db8

Browse files
committed
create cifx0 LAN if not exist already
1 parent 909dfb1 commit 99a8db8

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LABEL org.label-schema.build-date=$BUILD_DATE \
1111
org.label-schema.vcs-ref=$VCS_REF
1212

1313
#version
14-
ENV HILSCHERNETPI_CODESYS_BASIS_VERSION 1.3.4
14+
ENV HILSCHERNETPI_CODESYS_BASIS_VERSION 1.3.5
1515

1616
#execute all commands as root
1717
USER root

init.d/entrypoint.sh

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ fi
2727
# SIGNAL-handler
2828
term_handler() {
2929

30+
#remove cifx0 interface from system if created by the container
31+
if ps -A | grep -q "cifx0daemon" ; then
32+
killall cifx0deamon
33+
ip link delete cifx0
34+
fi
35+
3036
if [ -f /etc/init.d/edgegateway ]
3137
then
3238
echo "Terminating CODESYS Edge Gateway ..."
@@ -58,22 +64,26 @@ fi
5864
#check presence of device spi0.0 and net device register
5965
if [[ -e "/dev/spidev0.0" ]]&& [[ -e "/dev/net/tun" ]]; then
6066

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

63-
#pre-configure GPIO 24 to serve as interrupt pin between netX chip and BCM CPU
64-
if [[ ! -e "/sys/class/gpio/gpio24" ]]; then
65-
echo 24 > /sys/class/gpio/export
66-
fi
67-
echo rising > /sys/class/gpio/gpio24/edge
68-
echo in > /sys/class/gpio/gpio24/direction
69-
echo 1 > /sys/class/gpio/gpio24/active_low
70+
echo "cifx0 hardware support (TCP/IP over RTE LAN ports) configured."
71+
72+
#pre-configure GPIO 24 to serve as interrupt pin between netX chip and BCM CPU
73+
if [[ ! -e "/sys/class/gpio/gpio24" ]]; then
74+
echo 24 > /sys/class/gpio/export
75+
fi
76+
echo rising > /sys/class/gpio/gpio24/edge
77+
echo in > /sys/class/gpio/gpio24/direction
78+
echo 1 > /sys/class/gpio/gpio24/active_low
7079

71-
# create netx "cifx0" ethernet network interface
72-
/opt/cifx/cifx0daemon
80+
# create netx "cifx0" ethernet network interface
81+
/opt/cifx/cifx0daemon
7382

74-
# bring interface up first of all
75-
ip link set cifx0 up
83+
# bring interface up first of all
84+
ip link set cifx0 up
7685

86+
fi
7787
else
7888
echo "cifx0 hardware support (TCP/IP over RTE LAN ports) not configured."
7989
fi

0 commit comments

Comments
 (0)