Skip to content

Commit 1de5ae1

Browse files
committed
autosd integration dir + lola demo
Signed-off-by: Leonardo Rossetti <[email protected]>
1 parent 9c2a586 commit 1de5ae1

16 files changed

+554
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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+
name: Build and Test AutoSD
15+
16+
on:
17+
pull_request:
18+
paths:
19+
- 'autosd/**'
20+
workflow_dispatch:
21+
22+
jobs:
23+
build:
24+
name: build-and-test-autosd
25+
runs-on: ubuntu-latest
26+
defaults:
27+
run:
28+
working-directory: autosd/build
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
34+
- name: Setup Bazel
35+
uses: bazel-contrib/[email protected]
36+
37+
- name: Install System Dependencies
38+
run: |
39+
sudo apt-get update -y
40+
sudo apt-get install -y podman curl qemu-system
41+
42+
- name: Install AIB Tools
43+
run: |
44+
curl -o auto-image-builder.sh "https://gitlab.com/CentOS/automotive/src/automotive-image-builder/-/raw/main/auto-image-builder.sh"
45+
chmod +x auto-image-builder.sh
46+
47+
curl -o automotive-image-runner "https://gitlab.com/CentOS/automotive/src/automotive-image-builder/-/raw/main/automotive-image-runner"
48+
chmod +x automotive-image-runner
49+
50+
- name: Build lola-demo.aib.yml
51+
run: |
52+
sudo ./auto-image-builder.sh build \
53+
--distro autosd10 \
54+
--mode package \
55+
--target qemu \
56+
--export qcow2 \
57+
--define-file vars.yml \
58+
--define-file vars-devel.yml \
59+
lola-demo.aib.yml \
60+
disk.qcow2
61+
62+
sudo chown $(id -u) disk.qcow2
63+
64+
mv disk.qcow2 ../disk.qcow2
65+
66+
- name: Enable KVM group perms
67+
run: |
68+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
69+
sudo udevadm control --reload-rules
70+
sudo udevadm trigger --name-match=kvm
71+
72+
- name: Test QEMU image
73+
run: |
74+
sshcmd() {
75+
sshpass -p "$SSH_PASSWORD" ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 2222 root@localhost $@
76+
}
77+
./scripts/run_qemu
78+
sshcmd 'cat /etc/os-release'
79+
sleep 10
80+
sshcmd 'bluechictl start agent-qm lola-ipc-sub.service'
81+
sleep 5
82+
sshcmd '/usr/local/bin/lola-ipc-test'
83+
working-directory: ./autosd
84+
env:
85+
SSH_PASSWORD: password

autosd/BUILD.bazel

Whitespace-only changes.

autosd/MODULE.bazel

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
module(
14+
name = "score_ri_autosd",
15+
version = "0.0.1",
16+
compatibility_level = 0,
17+
)

autosd/build/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
_build/
2+
outputs/
3+
auto-image-builder.sh
4+
5+
*.qcow2
6+
*.img

