Skip to content

Commit b2ae791

Browse files
authored
Add QNX8 aarch64 build support (eclipse-score#241)
* Add QNX8 aarch64 build support * review findings * free more space
1 parent f82780a commit b2ae791

28 files changed

Lines changed: 1264 additions & 11 deletions

.bazelrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ build:_common --@score_logging//score/datarouter/build_configuration_flags:enabl
3030
build:_common --@score_logging//score/datarouter/build_configuration_flags:file_transfer=False
3131
build:_common --@score_logging//score/datarouter/build_configuration_flags:use_local_vlan=True
3232

33+
# ─── QNX common flags (shared by all QNX configs) ────────────────────────────
34+
build:_qnx_common --host_platform=@score_bazel_platforms//:x86_64-linux-gcc_12.2.0-posix
35+
build:_qnx_common --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
36+
build:_qnx_common --incompatible_enable_cc_toolchain_resolution
37+
3338
build:qnx-x86_64 --config=_common
3439
build:qnx-x86_64 --noexperimental_merged_skyframe_analysis_execution
3540
build:qnx-x86_64 --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
@@ -41,6 +46,16 @@ build:qnx-x86_64 --extra_toolchains=@score_qcc_x86_64_toolchain//:x86_64-qnx-sdp
4146
build:qnx-x86_64 --extra_toolchains=@score_qnx_x86_64_ifs_toolchain//:ifs-x86_64-qnx-sdp_8.0.0
4247
build:qnx-x86_64 --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_x86_64_pc_nto_qnx800
4348

49+
# ─── QNX aarch64 cross-compilation config ────────────────────────────────────
50+
# Usage: bazel build --config=qnx-aarch64 //target
51+
build:qnx-aarch64 --config=_common
52+
build:qnx-aarch64 --config=_qnx_common
53+
build:qnx-aarch64 --platforms=@score_bazel_platforms//:aarch64-qnx-sdp_8.0.0-posix
54+
build:qnx-aarch64 --extra_toolchains=@score_qcc_aarch64_toolchain//:aarch64-qnx-sdp_8.0.0
55+
build:qnx-aarch64 --extra_toolchains=@score_toolchains_rust//toolchains/ferrocene:ferrocene_aarch64_unknown_nto_qnx800
56+
build:qnx-aarch64 --extra_toolchains=@score_qnx_aarch64_ifs_toolchain//:ifs-aarch64-qnx-sdp_8.0.0
57+
58+
4459
build:linux-x86_64 --config=_common
4560
build:linux-x86_64 --extra_toolchains=@score_gcc_x86_64_toolchain//:x86_64-linux-gcc_12.2.0
4661
build:linux-x86_64 --platforms=@score_bazel_platforms//:x86_64-linux-gcc_12.2.0-posix

.github/workflows/test_and_docs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ jobs:
4040
pull-requests: write
4141
steps:
4242
- name: Clean disk space
43-
uses: eclipse-score/more-disk-space@v1
43+
uses: eclipse-score/more-disk-space@v1.1
44+
with:
45+
level: 4
4446
- name: Setup Bazel
4547
uses: bazel-contrib/setup-bazel@0.18.0
4648
with:

MODULE.bazel.lock

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bazel_common/score_images.MODULE.bazel

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,16 @@ imagefs.toolchain(
5959
target_os = "qnx",
6060
type = "ifs",
6161
)
62+
imagefs.toolchain(
63+
name = "score_qnx_aarch64_ifs_toolchain",
64+
sdp_to_import = "@score_qcc_aarch64_toolchain_pkg",
65+
sdp_version = "8.0.0",
66+
target_cpu = "aarch64",
67+
target_os = "qnx",
68+
type = "ifs",
69+
)
6270
use_repo(
6371
imagefs,
72+
"score_qnx_aarch64_ifs_toolchain",
6473
"score_qnx_x86_64_ifs_toolchain",
6574
)

bazel_common/score_qnx_toolchains.MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ qcc.toolchain(
3030
use_repo(
3131
qcc,
3232
"score_qcc_aarch64_toolchain",
33+
"score_qcc_aarch64_toolchain_pkg",
3334
"score_qcc_x86_64_toolchain",
3435
"score_qcc_x86_64_toolchain_pkg",
3536
)

images/qnx_aarch64/BUILD

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
14+
15+
alias(
16+
name = "image",
17+
actual = "//images/qnx_aarch64/build:init",
18+
visibility = ["//visibility:public"],
19+
)
20+
21+
sh_binary(
22+
name = "run",
23+
srcs = ["//runners/qemu_aarch64/scripts:run_qemu_qnx.sh"],
24+
args = [
25+
"$(location :image)",
26+
],
27+
data = [
28+
":image",
29+
],
30+
)

images/qnx_aarch64/build/BUILD

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
14+
load("@score_rules_imagefs//rules/qnx:ifs.bzl", "qnx_ifs")
15+
16+
filegroup(
17+
name = "scripts",
18+
srcs = [
19+
"//images/qnx_aarch64/configs:startup.sh",
20+
],
21+
visibility = ["//visibility:private"],
22+
)
23+
24+
filegroup(
25+
name = "configs",
26+
srcs = [
27+
"//images/qnx_aarch64/configs:dhcpcd.conf",
28+
"//images/qnx_aarch64/configs:group",
29+
"//images/qnx_aarch64/configs:hostname",
30+
"//images/qnx_aarch64/configs:network_capture.sh",
31+
"//images/qnx_aarch64/configs:network_setup.sh",
32+
"//images/qnx_aarch64/configs:network_setup_dhcp.sh",
33+
"//images/qnx_aarch64/configs:passwd",
34+
"//images/qnx_aarch64/configs:profile",
35+
"//images/qnx_aarch64/configs:qcrypto.conf",
36+
"//images/qnx_aarch64/configs:ssh_host_rsa_key",
37+
"//images/qnx_aarch64/configs:ssh_host_rsa_key.pub",
38+
"//images/qnx_aarch64/configs:sshd_config",
39+
],
40+
visibility = ["//visibility:private"],
41+
)
42+
43+
qnx_ifs(
44+
name = "init",
45+
srcs = [
46+
":configs",
47+
":scripts",
48+
":system.build",
49+
":system_dir",
50+
"//feature_integration_tests/configs:etc_configs",
51+
"//feature_integration_tests/configs/datarouter:etc_configs",
52+
"//showcases",
53+
"@score_logging//score/datarouter",
54+
"@score_persistency//tests/test_scenarios/cpp:test_scenarios",
55+
],
56+
build_file = "init.build",
57+
ext_repo_maping = {
58+
"BUNDLE_PATH": "$(location //showcases:showcases)",
59+
"DATAROUTER_PATH": "$(location @score_logging//score/datarouter:datarouter)",
60+
},
61+
visibility = [
62+
"//visibility:public",
63+
],
64+
)
65+
66+
filegroup(
67+
name = "system_dir",
68+
srcs = [
69+
"init.build",
70+
"system.build",
71+
],
72+
)
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
14+
15+
###############################################################################
16+
#
17+
# Example image built based on minimal configuration from QNX
18+
#
19+
###############################################################################
20+
21+
[-optional]
22+
23+
[image=0x3600000] # Set image size to 56MB (0x3600000 bytes)
24+
[virtual=aarch64le,raw -compress] boot = { # Configure for aarch64le architecture with raw compressed boot
25+
# TODO: replace startup-virt with the actual aarch64 startup binary for the target BSP.
26+
# QNX SDP 8.0.0 ships no generic QEMU-virt startup; source one from the appropriate BSP.
27+
startup-virt -v # Start aarch64 kernel - board-specific startup binary required
28+
PATH=/proc/boot # Set executable search path to boot directory
29+
LD_LIBRARY_PATH=/proc/boot # Set library search path to boot directory
30+
[+keeplinked] procnto-smp-instr # Keep process manager linked and instrumented for SMP
31+
}
32+
33+
[+script] startup-script = { # Define startup script that runs during boot
34+
procmgr_symlink /dev/shmem /tmp # Create symbolic link from shared memory to /tmp
35+
# /tmp will be mounted later as a proper RAM disk
36+
37+
display_msg Welcome to QNX OS 8.0 on aarch64 tweaked for S-CORE! # Display welcome message
38+
39+
# These env variables get inherited by all programs which follow
40+
SYSNAME=nto # Set system name to "nto" (Neutrino)
41+
TERM=qansi # Set terminal type to QNX ANSI
42+
43+
devc-ser8250 & # Start serial driver in background
44+
waitfor /dev/ser1 # Wait for serial device to be available
45+
reopen /dev/ser1 # Reopen serial device for console I/O
46+
47+
display_msg Placeholder for startup script # Display startup message
48+
etc/startup.sh # Execute main startup script
49+
50+
[+session] /bin/sh & # Start shell session in background
51+
}
52+
53+
# Essential utilities - core system commands needed for basic operation
54+
# These binaries provide fundamental system functionality and process management
55+
56+
# Process and system management utilities
57+
on # Command execution utility - runs commands with specific options
58+
[type=link] waitfor=on # Create symbolic link: waitfor -> on (waits for resources to become available)
59+
[type=link] ability=on # Create symbolic link: ability -> on (manages process abilities/privileges)
60+
61+
# Shell and command interpreter
62+
ksh # Korn shell - provides command-line interface and scripting
63+
pidin # Process information display - shows running processes (like 'ps' on Linux)
64+
[type=link] /bin/sh=/proc/boot/ksh # Create symbolic link: sh -> ksh (standard shell link)
65+
66+
# File system utilities
67+
mount # File system mount utility - mounts/unmounts file systems
68+
getconf # System configuration query utility - retrieves system parameters
69+
[type=link] setconf=getconf # Create symbolic link: setconf -> getconf (sets configuration parameters)
70+
71+
# Device drivers for hardware access
72+
devc-ser8250 # Serial port driver for 8250/16550 UART controllers (console access)
73+
74+
# System logging utilities
75+
slog2info # System log viewer - displays logged messages
76+
slogger2 # System logging daemon - collects and manages log messages
77+
78+
# Essential libraries - core runtime libraries required for system operation
79+
# These libraries provide fundamental services like C runtime, networking, and logging
80+
81+
# Standard C library - provides basic C runtime functions
82+
libc.so.6 # Main C library (malloc, printf, file I/O, etc.)
83+
84+
# Dynamic linker/loader - handles dynamic library loading at runtime
85+
/usr/lib/ldqnx-64.so.2=ldqnx-64.so.2 # 64-bit QNX dynamic linker (loads shared libraries)
86+
87+
# Networking library - provides socket and network communication functions
88+
libsocket.so.4 # Socket library (TCP/IP, UDP, network I/O functions)
89+
[type=link] libsocket.so=libsocket.so.4 # Create version-neutral symbolic link
90+
91+
# System logging library - provides logging services for applications
92+
libslog2.so.1 # System logging library (slog2_* functions)
93+
[type=link] libslog2.so=libslog2.so.1 # Create version-neutral symbolic link
94+
95+
# Orchestrator example needed
96+
[type=link] /data=/tmp_ram
97+
98+
[+include] ${MAIN_BUILD_FILE_DIR}/system.build # Include additional system build configurations

0 commit comments

Comments
 (0)