From 0d5be98ebc7b456102bdfaeafd6b61a8d1a6600d Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Wed, 3 Dec 2025 10:28:13 +0100 Subject: [PATCH 01/29] Initial support for QNX8 QEMU emulation --- .bazelrc | 9 + MODULE.bazel | 20 + README.md | 205 +++++++- project_config.bzl | 2 +- qnx8/boards/common/BUILD | 16 + qnx8/boards/common/common.build | 480 ++++++++++++++++++ qnx8/boards/common/ssh_host_ed25519_key | 7 + qnx8/boards/common/ssh_host_ed25519_key.pub | 1 + qnx8/boards/common/ssh_host_rsa_key | 38 ++ qnx8/boards/common/ssh_host_rsa_key.pub | 1 + qnx8/boards/qemu-arm64virt/BUILD | 24 + qnx8/boards/qemu-arm64virt/blk-start.sh | 27 + qnx8/boards/qemu-arm64virt/initscript | 64 +++ qnx8/boards/qemu-arm64virt/misc-services.sh | 18 + qnx8/boards/qemu-arm64virt/mount-fs.sh | 27 + qnx8/boards/qemu-arm64virt/net-start.sh | 54 ++ .../qemu-arm64virt/qemu-arm64virt.build | 25 + .../qemu-arm64virt/run-qemu-arm64virt.sh | 47 ++ qnx8/boards/qemu-arm64virt/target.build | 52 ++ qnx8/boards/qemu-x86_64/BUILD | 24 + qnx8/boards/qemu-x86_64/blk-start.sh | 27 + qnx8/boards/qemu-x86_64/initscript | 82 +++ qnx8/boards/qemu-x86_64/misc-services.sh | 18 + qnx8/boards/qemu-x86_64/mount-fs.sh | 27 + qnx8/boards/qemu-x86_64/net-start.sh | 54 ++ qnx8/boards/qemu-x86_64/qemu-x86_64.build | 25 + qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh | 47 ++ qnx8/boards/qemu-x86_64/target.build | 73 +++ 28 files changed, 1491 insertions(+), 3 deletions(-) create mode 100644 qnx8/boards/common/BUILD create mode 100644 qnx8/boards/common/common.build create mode 100644 qnx8/boards/common/ssh_host_ed25519_key create mode 100644 qnx8/boards/common/ssh_host_ed25519_key.pub create mode 100644 qnx8/boards/common/ssh_host_rsa_key create mode 100644 qnx8/boards/common/ssh_host_rsa_key.pub create mode 100644 qnx8/boards/qemu-arm64virt/BUILD create mode 100644 qnx8/boards/qemu-arm64virt/blk-start.sh create mode 100644 qnx8/boards/qemu-arm64virt/initscript create mode 100644 qnx8/boards/qemu-arm64virt/misc-services.sh create mode 100644 qnx8/boards/qemu-arm64virt/mount-fs.sh create mode 100644 qnx8/boards/qemu-arm64virt/net-start.sh create mode 100644 qnx8/boards/qemu-arm64virt/qemu-arm64virt.build create mode 100755 qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh create mode 100644 qnx8/boards/qemu-arm64virt/target.build create mode 100644 qnx8/boards/qemu-x86_64/BUILD create mode 100644 qnx8/boards/qemu-x86_64/blk-start.sh create mode 100644 qnx8/boards/qemu-x86_64/initscript create mode 100644 qnx8/boards/qemu-x86_64/misc-services.sh create mode 100644 qnx8/boards/qemu-x86_64/mount-fs.sh create mode 100644 qnx8/boards/qemu-x86_64/net-start.sh create mode 100644 qnx8/boards/qemu-x86_64/qemu-x86_64.build create mode 100755 qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh create mode 100644 qnx8/boards/qemu-x86_64/target.build diff --git a/.bazelrc b/.bazelrc index 51cac5a..def5062 100644 --- a/.bazelrc +++ b/.bazelrc @@ -7,3 +7,12 @@ test --test_output=errors common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/ common --registry=https://bcr.bazel.build + +# ------------------------------------------------------------------------------ +# QNX toolchain settings - see https://github.com/eclipse-score/toolchains_qnx +common --incompatible_strict_action_env +# mkifs is not a target platform specific tool, the host would be sufficient. But there is only +# target platform specific toolchains defined for QNX in this repo. +# Therefore we have to select a target platform and we choose x86_64-qnx. +common --platforms=@score_toolchains_qnx//platforms:x86_64-qnx +common --sandbox_writable_path=/var/tmp diff --git a/MODULE.bazel b/MODULE.bazel index b50ad2f..a46fbee 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -15,6 +15,26 @@ module( version = "1.0", ) +# ------------------------------------------------------------------------------ +# QNX toolchain +bazel_dep(name = "score_toolchains_qnx", version = "0.0.4") + +toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx", dev_dependency=True) +toolchains_qnx.sdp( + url = "file:///home/gjt2abt/qnx803.tgz", + sha256 = "8c62b8567727d2e402165eba5a3b29c56ad74165575412a07981b176cdadcaa2", +) + +use_repo(toolchains_qnx, "toolchains_qnx_sdp", "toolchains_qnx_ifs") + +register_toolchains("@toolchains_qnx_ifs//:ifs_x86_64", dev_dependency=True) +# mkifs is independent of target platform, so we just need _one_ toolchain. +#register_toolchains("@toolchains_qnx_ifs//:ifs_aarch64") + + +# ------------------------------------------------------------------------------ +# General purpose Bazel extensions + # Compliance and licensing toolchain bazel_dep(name = "score_dash_license_checker", version = "0.1.2") bazel_dep(name = "score_cr_checker", version = "0.2.2") diff --git a/README.md b/README.md index 0b9ff2d..3c69450 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,203 @@ -# os_images -OS Images for testing and deliveries +# OS images + +This module creates OS images intended for testing S-CORE software: + +* bootable QNX IFS images using the QNX 8 SDP. +* bootable Linux image: TODO + +**Why do we need OS images?** + +The basic idea is to have modular OS images for *testing* and *verifying* S-CORE binaries. Main purposes: + +* re-usable for multiple use cases: unit-, component-, binary- and system tests and demonstrations +* stuffed with common OS utilities: shell-, file-, test utilities +* no need for rebuilding OS images to match the use case - use cases are realized by a separate partition image created by the user/tester which is attached at OS boot time and is containing files required for the use case. + +**Features**: + +* Launches `sshd` service for remote control (user `root`, empty password by default). +* Supports attaching a user-created file system to `/` (root) in case of QNX. Linux: TODO. By placing some files on this file system the user can make these adaptions: + * Configure hostname and network IP address. + * Add an autostart script launched at the end of the OS startup to start arbitrary tasks. + +=> users can focus on creating the file system with content to match their use cases and *use* the OS image of their choice. + +## OS images for QNX 8 + +Following QNX 8 OS images can be created: + +* QEMU aarch64 "virt" image using virtio block and network drivers. +* QEMU x86_64 image using virtio block and network drivers. + +### Pre-requisites + +#### QNX SDP + +Building the images requires a QNX SDP 8.0.3 (or later) available during build with following additional QNX SDP packages integrated: + +* QNX® SDP 8.0 Networking - io-sock Virtio Drivers +* QNX® SDP 8.0 Virtualization Drivers (Block) +* QNX® SDP 8.0 Virtualization Drivers (Startup) + +Add the URL of the QNX SDP tarball to the `MODULE.bazel`: + +``` +[...] + +toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx", dev_dependency=True) +toolchains_qnx.sdp( + url = "http://link/to/qnx803.tar.gz", + # or: + # url = "file:///path/to/qnx803.tar.gz", + sha256 = "", +) + +[...] + +``` + +#### bazelrc + +A `.bazelrc` should include general eclipse-score registry and toolchain requirements given by +https://github.com/eclipse-score/toolchains_qnx/blob/main/README.md . + +``` +common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/ +common --registry=https://bcr.bazel.build + +common --incompatible_strict_action_env +# mkifs is not a target platform specific tool, the host would be sufficient. But there is only +# target platform specific toolchains defined for QNX in this repo. +# Therefore we have to select a target platform and we choose x86_64-qnx. +common --platforms=@score_toolchains_qnx//platforms:x86_64-qnx +common --sandbox_writable_path=/var/tmp +``` + +### Building QNX OS images + +QEMU arm64 image using "virt" VM: + +```bash +bazel build //qnx8/boards/qemu-arm64virt:all +``` + +QEMU x86_64 image: + +```bash +bazel build //qnx8/boards/qemu-x86_64:all +``` + +In case of requiring an online QNX license checkout for the QNX SDP `mkifs` utility you might have to set the QNXLM_LICENSE_FILE environment variable with the link to the license server `--action_env=QNXLM_LICENSE_FILE=...`, for example: + +```bash +bazel build --action_env=QNXLM_LICENSE_FILE=my@internal.qnx-license-server.com //qnx8/boards/qemu-arm64virt:all +``` + +### Running the images + +#### Pre-requisites + +In order to run the QEMU images on the host you must have `qemu-system-aarch64` and `qemu-system-x86_64` installed. The x86_64 QEMU run script uses `-accel kvm`, so the running user must have access to `/dev/kvm` for acceleration. + +#### Get started + +After successful build you'll find the IFS binary and an exemplary run script in `bazel-out`: + +``` +bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-arm64virt/run-qemu.sh +bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-arm64virt/ifs-qemu-arm64virt.bin +bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-x86_64/run-qemu.sh +bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-x86_64/ifs-qemu-x86_64.bin +``` + +In order to run the image, change into the directory with the IFS and execute the run script: + +``` +cd bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-arm64virt +./run-qemu.sh +``` + +You'll get something like: + +``` +Welcome to QNX 8.0.0 on QEMU_virt ! + +---> Starting slogger2 +---> Starting serial driver +---> Starting block driver +Path=0 - + target=0 lun=0 Direct-Access(0) - VIRTIO Rev: +---> Preparing /run using /dev/ram0 +---> Mounting file systems +No root file system has been detected +---> Starting Ethernet driver +---> Setting up vtnet0 with ip address 192.168.120.20/24 +---> Starting qconn +---> Starting sshd +---> Starting shell ... Have fun :-) +# +``` + +#### ssh from host into QEMU image + +The QNX IFS images start up a `sshd` server. The user `root` has by default no password and `sshd` is configured to accept a root login w/o password. +The exemplary `run-qemu.sh` script configures QEMU to use QEMU user networking and sets up a port forwarding from localhost:2210 -> VM-IP 192.168.120.20:22. So you can open a ssh from host using: + +``` +ssh -p 2210 root@localhost +``` + +#### Attaching a user-created QNX6fs file system + +The QNX startup script (see `qnx8/boards//initscript`) calls `mount-fs.sh` which tries to mount a file system to the system. +By default, the partition is mounted at `/` (root) and therefore a user sees a virtual file system with a combination of the IFS and the mounted file system. The path manager resolves path names first on the mounted partition, then on the IFS. This means all files on partition extend or even eclipse files on the IFS. For more information see https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.sys_arch/topic/proc_Resolving_pathnames.html. + +The generated QEMU launch script `run-qemu.sh` attaches a virtual disk `disk-score.qcow2` to the image. If it does not exist, it creates an empty virtual QEMU disk with size of 512MB before launching QEMU. + +##### Creating a file system on-line + +When starting up the QEMU VM with an empty virtual QEMU disk, no partitions are there. With the following commands you can create a partition and a qnx6fs file system which then gets mounted automatically on following boots: + +```bash +# initialize with GUID partition table +pted /dev/hd0 init -g +# Create a partition with 99% disk size and name 'scorefs' +pted /dev/hd0 add -t qnx6fs -p 99 -n scorefs +# Re-read the partition table +mount -e /dev/hd0 +# Create QNX6 file system +mkqnx6fs /dev/hd0.qnx6.0 +# Reboot to let the partition be mounted automatically +shutdown +``` + +After reboot you'll see in the startup messages that a partition is found and mounted: + +``` +[...] +---> Mounting file systems +Mounting root overlay filesystem /dev/hd0.qnx6.0 +[...] +``` + +##### Creating a file system offline + +A QNX file system can be created on the host using `mkqnx6fsimg` (see https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.utilities/topic/m/mkqnx6fsimg.html). + +TODO: integrate `mkqnx6fsimg` into `toolchains_qnx`. + +#### Configuring custom IP address + host name + +During the startup of the VM the network is being set up, *after* mounting the virtual file system. By default host name `qemu-arm64virt` or `qemu-x86_64` and IP address 192.168.120.20/24 is set up. **Before** setting these, the `net-start.sh` script tries to read a file `/boot/etc/settings/network`. By installing such a file on the virtual file system and adding variables one can configure hostname and IP address of the network interface: + +``` +# /boot/etc/settings/network +IP_ADDRESS_vtnet0="192.168.100.1/24" +HOSTNAME=myqemu +``` + +> NOTE: This changes only the IP address of the QNX network interface. In order to make the port forwardings of the QEMU user network function correctly you'll have to adapt the QEMU user networking configuration in the `run-qemu.sh` script according to your IP address/subnet. + +#### Autostart script + +If the file `/opt/score/autostart.sh` exists on the mounted file system, it is executed at the end of the OS image startup sequence. diff --git a/project_config.bzl b/project_config.bzl index f764a1d..1c18252 100644 --- a/project_config.bzl +++ b/project_config.bzl @@ -1,5 +1,5 @@ # project_config.bzl PROJECT_CONFIG = { "asil_level": "QM", - "source_code": ["rust"], + "source_code": [], } diff --git a/qnx8/boards/common/BUILD b/qnx8/boards/common/BUILD new file mode 100644 index 0000000..f5b5629 --- /dev/null +++ b/qnx8/boards/common/BUILD @@ -0,0 +1,16 @@ +exports_files([ + "common.build", + "ssh_host_ed25519_key", + "ssh_host_ed25519_key.pub", + "ssh_host_rsa_key", + "ssh_host_rsa_key.pub", +]) + +filegroup( + name = "common_files", + srcs = glob(["*"]), + visibility = [ + "//qnx8/boards/qemu-arm64virt:__pkg__", + "//qnx8/boards/qemu-x86_64:__pkg__", + ], +) \ No newline at end of file diff --git a/qnx8/boards/common/common.build b/qnx8/boards/common/common.build new file mode 100644 index 0000000..e0d3fd0 --- /dev/null +++ b/qnx8/boards/common/common.build @@ -0,0 +1,480 @@ + +[uid=0 gid=0 perms=0555] + +[type=link] /bin/sh=/bin/ksh +[type=link] /tmp=/dev/shmem +[type=link] /var/log=/tmp +[type=link] /usr/tmp=/tmp + + +####################################################################### +## Block driver support libraries +####################################################################### +/lib/libcam.so=libcam.so + +/lib/dll/io-blk.so=io-blk.so +/lib/dll/cam-disk.so=cam-disk.so +/lib/dll/cam-cdrom.so=cam-cdrom.so +/lib/dll/fs-qnx6.so=fs-qnx6.so +/lib/dll/fs-dos.so=fs-dos.so + + +####################################################################### +## Network driver shared libraries +####################################################################### +/usr/lib/libedit.so=libedit.so +/usr/lib/libexpat.so=libexpat.so +/usr/lib/libfdt.so=libfdt.so +/usr/lib/librpc.so.2=librpc.so.2 +/usr/lib/libxo.so.0=libxo.so.0 + +/lib/libsocket.so=libsocket.so +/lib/libjail.so=libjail.so + +/lib/dll/mods-phy.so=mods-phy.so + +####################################################################### +## Network driver and support +####################################################################### +/sbin/dhcpcd=dhcpcd +/sbin/dhcpcd-run-hooks=${QNX_TARGET}/sbin/dhcpcd-run-hooks +[uid=0 gid=0 perms=0444] /sbin/dhcpcd-hooks/20-resolv.conf=${QNX_TARGET}/sbin/dhcpcd-hooks/20-resolv.conf +/sbin/ifconfig=ifconfig +/sbin/io-sock=io-sock +/sbin/pfctl=pfctl +[uid=0 gid=0 perms=4755] /sbin/ping=ping +/sbin/route=route +/sbin/sysctl=sysctl + +/usr/bin/netstat=netstat +/usr/bin/sockstat=sockstat +/usr/bin/vmstat=vmstat + +/usr/sbin/arp=arp +/usr/sbin/devctl=devctl +/usr/sbin/devinfo=devinfo +/usr/sbin/fs-nfs3=fs-nfs3 +/usr/sbin/if_up=if_up +/usr/sbin/ifmcstat=ifmcstat +/usr/sbin/ifwatchd=ifwatchd +/usr/sbin/ip6addrctl=ip6addrctl +/usr/sbin/ndp=ndp + +[uid=0 gid=0 perms=0444] /etc/dhcpcd.conf=${QNX_TARGET}/etc/dhcpcd.conf +[uid=0 gid=0 perms=0444] /etc/hosts=${QNX_TARGET}/etc/hosts +[uid=0 gid=0 perms=0444] /etc/netconfig=${QNX_TARGET}/etc/netconfig +[uid=0 gid=0 perms=0444] /etc/protocols=${QNX_TARGET}/etc/protocols +[uid=0 gid=0 perms=0444] /etc/services=${QNX_TARGET}/etc/services + +####################################################################### +## Remote_debug +####################################################################### +/sbin/devc-pty=devc-pty + +/usr/bin/pdebug=pdebug + +/usr/sbin/qconn=qconn + +####################################################################### +## Network services (ssh and dhcpcd) support +####################################################################### +/usr/sbin/sshd=sshd + +/usr/bin/sftp-server=${QNX_TARGET}/${PROCESSOR}/usr/libexec/sftp-server +/usr/bin/sshd-session=${QNX_TARGET}/${PROCESSOR}/usr/libexec/sshd-session + +/usr/bin/scp=scp +/usr/bin/ssh=ssh +/usr/bin/ssh-keygen=ssh-keygen + +[uid=0 gid=0 perms=0400] /etc/ssh/sshd_config = { +Protocol 2 +LoginGraceTime 600 +HostKey /etc/ssh/ssh_host_rsa_key +HostKey /etc/ssh/ssh_host_ed25519_key +Ciphers aes128-ctr,aes192-ctr,aes256-ctr +MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com +KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256 +AuthorizedKeysFile .ssh/authorized_keys +UsePAM yes +PermitRootLogin yes +# override default of no subsystems +PasswordAuthentication yes +PermitEmptyPasswords yes +Subsystem sftp /usr/bin/sftp-server +SshdSessionPath /usr/bin/sshd-session +} + +[uid=0 gid=0 perms=0400] /etc/ssh/ssh_host_rsa_key=qnx8/boards/common/ssh_host_rsa_key +[uid=0 gid=0 perms=0444] /etc/ssh/ssh_host_rsa_key.pub=qnx8/boards/common/ssh_host_rsa_key.pub +[uid=0 gid=0 perms=0400] /etc/ssh/ssh_host_ed25519_key=qnx8/boards/common/ssh_host_ed25519_key +[uid=0 gid=0 perms=0444] /etc/ssh/ssh_host_ed25519_key.pub=qnx8/boards/common/ssh_host_ed25519_key.pub + + + +####################################################################### +## PCIe driver shared libraries +####################################################################### +/lib/libpci.so=libpci.so + +/lib/dll/pci/pci_bkwd_compat.so=pci/pci_bkwd_compat.so +/lib/dll/pci/pci_cap-0x01.so=pci/pci_cap-0x01.so +/lib/dll/pci/pci_cap-0x04.so=pci/pci_cap-0x04.so +/lib/dll/pci/pci_cap-0x05.so=pci/pci_cap-0x05.so +/lib/dll/pci/pci_cap-0x07.so=pci/pci_cap-0x07.so +/lib/dll/pci/pci_cap-0x09-ffffffff.so=pci/pci_cap-0x09-ffffffff.so +/lib/dll/pci/pci_cap-0x0d.so=pci/pci_cap-0x0d.so +/lib/dll/pci/pci_cap-0x10-16c3abcd.so=pci/pci_cap-0x10-16c3abcd.so +/lib/dll/pci/pci_cap-0x10-19570400.so=pci/pci_cap-0x10-19570400.so +/lib/dll/pci/pci_cap-0x10.so=pci/pci_cap-0x10.so +/lib/dll/pci/pci_cap-0x11-ffffffff.so=pci/pci_cap-0x11-ffffffff.so +/lib/dll/pci/pci_cap-0x11.so=pci/pci_cap-0x11.so +/lib/dll/pci/pci_cap-0x12.so=pci/pci_cap-0x12.so +/lib/dll/pci/pci_cap-0x13.so=pci/pci_cap-0x13.so +/lib/dll/pci/pci_debug.so=pci/pci_debug.so +/lib/dll/pci/pci_debug2.so=pci/pci_debug2.so +/lib/dll/pci/pci_server-buscfg-generic.so=pci/pci_server-buscfg-generic.so +/lib/dll/pci/pci_server-buscfg-hotplug.so=pci/pci_server-buscfg-hotplug.so +/lib/dll/pci/pci_server-buscfg2-generic.so=pci/pci_server-buscfg2-generic.so +/lib/dll/pci/pci_server-buscfg2-hotplug.so=pci/pci_server-buscfg2-hotplug.so +/lib/dll/pci/pci_server-enable_features.so=pci/pci_server-enable_features.so +/lib/dll/pci/pci_server-event_handler.so=pci/pci_server-event_handler.so +/lib/dll/pci/pci_server-namespace.so=pci/pci_server-namespace.so +/lib/dll/pci/pci_slog.so=pci/pci_slog.so +/lib/dll/pci/pci_slog2.so=pci/pci_slog2.so +/lib/dll/pci/pci_strings.so=pci/pci_strings.so +/lib/dll/pci/pcie_xcap-0x0001.so=pci/pcie_xcap-0x0001.so +/lib/dll/pci/pcie_xcap-0x0003.so=pci/pcie_xcap-0x0003.so +/lib/dll/pci/pcie_xcap-0x000b-ffffffff.so=pci/pcie_xcap-0x000b-ffffffff.so +/lib/dll/pci/pcie_xcap-0x0015.so=pci/pcie_xcap-0x0015.so + +####################################################################### +## PCIe driver and support +####################################################################### +/sbin/pci-server=pci-server + +/usr/sbin/pci-tool=pci-tool +/usr/sbin/rsrcdb_query=rsrcdb_query + +/etc/system/config/pci/pcidatabase.com-tab_delimited.txt=${QNX_TARGET}/etc/system/config/pci/pcidatabase.com-tab_delimited.txt + +####################################################################### +## Shared libraries for security +####################################################################### +/lib/libqh.so=libqh.so +/lib/libregex.so=libregex.so +/lib/libsecpol.so=libsecpol.so +/lib/libslog2parse.so=libslog2parse.so +/lib/libslog2shim.so=libslog2shim.so +/lib/libslog2.so=libslog2.so +/lib/libtracelog.so=libtracelog.so + +/lib/dll/qcrypto-openssl-3.so=qcrypto-openssl-3.so + +/usr/lib/libcrypto.so=libcrypto.so +/usr/lib/libncursesw.so=libncursesw.so +/usr/lib/libqcrypto.so=libqcrypto.so +/usr/lib/libssl.so=libssl.so + +####################################################################### +## libqcrypto support +####################################################################### +[uid=0 gid=0 perms=0444] /etc/qcrypto.conf = { +openssl-3 tags=* +} + +####################################################################### +## Security files +####################################################################### +[uid=0 gid=0 perms=4555] /bin/login=login +[uid=0 gid=0 perms=4555] /bin/su=su + +[uid=0 gid=0 perms=455] /usr/bin/passwd=passwd + +[uid=0 gid=0 perms=0644] /etc/passwd = { +root:x:0:0:Superuser:/root:/bin/sh +sshd:x:15:6:sshd:/var/chroot/sshd:/bin/false +qnxuser:x:1000:1000:QNX User:/home/qnxuser:/bin/sh +} + +## Enabled Username/Password: root/root, qnxuser/qnxuser +[uid=0 gid=0 perms=0644] /etc/shadow = { +root::1763474425:0:0 +sshd:*:1763474425:0:0 +qnxuser::1763474425:0:0 +} + +[uid=0 gid=0 perms=0644] /etc/group = { +root:x:0:root +sshd:x:6: +qnxuser:x:1000 +} + + +####################################################################### +## PAM configurations addon build file +####################################################################### +[uid=0 gid=0 type=dir dperms=0755] / +[uid=0 gid=0 type=dir dperms=0755] /etc +[uid=0 gid=0 type=dir dperms=0755] /etc/pam.d +[uid=0 gid=0 type=dir dperms=0555] /home +[uid=1000 gid=1000 type=dir dperms=0555] /home/qnxuser +[uid=0 gid=0 type=dir dperms=0555] /lib +[uid=0 gid=0 type=dir dperms=0700] /root +[uid=0 gid=0 type=dir dperms=0555] /usr +[uid=0 gid=0 type=dir dperms=0555] /usr/lib +[uid=0 gid=0 type=dir dperms=0755] /var +[uid=0 gid=0 type=dir dperms=0755] /var/chroot +[uid=0 gid=0 type=dir dperms=0755] /var/chroot/sshd + +[perms=644] /etc/pam.d/login = { +auth requisite pam_qnx.so nullok +account requisite pam_qnx.so nullok +session requisite pam_qnx.so nullok +password requisite pam_qnx.so nullok +} + +[perms=644] /etc/pam.d/sshd = { +auth requisite pam_qnx.so nullok +account requisite pam_qnx.so nullok +session requisite pam_qnx.so nullok +password requisite pam_qnx.so nullok +} + +[perms=644] /etc/pam.d/passwd = { +auth requisite pam_qnx.so nullok +account requisite pam_qnx.so nullok +session requisite pam_qnx.so nullok +password requisite pam_qnx.so nullok +} + +[perms=644] /etc/pam.d/su = { +auth sufficient pam_rootok.so no_warn +auth requisite pam_qnx.so +account requisite pam_qnx.so +session requisite pam_qnx.so +password requisite pam_qnx.so +} + + +[uid=0 gid=0 perms=0555] /usr/lib/libpam.so=libpam.so +[uid=0 gid=0 perms=0555] /usr/lib/pam_deny.so=pam_deny.so +[uid=0 gid=0 perms=0555] /usr/lib/pam_echo.so=pam_echo.so +[uid=0 gid=0 perms=0555] /usr/lib/pam_exec.so=pam_exec.so +[uid=0 gid=0 perms=0555] /usr/lib/pam_group.so=pam_group.so +[uid=0 gid=0 perms=0555] /usr/lib/pam_permit.so=pam_permit.so +[uid=0 gid=0 perms=0555] /usr/lib/pam_qnx.so=pam_qnx.so +[uid=0 gid=0 perms=0555] /usr/lib/pam_rootok.so=pam_rootok.so +[uid=0 gid=0 perms=0555] /usr/lib/pam_secpol.so=pam_secpol.so +[uid=0 gid=0 perms=0555] /usr/lib/pam_self.so=pam_self.so + + +####################################################################### +## General shared libraries +####################################################################### +ldqnx-64.so.2=ldqnx-64.so.2 + +/lib/libc.so=libc.so +/lib/libcatalog.so=libcatalog.so +/lib/libdevice-publisher.so=libdevice-publisher.so +/lib/libgcc_s.so=libgcc_s.so +/lib/libm.so=libm.so +[+optional] /lib/libfsnotify.so=libfsnotify.so + +/usr/lib/libbacktrace.so=libbacktrace.so +/usr/lib/libc++.so=libc++.so +/usr/lib/libiconv.so=libiconv.so +/usr/lib/libintl.so=libintl.so +/usr/lib/libpanelw.so=libpanelw.so +/usr/lib/libz.so=libz.so + + +####################################################################### +## General commands +####################################################################### +/bin/confstr=confstr +/bin/df=df +/bin/hostname=hostname +/bin/kill=kill +/bin/ksh=ksh +/bin/mount=mount +/bin/on=on +/bin/pidin=pidin +/bin/slay=slay +/bin/slog2info=slog2info +/bin/slogger2=slogger2 +/bin/sync=sync +/bin/umount=umount +/bin/waitfor=waitfor +/bin/umask=umask + +/sbin/mqueue=mqueue +/sbin/pipe=pipe +/sbin/shutdown=shutdown + +/usr/bin/getconf=getconf +/usr/bin/hd=hd +/usr/bin/ldd=ldd +/usr/bin/setconf=setconf +/usr/bin/top=top +/usr/bin/use=use + +/usr/sbin/dumper=dumper +/usr/sbin/random=random + +################################################################################################ +## Toybox commands +## Note: The toybox package combines many common Linux command line utilities together into +## a single, BSD-licensed executable. The following toybox commands are supported. +## Use one of the following commands to access help for a toybox command: +## toybox command_name --help +## command_name --help +################################################################################################ +/usr/bin/toybox=toybox + +[type=link] /bin/cat=/usr/bin/toybox +[type=link] /bin/chmod=/usr/bin/toybox +[type=link] /bin/cp=/usr/bin/toybox +[type=link] /bin/dd=/usr/bin/toybox +[type=link] /bin/echo=/usr/bin/toybox +[type=link] /bin/ln=/usr/bin/toybox +[type=link] /bin/ls=/usr/bin/toybox +[type=link] /bin/mkdir=/usr/bin/toybox +[type=link] /bin/mv=/usr/bin/toybox +[type=link] /bin/pwd=/usr/bin/toybox +[type=link] /bin/rm=/usr/bin/toybox +[type=link] /bin/sed=/usr/bin/toybox +[type=link] /bin/uname=/usr/bin/toybox + +[type=link] /usr/bin/ascii=/usr/bin/toybox +[type=link] /usr/bin/base64=/usr/bin/toybox +[type=link] /usr/bin/basename=/usr/bin/toybox +[type=link] /usr/bin/bc=/usr/bin/toybox +[type=link] /usr/bin/bunzip2=/usr/bin/toybox +[type=link] /usr/bin/bzcat=/usr/bin/toybox +[type=link] /usr/bin/cal=/usr/bin/toybox +[type=link] /usr/bin/chgrp=/usr/bin/toybox +[type=link] /usr/bin/chown=/usr/bin/toybox +[type=link] /usr/bin/cksum=/usr/bin/toybox +[type=link] /usr/bin/clear=/usr/bin/toybox +[type=link] /usr/bin/cmp=/usr/bin/toybox +[type=link] /usr/bin/comm=/usr/bin/toybox +[type=link] /usr/bin/cpio=/usr/bin/toybox +[type=link] /usr/bin/crc32=/usr/bin/toybox +[type=link] /usr/bin/cut=/usr/bin/toybox +[type=link] /usr/bin/date=/usr/bin/toybox +[type=link] /usr/bin/diff=/usr/bin/toybox +[type=link] /usr/bin/dirname=/usr/bin/toybox +[type=link] /usr/bin/dos2unix=/usr/bin/toybox +[type=link] /usr/bin/du=/usr/bin/toybox +[type=link] /usr/bin/egrep=/usr/bin/toybox +[type=link] /usr/bin/env=/usr/bin/toybox +[type=link] /usr/bin/expand=/usr/bin/toybox +[type=link] /usr/bin/expr=/usr/bin/toybox +[type=link] /usr/bin/false=/usr/bin/toybox +[type=link] /usr/bin/fgrep=/usr/bin/toybox +[type=link] /usr/bin/file=/usr/bin/toybox +[type=link] /usr/bin/find=/usr/bin/toybox +[type=link] /usr/bin/grep=/usr/bin/toybox +[type=link] /usr/bin/groups=/usr/bin/toybox +[type=link] /usr/bin/gunzip=/usr/bin/toybox +[type=link] /usr/bin/gzip=/usr/bin/toybox +[type=link] /usr/bin/head=/usr/bin/toybox +[type=link] /usr/bin/id=/usr/bin/toybox +[type=link] /usr/bin/install=/usr/bin/toybox +[type=link] /usr/bin/link=/usr/bin/toybox +[type=link] /usr/bin/logname=/usr/bin/toybox +[type=link] /usr/bin/md5sum=/usr/bin/toybox +[type=link] /usr/bin/mkfifo=/usr/bin/toybox +[type=link] /usr/bin/mktemp=/usr/bin/toybox +[type=link] /usr/bin/more=/usr/bin/toybox +[type=link] /usr/bin/nl=/usr/bin/toybox +[type=link] /usr/bin/nohup=/usr/bin/toybox +[type=link] /usr/bin/od=/usr/bin/toybox +[type=link] /usr/bin/paste=/usr/bin/toybox +[type=link] /usr/bin/patch=/usr/bin/toybox +[type=link] /usr/bin/printenv=/usr/bin/toybox +[type=link] /usr/bin/printf=/usr/bin/toybox +[type=link] /usr/bin/readlink=/usr/bin/toybox +[type=link] /usr/bin/realpath=/usr/bin/toybox +[type=link] /usr/bin/rmdir=/usr/bin/toybox +[type=link] /usr/bin/seq=/usr/bin/toybox +[type=link] /usr/bin/sha1sum=/usr/bin/toybox +[type=link] /usr/bin/sleep=/usr/bin/toybox +[type=link] /usr/bin/sort=/usr/bin/toybox +[type=link] /usr/bin/split=/usr/bin/toybox +[type=link] /usr/bin/stat=/usr/bin/toybox +[type=link] /usr/bin/strings=/usr/bin/toybox +[type=link] /usr/bin/tail=/usr/bin/toybox +[type=link] /usr/bin/tar=/usr/bin/toybox +[type=link] /usr/bin/tee=/usr/bin/toybox +[type=link] /usr/bin/test=/usr/bin/toybox +[type=link] /usr/bin/time=/usr/bin/toybox +[type=link] /usr/bin/timeout=/usr/bin/toybox +[type=link] /usr/bin/touch=/usr/bin/toybox +[type=link] /usr/bin/true=/usr/bin/toybox +[type=link] /usr/bin/truncate=/usr/bin/toybox +[type=link] /usr/bin/tty=/usr/bin/toybox +[type=link] /usr/bin/uniq=/usr/bin/toybox +[type=link] /usr/bin/unix2dos=/usr/bin/toybox +[type=link] /usr/bin/unlink=/usr/bin/toybox +[type=link] /usr/bin/uudecode=/usr/bin/toybox +[type=link] /usr/bin/uuencode=/usr/bin/toybox +[type=link] /usr/bin/uuidgen=/usr/bin/toybox +[type=link] /usr/bin/wc=/usr/bin/toybox +[type=link] /usr/bin/which=/usr/bin/toybox +[type=link] /usr/bin/whoami=/usr/bin/toybox +[type=link] /usr/bin/xargs=/usr/bin/toybox +[type=link] /usr/bin/xxd=/usr/bin/toybox +[type=link] /usr/bin/yes=/usr/bin/toybox +[type=link] /usr/bin/zcat=/usr/bin/toybox + +####################################################################### +## Terminal support +####################################################################### +/usr/share/terminfo/q/qansi = ${QNX_TARGET}/usr/share/terminfo/q/qansi +/usr/share/terminfo/q/qansi-m = ${QNX_TARGET}/usr/share/terminfo/q/qansi-m +/usr/share/terminfo/x/xterm+256color = ${QNX_TARGET}/usr/share/terminfo/x/xterm+256color +/usr/share/terminfo/x/xterm = ${QNX_TARGET}/usr/share/terminfo/x/xterm + + +####################################################################### +## additional SDP files for testing support +####################################################################### +/usr/bin/awk=awk +/usr/bin/coreinfo=coreinfo +/sbin/mkdosfs=mkdosfs +/sbin/mkqnx6fs=mkqnx6fs +/sbin/chkdosfs=chkdosfs +/sbin/chkqnx6fs=chkqnx6fs +/sbin/fdisk=fdisk +/usr/bin/pted=pted +/bin/vi=vi +/usr/bin/hogs=hogs +/usr/sbin/tracelogger=tracelogger +/usr/bin/iperf3=iperf3 +/usr/lib/libiperf.so=libiperf.so +/usr/sbin/tcpdump=tcpdump +/usr/sbin/traceroute=traceroute +/usr/sbin/traceroute6=traceroute6 + +####################################################################### +## security only: security policy support +####################################################################### +[uid=0 gid=0 perms=0555] /proc/boot/secpolpush=secpolpush +[uid=0 gid=0 perms=0555] /proc/boot/secpolmonitor=secpolmonitor +[uid=0 gid=0 perms=0555] /proc/boot/secpol=secpol +# only for debugging use-case using secpolgenerate: +[uid=0 gid=0 perms=0755] /proc/boot/secpolgenerate=secpolgenerate +[uid=0 gid=0 perms=0755] /lib/libsecpol-gen.so=libsecpol-gen.so + +####################################################################### +## custom files / directories +####################################################################### +[uid=0 gid=0 type=dir dperms=0755] /run +[type=link] /var/run=/run +[uid=0 gid=0 type=dir dperms=0755] /boot +[uid=0 gid=0 type=dir dperms=0755] /mnt +[uid=0 gid=0 type=dir dperms=0755] /opt + + diff --git a/qnx8/boards/common/ssh_host_ed25519_key b/qnx8/boards/common/ssh_host_ed25519_key new file mode 100644 index 0000000..89c6c2b --- /dev/null +++ b/qnx8/boards/common/ssh_host_ed25519_key @@ -0,0 +1,7 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW +QyNTUxOQAAACAs7bJJdtxERfVjlfPAi3h649xT6RIRowDorA0wX4wRPAAAAJg0VhFKNFYR +SgAAAAtzc2gtZWQyNTUxOQAAACAs7bJJdtxERfVjlfPAi3h649xT6RIRowDorA0wX4wRPA +AAAEBmnSYYCYgHKfenavLLXS4XzwgUQa8ssQaKEMk7BclzFiztskl23ERF9WOV88CLeHrj +3FPpEhGjAOisDTBfjBE8AAAAFGdqdDJhYnRAQUJUMy1DLTAwMDM5AQ== +-----END OPENSSH PRIVATE KEY----- diff --git a/qnx8/boards/common/ssh_host_ed25519_key.pub b/qnx8/boards/common/ssh_host_ed25519_key.pub new file mode 100644 index 0000000..eaee9c6 --- /dev/null +++ b/qnx8/boards/common/ssh_host_ed25519_key.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICztskl23ERF9WOV88CLeHrj3FPpEhGjAOisDTBfjBE8 gjt2abt@ABT3-C-00039 diff --git a/qnx8/boards/common/ssh_host_rsa_key b/qnx8/boards/common/ssh_host_rsa_key new file mode 100644 index 0000000..90c9815 --- /dev/null +++ b/qnx8/boards/common/ssh_host_rsa_key @@ -0,0 +1,38 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn +NhAAAAAwEAAQAAAYEAtA0lqCZL5ZDmimijBh3Izp9/T4B1tjoehIXd6nPdacAIqYfNvdoK +RXC+tu2gXD2Ww/bg/lY3b8O4DfB8i3HMNhEqQPN8HrezwiOVMin0ybPVNZYh36WxZr9j3Z +kBAJr+zWCq9BOjrlzX/yo2UTl4iwy5c2YTxcVnH6Pr6YkR6DHq6zA3i1kuouj4Q4QjrixM +eW7vmbrH4OnDBzEjsSyaiDzpKA2XshInwEvGiYyxNANIdMESLtOImDEKB7EoMIKmK/FLM/ +AR8mpu0hE6Eni3wbqO03zbUgC/Oe++tWyKXH8PBxeUrjoRuQ1obEFtgxTvHBZWxc6IPOKr +xu4ZHIJsyc3CXzhzPt+i3j5XWF7SnXYn8A9VnKxIgBFmDXPqbJ/uOpsqzdzCweD0XiyKxi +YnrL9WfP6tIWpnpdeVemBYBJotIWsm3GH1/OpN157Taxzz+jaGFpUL9Y08/AYrLz9F9Ms2 +U6uWNVGhut6441ZYOsLGZWu6Dft1dXXWoVvfwOr5AAAFkLcWOxK3FjsSAAAAB3NzaC1yc2 +EAAAGBALQNJagmS+WQ5opoowYdyM6ff0+AdbY6HoSF3epz3WnACKmHzb3aCkVwvrbtoFw9 +lsP24P5WN2/DuA3wfItxzDYRKkDzfB63s8IjlTIp9Mmz1TWWId+lsWa/Y92ZAQCa/s1gqv +QTo65c1/8qNlE5eIsMuXNmE8XFZx+j6+mJEegx6uswN4tZLqLo+EOEI64sTHlu75m6x+Dp +wwcxI7Esmog86SgNl7ISJ8BLxomMsTQDSHTBEi7TiJgxCgexKDCCpivxSzPwEfJqbtIROh +J4t8G6jtN821IAvznvvrVsilx/DwcXlK46EbkNaGxBbYMU7xwWVsXOiDziq8buGRyCbMnN +wl84cz7fot4+V1he0p12J/APVZysSIARZg1z6myf7jqbKs3cwsHg9F4sisYmJ6y/Vnz+rS +FqZ6XXlXpgWASaLSFrJtxh9fzqTdee02sc8/o2hhaVC/WNPPwGKy8/RfTLNlOrljVRobre +uONWWDrCxmVrug37dXV11qFb38Dq+QAAAAMBAAEAAAGADRVrfXA9pv1EPh3jwtJaljvcNN +Br6AW0fq16S8rcSw6g/S4Y0vP2N8eSmZkORHBWn/+KUqZnOYrqZAZBYUyv/znOF+bZnSMn +lTL1aNjIU06VxA1t1rej+t3A3wh68dVRhhEWkHf2NqRuhGSdNS0iR6XGus5ZyiRRyGh8AH +4XvAdslRHtkgW1WtySYILzU3kf8YRl4DDvd2DlQtoySByqpL3FtPBlQT5f1HHCh++eV4jp +ifpsXNS9ofmQ9gV3RdcofDwMCUr8HXuZL3OC+OYG3CLEdcrNktKHksT7X3Jb57i2iHrIme +qOsOhJjRDImtLd6kR3YolMT3t8UcB/0LMlwE8hcKfpTD+tzmkvbpjaBGzGB9mQl2QoboJH +3Y+Prj7mhT/7PBfxUUH5FNX2bxf/tYhluh1zHUl29b+1sewa9GjETntOPhlCoSE2VtpEMf +yG5Tsq8D/j5MVe1B4KK8zB3gYnjjzmqM/tsQ43zVfduudl+dM6q9aEouD9ygSOhvjFAAAA +wQCZ0gt9zLSvbinM4DQpad9GHDxke5Gh98potRblwlDm5dQ94c0mwIpfSY4DYelkNR3A8B +i1OxFPhOGjEVHs+HyYYcnXNBf8DmnHaxDyv5LFxDOEZTWaSlvC1RHHN0bIsLmUIHX6TP1N +GiI3iea5twBU+t2MsqUwaySjieTG5xdjObrlWmxytRYmX2vz0XiZI8CjQBgSrQnm44wd2h +hyKpdzwALqKwBc0zHaz6u0xI+oWPBGcVcVYANq/4wjjriCGQUAAADBANI2ZF42tRkuVlAd +u83VoUo+RWZ8b+0PoFly7dMf5iAvj4ds9AlQIOJ7uW6s3PA5KyGTTpRL2emyuX33nE5DTU +ewe5itwzD7e3i4+mWWiXokSYGHSxey6cSVcxdKdilHaC9ufEgKOdvEJ43eAqoaBr/+8NO5 +ugrJlhsJ3Ffc9WkrX/ketLH4gL2H+CTmnlbVH4vIYs0u4wMrVIYL8GRqGiQuSyhRZQb7kb +tv5qnn7J3ynOt6khm7LpmRNyH4HuydRwAAAMEA20TyxKWPEQxKFctMJXDyelYtn0jO3Iqk +WlIXQyUPD4j8BWkGIdURrO2LXiR3lKko/sYZ7rW4g6923klY9UrxYTRjAixU/AKKX3cJbK +8PNfvs+9uI9DT+eYrD7y/Ixsy4EE7cpAFeh28d55kqSS2us80a7pFy4OngXf1Tjq3pgUTe +pnuao7XXPX5Ht+IiQFbDHgbrNy9t82hTkZQv1bseJ6jJCBmn1YTbLNxhwZxptShF78e85/ +LqYPUErqheiVW/AAAAFGdqdDJhYnRAQUJUMy1DLTAwMDM5AQIDBAUG +-----END OPENSSH PRIVATE KEY----- diff --git a/qnx8/boards/common/ssh_host_rsa_key.pub b/qnx8/boards/common/ssh_host_rsa_key.pub new file mode 100644 index 0000000..70942de --- /dev/null +++ b/qnx8/boards/common/ssh_host_rsa_key.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC0DSWoJkvlkOaKaKMGHcjOn39PgHW2Oh6Ehd3qc91pwAiph8292gpFcL627aBcPZbD9uD+Vjdvw7gN8HyLccw2ESpA83wet7PCI5UyKfTJs9U1liHfpbFmv2PdmQEAmv7NYKr0E6OuXNf/KjZROXiLDLlzZhPFxWcfo+vpiRHoMerrMDeLWS6i6PhDhCOuLEx5bu+Zusfg6cMHMSOxLJqIPOkoDZeyEifAS8aJjLE0A0h0wRIu04iYMQoHsSgwgqYr8Usz8BHyam7SEToSeLfBuo7TfNtSAL857761bIpcfw8HF5SuOhG5DWhsQW2DFO8cFlbFzog84qvG7hkcgmzJzcJfOHM+36LePldYXtKddifwD1WcrEiAEWYNc+psn+46myrN3MLB4PReLIrGJiesv1Z8/q0hamel15V6YFgEmi0haybcYfX86k3XntNrHPP6NoYWlQv1jTz8BisvP0X0yzZTq5Y1UaG63rjjVlg6wsZla7oN+3V1ddahW9/A6vk= gjt2abt@ABT3-C-00039 diff --git a/qnx8/boards/qemu-arm64virt/BUILD b/qnx8/boards/qemu-arm64virt/BUILD new file mode 100644 index 0000000..0658ee1 --- /dev/null +++ b/qnx8/boards/qemu-arm64virt/BUILD @@ -0,0 +1,24 @@ +load("@score_toolchains_qnx//rules/fs:ifs.bzl", "qnx_ifs") + +qnx_ifs ( + name = "ifs-qemu-arm64virt", + build_file = "qemu-arm64virt.build", + srcs = ["target.build", + "initscript", + "//qnx8/boards/common:common_files"] + glob(["*.sh"], exclude=["run-*.sh"]), + extension = "bin", +) + +genrule( + name = "qemu-runscript", + srcs = [ + "run-qemu-arm64virt.sh", + ], + outs = [ + "run-qemu.sh", + ], + cmd = """ + cp $(execpath run-qemu-arm64virt.sh) $(execpath run-qemu.sh) + """, + visibility = ["//visibility:public"], +) diff --git a/qnx8/boards/qemu-arm64virt/blk-start.sh b/qnx8/boards/qemu-arm64virt/blk-start.sh new file mode 100644 index 0000000..c6ed888 --- /dev/null +++ b/qnx8/boards/qemu-arm64virt/blk-start.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# Start virtio block device driver +BLK_DEVICE_RAW=hd0 + +echo "---> Starting block driver" +# virtio-blk values from QEMU virt fdt... +devb-virtio cam user=20:20 blk cache=64M,auto=partition,vnode=2000,ncache=2000,commit=low virtio smem=0xa003e00,irq=79 blk ramdisk=20m + +waitfor /dev/$BLK_DEVICE_RAW 3 +if [ ! -e /dev/$BLK_DEVICE_RAW ] +then + echo "ERROR: No block device detected" +fi + + +# Start /run filesystem +if [ -e /dev/ram0 ] +then + echo "---> Preparing /run using /dev/ram0" + # Preparing for many small files: + # 4096 inodes, 512 bytes per block, no reserved blocks + mkqnx6fs -i 4096 -b 512 -r 0 -q /dev/ram0 + mount -t qnx6 /dev/ram0 /run +else + echo "ERROR: No /dev/ram0 detected. /run file system is not available." +fi diff --git a/qnx8/boards/qemu-arm64virt/initscript b/qnx8/boards/qemu-arm64virt/initscript new file mode 100644 index 0000000..a78ea98 --- /dev/null +++ b/qnx8/boards/qemu-arm64virt/initscript @@ -0,0 +1,64 @@ +SYSNAME=nto +TERM=xterm +ENV=/etc/profile + +procmgr_symlink ../../proc/boot/ldqnx-64.so.2 /usr/lib/ldqnx-64.so.2 + +## Needed for ksh to run the echo command below +pipe + +display_msg " " +ksh -c "echo Welcome to QNX $(uname -r) on $(uname -m) !" +display_msg " " + +############################################################################################ +display_msg "---> Starting slogger2" +############################################################################################ +/bin/slogger2 & +waitfor /dev/slog2 + +dumper +mqueue +random + + +####################################################################### +## Console SERIAL driver +####################################################################### +display_msg "---> Starting serial driver" +devc-serpl011 -e -F 0x9000000,33 +waitfor /dev/ser1 +reopen /dev/ser1 + +/sbin/devc-pty + +####################################################################### +# Initial block device setup +####################################################################### +/bin/sh /proc/boot/blk-start.sh + +####################################################################### +# Mount file systems +####################################################################### +/bin/sh /proc/boot/mount-fs.sh + +####################################################################### +# Start networking, set hostname +####################################################################### +/bin/sh /proc/boot/net-start.sh + +####################################################################### +# Starting remaining services startup script +####################################################################### +/bin/sh /proc/boot/misc-services.sh + +####################################################################### +# Starting consoles and shells +####################################################################### +display_msg "---> Starting shell ... Have fun :-)" +HOME=/root +umask 022 + +# replace this shell with an interactive one +[+session] /bin/ksh -l + diff --git a/qnx8/boards/qemu-arm64virt/misc-services.sh b/qnx8/boards/qemu-arm64virt/misc-services.sh new file mode 100644 index 0000000..12466c1 --- /dev/null +++ b/qnx8/boards/qemu-arm64virt/misc-services.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +if [ -x /usr/sbin/qconn ]; then + echo "---> Starting qconn" + waitfor /dev/ptyp0 4 + waitfor /dev/socket 4 + /usr/sbin/qconn port=8000 +fi + +if [ -x /usr/sbin/sshd ]; then + echo "---> Starting sshd" + /usr/sbin/sshd +fi + +if [ -x /opt/score/autostart.sh ]; then + echo "---> Executing /opt/score/autostart.sh" + sh /opt/score/autostart.sh & +fi diff --git a/qnx8/boards/qemu-arm64virt/mount-fs.sh b/qnx8/boards/qemu-arm64virt/mount-fs.sh new file mode 100644 index 0000000..732e505 --- /dev/null +++ b/qnx8/boards/qemu-arm64virt/mount-fs.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +echo "---> Mounting file systems" + +# Mount probe list: hd0... is MBR, hd0.qnx6.x is GPT +MOUNT_PROBE_LIST="hd0t177 hd0.qnx6.0 hd0.qnx6.1" + +if [ -f /boot/etc/settings/mount ]; then + . /boot/etc/settings/mount +fi + +for blk_device in $MOUNT_PROBE_LIST +do + if [ -e /dev/$blk_device ] + then + BLK_DEVICE=$blk_device + break + fi +done +if [ -n "$BLK_DEVICE" ] +then + echo "Mounting root overlay filesystem /dev/$BLK_DEVICE" + mount $MOUNTOPTIONS -t qnx6 /dev/$BLK_DEVICE / +else + echo "No root file system has been detected" +fi + diff --git a/qnx8/boards/qemu-arm64virt/net-start.sh b/qnx8/boards/qemu-arm64virt/net-start.sh new file mode 100644 index 0000000..0de541c --- /dev/null +++ b/qnx8/boards/qemu-arm64virt/net-start.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +DEVICE_NAME_PREFIX=vtnet +IP_ADDRESS_vtnet0="192.168.120.20/24" +HOSTNAME=qemu-arm64virt + +if [ -f /boot/etc/settings/network ]; then + . /boot/etc/settings/network +fi + +# Set hostname +setconf _CS_HOSTNAME ${HOSTNAME} + +echo "---> Starting Ethernet driver" +io-sock -m fdt -d vtnet_mmio + +waitfor /dev/socket 1 +# Check if any network device is in the system +if [ ! -e /dev/socket ]; then + # No - exit here + echo "---> No Network device has been detected" + exit 0; +fi + + +if [ "$IP_ADDRESS_vtnet0" = dhcp ]; then + dhcpcd -bq -f /boot/etc/dhcpcd/dhcpcd.conf -c /boot/etc/dhcpcd/dhcpcd-run-hooks + # If dhcpcd not run as root, need to give it read/write access to /dev/bpf + setfacl -m user:38:rw /dev/bpf +else + # Setup static IP addresses for all defined devices + # enumerate devices from 0..3 + for i in 0 1 2 3 + do + # Try finding env var "IP_ADDRESS_" defined in network config file. + # If found, set up corresponding device. + # Build device name out of prefix + i + DEVICE_NAME=${DEVICE_NAME_PREFIX}$i + # Build env var name out of string "NET_IP_ADDRESS_" + DEVICE_NAME + IP_ADDRESS_TEMPLATE="IP_ADDRESS_$DEVICE_NAME" + # Evaluate env var name to get IP address for device + IP_ADDRESS=$(eval echo \$$IP_ADDRESS_TEMPLATE) + if [ -n "$IP_ADDRESS" ]; then + echo "---> Setting up $DEVICE_NAME with ip address $IP_ADDRESS" + if_up -r 10 -p $DEVICE_NAME + ifconfig $DEVICE_NAME $IP_ADDRESS up + fi + done +fi + +sysctl -w net.inet.icmp.bmcastecho=1 > /dev/null +sysctl -w qnx.sec.droproot=33:33 > /dev/null + +exit 0 diff --git a/qnx8/boards/qemu-arm64virt/qemu-arm64virt.build b/qnx8/boards/qemu-arm64virt/qemu-arm64virt.build new file mode 100644 index 0000000..7931c21 --- /dev/null +++ b/qnx8/boards/qemu-arm64virt/qemu-arm64virt.build @@ -0,0 +1,25 @@ +################################################################################################ +## +## Build file for a QNX operating system +## +################################################################################################ + +[-optional] +[+keeplinked] +[image=0x40080000] +[virtual=aarch64le,raw] boot = { + startup-qemu-virt + 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 -v -mL +} + +# all owned by root +[uid=0 gid=0 perms=0555 dperms=0555] + +[+script] startup-script = qnx8/boards/qemu-arm64virt/initscript + +# include the target specific build file +[+include] qnx8/boards/qemu-arm64virt/target.build + +# include the common build file +[+include] qnx8/boards/common/common.build + diff --git a/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh b/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh new file mode 100755 index 0000000..2b933db --- /dev/null +++ b/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# run-qemu-qemu-arm64virt.sh + +# ------------------------------------------ +# General QEMU settings +QEMU_BIN=qemu-system-aarch64 +MEM_SIZE=1G # does not run with less than 1G! +CPU_COUNT=2 + +# ------------------------------------------ +# Images generated by mkqnximage +SCORE_DISK=disk-score.qcow2 +SCORE_DISK_SIZE=512M +QNX_IFS=ifs-qemu-arm64virt.bin + +if [ ! -f "$SCORE_DISK" ]; then + qemu-img create -f qcow2 "$SCORE_DISK" $SCORE_DISK_SIZE + if [ $? -ne 0 ]; then + echo "Error: Failed to create QEMU disk image $SCORE_DISK" + exit 1 + fi +fi + +# ------------------------------------------ +# QEMU user network settings +# subnet. This value must match the IP address configured in guest QNX. +NETWORK=192.168.120 +# HOST TCP ports to be forwarded to VM +HOST_SSH_PORT=2210 +HOST_QCONN_PORT=8000 +HOST_DLT_PORT=3490 +HOST_DOIP_PORT=13400 +# IP for SSH port forwarding. This value must match the IP address configured in guest QNX. +VM_IP=$NETWORK.20 + + +# ------------------------------------------ +# Launch QEMU +$QEMU_BIN -machine virt-4.2 -cpu cortex-a57 -smp $CPU_COUNT -m $MEM_SIZE \ + -kernel $QNX_IFS \ + -drive file=$SCORE_DISK,if=none,id=drv0 -device virtio-blk-device,drive=drv0 \ + -netdev user,id=net0,net=$NETWORK.0/24,hostfwd=tcp::$HOST_SSH_PORT-$VM_IP:22,hostfwd=tcp::$HOST_QCONN_PORT-$VM_IP:8000,hostfwd=tcp::$HOST_DLT_PORT-$VM_IP:3490,hostfwd=tcp::$HOST_DOIP_PORT-$VM_IP:13400 \ + -device virtio-net-device,mac=52:54:00:12:34:72,netdev=net0 \ + -nographic \ + -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0 \ + -serial mon:stdio \ + $* diff --git a/qnx8/boards/qemu-arm64virt/target.build b/qnx8/boards/qemu-arm64virt/target.build new file mode 100644 index 0000000..9d85d59 --- /dev/null +++ b/qnx8/boards/qemu-arm64virt/target.build @@ -0,0 +1,52 @@ + +[uid=0 gid=0 perms=0755] + +[type=link] /dev/console=/dev/ser1 + + +################################################################################################ +## Serial drivers +################################################################################################ +/sbin/devc-serpl011=devc-serpl011 + + +################################################################################################ +## Block drivers +################################################################################################ +/sbin/devb-virtio=devb-virtio +/sbin/devb-loopback=devb-loopback + + +################################################################################################ +## Network driver files +################################################################################################ +/lib/dll/devs-vtnet_mmio.so=devs-vtnet_mmio.so +/lib/dll/mods-fdt.so=mods-fdt.so +/lib/dll/mods-phy_fdt.so=mods-phy_fdt.so + + +################################################################################################ +## ENV profile +################################################################################################ +[uid=0 gid=0 perms=0444] /etc/profile = { +export HOME=/ +export SYSNAME=nto +export TERM=xterm +export PATH=/proc/boot:/sbin:/bin:/usr/bin:/usr/sbin:/usr/libexec +export LD_LIBRARY_PATH=/proc/boot:/lib:/usr/lib:/lib/dll:/lib/dll/pci + +export PCI_HW_MODULE=/lib/dll/pci/pci_hw-bcm2711-rpi4.so +export PCI_DEBUG_MODULE=/lib/dll/pci/pci_debug2.so +export PCI_SLOG_MODULE=/lib/dll/pci/pci_slog2.so +export PCI_BKWD_COMPAT_MODULE=/lib/dll/pci/pci_bkwd_compat.so +umask 022 +} + + +################################################################################################ +## startup scripts +################################################################################################ +net-start.sh = qnx8/boards/qemu-arm64virt/net-start.sh +blk-start.sh = qnx8/boards/qemu-arm64virt/blk-start.sh +mount-fs.sh = qnx8/boards/qemu-arm64virt/mount-fs.sh +misc-services.sh = qnx8/boards/qemu-arm64virt/misc-services.sh diff --git a/qnx8/boards/qemu-x86_64/BUILD b/qnx8/boards/qemu-x86_64/BUILD new file mode 100644 index 0000000..048814e --- /dev/null +++ b/qnx8/boards/qemu-x86_64/BUILD @@ -0,0 +1,24 @@ +load("@score_toolchains_qnx//rules/fs:ifs.bzl", "qnx_ifs") + +qnx_ifs ( + name = "ifs-qemu-x86_64", + build_file = "qemu-x86_64.build", + srcs = ["target.build", + "initscript", + "//qnx8/boards/common:common_files"] + glob(["*.sh"], exclude=["run-*.sh"]), + extension = "bin", +) + +genrule( + name = "qemu-runscript", + srcs = [ + "run-qemu-x86_64.sh", + ], + outs = [ + "run-qemu.sh", + ], + cmd = """ + cp $(execpath run-qemu-x86_64.sh) $(execpath run-qemu.sh) + """, + visibility = ["//visibility:public"], +) diff --git a/qnx8/boards/qemu-x86_64/blk-start.sh b/qnx8/boards/qemu-x86_64/blk-start.sh new file mode 100644 index 0000000..dbfb125 --- /dev/null +++ b/qnx8/boards/qemu-x86_64/blk-start.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# Start virtio block device driver +BLK_DEVICE_RAW=hd0 + +echo "---> Starting block driver" +# virtio-blk values from QEMU virt fdt... +devb-virtio cam user=20:20 blk cache=64M,auto=partition,vnode=2000,ncache=2000,commit=low virtio blk ramdisk=20m + +waitfor /dev/$BLK_DEVICE_RAW 3 +if [ ! -e /dev/$BLK_DEVICE_RAW ] +then + echo "ERROR: No block device detected" +fi + + +# Start /run filesystem +if [ -e /dev/ram0 ] +then + echo "---> Preparing /run using /dev/ram0" + # Preparing for many small files: + # 4096 inodes, 512 bytes per block, no reserved blocks + mkqnx6fs -i 4096 -b 512 -r 0 -q /dev/ram0 + mount -t qnx6 /dev/ram0 /run +else + echo "ERROR: No /dev/ram0 detected. /run file system is not available." +fi diff --git a/qnx8/boards/qemu-x86_64/initscript b/qnx8/boards/qemu-x86_64/initscript new file mode 100644 index 0000000..693fcaa --- /dev/null +++ b/qnx8/boards/qemu-x86_64/initscript @@ -0,0 +1,82 @@ +SYSNAME=nto +TERM=xterm +ENV=/etc/profile + +procmgr_symlink ../../proc/boot/ldqnx-64.so.2 /usr/lib/ldqnx-64.so.2 + +## Needed for ksh to run the echo command below +pipe + +display_msg " " +ksh -c "echo Welcome to QNX $(uname -r) on $(uname -m) !" +display_msg " " + +############################################################################################ +display_msg "---> Starting slogger2" +############################################################################################ +/bin/slogger2 & +waitfor /dev/slog2 + +dumper +mqueue + +############################################################################################ +## PCI Server +############################################################################################ +PCI_DEBUG_MODULE=/lib/dll/pci/pci_debug2.so +PCI_SLOG_MODULE=/lib/dll/pci/pci_slog2.so +PCI_BKWD_COMPAT_MODULE=/lib/dll/pci/pci_bkwd_compat.so +PCI_HW_MODULE=/lib/dll/pci/pci_hw-Intel_x86.so + +display_msg "---> Starting PCI server" +pci-server --aspace-enable +waitfor /dev/pci + +############################################################################################ +## RTC utility / random +############################################################################################ +display_msg "---> Starting RTC+random" +rtc hw +# no idea why, but need to start random in a ksh shell... +ksh -c "random -l /lib/dll/devr-virtio.so" + +####################################################################### +## Console SERIAL driver +####################################################################### +display_msg "---> Starting serial driver" +devc-ser8250 -e -b115200 +waitfor /dev/ser1 +reopen /dev/ser1 + +/sbin/devc-pty + +####################################################################### +# Initial block device setup +####################################################################### +/bin/sh /proc/boot/blk-start.sh + +####################################################################### +# Mount file systems +####################################################################### +/bin/sh /proc/boot/mount-fs.sh + +####################################################################### +# Start networking, set hostname +####################################################################### +/bin/sh /proc/boot/net-start.sh + +####################################################################### +# Starting remaining services startup script +####################################################################### +/bin/sh /proc/boot/misc-services.sh + +####################################################################### +# Starting consoles and shells +####################################################################### +display_msg "---> Starting shell ... Have fun :-)" +HOME=/root +umask 022 + +# replace this shell with an interactive one +[+session] /bin/ksh -l + diff --git a/qnx8/boards/qemu-x86_64/misc-services.sh b/qnx8/boards/qemu-x86_64/misc-services.sh new file mode 100644 index 0000000..12466c1 --- /dev/null +++ b/qnx8/boards/qemu-x86_64/misc-services.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +if [ -x /usr/sbin/qconn ]; then + echo "---> Starting qconn" + waitfor /dev/ptyp0 4 + waitfor /dev/socket 4 + /usr/sbin/qconn port=8000 +fi + +if [ -x /usr/sbin/sshd ]; then + echo "---> Starting sshd" + /usr/sbin/sshd +fi + +if [ -x /opt/score/autostart.sh ]; then + echo "---> Executing /opt/score/autostart.sh" + sh /opt/score/autostart.sh & +fi diff --git a/qnx8/boards/qemu-x86_64/mount-fs.sh b/qnx8/boards/qemu-x86_64/mount-fs.sh new file mode 100644 index 0000000..732e505 --- /dev/null +++ b/qnx8/boards/qemu-x86_64/mount-fs.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +echo "---> Mounting file systems" + +# Mount probe list: hd0... is MBR, hd0.qnx6.x is GPT +MOUNT_PROBE_LIST="hd0t177 hd0.qnx6.0 hd0.qnx6.1" + +if [ -f /boot/etc/settings/mount ]; then + . /boot/etc/settings/mount +fi + +for blk_device in $MOUNT_PROBE_LIST +do + if [ -e /dev/$blk_device ] + then + BLK_DEVICE=$blk_device + break + fi +done +if [ -n "$BLK_DEVICE" ] +then + echo "Mounting root overlay filesystem /dev/$BLK_DEVICE" + mount $MOUNTOPTIONS -t qnx6 /dev/$BLK_DEVICE / +else + echo "No root file system has been detected" +fi + diff --git a/qnx8/boards/qemu-x86_64/net-start.sh b/qnx8/boards/qemu-x86_64/net-start.sh new file mode 100644 index 0000000..334c593 --- /dev/null +++ b/qnx8/boards/qemu-x86_64/net-start.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +DEVICE_NAME_PREFIX=vtnet +IP_ADDRESS_vtnet0="192.168.120.20/24" +HOSTNAME=x86_64qemu + +if [ -f /boot/etc/settings/network ]; then + . /boot/etc/settings/network +fi + +# Set hostname +setconf _CS_HOSTNAME ${HOSTNAME} + +echo "---> Starting Ethernet driver" +io-sock -m phy -m pci -m usb -d vtnet_pci + +waitfor /dev/socket 1 +# Check if any network device is in the system +if [ ! -e /dev/socket ]; then + # No - exit here + echo "---> No Network device has been detected" + exit 0; +fi + + +if [ "$IP_ADDRESS_${DEVICE_NAME_PREFIX}0" = dhcp ]; then + dhcpcd -bq -f /system/etc/dhcpcd/dhcpcd.conf -c /system/etc/dhcpcd/dhcpcd-run-hooks + # If dhcpcd not run as root, need to give it read/write access to /dev/bpf + setfacl -m user:38:rw /dev/bpf +else + # Setup static IP addresses for all defined devices + # enumerate devices from 0..3 + for i in 0 1 2 3 + do + # Try finding env var "IP_ADDRESS_" defined in network config file. + # If found, set up corresponding device. + # Build device name out of prefix + i + DEVICE_NAME=${DEVICE_NAME_PREFIX}$i + # Build env var name out of string "NET_IP_ADDRESS_" + DEVICE_NAME + IP_ADDRESS_TEMPLATE="IP_ADDRESS_$DEVICE_NAME" + # Evaluate env var name to get IP address for device + IP_ADDRESS=$(eval echo \$$IP_ADDRESS_TEMPLATE) + if [ -n "$IP_ADDRESS" ]; then + echo "---> Setting up $DEVICE_NAME with ip address $IP_ADDRESS" + if_up -r 10 -p $DEVICE_NAME + ifconfig $DEVICE_NAME $IP_ADDRESS up + fi + done +fi + +sysctl -w net.inet.icmp.bmcastecho=1 > /dev/null +sysctl -w qnx.sec.droproot=33:33 > /dev/null + +exit 0 diff --git a/qnx8/boards/qemu-x86_64/qemu-x86_64.build b/qnx8/boards/qemu-x86_64/qemu-x86_64.build new file mode 100644 index 0000000..409f71a --- /dev/null +++ b/qnx8/boards/qemu-x86_64/qemu-x86_64.build @@ -0,0 +1,25 @@ +################################################################################################ +## +## Build file for a QNX operating system on a QEMU x86_64 machine +## +################################################################################################ + +[-optional] +[+keeplinked] +[image=0x2000000] +[virtual=x86_64,multiboot] boot = { + startup-x86 -v -D8250..115200 + PATH=/sbin:/usr/sbin:/bin:/usr/bin:/proc/boot LD_LIBRARY_PATH=/proc/boot:/lib:/usr/lib:/lib/dll/pci procnto-smp-instr -v -mL -bl +} + +# all owned by root +[uid=0 gid=0 perms=0555 dperms=0555] + +[+script] startup-script = qnx8/boards/qemu-x86_64/initscript + +# include the target specific build file +[+include] qnx8/boards/qemu-x86_64/target.build + +# include the common build file +[+include] qnx8/boards/common/common.build + diff --git a/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh b/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh new file mode 100755 index 0000000..ccfe117 --- /dev/null +++ b/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# run-qemu-x86_64.sh + +# ------------------------------------------ +# General QEMU settings +QEMU_BIN=qemu-system-x86_64 +MEM_SIZE=1G # does not run with less than 1G! +CPU_COUNT=2 + +# ------------------------------------------ +# Images generated by mkqnximage +SCORE_DISK=disk-score.qcow2 +SCORE_DISK_SIZE=512M +QNX_IFS=ifs-qemu-x86_64.bin + +if [ ! -f "$SCORE_DISK" ]; then + qemu-img create -f qcow2 "$SCORE_DISK" $SCORE_DISK_SIZE + if [ $? -ne 0 ]; then + echo "Error: Failed to create QEMU disk image $SCORE_DISK" + exit 1 + fi +fi + +# ------------------------------------------ +# QEMU user network settings +# subnet. This value must match the IP address configured in guest QNX. +NETWORK=192.168.120 +# HOST TCP ports to be forwarded to VM +HOST_SSH_PORT=2210 +HOST_QCONN_PORT=8000 +HOST_DLT_PORT=3490 +HOST_DOIP_PORT=13400 +# IP for SSH port forwarding. This value must match the IP address configured in guest QNX. +VM_IP=$NETWORK.20 + + +# ------------------------------------------ +# Launch QEMU +$QEMU_BIN -cpu host -accel kvm -smp $CPU_COUNT -m $MEM_SIZE \ + -kernel $QNX_IFS \ + -drive file=$SCORE_DISK,if=none,id=drv0 -device virtio-blk-pci,drive=drv0 \ + -netdev user,id=net0,net=$NETWORK.0/24,hostfwd=tcp::$HOST_SSH_PORT-$VM_IP:22,hostfwd=tcp::$HOST_QCONN_PORT-$VM_IP:8000,hostfwd=tcp::$HOST_DLT_PORT-$VM_IP:3490,hostfwd=tcp::$HOST_DOIP_PORT-$VM_IP:13400 \ + -device virtio-net-pci,mac=52:54:00:12:34:72,netdev=net0 \ + -nographic \ + -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 \ + -serial mon:stdio \ + $* diff --git a/qnx8/boards/qemu-x86_64/target.build b/qnx8/boards/qemu-x86_64/target.build new file mode 100644 index 0000000..1201cb5 --- /dev/null +++ b/qnx8/boards/qemu-x86_64/target.build @@ -0,0 +1,73 @@ + +[uid=0 gid=0 perms=0755] + +[type=link] /dev/console=/dev/ser1 + + +################################################################################################ +## PCI driver HW Modules and configuration file +################################################################################################ +/lib/dll/pci/pci_hw-AMD_x86.so=pci/pci_hw-AMD_x86.so +/lib/dll/pci/pci_hw-Intel_x86.so=pci/pci_hw-Intel_x86.so + + +################################################################################################ +## Serial drivers +################################################################################################ +/sbin/devc-ser8250=devc-ser8250 +/sbin/devc-serusb=devc-serusb +/sbin/devc-serpci=devc-serpci + + +################################################################################################ +## Block drivers +################################################################################################ +/sbin/devb-eide=devb-eide +/sbin/devb-nvme=devb-nvme +/sbin/devb-ram=devb-ram +/sbin/devb-virtio=devb-virtio +/sbin/devb-loopback=devb-loopback + + +################################################################################################ +## Network driver files +################################################################################################ +/lib/dll/devs-vtnet_pci.so=devs-vtnet_pci.so +/lib/dll/mods-pci.so=mods-pci.so +/lib/dll/mods-usb.so=mods-usb.so + +################################################################################################ +## random driver files +################################################################################################ +/lib/dll/devr-virtio.so=devr-virtio.so + +################################################################################################ +## RTC driver +################################################################################################ +/sbin/rtc=rtc + +################################################################################################ +## ENV profile +################################################################################################ +[uid=0 gid=0 perms=0444] /etc/profile = { +export HOME=/ +export SYSNAME=nto +export TERM=xterm +export PATH=/proc/boot:/sbin:/bin:/usr/bin:/usr/sbin:/usr/libexec +export LD_LIBRARY_PATH=/proc/boot:/lib:/usr/lib:/lib/dll:/lib/dll/pci + +export PCI_HW_MODULE=/lib/dll/pci/pci_hw-Intel_x86.so +export PCI_DEBUG_MODULE=/lib/dll/pci/pci_debug2.so +export PCI_SLOG_MODULE=/lib/dll/pci/pci_slog2.so +export PCI_BKWD_COMPAT_MODULE=/lib/dll/pci/pci_bkwd_compat.so +umask 022 +} + + +################################################################################################ +## startup scripts +################################################################################################ +net-start.sh = qnx8/boards/qemu-x86_64/net-start.sh +blk-start.sh = qnx8/boards/qemu-x86_64/blk-start.sh +mount-fs.sh = qnx8/boards/qemu-x86_64/mount-fs.sh +misc-services.sh = qnx8/boards/qemu-x86_64/misc-services.sh From f94b5bab71dbe6037cb413b88f3b4d3d8ff57693 Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Fri, 5 Dec 2025 11:57:27 +0100 Subject: [PATCH 02/29] Split up top level README, replace SDP link with notes --- MODULE.bazel | 7 +- README.md | 181 +------------------------------------------------ qnx8/README.md | 179 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 185 insertions(+), 182 deletions(-) create mode 100644 qnx8/README.md diff --git a/MODULE.bazel b/MODULE.bazel index a46fbee..48fb22c 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -20,9 +20,12 @@ module( bazel_dep(name = "score_toolchains_qnx", version = "0.0.4") toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx", dev_dependency=True) +# TODO: Add here your QNX8 toolchain which meets the requirements listed in qnx8/README.md toolchains_qnx.sdp( - url = "file:///home/gjt2abt/qnx803.tgz", - sha256 = "8c62b8567727d2e402165eba5a3b29c56ad74165575412a07981b176cdadcaa2", + url = "http://link/to/qnx803.tar.gz", + # or: + # url = "file:///path/to/qnx803.tar.gz", + sha256 = "", ) use_repo(toolchains_qnx, "toolchains_qnx_sdp", "toolchains_qnx_ifs") diff --git a/README.md b/README.md index 3c69450..d8d84b7 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This module creates OS images intended for testing S-CORE software: -* bootable QNX IFS images using the QNX 8 SDP. +* bootable [QNX IFS images using the QNX 8 SDP](qnx8/README.md). * bootable Linux image: TODO **Why do we need OS images?** @@ -22,182 +22,3 @@ The basic idea is to have modular OS images for *testing* and *verifying* S-CORE => users can focus on creating the file system with content to match their use cases and *use* the OS image of their choice. -## OS images for QNX 8 - -Following QNX 8 OS images can be created: - -* QEMU aarch64 "virt" image using virtio block and network drivers. -* QEMU x86_64 image using virtio block and network drivers. - -### Pre-requisites - -#### QNX SDP - -Building the images requires a QNX SDP 8.0.3 (or later) available during build with following additional QNX SDP packages integrated: - -* QNX® SDP 8.0 Networking - io-sock Virtio Drivers -* QNX® SDP 8.0 Virtualization Drivers (Block) -* QNX® SDP 8.0 Virtualization Drivers (Startup) - -Add the URL of the QNX SDP tarball to the `MODULE.bazel`: - -``` -[...] - -toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx", dev_dependency=True) -toolchains_qnx.sdp( - url = "http://link/to/qnx803.tar.gz", - # or: - # url = "file:///path/to/qnx803.tar.gz", - sha256 = "", -) - -[...] - -``` - -#### bazelrc - -A `.bazelrc` should include general eclipse-score registry and toolchain requirements given by -https://github.com/eclipse-score/toolchains_qnx/blob/main/README.md . - -``` -common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/ -common --registry=https://bcr.bazel.build - -common --incompatible_strict_action_env -# mkifs is not a target platform specific tool, the host would be sufficient. But there is only -# target platform specific toolchains defined for QNX in this repo. -# Therefore we have to select a target platform and we choose x86_64-qnx. -common --platforms=@score_toolchains_qnx//platforms:x86_64-qnx -common --sandbox_writable_path=/var/tmp -``` - -### Building QNX OS images - -QEMU arm64 image using "virt" VM: - -```bash -bazel build //qnx8/boards/qemu-arm64virt:all -``` - -QEMU x86_64 image: - -```bash -bazel build //qnx8/boards/qemu-x86_64:all -``` - -In case of requiring an online QNX license checkout for the QNX SDP `mkifs` utility you might have to set the QNXLM_LICENSE_FILE environment variable with the link to the license server `--action_env=QNXLM_LICENSE_FILE=...`, for example: - -```bash -bazel build --action_env=QNXLM_LICENSE_FILE=my@internal.qnx-license-server.com //qnx8/boards/qemu-arm64virt:all -``` - -### Running the images - -#### Pre-requisites - -In order to run the QEMU images on the host you must have `qemu-system-aarch64` and `qemu-system-x86_64` installed. The x86_64 QEMU run script uses `-accel kvm`, so the running user must have access to `/dev/kvm` for acceleration. - -#### Get started - -After successful build you'll find the IFS binary and an exemplary run script in `bazel-out`: - -``` -bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-arm64virt/run-qemu.sh -bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-arm64virt/ifs-qemu-arm64virt.bin -bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-x86_64/run-qemu.sh -bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-x86_64/ifs-qemu-x86_64.bin -``` - -In order to run the image, change into the directory with the IFS and execute the run script: - -``` -cd bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-arm64virt -./run-qemu.sh -``` - -You'll get something like: - -``` -Welcome to QNX 8.0.0 on QEMU_virt ! - ----> Starting slogger2 ----> Starting serial driver ----> Starting block driver -Path=0 - - target=0 lun=0 Direct-Access(0) - VIRTIO Rev: ----> Preparing /run using /dev/ram0 ----> Mounting file systems -No root file system has been detected ----> Starting Ethernet driver ----> Setting up vtnet0 with ip address 192.168.120.20/24 ----> Starting qconn ----> Starting sshd ----> Starting shell ... Have fun :-) -# -``` - -#### ssh from host into QEMU image - -The QNX IFS images start up a `sshd` server. The user `root` has by default no password and `sshd` is configured to accept a root login w/o password. -The exemplary `run-qemu.sh` script configures QEMU to use QEMU user networking and sets up a port forwarding from localhost:2210 -> VM-IP 192.168.120.20:22. So you can open a ssh from host using: - -``` -ssh -p 2210 root@localhost -``` - -#### Attaching a user-created QNX6fs file system - -The QNX startup script (see `qnx8/boards//initscript`) calls `mount-fs.sh` which tries to mount a file system to the system. -By default, the partition is mounted at `/` (root) and therefore a user sees a virtual file system with a combination of the IFS and the mounted file system. The path manager resolves path names first on the mounted partition, then on the IFS. This means all files on partition extend or even eclipse files on the IFS. For more information see https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.sys_arch/topic/proc_Resolving_pathnames.html. - -The generated QEMU launch script `run-qemu.sh` attaches a virtual disk `disk-score.qcow2` to the image. If it does not exist, it creates an empty virtual QEMU disk with size of 512MB before launching QEMU. - -##### Creating a file system on-line - -When starting up the QEMU VM with an empty virtual QEMU disk, no partitions are there. With the following commands you can create a partition and a qnx6fs file system which then gets mounted automatically on following boots: - -```bash -# initialize with GUID partition table -pted /dev/hd0 init -g -# Create a partition with 99% disk size and name 'scorefs' -pted /dev/hd0 add -t qnx6fs -p 99 -n scorefs -# Re-read the partition table -mount -e /dev/hd0 -# Create QNX6 file system -mkqnx6fs /dev/hd0.qnx6.0 -# Reboot to let the partition be mounted automatically -shutdown -``` - -After reboot you'll see in the startup messages that a partition is found and mounted: - -``` -[...] ----> Mounting file systems -Mounting root overlay filesystem /dev/hd0.qnx6.0 -[...] -``` - -##### Creating a file system offline - -A QNX file system can be created on the host using `mkqnx6fsimg` (see https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.utilities/topic/m/mkqnx6fsimg.html). - -TODO: integrate `mkqnx6fsimg` into `toolchains_qnx`. - -#### Configuring custom IP address + host name - -During the startup of the VM the network is being set up, *after* mounting the virtual file system. By default host name `qemu-arm64virt` or `qemu-x86_64` and IP address 192.168.120.20/24 is set up. **Before** setting these, the `net-start.sh` script tries to read a file `/boot/etc/settings/network`. By installing such a file on the virtual file system and adding variables one can configure hostname and IP address of the network interface: - -``` -# /boot/etc/settings/network -IP_ADDRESS_vtnet0="192.168.100.1/24" -HOSTNAME=myqemu -``` - -> NOTE: This changes only the IP address of the QNX network interface. In order to make the port forwardings of the QEMU user network function correctly you'll have to adapt the QEMU user networking configuration in the `run-qemu.sh` script according to your IP address/subnet. - -#### Autostart script - -If the file `/opt/score/autostart.sh` exists on the mounted file system, it is executed at the end of the OS image startup sequence. diff --git a/qnx8/README.md b/qnx8/README.md new file mode 100644 index 0000000..80595bf --- /dev/null +++ b/qnx8/README.md @@ -0,0 +1,179 @@ +# OS images for QNX 8 + +Following QNX 8 OS images can be created: + +* QEMU aarch64 "virt" image using virtio block and network drivers. +* QEMU x86_64 image using virtio block and network drivers. + +## Pre-requisites + +### QNX SDP + +Building the images requires a QNX SDP 8.0.3 (or later) available during build with following additional QNX SDP packages integrated: + +* QNX® SDP 8.0 Networking - io-sock Virtio Drivers +* QNX® SDP 8.0 Virtualization Drivers (Block) +* QNX® SDP 8.0 Virtualization Drivers (Startup) + +Add the URL of the QNX SDP tarball to the `MODULE.bazel`: + +``` +[...] + +toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx", dev_dependency=True) +toolchains_qnx.sdp( + url = "http://link/to/qnx803.tar.gz", + # or: + # url = "file:///path/to/qnx803.tar.gz", + sha256 = "", +) + +[...] + +``` + +### bazelrc + +A `.bazelrc` should include general eclipse-score registry and toolchain requirements given by +https://github.com/eclipse-score/toolchains_qnx/blob/main/README.md . + +``` +common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/ +common --registry=https://bcr.bazel.build + +common --incompatible_strict_action_env +# mkifs is not a target platform specific tool, the host would be sufficient. But there is only +# target platform specific toolchains defined for QNX in this repo. +# Therefore we have to select a target platform and we choose x86_64-qnx. +common --platforms=@score_toolchains_qnx//platforms:x86_64-qnx +common --sandbox_writable_path=/var/tmp +``` + +## Building QNX OS images + +QEMU arm64 image using "virt" VM: + +```bash +bazel build //qnx8/boards/qemu-arm64virt:all +``` + +QEMU x86_64 image: + +```bash +bazel build //qnx8/boards/qemu-x86_64:all +``` + +In case of requiring an online QNX license checkout for the QNX SDP `mkifs` utility you might have to set the QNXLM_LICENSE_FILE environment variable with the link to the license server `--action_env=QNXLM_LICENSE_FILE=...`, for example: + +```bash +bazel build --action_env=QNXLM_LICENSE_FILE=my@internal.qnx-license-server.com //qnx8/boards/qemu-arm64virt:all +``` + +## Running the images + +### Pre-requisites + +In order to run the QEMU images on the host you must have `qemu-system-aarch64` and `qemu-system-x86_64` installed. The x86_64 QEMU run script uses `-accel kvm`, so the running user must have access to `/dev/kvm` for acceleration. + +### Get started + +After successful build you'll find the IFS binary and an exemplary run script in `bazel-out`: + +``` +bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-arm64virt/run-qemu.sh +bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-arm64virt/ifs-qemu-arm64virt.bin +bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-x86_64/run-qemu.sh +bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-x86_64/ifs-qemu-x86_64.bin +``` + +In order to run the image, change into the directory with the IFS and execute the run script: + +``` +cd bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-arm64virt +./run-qemu.sh +``` + +You'll get something like: + +``` +Welcome to QNX 8.0.0 on QEMU_virt ! + +---> Starting slogger2 +---> Starting serial driver +---> Starting block driver +Path=0 - + target=0 lun=0 Direct-Access(0) - VIRTIO Rev: +---> Preparing /run using /dev/ram0 +---> Mounting file systems +No root file system has been detected +---> Starting Ethernet driver +---> Setting up vtnet0 with ip address 192.168.120.20/24 +---> Starting qconn +---> Starting sshd +---> Starting shell ... Have fun :-) +# +``` + +### ssh from host into QEMU image + +The QNX IFS images start up a `sshd` server. The user `root` has by default no password and `sshd` is configured to accept a root login w/o password. +The exemplary `run-qemu.sh` script configures QEMU to use QEMU user networking and sets up a port forwarding from localhost:2210 -> VM-IP 192.168.120.20:22. So you can open a ssh from host using: + +``` +ssh -p 2210 root@localhost +``` + +### Attaching a user-created QNX6fs file system + +The QNX startup script (see `qnx8/boards//initscript`) calls `mount-fs.sh` which tries to mount a file system to the system. +By default, the partition is mounted at `/` (root) and therefore a user sees a virtual file system with a combination of the IFS and the mounted file system. The path manager resolves path names first on the mounted partition, then on the IFS. This means all files on partition extend or even eclipse files on the IFS. For more information see https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.sys_arch/topic/proc_Resolving_pathnames.html. + +The generated QEMU launch script `run-qemu.sh` attaches a virtual disk `disk-score.qcow2` to the image. If it does not exist, it creates an empty virtual QEMU disk with size of 512MB before launching QEMU. + +#### Creating a file system on-line + +When starting up the QEMU VM with an empty virtual QEMU disk, no partitions are there. With the following commands you can create a partition and a qnx6fs file system which then gets mounted automatically on following boots: + +```bash +# initialize with GUID partition table +pted /dev/hd0 init -g +# Create a partition with 99% disk size and name 'scorefs' +pted /dev/hd0 add -t qnx6fs -p 99 -n scorefs +# Re-read the partition table +mount -e /dev/hd0 +# Create QNX6 file system +mkqnx6fs /dev/hd0.qnx6.0 +# Reboot to let the partition be mounted automatically +shutdown +``` + +After reboot you'll see in the startup messages that a partition is found and mounted: + +``` +[...] +---> Mounting file systems +Mounting root overlay filesystem /dev/hd0.qnx6.0 +[...] +``` + +#### Creating a file system offline + +A QNX file system can be created on the host using `mkqnx6fsimg` (see https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.utilities/topic/m/mkqnx6fsimg.html). + +TODO: integrate `mkqnx6fsimg` into `toolchains_qnx`. + +### Configuring custom IP address + host name + +During the startup of the VM the network is being set up, *after* mounting the virtual file system. By default host name `qemu-arm64virt` or `qemu-x86_64` and IP address 192.168.120.20/24 is set up. **Before** setting these, the `net-start.sh` script tries to read a file `/boot/etc/settings/network`. By installing such a file on the virtual file system and adding variables one can configure hostname and IP address of the network interface: + +``` +# /boot/etc/settings/network +IP_ADDRESS_vtnet0="192.168.100.1/24" +HOSTNAME=myqemu +``` + +> NOTE: This changes only the IP address of the QNX network interface. In order to make the port forwardings of the QEMU user network function correctly you'll have to adapt the QEMU user networking configuration in the `run-qemu.sh` script according to your IP address/subnet. + +### Autostart script + +If the file `/opt/score/autostart.sh` exists on the mounted file system, it is executed at the end of the OS image startup sequence. From 1efd176d1271d9c5ed9c60b7a17753ebb8b377f1 Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Mon, 15 Dec 2025 08:47:59 +0100 Subject: [PATCH 03/29] Fix in qnx8 README --- qnx8/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qnx8/README.md b/qnx8/README.md index 80595bf..3306652 100644 --- a/qnx8/README.md +++ b/qnx8/README.md @@ -135,10 +135,10 @@ The generated QEMU launch script `run-qemu.sh` attaches a virtual disk `disk-sco When starting up the QEMU VM with an empty virtual QEMU disk, no partitions are there. With the following commands you can create a partition and a qnx6fs file system which then gets mounted automatically on following boots: ```bash -# initialize with GUID partition table +# initialize /dev/hd0 with GUID partition table pted /dev/hd0 init -g -# Create a partition with 99% disk size and name 'scorefs' -pted /dev/hd0 add -t qnx6fs -p 99 -n scorefs +# Create a qnx6fs partition with 99% disk size and name 'scorefs' +pted /dev/hd0 add -t qnx6 -p 99 -n scorefs # Re-read the partition table mount -e /dev/hd0 # Create QNX6 file system From afa97161a5aa0fb09d0099886cee9c6ee3d1f067 Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Wed, 17 Dec 2025 09:49:18 +0100 Subject: [PATCH 04/29] Add 'external/os_images+' to mkifs build file search path --- qnx8/boards/qemu-arm64virt/qemu-arm64virt.build | 3 +++ qnx8/boards/qemu-x86_64/qemu-x86_64.build | 3 +++ 2 files changed, 6 insertions(+) diff --git a/qnx8/boards/qemu-arm64virt/qemu-arm64virt.build b/qnx8/boards/qemu-arm64virt/qemu-arm64virt.build index 7931c21..e09f51a 100644 --- a/qnx8/boards/qemu-arm64virt/qemu-arm64virt.build +++ b/qnx8/boards/qemu-arm64virt/qemu-arm64virt.build @@ -15,6 +15,9 @@ # all owned by root [uid=0 gid=0 perms=0555 dperms=0555] +# add external search path in case we are building the image with bazel in context of another module *sigh* +[search=${MKIFS_PATH}:external/os_images+] + [+script] startup-script = qnx8/boards/qemu-arm64virt/initscript # include the target specific build file diff --git a/qnx8/boards/qemu-x86_64/qemu-x86_64.build b/qnx8/boards/qemu-x86_64/qemu-x86_64.build index 409f71a..e09872c 100644 --- a/qnx8/boards/qemu-x86_64/qemu-x86_64.build +++ b/qnx8/boards/qemu-x86_64/qemu-x86_64.build @@ -15,6 +15,9 @@ # all owned by root [uid=0 gid=0 perms=0555 dperms=0555] +# add external search path in case we are building the image with bazel in context of another module *sigh* +[search=${MKIFS_PATH}:external/os_images+] + [+script] startup-script = qnx8/boards/qemu-x86_64/initscript # include the target specific build file From 4ebd5cdc120b7efcf0a1ee22ac00be2bb2886f3d Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Wed, 17 Dec 2025 10:34:34 +0100 Subject: [PATCH 05/29] Add external build information to README --- qnx8/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/qnx8/README.md b/qnx8/README.md index 3306652..b3f2d76 100644 --- a/qnx8/README.md +++ b/qnx8/README.md @@ -69,6 +69,21 @@ In case of requiring an online QNX license checkout for the QNX SDP `mkifs` util bazel build --action_env=QNXLM_LICENSE_FILE=my@internal.qnx-license-server.com //qnx8/boards/qemu-arm64virt:all ``` +## Building QNX OS images from external module + +Add a reference to this module to your `MODULE.bazel`: + +``` +bazel_dep(name = "os_images", version = "...") +``` + +Build it with the `@os_images//` prefix, the rest is identical like in the section above: + +```bash +bazel build @os_images//qnx8/boards/qemu-... +``` + + ## Running the images ### Pre-requisites From 0b0974168107aa3538dd6e2f6a2414c1a5538c65 Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Wed, 17 Dec 2025 14:04:40 +0100 Subject: [PATCH 06/29] Add 'run' bazel target to run the QEMU images --- qnx8/README.md | 21 ++++++++++++++++--- qnx8/boards/qemu-arm64virt/BUILD | 7 +++++++ .../qemu-arm64virt/run-qemu-arm64virt.sh | 16 +++++++++++--- qnx8/boards/qemu-x86_64/BUILD | 7 +++++++ qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh | 14 +++++++++++-- 5 files changed, 57 insertions(+), 8 deletions(-) diff --git a/qnx8/README.md b/qnx8/README.md index b3f2d76..819cd4f 100644 --- a/qnx8/README.md +++ b/qnx8/README.md @@ -100,12 +100,18 @@ bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-arm64virt/ifs-qemu-arm64virt.bin bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-x86_64/run-qemu.sh bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-x86_64/ifs-qemu-x86_64.bin ``` +#### Run the images with bazel -In order to run the image, change into the directory with the IFS and execute the run script: +QEMU arm64virt image: ``` -cd bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-arm64virt -./run-qemu.sh +bazel run //qnx8/boards/qemu-arm64-virt:run +``` + +QEMU x86_64 image: + +``` +bazel run //qnx8/boards/qemu-x86_64:run ``` You'll get something like: @@ -129,6 +135,15 @@ No root file system has been detected # ``` +#### Run the images manually + +In order to run the image, change into the directory with the IFS and execute the run script: + +``` +cd bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-arm64virt +./run-qemu.sh +``` + ### ssh from host into QEMU image The QNX IFS images start up a `sshd` server. The user `root` has by default no password and `sshd` is configured to accept a root login w/o password. diff --git a/qnx8/boards/qemu-arm64virt/BUILD b/qnx8/boards/qemu-arm64virt/BUILD index 0658ee1..e26ac70 100644 --- a/qnx8/boards/qemu-arm64virt/BUILD +++ b/qnx8/boards/qemu-arm64virt/BUILD @@ -22,3 +22,10 @@ genrule( """, visibility = ["//visibility:public"], ) + +sh_binary( + name = "run", + srcs = ["run-qemu.sh"], + data = [":ifs-qemu-arm64virt"], + args = ["$(location :ifs-qemu-arm64virt)"], +) diff --git a/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh b/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh index 2b933db..813601c 100755 --- a/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh +++ b/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh @@ -1,5 +1,5 @@ #!/bin/bash -# run-qemu-qemu-arm64virt.sh +# run-qemu-qemu-arm64virt.sh [] # ------------------------------------------ # General QEMU settings @@ -7,11 +7,21 @@ QEMU_BIN=qemu-system-aarch64 MEM_SIZE=1G # does not run with less than 1G! CPU_COUNT=2 +# ------------------------------------------ +QNX_IFS=ifs-qemu-arm64virt.bin +if [ "$1" != "" ]; then + QNX_IFS=$1 + # Remove first argument so that additional args can be passed to QEMU + shift +fi + # ------------------------------------------ # Images generated by mkqnximage -SCORE_DISK=disk-score.qcow2 +# Get the directory where the IFS image is located +QNX_IFS_DIR="$(dirname "$QNX_IFS")" + +SCORE_DISK="${QNX_IFS_DIR}/disk-score.qcow2" SCORE_DISK_SIZE=512M -QNX_IFS=ifs-qemu-arm64virt.bin if [ ! -f "$SCORE_DISK" ]; then qemu-img create -f qcow2 "$SCORE_DISK" $SCORE_DISK_SIZE diff --git a/qnx8/boards/qemu-x86_64/BUILD b/qnx8/boards/qemu-x86_64/BUILD index 048814e..4d3afba 100644 --- a/qnx8/boards/qemu-x86_64/BUILD +++ b/qnx8/boards/qemu-x86_64/BUILD @@ -22,3 +22,10 @@ genrule( """, visibility = ["//visibility:public"], ) + +sh_binary( + name = "run", + srcs = ["run-qemu.sh"], + data = [":ifs-qemu-x86_64"], + args = ["$(location :ifs-qemu-x86_64)"], +) diff --git a/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh b/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh index ccfe117..c504410 100755 --- a/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh +++ b/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh @@ -1,5 +1,5 @@ #!/bin/bash -# run-qemu-x86_64.sh +# run-qemu-x86_64.sh [] # ------------------------------------------ # General QEMU settings @@ -7,11 +7,21 @@ QEMU_BIN=qemu-system-x86_64 MEM_SIZE=1G # does not run with less than 1G! CPU_COUNT=2 +# ------------------------------------------ +QNX_IFS=ifs-qemu-x86_64.bin +if [ "$1" != "" ]; then + QNX_IFS=$1 + # Remove first argument so that additional args can be passed to QEMU + shift +fi + # ------------------------------------------ # Images generated by mkqnximage +# Get the directory where the IFS image is located +QNX_IFS_DIR="$(dirname "$QNX_IFS")" + SCORE_DISK=disk-score.qcow2 SCORE_DISK_SIZE=512M -QNX_IFS=ifs-qemu-x86_64.bin if [ ! -f "$SCORE_DISK" ]; then qemu-img create -f qcow2 "$SCORE_DISK" $SCORE_DISK_SIZE From 4d58f3242a1fed17d40b2b81618eebc0925ed248 Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Wed, 17 Dec 2025 16:37:02 +0100 Subject: [PATCH 07/29] Migrate to score_toolchains_qnx 0.0.6 --- .bazelrc | 2 +- MODULE.bazel | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.bazelrc b/.bazelrc index def5062..3b1cdcd 100644 --- a/.bazelrc +++ b/.bazelrc @@ -14,5 +14,5 @@ common --incompatible_strict_action_env # mkifs is not a target platform specific tool, the host would be sufficient. But there is only # target platform specific toolchains defined for QNX in this repo. # Therefore we have to select a target platform and we choose x86_64-qnx. -common --platforms=@score_toolchains_qnx//platforms:x86_64-qnx +common --platforms=@score_bazel_platforms//:x86_64-qnx8_0 common --sandbox_writable_path=/var/tmp diff --git a/MODULE.bazel b/MODULE.bazel index 48fb22c..1cef015 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -17,7 +17,7 @@ module( # ------------------------------------------------------------------------------ # QNX toolchain -bazel_dep(name = "score_toolchains_qnx", version = "0.0.4") +bazel_dep(name = "score_toolchains_qnx", version = "0.0.6") toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx", dev_dependency=True) # TODO: Add here your QNX8 toolchain which meets the requirements listed in qnx8/README.md @@ -51,3 +51,5 @@ bazel_dep(name = "buildifier_prebuilt", version = "7.3.1") # Documentation tools bazel_dep(name = "score_docs_as_code", version = "0.2.4") + +bazel_dep(name = "score_bazel_platforms", version = "0.0.3") \ No newline at end of file From 7478d8c210a14c9285766649bc74657e19e49a7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Gittinger?= <156693757+jgetas@users.noreply.github.com> Date: Thu, 15 Jan 2026 10:55:34 +0100 Subject: [PATCH 08/29] Update qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Jörg Gittinger <156693757+jgetas@users.noreply.github.com> --- qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh b/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh index 813601c..cece8e2 100755 --- a/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh +++ b/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh @@ -1,5 +1,5 @@ #!/bin/bash -# run-qemu-qemu-arm64virt.sh [] +# run-qemu-arm64virt.sh [] # ------------------------------------------ # General QEMU settings From 28d54f8360d6044ab3089e385050373ae85d0cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Gittinger?= <156693757+jgetas@users.noreply.github.com> Date: Thu, 15 Jan 2026 10:55:58 +0100 Subject: [PATCH 09/29] Update qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Jörg Gittinger <156693757+jgetas@users.noreply.github.com> --- qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh b/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh index cece8e2..93a7356 100755 --- a/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh +++ b/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh @@ -54,4 +54,4 @@ $QEMU_BIN -machine virt-4.2 -cpu cortex-a57 -smp $CPU_COUNT -m $MEM_SIZE \ -nographic \ -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0 \ -serial mon:stdio \ - $* + $* From 9c5bc23a15829e350c0d33441beca558124681c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Gittinger?= <156693757+jgetas@users.noreply.github.com> Date: Thu, 15 Jan 2026 10:56:07 +0100 Subject: [PATCH 10/29] Update qnx8/README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Jörg Gittinger <156693757+jgetas@users.noreply.github.com> --- qnx8/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qnx8/README.md b/qnx8/README.md index 819cd4f..d3d7e2b 100644 --- a/qnx8/README.md +++ b/qnx8/README.md @@ -105,7 +105,7 @@ bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-x86_64/ifs-qemu-x86_64.bin QEMU arm64virt image: ``` -bazel run //qnx8/boards/qemu-arm64-virt:run +bazel run //qnx8/boards/qemu-arm64virt:run ``` QEMU x86_64 image: From 44da728a1cdd607ac296aadfd77e2b94fba59f82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Gittinger?= <156693757+jgetas@users.noreply.github.com> Date: Thu, 15 Jan 2026 14:41:15 +0100 Subject: [PATCH 11/29] Update qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Jörg Gittinger <156693757+jgetas@users.noreply.github.com> --- qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh b/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh index c504410..5ea7345 100755 --- a/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh +++ b/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh @@ -20,7 +20,7 @@ fi # Get the directory where the IFS image is located QNX_IFS_DIR="$(dirname "$QNX_IFS")" -SCORE_DISK=disk-score.qcow2 +SCORE_DISK="${QNX_IFS_DIR}/disk-score.qcow2" SCORE_DISK_SIZE=512M if [ ! -f "$SCORE_DISK" ]; then From 882372946157f07184c5fe40044d68cbfb45fbf6 Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Mon, 19 Jan 2026 13:56:24 +0100 Subject: [PATCH 12/29] Add fsevmgr for inotify* support --- qnx8/boards/common/common.build | 3 +++ qnx8/boards/qemu-arm64virt/blk-start.sh | 2 ++ qnx8/boards/qemu-arm64virt/misc-services.sh | 6 ++++++ qnx8/boards/qemu-x86_64/blk-start.sh | 2 ++ qnx8/boards/qemu-x86_64/misc-services.sh | 6 ++++++ 5 files changed, 19 insertions(+) diff --git a/qnx8/boards/common/common.build b/qnx8/boards/common/common.build index e0d3fd0..50b905b 100644 --- a/qnx8/boards/common/common.build +++ b/qnx8/boards/common/common.build @@ -448,6 +448,7 @@ ldqnx-64.so.2=ldqnx-64.so.2 /sbin/chkdosfs=chkdosfs /sbin/chkqnx6fs=chkqnx6fs /sbin/fdisk=fdisk +/sbin/fsevmgr=fsevmgr /usr/bin/pted=pted /bin/vi=vi /usr/bin/hogs=hogs @@ -476,5 +477,7 @@ ldqnx-64.so.2=ldqnx-64.so.2 [uid=0 gid=0 type=dir dperms=0755] /boot [uid=0 gid=0 type=dir dperms=0755] /mnt [uid=0 gid=0 type=dir dperms=0755] /opt +# lola requirement +[type=link] /tmp_discovery=/run/lola_discovery diff --git a/qnx8/boards/qemu-arm64virt/blk-start.sh b/qnx8/boards/qemu-arm64virt/blk-start.sh index c6ed888..022b88f 100644 --- a/qnx8/boards/qemu-arm64virt/blk-start.sh +++ b/qnx8/boards/qemu-arm64virt/blk-start.sh @@ -22,6 +22,8 @@ then # 4096 inodes, 512 bytes per block, no reserved blocks mkqnx6fs -i 4096 -b 512 -r 0 -q /dev/ram0 mount -t qnx6 /dev/ram0 /run + # Create /run/lola_discovery for lola + mkdir /run/lola_discovery else echo "ERROR: No /dev/ram0 detected. /run file system is not available." fi diff --git a/qnx8/boards/qemu-arm64virt/misc-services.sh b/qnx8/boards/qemu-arm64virt/misc-services.sh index 12466c1..8e3482f 100644 --- a/qnx8/boards/qemu-arm64virt/misc-services.sh +++ b/qnx8/boards/qemu-arm64virt/misc-services.sh @@ -7,6 +7,12 @@ if [ -x /usr/sbin/qconn ]; then /usr/sbin/qconn port=8000 fi +if [ -x /sbin/fsevmgr ]; then + echo "---> Starting fsevmgr" + /sbin/fsevmgr + waitfor /dev/fsnotify +fi + if [ -x /usr/sbin/sshd ]; then echo "---> Starting sshd" /usr/sbin/sshd diff --git a/qnx8/boards/qemu-x86_64/blk-start.sh b/qnx8/boards/qemu-x86_64/blk-start.sh index dbfb125..587eef3 100644 --- a/qnx8/boards/qemu-x86_64/blk-start.sh +++ b/qnx8/boards/qemu-x86_64/blk-start.sh @@ -22,6 +22,8 @@ then # 4096 inodes, 512 bytes per block, no reserved blocks mkqnx6fs -i 4096 -b 512 -r 0 -q /dev/ram0 mount -t qnx6 /dev/ram0 /run + # Create /run/lola_discovery for lola + mkdir /run/lola_discovery else echo "ERROR: No /dev/ram0 detected. /run file system is not available." fi diff --git a/qnx8/boards/qemu-x86_64/misc-services.sh b/qnx8/boards/qemu-x86_64/misc-services.sh index 12466c1..8e3482f 100644 --- a/qnx8/boards/qemu-x86_64/misc-services.sh +++ b/qnx8/boards/qemu-x86_64/misc-services.sh @@ -7,6 +7,12 @@ if [ -x /usr/sbin/qconn ]; then /usr/sbin/qconn port=8000 fi +if [ -x /sbin/fsevmgr ]; then + echo "---> Starting fsevmgr" + /sbin/fsevmgr + waitfor /dev/fsnotify +fi + if [ -x /usr/sbin/sshd ]; then echo "---> Starting sshd" /usr/sbin/sshd From ac6ba690f2257b1ac89e394f1839a2974b59d7f7 Mon Sep 17 00:00:00 2001 From: Kai Graeper Date: Tue, 13 Jan 2026 09:21:56 +0100 Subject: [PATCH 13/29] add sdp from artifactory --- MODULE.bazel | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 1cef015..781cccb 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -22,10 +22,12 @@ bazel_dep(name = "score_toolchains_qnx", version = "0.0.6") toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx", dev_dependency=True) # TODO: Add here your QNX8 toolchain which meets the requirements listed in qnx8/README.md toolchains_qnx.sdp( - url = "http://link/to/qnx803.tar.gz", + #url = "http://link/to/qnx803.tar.gz", # or: # url = "file:///path/to/qnx803.tar.gz", - sha256 = "", + #sha256 = "", + url = "https://artifactory.boschdevcloud.com/artifactory/vrte-conan-releases-local/vrte-ci/qnx-sdp8/2025.12.1/tools/39a6e8fc924e6c3cc8eedd34cb02798a/package/3d2268685caec3e0b869469fb726217a3d45aba6/4a0afc64da694d0eb33a804af7429e5d/conan_package.tgz", + sha256 = "03a0afc329e4cbc78a1d0829009fad0de47fb335189b36c81670bfd4ec0e67de", ) use_repo(toolchains_qnx, "toolchains_qnx_sdp", "toolchains_qnx_ifs") From 46a06986781fd03358745cabbbde1e47614ce3de Mon Sep 17 00:00:00 2001 From: Kai Graeper Date: Mon, 19 Jan 2026 15:45:25 +0100 Subject: [PATCH 14/29] fix license-check workflow introduce configs for bazel --- .bazelrc | 10 ++++++---- README.md | 3 +++ project_config.bzl | 2 +- qnx8/README.md | 8 ++++---- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.bazelrc b/.bazelrc index 3b1cdcd..5ac71ab 100644 --- a/.bazelrc +++ b/.bazelrc @@ -10,9 +10,11 @@ common --registry=https://bcr.bazel.build # ------------------------------------------------------------------------------ # QNX toolchain settings - see https://github.com/eclipse-score/toolchains_qnx -common --incompatible_strict_action_env +# Common QNX build settings + # mkifs is not a target platform specific tool, the host would be sufficient. But there is only # target platform specific toolchains defined for QNX in this repo. -# Therefore we have to select a target platform and we choose x86_64-qnx. -common --platforms=@score_bazel_platforms//:x86_64-qnx8_0 -common --sandbox_writable_path=/var/tmp +# Use --config=qnx8_0 for QNX platform builds +common:qnx8_0 --incompatible_strict_action_env +common:qnx8_0 --sandbox_writable_path=/var/tmp +common:qnx8_0 --platforms=@score_bazel_platforms//:x86_64-qnx8_0 diff --git a/README.md b/README.md index d8d84b7..27fdd04 100644 --- a/README.md +++ b/README.md @@ -22,3 +22,6 @@ The basic idea is to have modular OS images for *testing* and *verifying* S-CORE => users can focus on creating the file system with content to match their use cases and *use* the OS image of their choice. +## Usage + +For detailed instructions on pre-requisites, building, running, and configuring QNX images, see [qnx8/README.md](qnx8/README.md). diff --git a/project_config.bzl b/project_config.bzl index 1c18252..6cdad0f 100644 --- a/project_config.bzl +++ b/project_config.bzl @@ -1,5 +1,5 @@ # project_config.bzl PROJECT_CONFIG = { "asil_level": "QM", - "source_code": [], + "source_code": ["python"], } diff --git a/qnx8/README.md b/qnx8/README.md index d3d7e2b..f580296 100644 --- a/qnx8/README.md +++ b/qnx8/README.md @@ -54,19 +54,19 @@ common --sandbox_writable_path=/var/tmp QEMU arm64 image using "virt" VM: ```bash -bazel build //qnx8/boards/qemu-arm64virt:all +bazel build //qnx8/boards/qemu-arm64virt:all --config=qnx8_0 ``` QEMU x86_64 image: ```bash -bazel build //qnx8/boards/qemu-x86_64:all +bazel build //qnx8/boards/qemu-x86_64:all --config=qnx8_0 ``` In case of requiring an online QNX license checkout for the QNX SDP `mkifs` utility you might have to set the QNXLM_LICENSE_FILE environment variable with the link to the license server `--action_env=QNXLM_LICENSE_FILE=...`, for example: ```bash -bazel build --action_env=QNXLM_LICENSE_FILE=my@internal.qnx-license-server.com //qnx8/boards/qemu-arm64virt:all +bazel build --action_env=QNXLM_LICENSE_FILE=my@internal.qnx-license-server.com //qnx8/boards/qemu-arm64virt:all --config=qnx8_0 ``` ## Building QNX OS images from external module @@ -80,7 +80,7 @@ bazel_dep(name = "os_images", version = "...") Build it with the `@os_images//` prefix, the rest is identical like in the section above: ```bash -bazel build @os_images//qnx8/boards/qemu-... +bazel build @os_images//qnx8/boards/qemu-... --config=qnx8_0 ``` From 94888a480ac7874750a1a49991069dc2d3c3bffa Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Tue, 27 Jan 2026 08:28:05 +0100 Subject: [PATCH 15/29] Add fixed bazel version --- .bazelversion | 1 + 1 file changed, 1 insertion(+) create mode 100644 .bazelversion diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 0000000..905c243 --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +8.3.1 \ No newline at end of file From ffa37244c7aeb8952f01c407dd9c3d0175469241 Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Wed, 28 Jan 2026 09:29:42 +0100 Subject: [PATCH 16/29] Fix inotify: launch fsevmgr before block device driver --- qnx8/boards/qemu-arm64virt/blk-start.sh | 9 +++++++++ qnx8/boards/qemu-arm64virt/misc-services.sh | 6 ------ qnx8/boards/qemu-x86_64/blk-start.sh | 9 +++++++++ qnx8/boards/qemu-x86_64/misc-services.sh | 6 ------ 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/qnx8/boards/qemu-arm64virt/blk-start.sh b/qnx8/boards/qemu-arm64virt/blk-start.sh index 022b88f..f4c5ce7 100644 --- a/qnx8/boards/qemu-arm64virt/blk-start.sh +++ b/qnx8/boards/qemu-arm64virt/blk-start.sh @@ -1,5 +1,14 @@ #!/bin/sh +# Start file system event manager. +# Required for applications utilizing inotify_...() APIs. +# Must start before any block device driver. +if [ -x /sbin/fsevmgr ]; then + echo "---> Starting fsevmgr" + /sbin/fsevmgr + waitfor /dev/fsnotify +fi + # Start virtio block device driver BLK_DEVICE_RAW=hd0 diff --git a/qnx8/boards/qemu-arm64virt/misc-services.sh b/qnx8/boards/qemu-arm64virt/misc-services.sh index 8e3482f..12466c1 100644 --- a/qnx8/boards/qemu-arm64virt/misc-services.sh +++ b/qnx8/boards/qemu-arm64virt/misc-services.sh @@ -7,12 +7,6 @@ if [ -x /usr/sbin/qconn ]; then /usr/sbin/qconn port=8000 fi -if [ -x /sbin/fsevmgr ]; then - echo "---> Starting fsevmgr" - /sbin/fsevmgr - waitfor /dev/fsnotify -fi - if [ -x /usr/sbin/sshd ]; then echo "---> Starting sshd" /usr/sbin/sshd diff --git a/qnx8/boards/qemu-x86_64/blk-start.sh b/qnx8/boards/qemu-x86_64/blk-start.sh index 587eef3..0ec920f 100644 --- a/qnx8/boards/qemu-x86_64/blk-start.sh +++ b/qnx8/boards/qemu-x86_64/blk-start.sh @@ -1,5 +1,14 @@ #!/bin/sh +# Start file system event manager. +# Required for applications utilizing inotify_...() APIs. +# Must start before any block device driver. +if [ -x /sbin/fsevmgr ]; then + echo "---> Starting fsevmgr" + /sbin/fsevmgr + waitfor /dev/fsnotify +fi + # Start virtio block device driver BLK_DEVICE_RAW=hd0 diff --git a/qnx8/boards/qemu-x86_64/misc-services.sh b/qnx8/boards/qemu-x86_64/misc-services.sh index 8e3482f..12466c1 100644 --- a/qnx8/boards/qemu-x86_64/misc-services.sh +++ b/qnx8/boards/qemu-x86_64/misc-services.sh @@ -7,12 +7,6 @@ if [ -x /usr/sbin/qconn ]; then /usr/sbin/qconn port=8000 fi -if [ -x /sbin/fsevmgr ]; then - echo "---> Starting fsevmgr" - /sbin/fsevmgr - waitfor /dev/fsnotify -fi - if [ -x /usr/sbin/sshd ]; then echo "---> Starting sshd" /usr/sbin/sshd From 3342899d01f5962d44ff3927d2a5ab4a4ebabff6 Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Tue, 17 Feb 2026 17:01:47 +0100 Subject: [PATCH 17/29] QNX8 qemu: change virtual disk mount point to /opt/score --- qnx8/README.md | 4 ++-- qnx8/boards/qemu-arm64virt/mount-fs.sh | 5 +++-- qnx8/boards/qemu-arm64virt/net-start.sh | 4 ++-- qnx8/boards/qemu-x86_64/mount-fs.sh | 5 +++-- qnx8/boards/qemu-x86_64/net-start.sh | 4 ++-- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/qnx8/README.md b/qnx8/README.md index f580296..f0f2552 100644 --- a/qnx8/README.md +++ b/qnx8/README.md @@ -182,7 +182,7 @@ After reboot you'll see in the startup messages that a partition is found and mo ``` [...] ---> Mounting file systems -Mounting root overlay filesystem /dev/hd0.qnx6.0 +Mounting filesystem /dev/hd0.qnx6.0 to /opt/score [...] ``` @@ -194,7 +194,7 @@ TODO: integrate `mkqnx6fsimg` into `toolchains_qnx`. ### Configuring custom IP address + host name -During the startup of the VM the network is being set up, *after* mounting the virtual file system. By default host name `qemu-arm64virt` or `qemu-x86_64` and IP address 192.168.120.20/24 is set up. **Before** setting these, the `net-start.sh` script tries to read a file `/boot/etc/settings/network`. By installing such a file on the virtual file system and adding variables one can configure hostname and IP address of the network interface: +During the startup of the VM the network is being set up, *after* mounting the virtual file system. By default host name `qemu-arm64virt` or `qemu-x86_64` and IP address 192.168.120.20/24 is set up. **Before** setting these, the `net-start.sh` script tries to read a file `/opt/score/etc/settings/network`. By installing such a file on the virtual file system and adding variables one can configure hostname and IP address of the network interface: ``` # /boot/etc/settings/network diff --git a/qnx8/boards/qemu-arm64virt/mount-fs.sh b/qnx8/boards/qemu-arm64virt/mount-fs.sh index 732e505..0521a27 100644 --- a/qnx8/boards/qemu-arm64virt/mount-fs.sh +++ b/qnx8/boards/qemu-arm64virt/mount-fs.sh @@ -4,6 +4,7 @@ echo "---> Mounting file systems" # Mount probe list: hd0... is MBR, hd0.qnx6.x is GPT MOUNT_PROBE_LIST="hd0t177 hd0.qnx6.0 hd0.qnx6.1" +MOUNT_POINT=/opt/score if [ -f /boot/etc/settings/mount ]; then . /boot/etc/settings/mount @@ -19,8 +20,8 @@ do done if [ -n "$BLK_DEVICE" ] then - echo "Mounting root overlay filesystem /dev/$BLK_DEVICE" - mount $MOUNTOPTIONS -t qnx6 /dev/$BLK_DEVICE / + echo "Mounting filesystem /dev/$BLK_DEVICE to $MOUNT_POINT" + mount $MOUNTOPTIONS -t qnx6 /dev/$BLK_DEVICE $MOUNT_POINT else echo "No root file system has been detected" fi diff --git a/qnx8/boards/qemu-arm64virt/net-start.sh b/qnx8/boards/qemu-arm64virt/net-start.sh index 0de541c..b5a4f6c 100644 --- a/qnx8/boards/qemu-arm64virt/net-start.sh +++ b/qnx8/boards/qemu-arm64virt/net-start.sh @@ -4,8 +4,8 @@ DEVICE_NAME_PREFIX=vtnet IP_ADDRESS_vtnet0="192.168.120.20/24" HOSTNAME=qemu-arm64virt -if [ -f /boot/etc/settings/network ]; then - . /boot/etc/settings/network +if [ -f /opt/score/etc/settings/network ]; then + . /opt/score/etc/settings/network fi # Set hostname diff --git a/qnx8/boards/qemu-x86_64/mount-fs.sh b/qnx8/boards/qemu-x86_64/mount-fs.sh index 732e505..0521a27 100644 --- a/qnx8/boards/qemu-x86_64/mount-fs.sh +++ b/qnx8/boards/qemu-x86_64/mount-fs.sh @@ -4,6 +4,7 @@ echo "---> Mounting file systems" # Mount probe list: hd0... is MBR, hd0.qnx6.x is GPT MOUNT_PROBE_LIST="hd0t177 hd0.qnx6.0 hd0.qnx6.1" +MOUNT_POINT=/opt/score if [ -f /boot/etc/settings/mount ]; then . /boot/etc/settings/mount @@ -19,8 +20,8 @@ do done if [ -n "$BLK_DEVICE" ] then - echo "Mounting root overlay filesystem /dev/$BLK_DEVICE" - mount $MOUNTOPTIONS -t qnx6 /dev/$BLK_DEVICE / + echo "Mounting filesystem /dev/$BLK_DEVICE to $MOUNT_POINT" + mount $MOUNTOPTIONS -t qnx6 /dev/$BLK_DEVICE $MOUNT_POINT else echo "No root file system has been detected" fi diff --git a/qnx8/boards/qemu-x86_64/net-start.sh b/qnx8/boards/qemu-x86_64/net-start.sh index 334c593..98f7110 100644 --- a/qnx8/boards/qemu-x86_64/net-start.sh +++ b/qnx8/boards/qemu-x86_64/net-start.sh @@ -4,8 +4,8 @@ DEVICE_NAME_PREFIX=vtnet IP_ADDRESS_vtnet0="192.168.120.20/24" HOSTNAME=x86_64qemu -if [ -f /boot/etc/settings/network ]; then - . /boot/etc/settings/network +if [ -f /opt/score/etc/settings/network ]; then + . /opt/score/etc/settings/network fi # Set hostname From b4ef597ca2c273a2ad93661a04b809cfeeefb801 Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Mon, 2 Mar 2026 14:33:03 +0100 Subject: [PATCH 18/29] Add visibility attribute to qnx_ifs for qemu ARM64 and x86_64 builds --- qnx8/boards/qemu-arm64virt/BUILD | 1 + qnx8/boards/qemu-x86_64/BUILD | 1 + 2 files changed, 2 insertions(+) diff --git a/qnx8/boards/qemu-arm64virt/BUILD b/qnx8/boards/qemu-arm64virt/BUILD index e26ac70..4320e1a 100644 --- a/qnx8/boards/qemu-arm64virt/BUILD +++ b/qnx8/boards/qemu-arm64virt/BUILD @@ -7,6 +7,7 @@ qnx_ifs ( "initscript", "//qnx8/boards/common:common_files"] + glob(["*.sh"], exclude=["run-*.sh"]), extension = "bin", + visibility = ["//visibility:public"], ) genrule( diff --git a/qnx8/boards/qemu-x86_64/BUILD b/qnx8/boards/qemu-x86_64/BUILD index 4d3afba..af7becb 100644 --- a/qnx8/boards/qemu-x86_64/BUILD +++ b/qnx8/boards/qemu-x86_64/BUILD @@ -7,6 +7,7 @@ qnx_ifs ( "initscript", "//qnx8/boards/common:common_files"] + glob(["*.sh"], exclude=["run-*.sh"]), extension = "bin", + visibility = ["//visibility:public"], ) genrule( From 0e686c7c668fdb171530a346decaaac374a0d485 Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Fri, 20 Mar 2026 08:24:59 +0100 Subject: [PATCH 19/29] qnx8 qemu: migrate to rules_imagefs --- .bazelrc | 7 +++- MODULE.bazel | 47 +++++++++++++++------- qnx8/boards/qemu-arm64virt/BUILD | 4 +- qnx8/boards/qemu-x86_64/BUILD | 2 +- sdp.BUILD | 68 ++++++++++++++++++++++++++++++++ 5 files changed, 109 insertions(+), 19 deletions(-) create mode 100644 sdp.BUILD diff --git a/.bazelrc b/.bazelrc index 5ac71ab..a32dc0b 100644 --- a/.bazelrc +++ b/.bazelrc @@ -7,6 +7,8 @@ test --test_output=errors common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/ common --registry=https://bcr.bazel.build +common --host_platform=@score_bazel_platforms//:x86_64-linux +common --config=qnx8_0 # ------------------------------------------------------------------------------ # QNX toolchain settings - see https://github.com/eclipse-score/toolchains_qnx @@ -17,4 +19,7 @@ common --registry=https://bcr.bazel.build # Use --config=qnx8_0 for QNX platform builds common:qnx8_0 --incompatible_strict_action_env common:qnx8_0 --sandbox_writable_path=/var/tmp -common:qnx8_0 --platforms=@score_bazel_platforms//:x86_64-qnx8_0 +common:qnx8_0 --platforms=@score_bazel_platforms//:aarch64-qnx-sdp_8.0.0-posix + +build:qnx8_0 --extra_toolchains=@score_qnx_ifs_toolchain//:ifs-aarch64-qnx-sdp_8.0.0 + diff --git a/MODULE.bazel b/MODULE.bazel index 781cccb..b0a4e92 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -16,25 +16,42 @@ module( ) # ------------------------------------------------------------------------------ -# QNX toolchain -bazel_dep(name = "score_toolchains_qnx", version = "0.0.6") - -toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx", dev_dependency=True) -# TODO: Add here your QNX8 toolchain which meets the requirements listed in qnx8/README.md -toolchains_qnx.sdp( - #url = "http://link/to/qnx803.tar.gz", - # or: - # url = "file:///path/to/qnx803.tar.gz", - #sha256 = "", +# QNX toolchains + +bazel_dep(name = "score_rules_imagefs", version = "0.0.1") +git_override( + module_name = "score_rules_imagefs", + remote = "https://github.com/eclipse-score/rules_imagefs.git", + commit = "38d5a1a5e5d83faa5d00e4d2f31c303db0d0f7de", +) + +imagefs = use_extension("@score_rules_imagefs//extensions:imagefs.bzl", "imagefs", dev_dependency = True) +imagefs.sdp( + name = "score_qnx_imagefs_toolchain_pkg", url = "https://artifactory.boschdevcloud.com/artifactory/vrte-conan-releases-local/vrte-ci/qnx-sdp8/2025.12.1/tools/39a6e8fc924e6c3cc8eedd34cb02798a/package/3d2268685caec3e0b869469fb726217a3d45aba6/4a0afc64da694d0eb33a804af7429e5d/conan_package.tgz", sha256 = "03a0afc329e4cbc78a1d0829009fad0de47fb335189b36c81670bfd4ec0e67de", + build_file = "//:sdp.BUILD", ) -use_repo(toolchains_qnx, "toolchains_qnx_sdp", "toolchains_qnx_ifs") +imagefs.toolchain( + name = "score_qnx_ifs_toolchain", + sdp_to_import = "@score_qnx_imagefs_toolchain_pkg", + sdp_version = "8.0.0", + target_cpu = "aarch64", + target_os = "qnx", + type = "ifs", + ) + +use_repo( + imagefs, + "score_qnx_imagefs_toolchain_pkg", + "score_qnx_ifs_toolchain", +) + +register_toolchains( + "@score_qnx_ifs_toolchain//:ifs-aarch64-qnx-sdp_8.0.0", +) -register_toolchains("@toolchains_qnx_ifs//:ifs_x86_64", dev_dependency=True) -# mkifs is independent of target platform, so we just need _one_ toolchain. -#register_toolchains("@toolchains_qnx_ifs//:ifs_aarch64") # ------------------------------------------------------------------------------ @@ -54,4 +71,4 @@ bazel_dep(name = "buildifier_prebuilt", version = "7.3.1") # Documentation tools bazel_dep(name = "score_docs_as_code", version = "0.2.4") -bazel_dep(name = "score_bazel_platforms", version = "0.0.3") \ No newline at end of file +bazel_dep(name = "score_bazel_platforms", version = "0.0.3") diff --git a/qnx8/boards/qemu-arm64virt/BUILD b/qnx8/boards/qemu-arm64virt/BUILD index 4320e1a..d77920a 100644 --- a/qnx8/boards/qemu-arm64virt/BUILD +++ b/qnx8/boards/qemu-arm64virt/BUILD @@ -1,9 +1,9 @@ -load("@score_toolchains_qnx//rules/fs:ifs.bzl", "qnx_ifs") +load("@score_rules_imagefs//rules/qnx:ifs.bzl", "qnx_ifs") qnx_ifs ( name = "ifs-qemu-arm64virt", build_file = "qemu-arm64virt.build", - srcs = ["target.build", + srcs = ["target.build", "initscript", "//qnx8/boards/common:common_files"] + glob(["*.sh"], exclude=["run-*.sh"]), extension = "bin", diff --git a/qnx8/boards/qemu-x86_64/BUILD b/qnx8/boards/qemu-x86_64/BUILD index af7becb..8cb6aa6 100644 --- a/qnx8/boards/qemu-x86_64/BUILD +++ b/qnx8/boards/qemu-x86_64/BUILD @@ -1,4 +1,4 @@ -load("@score_toolchains_qnx//rules/fs:ifs.bzl", "qnx_ifs") +load("@score_rules_imagefs//rules/qnx:ifs.bzl", "qnx_ifs") qnx_ifs ( name = "ifs-qemu-x86_64", diff --git a/sdp.BUILD b/sdp.BUILD new file mode 100644 index 0000000..d5cd5be --- /dev/null +++ b/sdp.BUILD @@ -0,0 +1,68 @@ +# ******************************************************************************* +# Copyright (c) 2026 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +"""Default BUILD file for QNX SDP archives. + +This file is shipped with score_rules_imagefs so that consumers do not need +to provide their own BUILD file for the standard QNX SDP directory layout. +It can be overridden by passing a custom `build_file` to the `imagefs.sdp` tag. +""" + +package(default_visibility = [ + "//visibility:public", +]) + +filegroup( + name = "all_files", + srcs = glob(["*/**/*"]), +) + +filegroup( + name = "target_dir", + srcs = ["target/qnx"], +) + +filegroup( + name = "host_dir", + srcs = ["host/linux/x86_64"], +) + +filegroup( + name = "target_all", + srcs = glob(["target/**/*"]), +) + +filegroup( + name = "host_all", + srcs = glob(["host/**/*"]), +) + +filegroup( + name = "mkifs", + srcs = ["host/linux/x86_64/usr/bin/mkifs"], +) + +filegroup( + name = "mkfatfs", + srcs = ["host/linux/x86_64/usr/bin/mkfatfsimg"], +) + +filegroup( + name = "mkqnx6fs", + srcs = ["host/linux/x86_64/usr/bin/mkqnx6fsimg"], +) + +filegroup( + name = "mkdiskimage", + srcs = ["host/linux/x86_64/usr/bin/diskimage"], +) From 10a40bce6f85321465013415490bf46d42512156 Mon Sep 17 00:00:00 2001 From: sea1mi Date: Tue, 24 Mar 2026 09:30:16 +0100 Subject: [PATCH 20/29] Add dev_dependency true for register_toolchains --- MODULE.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/MODULE.bazel b/MODULE.bazel index b0a4e92..f4ad040 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -50,6 +50,7 @@ use_repo( register_toolchains( "@score_qnx_ifs_toolchain//:ifs-aarch64-qnx-sdp_8.0.0", + dev_dependency = True, ) From 83aaac0ac053c5b3cd7795b1bdde7077179e29f7 Mon Sep 17 00:00:00 2001 From: sea1mi Date: Tue, 24 Mar 2026 09:56:10 +0100 Subject: [PATCH 21/29] Increase timeout value --- qnx8/boards/qemu-arm64virt/blk-start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qnx8/boards/qemu-arm64virt/blk-start.sh b/qnx8/boards/qemu-arm64virt/blk-start.sh index f4c5ce7..37486d1 100644 --- a/qnx8/boards/qemu-arm64virt/blk-start.sh +++ b/qnx8/boards/qemu-arm64virt/blk-start.sh @@ -16,7 +16,7 @@ echo "---> Starting block driver" # virtio-blk values from QEMU virt fdt... devb-virtio cam user=20:20 blk cache=64M,auto=partition,vnode=2000,ncache=2000,commit=low virtio smem=0xa003e00,irq=79 blk ramdisk=20m -waitfor /dev/$BLK_DEVICE_RAW 3 +waitfor /dev/$BLK_DEVICE_RAW 30 #Increase timeout value for arm64 as block device initialization takes longer time if [ ! -e /dev/$BLK_DEVICE_RAW ] then echo "ERROR: No block device detected" From 6238b05a59f05a4682a7a1c5d9fb0f7932249730 Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Thu, 26 Mar 2026 09:48:20 +0100 Subject: [PATCH 22/29] qnx8: use current QNX provided SDP --- .bazelrc | 3 +- MODULE.bazel | 4 +- qnx8/README.md | 45 ++++++++++--------- tools/qnx_credential_helper.py | 81 ++++++++++++++++++++++++++++++++++ 4 files changed, 109 insertions(+), 24 deletions(-) create mode 100755 tools/qnx_credential_helper.py diff --git a/.bazelrc b/.bazelrc index a32dc0b..92276e3 100644 --- a/.bazelrc +++ b/.bazelrc @@ -11,7 +11,7 @@ common --host_platform=@score_bazel_platforms//:x86_64-linux common --config=qnx8_0 # ------------------------------------------------------------------------------ -# QNX toolchain settings - see https://github.com/eclipse-score/toolchains_qnx +# QNX toolchain settings # Common QNX build settings # mkifs is not a target platform specific tool, the host would be sufficient. But there is only @@ -20,6 +20,7 @@ common --config=qnx8_0 common:qnx8_0 --incompatible_strict_action_env common:qnx8_0 --sandbox_writable_path=/var/tmp common:qnx8_0 --platforms=@score_bazel_platforms//:aarch64-qnx-sdp_8.0.0-posix +common:qnx8_0 --credential_helper=*.qnx.com=%workspace%/tools/qnx_credential_helper.py build:qnx8_0 --extra_toolchains=@score_qnx_ifs_toolchain//:ifs-aarch64-qnx-sdp_8.0.0 diff --git a/MODULE.bazel b/MODULE.bazel index f4ad040..8e0c03e 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -28,8 +28,8 @@ git_override( imagefs = use_extension("@score_rules_imagefs//extensions:imagefs.bzl", "imagefs", dev_dependency = True) imagefs.sdp( name = "score_qnx_imagefs_toolchain_pkg", - url = "https://artifactory.boschdevcloud.com/artifactory/vrte-conan-releases-local/vrte-ci/qnx-sdp8/2025.12.1/tools/39a6e8fc924e6c3cc8eedd34cb02798a/package/3d2268685caec3e0b869469fb726217a3d45aba6/4a0afc64da694d0eb33a804af7429e5d/conan_package.tgz", - sha256 = "03a0afc329e4cbc78a1d0829009fad0de47fb335189b36c81670bfd4ec0e67de", + url = "https://www.qnx.com/download/download/87174/installation_qnx_803_260305.tar.xz", + sha256 = "9039fd6a4a639f06ea977afb93963a6fe8f8c46db727066709370d999c7232e0", build_file = "//:sdp.BUILD", ) diff --git a/qnx8/README.md b/qnx8/README.md index f0f2552..1dc27e7 100644 --- a/qnx8/README.md +++ b/qnx8/README.md @@ -9,44 +9,47 @@ Following QNX 8 OS images can be created: ### QNX SDP -Building the images requires a QNX SDP 8.0.3 (or later) available during build with following additional QNX SDP packages integrated: +#### Using the S-CORE QNX SDP package + +The default QNX SDP package is set up in the top-level `MODULE.bazel` of this repo. It downloads the package +from `qnx.com`. For being able to do this you need to use your MyQNX account credentials set up in your in +environment variables `SCORE_QNX_USER` and `SCORE_QNX_PASSWORD`. This can be accomplished in your `~/.bazelrc`: + +``` +build --action_env=SCORE_QNX_USER=<...> +build --action_env=SCORE_QNX_PASSWORD=<...> +``` + +#### Using a custom QNX SDP package + +Building the QNX8 OS images requires a QNX SDP 8.0.3 (or later) available during build with following additional QNX SDP packages integrated: * QNX® SDP 8.0 Networking - io-sock Virtio Drivers * QNX® SDP 8.0 Virtualization Drivers (Block) -* QNX® SDP 8.0 Virtualization Drivers (Startup) +* QNX® SDP 8.0 QEMU Virtualization Drivers (Startup) Add the URL of the QNX SDP tarball to the `MODULE.bazel`: ``` [...] -toolchains_qnx = use_extension("@score_toolchains_qnx//:extensions.bzl", "toolchains_qnx", dev_dependency=True) -toolchains_qnx.sdp( - url = "http://link/to/qnx803.tar.gz", - # or: - # url = "file:///path/to/qnx803.tar.gz", - sha256 = "", +imagefs = use_extension("@score_rules_imagefs//extensions:imagefs.bzl", "imagefs", dev_dependency = True) +imagefs.sdp( + name = "score_qnx_imagefs_toolchain_pkg", + url = "http://link/to/your/qnx80x.tar.xz", + sha256 = "", + build_file = "//:sdp.BUILD", ) [...] ``` -### bazelrc - -A `.bazelrc` should include general eclipse-score registry and toolchain requirements given by -https://github.com/eclipse-score/toolchains_qnx/blob/main/README.md . +In case your QNX license requires to check out a license from a license server, you may want to add the +information to your local `~/.bazelrc`: ``` -common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/ -common --registry=https://bcr.bazel.build - -common --incompatible_strict_action_env -# mkifs is not a target platform specific tool, the host would be sufficient. But there is only -# target platform specific toolchains defined for QNX in this repo. -# Therefore we have to select a target platform and we choose x86_64-qnx. -common --platforms=@score_toolchains_qnx//platforms:x86_64-qnx -common --sandbox_writable_path=/var/tmp +build --action_env=QNXLM_LICENSE_FILE=<...> ``` ## Building QNX OS images diff --git a/tools/qnx_credential_helper.py b/tools/qnx_credential_helper.py new file mode 100755 index 0000000..06ae795 --- /dev/null +++ b/tools/qnx_credential_helper.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 + +# ******************************************************************************* +# Copyright (c) 2025 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0 +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************* + +import http.cookiejar +import json +import netrc +import os +import sys +import urllib.parse +import urllib.request + + +def eprint(*args, **kwargs): + print(*args, file=sys.stderr, **kwargs) + + +if __name__ == "__main__": + data = json.load(sys.stdin) + + if "qnx.com" not in data["uri"]: + eprint("Unsupported domain") + sys.exit(1) + + if "SCORE_QNX_USER" in os.environ and "SCORE_QNX_PASSWORD" in os.environ: + login = os.environ["SCORE_QNX_USER"] + password = os.environ["SCORE_QNX_PASSWORD"] + else: + try: + nrc = netrc.netrc() + auth = nrc.authenticators("qnx.com") + if auth: + login, _, password = auth + else: + raise Exception("No credential found for QNX") + except Exception as excp: + eprint(excp) + eprint("Failed getting credentials from .netrc") + sys.exit(1) + + data = urllib.parse.urlencode( + {"userlogin": login, "password": password, "UseCookie": "1"} + ) + data = data.encode("ascii") + + cookie_jar = http.cookiejar.CookieJar() + cookie_processor = urllib.request.HTTPCookieProcessor(cookie_jar) + opener = urllib.request.build_opener(cookie_processor) + urllib.request.install_opener(opener) + + r = urllib.request.urlopen("https://www.qnx.com/account/login.html", data) + if r.status != 200: + eprint("Failed to login to QNX") + sys.exit(1) + + cookies = {c.name: c.value for c in list(cookie_jar)} + if not "myQNX" in cookies: + eprint("Failed to get myQNX cookie from login page") + sys.exit(1) + + myQNX = cookies["myQNX"] + print( + json.dumps( + { + "headers": { + "Cookie": [f"myQNX={myQNX}"], + } + } + ) + ) From 23adc4ea72ae6a7247517e86d86f748b728afd0d Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Thu, 26 Mar 2026 15:38:17 +0100 Subject: [PATCH 23/29] reinstalling project_config to fix license check --- project_config.bzl | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 project_config.bzl diff --git a/project_config.bzl b/project_config.bzl new file mode 100644 index 0000000..e9aac98 --- /dev/null +++ b/project_config.bzl @@ -0,0 +1,5 @@ +# project_config.bzl +PROJECT_CONFIG = { + "asil_level": "QM", + "source_code": ["python"], +} \ No newline at end of file From 6d7448d9a3aed959da2cc1bf68b1269e15ca2a49 Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Thu, 26 Mar 2026 16:19:47 +0100 Subject: [PATCH 24/29] fix review findings --- .bazelrc | 1 - qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh | 2 +- qnx8/boards/qemu-x86_64/BUILD | 8 +++++--- qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh | 2 +- tools/qnx_credential_helper.py | 3 ++- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.bazelrc b/.bazelrc index 92276e3..c9cd30e 100644 --- a/.bazelrc +++ b/.bazelrc @@ -8,7 +8,6 @@ test --test_output=errors common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/ common --registry=https://bcr.bazel.build common --host_platform=@score_bazel_platforms//:x86_64-linux -common --config=qnx8_0 # ------------------------------------------------------------------------------ # QNX toolchain settings diff --git a/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh b/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh index 93a7356..8bbb592 100755 --- a/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh +++ b/qnx8/boards/qemu-arm64virt/run-qemu-arm64virt.sh @@ -54,4 +54,4 @@ $QEMU_BIN -machine virt-4.2 -cpu cortex-a57 -smp $CPU_COUNT -m $MEM_SIZE \ -nographic \ -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0 \ -serial mon:stdio \ - $* + "$@" diff --git a/qnx8/boards/qemu-x86_64/BUILD b/qnx8/boards/qemu-x86_64/BUILD index 8cb6aa6..3df49c4 100644 --- a/qnx8/boards/qemu-x86_64/BUILD +++ b/qnx8/boards/qemu-x86_64/BUILD @@ -1,11 +1,13 @@ load("@score_rules_imagefs//rules/qnx:ifs.bzl", "qnx_ifs") -qnx_ifs ( +qnx_ifs( name = "ifs-qemu-x86_64", build_file = "qemu-x86_64.build", - srcs = ["target.build", + srcs = [ + "target.build", "initscript", - "//qnx8/boards/common:common_files"] + glob(["*.sh"], exclude=["run-*.sh"]), + "//qnx8/boards/common:common_files", + ] + glob(["*.sh"], exclude = ["run-*.sh"]), extension = "bin", visibility = ["//visibility:public"], ) diff --git a/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh b/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh index 5ea7345..01aea4b 100755 --- a/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh +++ b/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh @@ -54,4 +54,4 @@ $QEMU_BIN -cpu host -accel kvm -smp $CPU_COUNT -m $MEM_SIZE \ -nographic \ -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 \ -serial mon:stdio \ - $* + "$@" diff --git a/tools/qnx_credential_helper.py b/tools/qnx_credential_helper.py index 06ae795..fb4a012 100755 --- a/tools/qnx_credential_helper.py +++ b/tools/qnx_credential_helper.py @@ -29,7 +29,8 @@ def eprint(*args, **kwargs): if __name__ == "__main__": data = json.load(sys.stdin) - if "qnx.com" not in data["uri"]: + hostname = urllib.parse.urlparse(data["uri"]).hostname or "" + if hostname != "qnx.com" and not hostname.endswith(".qnx.com"): eprint("Unsupported domain") sys.exit(1) From d43dfb1465e45fe0c48c1014f0a0d866adbbc1cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Gittinger?= <156693757+jgetas@users.noreply.github.com> Date: Thu, 26 Mar 2026 16:22:46 +0100 Subject: [PATCH 25/29] Update qnx8/README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Jörg Gittinger <156693757+jgetas@users.noreply.github.com> --- qnx8/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qnx8/README.md b/qnx8/README.md index 1dc27e7..b81836d 100644 --- a/qnx8/README.md +++ b/qnx8/README.md @@ -200,7 +200,7 @@ TODO: integrate `mkqnx6fsimg` into `toolchains_qnx`. During the startup of the VM the network is being set up, *after* mounting the virtual file system. By default host name `qemu-arm64virt` or `qemu-x86_64` and IP address 192.168.120.20/24 is set up. **Before** setting these, the `net-start.sh` script tries to read a file `/opt/score/etc/settings/network`. By installing such a file on the virtual file system and adding variables one can configure hostname and IP address of the network interface: ``` -# /boot/etc/settings/network +# /opt/score/etc/settings/network IP_ADDRESS_vtnet0="192.168.100.1/24" HOSTNAME=myqemu ``` From 7e77555b66a58e37527688e275c0a159bf197e0a Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Fri, 27 Mar 2026 11:50:56 +0100 Subject: [PATCH 26/29] add EOL at EOF, remove superfluous register_toolchain() --- LICENSE.md | 2 +- MODULE.bazel | 7 ------- project_config.bzl | 2 +- qnx8/boards/common/BUILD | 2 +- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index ed8d20a..8c69a8b 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -10,4 +10,4 @@ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and -limitations under the License. \ No newline at end of file +limitations under the License. diff --git a/MODULE.bazel b/MODULE.bazel index 4aa9608..1999fae 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -48,13 +48,6 @@ use_repo( "score_qnx_ifs_toolchain", ) -register_toolchains( - "@score_qnx_ifs_toolchain//:ifs-aarch64-qnx-sdp_8.0.0", - dev_dependency = True, -) - - - # ------------------------------------------------------------------------------ # General purpose Bazel extensions diff --git a/project_config.bzl b/project_config.bzl index e9aac98..6cdad0f 100644 --- a/project_config.bzl +++ b/project_config.bzl @@ -2,4 +2,4 @@ PROJECT_CONFIG = { "asil_level": "QM", "source_code": ["python"], -} \ No newline at end of file +} diff --git a/qnx8/boards/common/BUILD b/qnx8/boards/common/BUILD index f5b5629..92b9164 100644 --- a/qnx8/boards/common/BUILD +++ b/qnx8/boards/common/BUILD @@ -13,4 +13,4 @@ filegroup( "//qnx8/boards/qemu-arm64virt:__pkg__", "//qnx8/boards/qemu-x86_64:__pkg__", ], -) \ No newline at end of file +) From 8e81222c3cd09f537f44fd405aefefa971ec61c7 Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Fri, 27 Mar 2026 14:07:39 +0100 Subject: [PATCH 27/29] Improved README --- README.md | 4 ++-- qnx8/README.md | 64 ++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 56 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8edce15..709725e 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ This module creates OS images intended for testing S-CORE software: * bootable [QNX IFS images using the QNX 8 SDP](qnx8/README.md). * bootable Linux image: TODO -**Why do we need OS images?** +**Motivation** -The basic idea is to have modular OS images for *testing* and *verifying* S-CORE binaries. Main purposes: +The basic idea is to have generic OS images for *testing* and *verifying* S-CORE binaries. Main purposes: * re-usable for multiple use cases: unit-, component-, binary- and system tests and demonstrations * stuffed with common OS utilities: shell-, file-, test utilities diff --git a/qnx8/README.md b/qnx8/README.md index b81836d..daa15d7 100644 --- a/qnx8/README.md +++ b/qnx8/README.md @@ -1,10 +1,29 @@ # OS images for QNX 8 +``` ++-------------------+ +- - - - - - - - - - - - - -+ +| QNX IFS | | Custom qnx6fs filesystem | +| | | (not part of OS image) | +| (base OS files) | | (user files) | ++-------------------+ +- - - - - - - - - - - - - -+ +``` + +The QNX OS images generated by this repo are intended to be generic images which serve +as a base for custom use-cases like testing. They implement the basic OS services like +block device, network device, system logging, ... support and provide standard QNX +system libraries. + +The QNX IFS image is by nature of QNX boot image file system _read-only_. In order +to use it in a custom use case it should be paired with a custom qnx6fs file system which +can either be populated as OS run-time or before-hand by creating a qnx6fs image offline. +See section _Using QNX OS images for custom use-case_ below. + Following QNX 8 OS images can be created: * QEMU aarch64 "virt" image using virtio block and network drivers. * QEMU x86_64 image using virtio block and network drivers. + ## Pre-requisites ### QNX SDP @@ -86,7 +105,6 @@ Build it with the `@os_images//` prefix, the rest is identical like in the secti bazel build @os_images//qnx8/boards/qemu-... --config=qnx8_0 ``` - ## Running the images ### Pre-requisites @@ -147,15 +165,29 @@ cd bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-arm64virt ./run-qemu.sh ``` -### ssh from host into QEMU image +## Using QNX OS images for custom use-case -The QNX IFS images start up a `sshd` server. The user `root` has by default no password and `sshd` is configured to accept a root login w/o password. -The exemplary `run-qemu.sh` script configures QEMU to use QEMU user networking and sets up a port forwarding from localhost:2210 -> VM-IP 192.168.120.20:22. So you can open a ssh from host using: +``` ++-------------------+ +---------------------------+ +| QNX IFS | | Custom qnx6fs filesystem | +| | | | +| (base OS files) | | (user files) | ++-------------------+ +---------------------------+ + | mount point: /opt/score | + +-------------------------------+ +``` + +The QNX OS image generated by this repo is intended to be generic and shall not be modified for custom use cases. +In order to use it for example in a test setup, create a custom partition and put your test files on it. +See the sections below for instructions. +In case of QEMU, add the partition to a disk image and pass it to QEMU. See for example the `run-qemu.sh`: ``` -ssh -p 2210 root@localhost +-drive file=$SCORE_DISK,if=none,id=drv0 -device virtio-blk-device,drive=drv0 ``` +The QNX OS tries to mount the first `qnx6fs` partition on the disk image to `/opt/score`. + ### Attaching a user-created QNX6fs file system The QNX startup script (see `qnx8/boards//initscript`) calls `mount-fs.sh` which tries to mount a file system to the system. @@ -176,8 +208,10 @@ pted /dev/hd0 add -t qnx6 -p 99 -n scorefs mount -e /dev/hd0 # Create QNX6 file system mkqnx6fs /dev/hd0.qnx6.0 -# Reboot to let the partition be mounted automatically -shutdown +# Either mount the partition... +mount /dev/hd0.qnx6.0 /opt/score +# ... or reboot to let the partition be mounted automatically at boot time +# shutdown ``` After reboot you'll see in the startup messages that a partition is found and mounted: @@ -195,6 +229,19 @@ A QNX file system can be created on the host using `mkqnx6fsimg` (see https://ww TODO: integrate `mkqnx6fsimg` into `toolchains_qnx`. +### Autostart script + +If the file `/opt/score/autostart.sh` exists on the mounted file system, it is executed at the end of the OS image startup sequence. + +### ssh from host into QEMU image + +The QNX IFS images start up a `sshd` server. The user `root` has by default no password and `sshd` is configured to accept a root login w/o password. +The exemplary `run-qemu.sh` script configures QEMU to use QEMU user networking and sets up a port forwarding from localhost:2210 -> VM-IP 192.168.120.20:22. So you can open a ssh from host using: + +``` +ssh -p 2210 root@localhost +``` + ### Configuring custom IP address + host name During the startup of the VM the network is being set up, *after* mounting the virtual file system. By default host name `qemu-arm64virt` or `qemu-x86_64` and IP address 192.168.120.20/24 is set up. **Before** setting these, the `net-start.sh` script tries to read a file `/opt/score/etc/settings/network`. By installing such a file on the virtual file system and adding variables one can configure hostname and IP address of the network interface: @@ -207,6 +254,3 @@ HOSTNAME=myqemu > NOTE: This changes only the IP address of the QNX network interface. In order to make the port forwardings of the QEMU user network function correctly you'll have to adapt the QEMU user networking configuration in the `run-qemu.sh` script according to your IP address/subnet. -### Autostart script - -If the file `/opt/score/autostart.sh` exists on the mounted file system, it is executed at the end of the OS image startup sequence. From 3f31ccfffcebeea0acb46091c53d59c648c40c47 Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Mon, 30 Mar 2026 09:06:00 +0200 Subject: [PATCH 28/29] Use rules_images 0.0.2 --- MODULE.bazel | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 1999fae..8ecf921 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -18,12 +18,7 @@ module( # ------------------------------------------------------------------------------ # QNX toolchains -bazel_dep(name = "score_rules_imagefs", version = "0.0.1") -git_override( - module_name = "score_rules_imagefs", - remote = "https://github.com/eclipse-score/rules_imagefs.git", - commit = "38d5a1a5e5d83faa5d00e4d2f31c303db0d0f7de", -) +bazel_dep(name = "score_rules_imagefs", version = "0.0.2") imagefs = use_extension("@score_rules_imagefs//extensions:imagefs.bzl", "imagefs", dev_dependency = True) imagefs.sdp( From f8fea10590917300c578d217adf323cd0d41cd10 Mon Sep 17 00:00:00 2001 From: Joerg Gittinger Date: Tue, 31 Mar 2026 10:29:53 +0200 Subject: [PATCH 29/29] Update bazelversion, doc and x86_64 run script changes --- .bazelversion | 2 +- qnx8/README.md | 129 +++++++++++---------- qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh | 10 +- 3 files changed, 75 insertions(+), 66 deletions(-) diff --git a/.bazelversion b/.bazelversion index 56b6be4..e7fdef7 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -8.3.1 +8.4.2 diff --git a/qnx8/README.md b/qnx8/README.md index daa15d7..81ae13d 100644 --- a/qnx8/README.md +++ b/qnx8/README.md @@ -23,6 +23,71 @@ Following QNX 8 OS images can be created: * QEMU aarch64 "virt" image using virtio block and network drivers. * QEMU x86_64 image using virtio block and network drivers. +## Using QNX OS images for custom use-case + +``` ++-------------------+ +---------------------------+ +| QNX IFS | | Custom qnx6fs filesystem | +| | | | +| (base OS files) | | (user files) | ++-------------------+ +---------------------------+ + | mount point: /opt/score | + +-------------------------------+ +``` + +The QNX OS image generated by this repo is intended to be generic and shall not be modified for custom use cases. +In order to use it for example in a test setup, create a custom partition and put your test files on it. +See the sections below for instructions. +In case of QEMU, add the partition to a disk image and pass it to QEMU. See for example the `run-qemu.sh`: + +``` +-drive file=$SCORE_DISK,if=none,id=drv0 -device virtio-blk-device,drive=drv0 +``` + +The QNX OS tries to mount the first `qnx6fs` partition on the disk image to `/opt/score`. + +### Attaching a user-created QNX6fs file system + +The QNX startup script (see `qnx8/boards//initscript`) calls `mount-fs.sh` which tries to mount a file system to the system. +By default, the partition is mounted at `/` (root) and therefore a user sees a virtual file system with a combination of the IFS and the mounted file system. The path manager resolves path names first on the mounted partition, then on the IFS. This means all files on partition extend or even eclipse files on the IFS. For more information see https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.sys_arch/topic/proc_Resolving_pathnames.html. + +The generated QEMU launch script `run-qemu.sh` attaches a virtual disk `disk-score.qcow2` to the image. If it does not exist, it creates an empty virtual QEMU disk with size of 512MB before launching QEMU. + +#### Creating a file system on-line + +When starting up the QEMU VM with an empty virtual QEMU disk, no partitions are there. With the following commands you can create a partition and a qnx6fs file system which then gets mounted automatically on following boots: + +```bash +# initialize /dev/hd0 with GUID partition table +pted /dev/hd0 init -g +# Create a qnx6fs partition with 99% disk size and name 'scorefs' +pted /dev/hd0 add -t qnx6 -p 99 -n scorefs +# Re-read the partition table +mount -e /dev/hd0 +# Create QNX6 file system +mkqnx6fs /dev/hd0.qnx6.0 +# Either mount the partition... +mount /dev/hd0.qnx6.0 /opt/score +# ... or reboot to let the partition be mounted automatically at boot time +# shutdown +``` + +After reboot you'll see in the startup messages that a partition is found and mounted: + +``` +[...] +---> Mounting file systems +Mounting filesystem /dev/hd0.qnx6.0 to /opt/score +[...] +``` + +#### Creating a file system offline + +A QNX file system can be created on the host using `mkqnx6fsimg` (see https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.utilities/topic/m/mkqnx6fsimg.html). + +The [rules_imagefs](https://github.com/eclipse-score/rules_imagefs) S-CORE module supports creating qnx6fs images by making use of the +QNX SDP utilities like `mkqnx6fsimg`. + ## Pre-requisites @@ -165,70 +230,6 @@ cd bazel-out/k8-fastbuild/bin/qnx8/boards/qemu-arm64virt ./run-qemu.sh ``` -## Using QNX OS images for custom use-case - -``` -+-------------------+ +---------------------------+ -| QNX IFS | | Custom qnx6fs filesystem | -| | | | -| (base OS files) | | (user files) | -+-------------------+ +---------------------------+ - | mount point: /opt/score | - +-------------------------------+ -``` - -The QNX OS image generated by this repo is intended to be generic and shall not be modified for custom use cases. -In order to use it for example in a test setup, create a custom partition and put your test files on it. -See the sections below for instructions. -In case of QEMU, add the partition to a disk image and pass it to QEMU. See for example the `run-qemu.sh`: - -``` --drive file=$SCORE_DISK,if=none,id=drv0 -device virtio-blk-device,drive=drv0 -``` - -The QNX OS tries to mount the first `qnx6fs` partition on the disk image to `/opt/score`. - -### Attaching a user-created QNX6fs file system - -The QNX startup script (see `qnx8/boards//initscript`) calls `mount-fs.sh` which tries to mount a file system to the system. -By default, the partition is mounted at `/` (root) and therefore a user sees a virtual file system with a combination of the IFS and the mounted file system. The path manager resolves path names first on the mounted partition, then on the IFS. This means all files on partition extend or even eclipse files on the IFS. For more information see https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.sys_arch/topic/proc_Resolving_pathnames.html. - -The generated QEMU launch script `run-qemu.sh` attaches a virtual disk `disk-score.qcow2` to the image. If it does not exist, it creates an empty virtual QEMU disk with size of 512MB before launching QEMU. - -#### Creating a file system on-line - -When starting up the QEMU VM with an empty virtual QEMU disk, no partitions are there. With the following commands you can create a partition and a qnx6fs file system which then gets mounted automatically on following boots: - -```bash -# initialize /dev/hd0 with GUID partition table -pted /dev/hd0 init -g -# Create a qnx6fs partition with 99% disk size and name 'scorefs' -pted /dev/hd0 add -t qnx6 -p 99 -n scorefs -# Re-read the partition table -mount -e /dev/hd0 -# Create QNX6 file system -mkqnx6fs /dev/hd0.qnx6.0 -# Either mount the partition... -mount /dev/hd0.qnx6.0 /opt/score -# ... or reboot to let the partition be mounted automatically at boot time -# shutdown -``` - -After reboot you'll see in the startup messages that a partition is found and mounted: - -``` -[...] ----> Mounting file systems -Mounting filesystem /dev/hd0.qnx6.0 to /opt/score -[...] -``` - -#### Creating a file system offline - -A QNX file system can be created on the host using `mkqnx6fsimg` (see https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.utilities/topic/m/mkqnx6fsimg.html). - -TODO: integrate `mkqnx6fsimg` into `toolchains_qnx`. - ### Autostart script If the file `/opt/score/autostart.sh` exists on the mounted file system, it is executed at the end of the OS image startup sequence. diff --git a/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh b/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh index 01aea4b..8430923 100755 --- a/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh +++ b/qnx8/boards/qemu-x86_64/run-qemu-x86_64.sh @@ -31,6 +31,14 @@ if [ ! -f "$SCORE_DISK" ]; then fi fi +# ------------------------------------------ +# Set KVM options based on QEMU_NO_KVM if user does not have kvm - like nested VMs +if [ -z "${QEMU_NO_KVM:-}" ]; then + QEMU_KVM_OPTS="-enable-kvm -cpu host" +else + QEMU_KVM_OPTS="-cpu Cascadelake-Server-v5" +fi + # ------------------------------------------ # QEMU user network settings # subnet. This value must match the IP address configured in guest QNX. @@ -46,7 +54,7 @@ VM_IP=$NETWORK.20 # ------------------------------------------ # Launch QEMU -$QEMU_BIN -cpu host -accel kvm -smp $CPU_COUNT -m $MEM_SIZE \ +$QEMU_BIN $QEMU_KVM_OPTS -smp $CPU_COUNT -m $MEM_SIZE \ -kernel $QNX_IFS \ -drive file=$SCORE_DISK,if=none,id=drv0 -device virtio-blk-pci,drive=drv0 \ -netdev user,id=net0,net=$NETWORK.0/24,hostfwd=tcp::$HOST_SSH_PORT-$VM_IP:22,hostfwd=tcp::$HOST_QCONN_PORT-$VM_IP:8000,hostfwd=tcp::$HOST_DLT_PORT-$VM_IP:3490,hostfwd=tcp::$HOST_DOIP_PORT-$VM_IP:13400 \