Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 37 additions & 11 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 1 addition & 11 deletions bazel_common/score_images.MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,7 @@ http_file(
url = "https://github.com/Elektrobit/eb_corbos_toolkit/releases/download/v2.0.0-beta2/fastdev-trixie-ebclfsa-ebcl-qemuarm64.tar.gz",
)

bazel_dep(name = "score_rules_imagefs", version = "0.0.1")

# Pin score_rules_imagefs to 0.0.1. The bumped score_communication pulls in
# score_qnx_unit_tests@0.2.0 which requests score_rules_imagefs@0.0.3, but 0.0.3
# drops the `ext_repo_maping` attribute used by our QNX image build files. Force
# 0.0.1 so the reference integration image definitions keep working without a
# larger image-definition migration.
single_version_override(
module_name = "score_rules_imagefs",
version = "0.0.1",
)
bazel_dep(name = "score_rules_imagefs", version = "0.1.0")

imagefs = use_extension("@score_rules_imagefs//extensions:imagefs.bzl", "imagefs", dev_dependency = True)
imagefs.toolchain(
Expand Down
32 changes: 19 additions & 13 deletions docs/integration_process/step_4_platforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,30 +184,36 @@ must always be present — you wire it straight into each image's build
description instead. Unlike the showcase route, **this is per-image work: you
repeat it for every image you target** (Linux, QNX, AutoSD, EBcLfSA).

The reference example is the ``datarouter``. In the QNX image it is added as a
source of the image target and exposed to the image's build description via a
location mapping, then placed into the filesystem by ``system.build``:
The reference example is the ``datarouter``. In the QNX images its destination
path, permissions and owner are declared as a ``pkg_files`` target which is then
listed in the image's ``srcs``; ``score_rules_imagefs`` generates the matching
``mkifs`` directives, so nothing has to be added to ``system.build``:

.. code-block:: python

# images/qnx_x86_64/build/BUILD
pkg_files(
name = "datarouter",
srcs = ["@score_logging//score/datarouter"],
attributes = pkg_attributes(mode = "0777"),
prefix = "usr/bin/datarouter",
)

qnx_ifs(
name = "init",
srcs = [
# ...
"//showcases",
"@score_logging//score/datarouter",
"//feature_integration_tests/configs/datarouter:etc_configs",
":datarouter",
],
ext_repo_maping = {
"BUNDLE_PATH": "$(location //showcases:showcases)",
"DATAROUTER_PATH": "$(location @score_logging//score/datarouter:datarouter)",
},
build_file = "init.build",
extra_build_files = ["system.build"],
)

See `images/qnx_x86_64/build/BUILD <https://github.com/eclipse-score/reference_integration/blob/main/images/qnx_x86_64/build/BUILD>`_ and the
matching deployment lines in
`images/qnx_x86_64/build/system.build <https://github.com/eclipse-score/reference_integration/blob/main/images/qnx_x86_64/build/system.build>`_
Note that ``qnx_ifs`` rejects anything in ``srcs`` that does not provide a
``rules_pkg`` provider, so a plain ``filegroup`` or a bare label will not work -
wrap it in ``pkg_files``.

See `images/qnx_x86_64/build/BUILD <https://github.com/eclipse-score/reference_integration/blob/main/images/qnx_x86_64/build/BUILD>`_
for the full picture, and repeat the equivalent wiring in the other images you
need (`images/linux_x86_64 <https://github.com/eclipse-score/reference_integration/tree/main/images/linux_x86_64>`_,
`images/autosd <https://github.com/eclipse-score/reference_integration/tree/main/images/autosd>`_,
Expand Down
148 changes: 117 additions & 31 deletions images/qnx_aarch64/build/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,62 +11,148 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

load("@rules_pkg//pkg:mappings.bzl", "REMOVE_BASE_DIRECTORY", "pkg_attributes", "pkg_files")
load("@score_rules_imagefs//rules/qnx:ifs.bzl", "qnx_ifs")

filegroup(
name = "scripts",
# score_rules_imagefs derives the mkifs placement directives from these
# rules_pkg targets, so the destination path, permissions and owner of every
# Bazel-provided file are declared here instead of in system.build.

pkg_files(
name = "etc_scripts",
srcs = [
"//images/qnx_aarch64/configs:network_setup.sh",
"//images/qnx_aarch64/configs:network_setup_dhcp.sh",
"//images/qnx_aarch64/configs:startup.sh",
],
attributes = pkg_attributes(mode = "0700"),
prefix = "etc",
visibility = ["//visibility:private"],
)

pkg_files(
name = "etc_network_capture",
srcs = ["//images/qnx_aarch64/configs:network_capture.sh"],
attributes = pkg_attributes(mode = "0755"),
prefix = "etc",
renames = {"//images/qnx_aarch64/configs:network_capture.sh": "network_capture"},
visibility = ["//visibility:private"],
)

filegroup(
name = "configs",
# mkifs resolves a bare filename against its default /proc/boot prefix, which is
# how these were written before; the prefix is explicit now because
# score_rules_imagefs always emits an absolute destination. startup.sh references
# these by their /proc/boot path.
pkg_files(
name = "boot_configs",
srcs = ["//images/qnx_aarch64/configs:qcrypto.conf"],
attributes = pkg_attributes(mode = "0444"),
prefix = "proc/boot",
visibility = ["//visibility:private"],
)

# These four carried no attribute block before, which made mkifs inherit the
# host file mode. All four are 0644 in git; pin it.
pkg_files(
name = "etc_identity",
srcs = [
"//images/qnx_aarch64/configs:dhcpcd.conf",
"//images/qnx_aarch64/configs:group",
"//images/qnx_aarch64/configs:hostname",
"//images/qnx_aarch64/configs:network_capture.sh",
"//images/qnx_aarch64/configs:network_setup.sh",
"//images/qnx_aarch64/configs:network_setup_dhcp.sh",
"//images/qnx_aarch64/configs:passwd",
"//images/qnx_aarch64/configs:profile",
"//images/qnx_aarch64/configs:qcrypto.conf",
],
attributes = pkg_attributes(mode = "0644"),
prefix = "etc",
visibility = ["//visibility:private"],
)

pkg_files(
name = "etc_dhcpcd",
srcs = ["//images/qnx_aarch64/configs:dhcpcd.conf"],
attributes = pkg_attributes(mode = "0644"),
prefix = "etc",
visibility = ["//visibility:private"],
)

pkg_files(
name = "ssh_config",
srcs = ["//images/qnx_aarch64/configs:sshd_config"],
attributes = pkg_attributes(mode = "0444"),
prefix = "var/ssh",
visibility = ["//visibility:private"],
)

pkg_files(
name = "ssh_host_keys",
srcs = [
"//images/qnx_aarch64/configs:ssh_host_rsa_key",
"//images/qnx_aarch64/configs:ssh_host_rsa_key.pub",
"//images/qnx_aarch64/configs:sshd_config",
],
attributes = pkg_attributes(
gid = 0,
mode = "0400",
uid = 0,
),
prefix = "var/ssh",
visibility = ["//visibility:private"],
)

pkg_files(
name = "etc_comm_configs",
srcs = ["//feature_integration_tests/configs:etc_configs"],
attributes = pkg_attributes(mode = "0777"),
prefix = "etc",
visibility = ["//visibility:private"],
)

pkg_files(
name = "datarouter",
srcs = ["@score_logging//score/datarouter"],
attributes = pkg_attributes(mode = "0777"),
prefix = "usr/bin/datarouter",
visibility = ["//visibility:private"],
)

pkg_files(
name = "datarouter_configs",
srcs = ["//feature_integration_tests/configs/datarouter:etc_configs"],
attributes = pkg_attributes(mode = "0644"),
prefix = "usr/bin/datarouter/etc",
visibility = ["//visibility:private"],
)

# REMOVE_BASE_DIRECTORY drops the bundle's contents at the image root, which is
# what `[perms=777] / = ${BUNDLE_PATH}` did.
pkg_files(
name = "showcases",
srcs = ["//showcases"],
attributes = pkg_attributes(mode = "0777"),
renames = {"//showcases": REMOVE_BASE_DIRECTORY},
visibility = ["//visibility:private"],
)

# Not built or booted by CI. QNX SDP 8.0.0 ships no generic QEMU-virt startup
# binary, so init.build's `startup-virt` cannot resolve without a target BSP.
# Tagged manual so wildcard builds skip it.
qnx_ifs(
name = "init",
srcs = [
":configs",
":scripts",
":system.build",
":system_dir",
"//feature_integration_tests/configs:etc_configs",
"//feature_integration_tests/configs/datarouter:etc_configs",
"//showcases",
"@score_logging//score/datarouter",
"@score_persistency//tests/test_scenarios/cpp:test_scenarios",
":boot_configs",
":datarouter",
":datarouter_configs",
":etc_comm_configs",
":etc_dhcpcd",
":etc_identity",
":etc_network_capture",
":etc_scripts",
":showcases",
":ssh_config",
":ssh_host_keys",
],
build_file = "init.build",
ext_repo_maping = {
"BUNDLE_PATH": "$(location //showcases:showcases)",
"DATAROUTER_PATH": "$(location @score_logging//score/datarouter:datarouter)",
},
extra_build_files = ["system.build"],
tags = ["manual"],
visibility = [
"//visibility:public",
],
)

filegroup(
name = "system_dir",
srcs = [
"init.build",
"system.build",
],
)
1 change: 0 additions & 1 deletion images/qnx_aarch64/build/init.build
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,3 @@ libslog2.so.1 # System logging library (slog2_* functions)
# Orchestrator example needed
[type=link] /data=/tmp_ram

[+include] ${MAIN_BUILD_FILE_DIR}/system.build # Include additional system build configurations
Loading
Loading