How to install and run the "Siemens LOGO Comfort" program used to configure "Siemens LOGO!" PLCs under FreeBSD:

# Start with a FreeBSD 13 system with X11 etc.

kldload linux linux64

pkg install linux-c7

################################################################
# We are not mounting linux' procfs because our emulation of it
# does not provide /proc/net/route, instead we just make some
# plausible looking files below.

echo '
linsysfs    /compat/linux/sys   linsysfs        rw      0       0
tmpfs    /compat/linux/dev/shm  tmpfs   rw,mode=1777    0       0
' >> /etc/fstab

mount /compat/linux/sys
mount /compat/linux/dev/shm

################################################################
# The installation script uses "gzip -d" to uncompress .ZIP
# files, which FreeBSD's gzip does not support, fake it.

echo '
#!/bin/sh

tar xvf $2
' > /compat/linux/bin/gzip
chmod +x /compat/linux/bin/gzip

################################################################
# When running, the Logo Comfort program likes to display
# interface names, which it gets trough /proc and debian-style
# "ifcfg" files.

# These fails do not seem to need any actual content
mkdir -p /compat/linux/etc/sysconfig/network
touch /compat/linux/etc/sysconfig/network/ifcfg-eth0
touch /compat/linux/etc/sysconfig/network/ifcfg-eth1

# Pretend to have a /proc filesystem with /proc/net/dev and /proc/net/route
# entries.  Once FreeBSD's linprocfs supports both, this can go away.
#
# This works for my config with two ethernets, one for the real
# network and a USB-dongle for the network with the Siemens Logo!
# units.  Configure IP# as usual in /etc/rc.conf or however.
#

mkdir -p /compat/linux/proc/net

echo 'Inter-|                                                   Receive|  Transmit
  face|bytes    packets errs drop fifo frame compressed multicast|  bytes    packets errs drop fifo colls carrier compressed
  eth0: 568353535  378603    0    0    0     0          0       706  4638148   68292    0    0    0     0       0          0
   lo0:    2848      32    0    0    0     0          0         0     2848      32    0    0    0     0       0          0
  eth1:     338       5    0    0    0     0          0         3      182       3    0    0    0     0       0          0
' > /compat/linux/proc/net/dev

echo 'Iface   Destination     Gateway         Flags   RefCnt  Use     Metric  Mask            MTU     Window  IRTT
eth1    00000000        013CA8C0        0003    0       0       100     00000000        0       0       0

eth1    003CA8C0        00000000        0001    0       0       100     00FFFFFF        0       0       0
' > /compat/linux/proc/net/route


################################################################
# Mount the disk you bought from Siemens
mount -t cd9660 /dev/cd0 /media

# Temporarily mount linprocfs for the installer
mount -t linprocfs linprocfs /compat/linux/proc

# Start a Linux bash
/compat/linux/bin/bash

# Start installer
bash /media/CDROM_Installers/Disk1/InstData/Linux64/VM/Setup.bin

# unmount linprocfs again
umount /compat/linux/proc

# Remove the gzip-hack
rm /compat/linux/bin/gzip


################################################################
# Now, whenever you want to run the Logo Comfort program you
# need to first mount linprocfs, then launch the program
# and then unmount linprocfs again (from another terminal)


mount -t linprocfs linprocfs /compat/linux/proc
./LOGOComfort

# After the application launches, in other window:
umount /compat/linux/proc

electronics/plc (last edited 2022-09-18T12:50:57+0000 by PoulHenningKamp)