Skip to content
Merged
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
8 changes: 6 additions & 2 deletions .github/workflows/build_and_test_ebclfsa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ jobs:
uses: actions/checkout@v4

- name: Build for EB corbos Linux for Safety Applications and run tests
run: bazel build --config=aarch64 --spawn_strategy=local //scrample_integration:run
run: |
bazel build --config=aarch64-ebclfsa //scrample_integration:run
bazel build --config=aarch64-ebclfsa //persistency_integration:run
working-directory: ./ebclfsa

- name: Upload test logs
uses: actions/upload-artifact@v5
with:
name: test-logs
path: ebclfsa/bazel-bin/scrample_integration/*.log
path: |
ebclfsa/bazel-bin/scrample_integration/*.log
ebclfsa/bazel-bin/persistency_integration/*.log
18 changes: 11 additions & 7 deletions ebclfsa/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
common --@score_baselibs//score/mw/log/detail/flags:KUse_Stub_Implementation_Only=False
common --@score_baselibs//score/mw/log/flags:KRemote_Logging=False
common --@score_baselibs//score/json:base_library=nlohmann
common --@score_communication//score/mw/com/flags:tracing_library=stub

common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/
common --registry=https://bcr.bazel.build

common --extra_toolchains=@gcc_toolchain//:aarch64_gcc_13
build:aarch64 --platforms=@score_toolchains_gcc//platforms:aarch64-linux
build:_common --@score_baselibs//score/mw/log/detail/flags:KUse_Stub_Implementation_Only=False
build:_common --@score_baselibs//score/mw/log/flags:KRemote_Logging=False
build:_common --@score_baselibs//score/json:base_library=nlohmann
build:_common --@score_baselibs//score/memory/shared/flags:use_typedshmd=False
build:_common --@score_communication//score/mw/com/flags:tracing_library=stub
build:_common --cxxopt=-Wno-error=mismatched-new-delete

build:aarch64-ebclfsa --config=_common
build:aarch64-ebclfsa --extra_toolchains=@gcc_toolchain//:aarch64_gcc_13
build:aarch64-ebclfsa --platforms=@score_toolchains_gcc//platforms:aarch64-linux
build:aarch64-ebclfsa --spawn_strategy=local
10 changes: 9 additions & 1 deletion ebclfsa/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ bazel_dep(name = "score_toolchains_gcc", dev_dependency=True)
git_override( # Elektrobit corbos Linux for Safety Applications needs a specific toolchain
module_name = "score_toolchains_gcc",
remote = "https://github.com/elektrobit-contrib/eclipse-score_toolchains_gcc.git",
tag = "0.5.0-alpha", # commit sha: fb009e490b9b8f28805d587f50d0bf6d885f3414
#tag = "0.5.0-alpha", # commit sha: fb009e490b9b8f28805d587f50d0bf6d885f3414
commit = "605020d7a95b7fb128944495e45449eb07fedc01",
)
gcc = use_extension("@score_toolchains_gcc//extentions:gcc.bzl", "gcc", dev_dependency=True)
gcc.toolchain(
Expand All @@ -49,6 +50,12 @@ gcc.warning_flags(

use_repo(gcc, "gcc_toolchain", "gcc_toolchain_gcc")

bazel_dep(name = "score_docs_as_code", version = "2.0.1") # part of 0.5.0-alpha release
single_version_override(
module_name = "score_docs_as_code",
version = "2.0.1",
)

bazel_dep(name = "score_baselibs")
single_version_override(
module_name = "score_baselibs",
Expand All @@ -60,6 +67,7 @@ single_version_override(
)
bazel_dep(name = "score_communication", version = "0.1.1") # part of 0.5.0-alpha release
bazel_dep(name = "score_scrample", version = "0.1.0") # part of 0.5.0-alpha release
bazel_dep(name = "score_persistency", version = "0.2.1") # part of 0.5.0-alpha release

# git_override is not forwarded by bazel_dep, so we need to redefine it here
git_override(
Expand Down
17 changes: 10 additions & 7 deletions ebclfsa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ However, please understand that we cannot advise you about possible costs in you
> - Copy and paste the following command into the terminal and hit "Enter":
>
> ```bash
> cd ./ebclfsa && bazel build --config=aarch64 --spawn_strategy=local //scrample_integration:run
> cd ./ebclfsa && bazel build --config=aarch64-ebclfsa //scrample_integration:run
> ```
>
> This will build and run the example.
Expand Down Expand Up @@ -229,7 +229,7 @@ The demo SDK integrates the [S-CORE toolchain with two extensions](https://githu
### Bazel Rules for the Example Applications

The example extends the [`scrample` example](https://github.com/eclipse-score/scrample) of S-CORE with the application setup and the toolchain extensions described above.
With those changes, the toolchain can be used via `bazel build --config=aarch64 --spawn_strategy=local //scrample_integration:<target>`.
With those changes, the toolchain can be used via `bazel build --config=aarch64-ebclfsa //scrample_integration:<target>`.

> [!IMPORTANT]
> Building inside a sandbox is currently not possible.
Expand All @@ -253,7 +253,7 @@ The following sections introduce some of the rules mentioned above.
The `run` target provides an easy entry point, to build, post-process, deploy, run and stop the example:

```bash
bazel build --config=aarch64 --spawn_strategy=local //scrample_integration:run
bazel build --config=aarch64-ebclfsa //scrample_integration:run
```

This command will take a while to finish, since it performs some downloads and starts the fast-dev image.
Expand Down Expand Up @@ -322,7 +322,7 @@ SDK:handler_do_el0_svc_pre: syscall __NR_clone3 (435) is not allowed
Building all components of the example application can be performed with the `hi_app` rule.

```bash
bazel build --config=aarch64 --spawn_strategy=local //scrample_integration:hi_app
bazel build --config=aarch64-ebclfsa //scrample_integration:hi_app
```

Due the dependencies towards `:scrample_sil` and `:scrample_sil_wrapper` this will build all required binaries.
Expand All @@ -333,7 +333,7 @@ Including the LI `scrample` binary, a temporary `scrample_sil_wrapper` binary as
The easiest way to setup the fast-dev image, is to use the `fastdev-image` rule.

```bash
bazel build --config=aarch64 --spawn_strategy=local //scrample_integration:fastdev-image
bazel build --config=aarch64-ebclfsa //scrample_integration:fastdev-image
```

This will first download the image via the `fetch-fastdev-archive` rule and cache the archive.
Expand Down Expand Up @@ -362,7 +362,7 @@ ssh -p 2222 root@localhost
For deploying the example application to the image, the `upload` rule is available, which will start the image based on the content of `bazel-bin/scrample_integration/deb-qemuarm64/` and deploy all needed files via `scp`.

```bash
bazel build --config=aarch64 --spawn_strategy=local //scrample_integration:upload
bazel build --config=aarch64-ebclfsa //scrample_integration:upload
```

Since the deployment step will change the stored disk image, the `upload` rule stores its output in `bazel-bin/scrample_integration/deb-qemuarm64-modified/`.
Expand Down Expand Up @@ -392,4 +392,7 @@ crinit-ctl poweroff

## Further notes

The toolchain and librares are provided for demonstration and prototyping purposes without further qualification.
* The toolchain and librares are provided for demonstration and prototyping purposes without further qualification.
* A second test case for S-CORE persistency is also integrated. You can run it via
`bazel build --config=aarch64-ebclfsa //persistency_integration:run`
However, this is not integrated as HI application to avoid the additional complexity of the required wrapper.
27 changes: 23 additions & 4 deletions ebclfsa/patches/fix_hard_coded_amd64.patch
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
diff --git a/MODULE.bazel b/MODULE.bazel
index a302a84..7917e2b 100644
index 16776ba..683c131 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -60,7 +60,7 @@ deb = use_repo_rule("@download_utils//download/deb:defs.bzl", "download_deb")
@@ -70,7 +70,7 @@ deb = use_repo_rule("@download_utils//download/deb:defs.bzl", "download_deb")
deb(
name = "acl-deb",
build = "//third_party/acl:acl.BUILD",
- urls = ["https://archive.ubuntu.com/ubuntu/pool/main/a/acl/libacl1-dev_2.2.52-3build1_amd64.deb"],
+ urls = ["https://ports.ubuntu.com/pool/main/a/acl/libacl1-dev_2.2.52-3build1_arm64.deb"],
+ urls = ["https://launchpadlibrarian.net/581258948/libacl1-dev_2.3.1-1_arm64.deb"],
visibility = ["//visibility:public"],
)


diff --git a/third_party/acl/acl.BUILD b/third_party/acl/acl.BUILD
index 718726c..710befd 100644
--- a/third_party/acl/acl.BUILD
+++ b/third_party/acl/acl.BUILD
@@ -1,7 +1,7 @@
cc_library(
name = "acl",
srcs = [
- "usr/lib/libacl.a",
+ "usr/lib/aarch64-linux-gnu/libacl.a",
],
hdrs = [
"usr/include/acl/libacl.h",
@@ -9,4 +9,4 @@ cc_library(
],
includes = ["usr/include/"],
visibility = ["//visibility:public"],
-)
+)
76 changes: 76 additions & 0 deletions ebclfsa/persistency_integration/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# *******************************************************************************
# 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
# *******************************************************************************
load("@score_baselibs//score/language/safecpp:toolchain_features.bzl", "COMPILER_WARNING_FEATURES")

genrule(
name = "fetch-fastdev-archive",
srcs = [],
outs = ["fastdev-archive.tgz"],
cmd = "wget -O $@ https://github.com/Elektrobit/eclipse-score_toolchains_gcc/releases/download/0.5.0-alpha/fastdev-ubuntu-ebcl-deb-qemu-arm64.tgz"
)

genrule(
name = "fastdev-image",
srcs = [":fetch-fastdev-archive"],
outs = [
"deb-qemuarm64/fastdev-ubuntu-ebcl-deb-qemuarm64.wic",
"deb-qemuarm64/fastdev-ubuntu-ebcl-deb-qemuarm64-vmlinux"
],
cmd = "tar xzf $(location :fetch-fastdev-archive) -C $(RULEDIR)",
)

genrule(
name = "upload",
srcs = [
"@score_persistency//tests/cpp_test_scenarios:cpp_test_scenarios",
":fastdev-image",
"scripts/cpp_tests_persistency.sh",
"run_qemu.sh",
],
cmd = " \
mkdir -p $(RULEDIR)/deb-qemuarm64-modified &&\
cp $(RULEDIR)/deb-qemuarm64/* $(RULEDIR)/deb-qemuarm64-modified/ &&\
$(location run_qemu.sh) $(RULEDIR)/deb-qemuarm64-modified -pidfile $(RULEDIR)/qemu.pid > $(RULEDIR)/qemu_upload.log &\
sleep 30 ; \
sshpass -p linux scp -o StrictHostKeyChecking=no -P 2222 $(location @score_persistency//tests/cpp_test_scenarios:cpp_test_scenarios) root@localhost:/usr/bin/cpp_tests_persistency &&\
sshpass -p linux scp -o StrictHostKeyChecking=no -P 2222 $(location scripts/cpp_tests_persistency.sh) root@localhost:/usr/bin/cpp_tests_persistency.sh &&\
sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost sync &&\
sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost crinit-ctl poweroff || true \
sleep 5 \
",
outs = [
"qemu_upload.log",
"deb-qemuarm64-modified/fastdev-ubuntu-ebcl-deb-qemuarm64.wic",
"deb-qemuarm64-modified/fastdev-ubuntu-ebcl-deb-qemuarm64-vmlinux"
],
)

genrule(
name = "run",
srcs = [
"deb-qemuarm64-modified/fastdev-ubuntu-ebcl-deb-qemuarm64.wic",
"deb-qemuarm64-modified/fastdev-ubuntu-ebcl-deb-qemuarm64-vmlinux",
"run_qemu.sh"
],
cmd = " \
$(location run_qemu.sh) $(RULEDIR)/deb-qemuarm64-modified -pidfile $(RULEDIR)/qemu.pid > $(RULEDIR)/qemu_run.log &\
sleep 10 ; \
sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost cpp_tests_persistency.sh > $(RULEDIR)/ssh_persistency_test_scenarios_run.log && \
sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost crinit-ctl poweroff || true \
sleep 5 \
",
outs = [
"qemu_run.log",
"ssh_persistency_test_scenarios_run.log",
],
)
33 changes: 33 additions & 0 deletions ebclfsa/persistency_integration/run_qemu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

set -xu

if [ -z "$1" ]; then
echo "Usage: $0 <basefolder>"
exit 1
fi
BASEFOLDER=$1
IMAGE="${BASEFOLDER}/fastdev-ubuntu-ebcl-deb-qemuarm64.wic"
KERNEL="${BASEFOLDER}/fastdev-ubuntu-ebcl-deb-qemuarm64-vmlinux"
if [ ! -d "${BASEFOLDER}" ] || [ ! -f "${IMAGE}" ] || [ ! -f "${KERNEL}" ] ; then
echo "Run \"bazel build --config=aarch64-ebclfsa //persistency_integration:fastdev-image\" first to fetch the image"
fi

MACHINE="virt,virtualization=true,gic-version=3"
CPU="cortex-a53"
SMP="8"
MEM="4G"
KERNEL_ARGS=("-append" "root=/dev/vda1 sdk_enable lisa_syscall_whitelist=2026 rw sharedmem.enable_sharedmem=0 init=/usr/bin/ebclfsa-cflinit")
DISK_ARGS="-device virtio-blk-device,drive=vd0 -drive if=none,format=raw,file=${IMAGE},id=vd0"
NETWORK_ARGS="-netdev user,id=net0,net=192.168.7.0/24,dhcpstart=192.168.7.2,dns=192.168.7.3,host=192.168.7.5,hostfwd=tcp::2222-:22,hostfwd=tcp::3333-:3333 -device virtio-net-device,netdev=net0 "

if ! command -v qemu-system-aarch64 > /dev/null; then
echo "Please install qemu-system-aarch64"
exit 1
fi

chmod +w ${IMAGE}

exec qemu-system-aarch64 -m "${MEM}" -machine "${MACHINE}" -cpu "${CPU}" \
-smp "${SMP}" -kernel "${KERNEL}" "${KERNEL_ARGS[@]}" ${DISK_ARGS} \
${NETWORK_ARGS} -nographic ${@:2}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
# Script to run C++ persistency tests inside the QEMU environment
# Wrapper due to quoting issues when calling directly from Bazel
cpp_tests_persistency --name basic.basic --input '{"kvs_parameters":{"instance_id":0}}'
4 changes: 2 additions & 2 deletions ebclfsa/scrample_integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ genrule(
cmd = " \
$(location run_qemu.sh) $(RULEDIR)/deb-qemuarm64-modified -pidfile $(RULEDIR)/qemu.pid > $(RULEDIR)/qemu_run.log &\
sleep 10 ; \
sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost scrample -n 10 -m send -t 200 -s /etc/mw_com_config.json > $(RULEDIR)/ssh_run.log && \
sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost scrample -n 10 -m send -t 200 -s /etc/mw_com_config.json > $(RULEDIR)/ssh_scrample_run.log && \
sshpass -p linux ssh -o StrictHostKeyChecking=no -p 2222 root@localhost crinit-ctl poweroff || true \
sleep 5 \
",
outs = [
"qemu_run.log",
"ssh_run.log",
"ssh_scrample_run.log",
],
)
2 changes: 1 addition & 1 deletion ebclfsa/scrample_integration/run_qemu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ BASEFOLDER=$1
IMAGE="${BASEFOLDER}/fastdev-ubuntu-ebcl-deb-qemuarm64.wic"
KERNEL="${BASEFOLDER}/fastdev-ubuntu-ebcl-deb-qemuarm64-vmlinux"
if [ ! -d "${BASEFOLDER}" ] || [ ! -f "${IMAGE}" ] || [ ! -f "${KERNEL}" ] ; then
echo "Run \"bazel build --config=aarch64 --spawn_strategy=local //scrample_integration:fastdev-image\" first to fetch the image"
echo "Run \"bazel build --config=aarch64-ebclfsa //scrample_integration:fastdev-image\" first to fetch the image"
fi

MACHINE="virt,virtualization=true,gic-version=3"
Expand Down
Loading