Modifying a BSP to Support io-sock
If QNX does not provide a BSP that supports io-sock for your target hardware, you need to create one. To simplify the process, QNX recommends that you start with the io-sock-compatible BSP provided by QNX that most closely matches your target's specifications.
If you choose to use an existing custom BSP, you must rebuild it with a modified buildfile that adds the appropriate libraries and utilities and loads io-sock resources.
The new or modified buildfile must use io-sock versions of resources
wherever they exist. The use -i command allows you to see which package a
library came from. For a list of utilities that have io-sock
versions, see Networking utilities and
services.
In addition, you should remove or exclude all io-pkt resource manager (io-pkt-*) and io-pkt network drivers (devnp-*).
For detailed information on building a BSP, see the documentation for your BSP and the
Working with QNX BSPs
chapter in Building Embedded Systems.
Specifying io-sock versions of files
Where both io-pkt and io-sock versions of files are available, your buildfile must add the io-sock versions. The io-sock versions of binaries and configuration files are found in the following locations:
- ${QNX_TARGET}/${PROCESSOR}/io-sock/
- ${QNX_TARGET}/io-sock/
Revise your buildfile to add the appropriate versions, for both files that are specified using relative paths and ones it adds using full paths:
- If your buildfile specifies files related to networking using relative paths
only, use a search path that checks io-sock directories for
content before it searches any standard paths. For example:
This search path does not work for io-sock binaries with a relative path that is different from io-pkt. For example, for setkey, the relative path is io-sock/sbin/setkey for io-sock, and /usr/sbin/setkey for io-pkt. To detect these binaries, use the methods described in[search=../../install/${PROCESSOR}:../../install:${QNX_TARGET}/${PROCESSOR}/io-sock: ${QNX_TARGET}/io-sock:${QNX_TARGET}/${PROCESSOR}:${QNX_TARGET}]Detecting io-pkt binaries to remove.
-
If your buildfile uses full paths for any network-related files, modify each path to point to the io-sock version. Use find to determine the new paths. For example, to find the location of ping for io-sock:
find ${QNX_TARGET}/io-sock ${QNX_TARGET}/${PROCESSOR}/io-sock –name ping
Detecting io-pkt binaries to remove
To detect binaries that link to the wrong libraries, add the [autoso=list] attribute to the beginning of the buildfile. For example:[autoso=list]
[-optional]
[+keeplinked]
[image=0x2000000]
[virtual=x86_64,bios +compress] boot = {
startup-x86
PATH=/proc/boot:/sbin:/bin:/usr/bin:/usr/sbin:/usr/libexec
LD_LIBRARY_PATH=/proc/boot:/lib:/usr/lib:/lib/dll:/lib/dll/pci procnto-smp-instr
}
... For
each missing shared library, mkifs prints a line to standard error
output. You can then locate the binary that generated the error and replace it with the
correct one. For example, if the buildfile adds an io-pkt application
that needs libsocket.so.3, mkifs prints the
following
error:$ mkifs -r ../../install x86_64-generic-bios.build x86_64-generic-bios.bin
Host file 'libsocket.so.3' not available.
$You can also identify binaries that are not built for io-sock by executing the following command on the target:
for x in `find . -type f`; do strings $x | grep -q 'libsocket.so.3' && echo $x ; doneIf
libsocket.so.3 is found, you need to modify your BSP to build with the
correct binary (see Specifying
io-sock versions of files
).
Networking applications
Include the following networking applications and files, from the specified locations.
The list includes the following optional utilities, which are useful for debugging tasks:
- devctl
- devinfo
- sysctl
- vmstat
...
[search=../../install/${PROCESSOR}:../../install:${QNX_TARGET}/${PROCESSOR}/io-sock:
${QNX_TARGET}/io-sock:${QNX_TARGET}/${PROCESSOR}:${QNX_TARGET}]
...
/sbin/dhclient=sbin/dhclient
/sbin/dhclient-script=sbin/dhclient-script
/sbin/ifconfig=sbin/ifconfig
/sbin/io-sock=sbin/io-sock
/sbin/pfctl=sbin/pfctl
[uid=0 gid=0 perms=4755] /sbin/ping=sbin/ping
/sbin/route=sbin/route
/sbin/sysctl=sbin/sysctl
/usr/bin/ftp=usr/bin/ftp
/usr/bin/netstat=usr/bin/netstat
/usr/bin/sockstat=usr/bin/sockstat
/usr/bin/vmstat=usr/bin/vmstat
/usr/sbin/arp=usr/sbin/arp
/usr/sbin/devctl=usr/sbin/devctl
/usr/sbin/devinfo=usr/sbin/devinfo
/usr/sbin/fs-nfs3=usr/sbin/fs-nfs3
/usr/sbin/if_up=usr/sbin/if_up
/usr/sbin/ifmcstat=usr/sbin/ifmcstat
/usr/sbin/ifwatchd=usr/sbin/ifwatchd
/usr/sbin/ip6addrctl=usr/sbin/ip6addrctl
/usr/sbin/ndp=usr/sbin/ndp
/usr/sbin/rtsold=usr/sbin/rtsold
/usr/sbin/tcpdump=usr/sbin/tcpdump
[uid=0 gid=0 perms=4755] /usr/sbin/traceroute=usr/sbin/traceroute
[uid=0 gid=0 perms=4755] /usr/sbin/traceroute6=usr/sbin/traceroute6
/etc/dhclient.conf=etc/dhclient.conf
/etc/ftpusers=etc/ftpusers
/etc/hosts=etc/hosts
/etc/netconfig=etc/netconfig
/etc/protocols=etc/protocols
/etc/services=etc/services
Required networking services and telnet support
Include the following networking services, from the specified locations.
If you need network access, use a secure protocol like ssh (e.g., OpenSSH).
...
[search=../../install/${PROCESSOR}:../../install:${QNX_TARGET}/${PROCESSOR}/io-sock:
${QNX_TARGET}/io-sock:${QNX_TARGET}/${PROCESSOR}:${QNX_TARGET}]
...
[uid=0 gid=0 perms=0755] /usr/sbin/inetd=usr/sbin/inetd
[uid=0 gid=0 perms=0755] /usr/sbin/sshd=usr/sbin/sshd
[uid=0 gid=0 perms=0755] /usr/bin/scp=usr/bin/scp
[uid=0 gid=0 perms=0755] /usr/bin/ssh=usr/bin/ssh
[uid=0 gid=0 perms=0755] /usr/libexec/ftpd=usr/libexec/ftpd
[uid=0 gid=0 perms=0755] /usr/libexec/telnetd=usr/libexec/telnetd
[uid=0 gid=0 perms=0755]/etc/newif.sh = {
#!/bin/sh
ifconfig $1 up
}
[uid=0 gid=0 perms=0755]/etc/up.sh = {
#!/bin/sh
dhclient -m -lf /dev/shmem/dhclient.leases.$1 -pf /dev/shmem/dhclient.pid.$1 -nw $1
}
[uid=0 gid=0 perms=0755]/etc/down.sh = {
#!/bin/sh
dhclient -m -lf /dev/shmem/dhclient.leases.$1 -pf /dev/shmem/dhclient.pid.$1 -x $1
}
/etc/inetd.conf = {
telnet stream tcp nowait root /usr/libexec/telnetd in.telnetd
ftp stream tcp nowait root /usr/libexec/ftpd in.ftpd -l
}
/etc/ftpd.conf = {
/* Make things a+rw by default */
umask all 0000
}
/etc/esh = {
}
Adding drivers and libraries
Include one or more of the io-sock network drivers:
- PHY:
- devs-phy.so (Ethernet PHY)
- PCI:
- devs-libpci.so (PCI bus)
- devs-em.so (Intel PRO/1000 Gigabit Ethernet adapter)
- devs-igc.so (Intel Ethernet Controller I225)
- devs-ixgbe.so (Intel 10Gb Ethernet)
- devs-ixl.so (Intel Ethernet 700 Series Driver)
- devs-re.so (RealTek 8139C+/8169/816xS/811xS/8168/810xE/8111 PCI/PCIe Ethernet adapter)
- devs-vmx.so (VMware VMXNET3 Ethernet)
- USB:
- devs-libusbdci.so (USB bus)
- devs-axe.so (ASIX Electronics AX88x7x/760 USB Ethernet)
- devs-axge.so (ASIX Electronics AX88178A/AX88179 USB Gigabit Ethernet)
- devs-cdce.so (USB Communication Device Class Ethernet)
- devs-smsc.so (USB SMSC LAN9xxx Fast Ethernet)
- devs-ure.so (Realtek RTL815x USB Ethernet)
- FDT:
- devs-cpsw-processor.so (TI CPSW J7/AM62)
- devs-libfdt.so (FDT bus)
- devs-dwc.so (DWC Gigabit Ethernet Controller)
- devs-dwceqos.so (Synopsys DWC Ethernet-Quality-of-Service MAC controller)
- devs-genet.so (Raspberry Pi 4 Gigabit Ethernet)
| To support: | Include: |
|---|---|
| ifconfig (for io-sock) | libexpat.so |
| arp, vmstat, or netstat | libxo.so.0 |
| inetd | librpc.so |
| USB network drivers | devs-libusbdci.so and libusbdci.so |
| PCI network drivers | devs-libpci.so and PCI libraries (see example below) |
| FDT network drivers | devs-libfdt.so and libfdt.so |
For example, if your target has PCI and USB interfaces:
[search=${QNX_TARGET}/${PROCESSOR}/io-sock/lib] /lib/libsocket.so=libsocket.so
[search=${QNX_TARGET}/${PROCESSOR}/io-sock/lib/dll] /lib/dll/devs-libpci.so=devs-libpci.so
[search=${QNX_TARGET}/${PROCESSOR}/io-sock/lib/dll] /lib/dll/devs-em.so=devs-em.so
[search=${QNX_TARGET}/${PROCESSOR}/io-sock/lib/dll] /lib/dll/devs-ixgbe.so=devs-ixgbe.so
[search=${QNX_TARGET}/${PROCESSOR}/io-sock/lib/dll] /lib/dll/devs-re.so=devs-re.so
[search=${QNX_TARGET}/${PROCESSOR}/io-sock/lib/dll] /lib/dll/devs-libusbdci.so=devs-libusbdci.so
[search=${QNX_TARGET}/${PROCESSOR}/io-sock/lib/dll] /lib/dll/devs-axe.so=devs-axe.so
[search=${QNX_TARGET}/${PROCESSOR}/io-sock/lib/dll] /lib/dll/devs-axge.so=devs-axge.so
[search=${QNX_TARGET}/${PROCESSOR}/io-sock/lib/dll] /lib/dll/devs-cdce.so=devs-cdce.so
[search=${QNX_TARGET}/${PROCESSOR}/io-sock/lib/dll] /lib/dll/devs-smsc.so=devs-smsc.so
[search=${QNX_TARGET}/${PROCESSOR}/io-sock/lib/dll] /lib/dll/devs-ure.so=devs-ure.so
################################################################################################
## Network driver shared libraries
################################################################################################
/usr/lib/libexpat.so=usr/lib/libexpat.so
/usr/lib/libxo.so.0=usr/lib/libxo.so.0
/lib/libsocket.so=lib/libsocket.so
/usr/lib/librpc.so=usr/lib/librpc.so
################################################################################################
## USB device shared libraries
################################################################################################
/lib/libusbdci.so=lib/libusbdci.so
################################################################################################
## PCI driver HW Modules and configuration file
################################################################################################
/lib/dll/pci/pci_hw-AMD_x86.so=lib/dll/pci/pci_hw-AMD_x86.so
/lib/dll/pci/pci_hw-Intel_x86.so=lib/dll/pci/pci_hw-Intel_x86.so
################################################################################################
## PCIe driver shared libraries
################################################################################################
/lib/libpci.so=lib/libpci.so
/lib/dll/pci/pci_bkwd_compat.so=lib/dll/pci/pci_bkwd_compat.so
/lib/dll/pci/pci_cap-0x01.so=lib/dll/pci/pci_cap-0x01.so
/lib/dll/pci/pci_cap-0x04.so=lib/dll/pci/pci_cap-0x04.so
/lib/dll/pci/pci_cap-0x05.so=lib/dll/pci/pci_cap-0x05.so
/lib/dll/pci/pci_cap-0x07.so=lib/dll/pci/pci_cap-0x07.so
/lib/dll/pci/pci_cap-0x09-ffffffff.so=lib/dll/pci/pci_cap-0x09-ffffffff.so
/lib/dll/pci/pci_cap-0x0d.so=lib/dll/pci/pci_cap-0x0d.so
/lib/dll/pci/pci_cap-0x10-16c3abcd.so=lib/dll/pci/pci_cap-0x10-16c3abcd.so
/lib/dll/pci/pci_cap-0x10-19570400.so=lib/dll/pci/pci_cap-0x10-19570400.so
/lib/dll/pci/pci_cap-0x10.so=lib/dll/pci/pci_cap-0x10.so
/lib/dll/pci/pci_cap-0x11-ffffffff.so=lib/dll/pci/pci_cap-0x11-ffffffff.so
/lib/dll/pci/pci_cap-0x11.so=lib/dll/pci/pci_cap-0x11.so
/lib/dll/pci/pci_cap-0x12.so=lib/dll/pci/pci_cap-0x12.so
/lib/dll/pci/pci_cap-0x13.so=lib/dll/pci/pci_cap-0x13.so
/lib/dll/pci/pci_debug.so=lib/dll/pci/pci_debug.so
/lib/dll/pci/pci_debug2.so=lib/dll/pci/pci_debug2.so
/lib/dll/pci/pci_server-buscfg-generic.so=lib/dll/pci/pci_server-buscfg-generic.so
/lib/dll/pci/pci_server-buscfg-hotplug.so=lib/dll/pci/pci_server-buscfg-hotplug.so
/lib/dll/pci/pci_server-buscfg2-generic.so=lib/dll/pci/pci_server-buscfg2-generic.so
/lib/dll/pci/pci_server-buscfg2-hotplug.so=lib/dll/pci/pci_server-buscfg2-hotplug.so
/lib/dll/pci/pci_server-enable_features.so=lib/dll/pci/pci_server-enable_features.so
/lib/dll/pci/pci_server-event_handler.so=lib/dll/pci/pci_server-event_handler.so
/lib/dll/pci/pci_server-namespace.so=lib/dll/pci/pci_server-namespace.so
/lib/dll/pci/pci_slog.so=lib/dll/pci/pci_slog.so
/lib/dll/pci/pci_slog2.so=lib/dll/pci/pci_slog2.so
/lib/dll/pci/pci_strings.so=lib/dll/pci/pci_strings.so
/lib/dll/pci/pcie_xcap-0x0001.so=lib/dll/pci/pcie_xcap-0x0001.so
/lib/dll/pci/pcie_xcap-0x0003.so=lib/dll/pci/pcie_xcap-0x0003.so
/lib/dll/pci/pcie_xcap-0x000b-ffffffff.so=lib/dll/pci/pcie_xcap-0x000b-ffffffff.so
/lib/dll/pci/pcie_xcap-0x0015.so=lib/dll/pci/pcie_xcap-0x0015.so
Default interface names
In some cases, io-sock uses different default device or interface names than io-pkt.
| io-pkt | io-sock | ||
|---|---|---|---|
| Driver | Default device/interface name | Driver name | Default device/interface name |
| devnp-asix.so (100 Mb/s) | ax0 | devs-axe.so | axe0 |
| devnp-asix.so (1 Gb/s) | ax0 | devs-axge.so | axge0 |
| devnp-dwceqos.so | dwc0 | devs-dwceqos.so | dwceqos0 |
| devnp-dwcmac.so | dwc0 | devs-dwc.so | dwc0 |
| devnp-e1000.so | wm0 | devs-em.so | em0 or igb0 |
| devnp-genet.so | genet0 | devs-genet.so | genet0 |
| devnp-ixgbe.so | ix0 | devs-ixgbe.so | ix0 |
| devnp-mx8xp.so | mx8xp0 | devs-ffec.so | ffec0 |
| devnp-rtl8169.so | rt0 | devs-re.so | re0 |
| devnp-smsc9500.so | sc0 | devs-smsc.so | smsc0 |
| devnp-speedo.so | fxp0 | FreeBSD's fxp module (not provided by QNX Neutrino) | fxp0 |
| devnp-usbdnet.so (device mode) | ecm0, ncm0 | devs-cdce.so | cdce0 |
| rndis | Currently not supported | N/A | |
| devnp-usbnet.so (host mode) | ecm0, ncm0 | devs-cdce.so | cdce0 |
| mbim0, iph0 | Currently not supported | N/A | |
| devnp-vmxnet3.so | vx0 | devs-vmx.so | vmx0 |
Starting io-sock and bringing up the interfaces
Start io-sock with all networking interfaces. For example, if your target has PCI and USB interfaces:
io-sock -d em -d igc -d ixgbe -d ixl -d re -d axe -d axge -d cdce\
-d smsc -d ure
Run ifwatchd to detect active interfaces. This utility is used to monitor dynamic interfaces for address changes, and to monitor static interfaces for carrier changes. For example:
ifwatchd -A /etc/newif.sh -D /etc/down.sh -c /etc/up.sh -n /etc/down.sh
em0 igb0 wlan0 ix0 re0 axe0 axge0 cdce0 smsc0 ure0
where:
- /etc/newif.sh defines commands to invoke for new interfaces.
- /etc/up.sh defines commands to invoke when the carrier status changes from no carrier to carrier.
- /etc/down.sh defines commands to invoke when new interfaces depart (e.g., card is removed).
For example:
[uid=0 gid=0 perms=0755]/etc/newif.sh = {
#!/bin/sh
ifconfig $1 up
}
[uid=0 gid=0 perms=0755]/etc/up.sh = {
#!/bin/sh
dhclient -m -lf /dev/shmem/dhclient.leases.$1 -pf /dev/shmem/dhclient.pid.$1 -nw $1
}
[uid=0 gid=0 perms=0755]/etc/down.sh = {
#!/bin/sh
dhclient -m -lf /dev/shmem/dhclient.leases.$1 -pf /dev/shmem/dhclient.pid.$1 -x $1
}
io-sock -d em
if_up -p em0
ifconfig em0 172.16.129.1/24 upAlthough
waitfor is often used for synchronization tasks, it is not
reliable to use it on networking resources such as /dev/socket
or /dev/io-sock/devs-em.so/em0 to determine if the interface is
ready.Setting up DNS
When you set up DNS (Domain Name Service), make sure that you provide a default IPv6 route. For example, you can add it using ip6addrctl (see https://www.freebsd.org/cgi/man.cgi?query=ip6addrctl&sektion=8&manpath=FreeBSD+13.5-RELEASE+and+Ports):
ip6addrctl add ::ffff:0.0.0.0/96 50 0