autosd/build/README.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
AutoSD MCO LoLa Demo
2+
====================
3+
4+
## Background and Basic Info
5+
6+
This demo build an AutoSD image using [Automotive-Image-Builder](https://gitlab.com/CentOS/automotive/src/automotive-image-builder).
7+
This image comes pre-populated with the S-core's [communication](https://github.com/eclipse-score/communication) project packaged as RPM in a [COPR](https://copr.fedorainfracloud.org/coprs/pingou/score-playground/) repository as well as the [QM](https://github.com/containers/qm) project.
8+
9+
The image is pre-configured to allow the communication project to send and receive messages within the root partition but also between the root partition and the QM partition.
10+
11+
12+
Some things to know about this demo:
13+
- The RPM packaging, currently, doesn't rely on Bazel. This is something that is being fixed, but in the current stage it is not there yet.
14+
- Baselibs and communication have had to get some patches, some of which have already been sent upstream:
15+
- Missing headers: https://github.com/eclipse-score/communication/pull/64
16+
- Missing headers: https://github.com/eclipse-score/baselibs/pull/19
17+
- Compilation issues on newer GCC + support for Linux ARM64: https://github.com/eclipse-score/baselibs/pull/22
18+
- Fix dangling references and compiler warnings for newer GCC: https://github.com/eclipse-score/communication/pull/68
19+
- Fix Google benchmark main function scope: https://github.com/eclipse-score/communication/pull/67
20+
- Other changes have not yet been sent upstream:
21+
- Add the ability to configure the path where communication opens the shared memory segments: https://github.com/eclipse-score/communication/commit/127a64f07f48e1d69783dc20f217da813115dbe6 (not the final version of this change)
22+
23+
The goal of this last commit is to avoid having to mount the entire `/dev/shm` into the QM partition and instead mount just a subfolder: `/dev/shm/lola_qm`.
24+
25+
26+
## Building It
27+
28+
A linux system is required to build this image but Ubuntu
29+
and an OCI compliant container manager (docker, podman) should be enough.
30+
31+
Download the builder script:
32+
33+
```
34+
$ curl -o auto-image-builder.sh \
35+
"https://gitlab.com/CentOS/automotive/src/automotive-image-builder/-/raw/main/auto-image-builder.sh"
36+
$ chmod +x automotive-image-builder
37+
```
38+
39+
Build a qemu image by running:
40+
41+
```
42+
sudo ./auto-image-builder.sh build \
43+
--define-file vars-devel.yml \
44+
--target qemu \
45+
--export qcow2 \
46+
--distro autosd10 lola-demo.aib.yml \
47+
autosd10-lola-x86_64.qcow2
48+
```
49+
50+
Change the image perms (if needed) since `sudo` was used:
51+
52+
```
53+
sudo chown $(logname) autosd10-lola-x86_64.qcow2
54+
```
55+
56+
## Running/Testing the Demo
57+
58+
You can run the qcow2 image with your qemu tool of choice and login into the image (either directly or over ssh)
59+
with `root / password` (developer access defined by `vars-devel`).
60+
61+
The image contains Systemd service defintions for LoLa, in both host and QM environemnts:
62+
63+
- lola-ipc-sub.service
64+
- lola-ipc-pub.service
65+
66+
They can be used in the same environment or between them, to exemplify its mixed critical orchestration integration.
67+
68+
For example, to run the publisher in the host environment while receiving messages in the QM one:
69+
70+
71+
Start the subscriber in the QM partition:
72+
73+
```
74+
# start the service
75+
podman exec -it qm systemctl start lola-ipc-sub
76+
77+
# check status
78+
podman exec -it qm systemctl status lola-ipc-sub
79+
80+
# get logs
81+
podman exec -it qm journalctl -u lola-ipc-sub.service
82+
```
83+
84+
85+
Start a publisher in the host environment:
86+
87+
```
88+
systemctl start lola-ipc-pub
89+
```
90+
91+
Check the QM process logs again with:
92+
93+
```
94+
podman exec -it qm journalctl -u lola-ipc-sub.service
95+
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
[bluechi-agent]
14+
NodeName=agent-main
15+
ControllerAddress=unix:path=/run/bluechi/bluechi.sock
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
[bluechi-agent]
14+
NodeName=agent-qm
15+
ControllerAddress=unix:path=/run/bluechi/bluechi.sock
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
[bluechi-controller]
14+
ControllerPort=2020
15+
UseTCP=true
16+
UseUDS=true
17+
LogLevel=DEBUG
18+
AllowedNodeNames=agent-main,agent-qm
19+
20+
[node agent-main]
21+
Allowed=true
22+
AllowDependenciesOn=agent-main,agent-qm
23+
24+
[node agent-qm]
25+
Allowed=true
26+
AllowDependenciesOn=agent-main,agent-qm
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
[Unit]
14+
Description=LoLa IPC Publisher
15+
After=network.target
16+
17+
[Service]
18+
Type=simple
19+
WorkingDirectory=/usr/share/score-communication/examples/ipc_bridge/etc/
20+
ExecStart=/usr/bin/ipc_bridge_cpp --mode skeleton --num-cycles 5 --cycle-time 1000 --service_instance_manifest mw_com_config.json
21+
Restart=on-failure
22+
RestartSec=5
23+
RemainAfterExit=yes
24+
25+
[Install]
26+
WantedBy=multi-user.target
27+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
[Unit]
14+
Requires=bluechi-proxy@agent-main_lola-ipc-pub.service
15+
Description=LoLa IPC Subscriber
16+
After=network.target
17+
18+
[Service]
19+
WorkingDirectory=/usr/share/score-communication/examples/ipc_bridge/etc/
20+
ExecStart=/usr/bin/ipc_bridge_cpp --mode proxy --num-cycles 5 --cycle-time 1000 --service_instance_manifest mw_com_config.json
21+
Restart=on-failure
22+
RestartSec=5
23+
RemainAfterExit=yes
24+
25+
[Install]
26+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)