You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* chore: Bump devcontainer to v.1.7.0
* doc: remove scrample references in the EB clfsa documentation
The scrample code had been removed already but this document was forgotten.
# Eclipse S-CORE on Elektrobit corbos Linux for Safety Applications
2
2
3
3
This directory shows the integration of Eclipse S-CORE on Elektrobit corbos Linux for Safety Applications.
4
-
It builds an [example based on the Eclipse S-CORE communication framework](https://github.com/eclipse-score/scrample) as demo/test application.
5
-
This application is then [integrated](scrample_integration/) into the so-called "fast-dev" variant of EB corbos Linux for Safety Applications (EBcLfSA).
6
4
This is an `aarch64`-based, pre-built image, capable of demonstraing the execution of high integrity applications in regular Linux user-space.
7
5
The example can be executed using QEMU.
8
6
In the [related CI workflow](../.github/workflows/build_and_test_ebclfsa.yml), all these steps are performed, and the resulting log files are stored and made available for download.
@@ -24,35 +22,34 @@ However, please understand that we cannot advise you about possible costs in you
24
22
> - Copy and paste the following command into the terminal and hit "Enter":
> INFO: 2020 processes: 1502 disk cache hit, 518 internal.
43
+
> INFO: Build completed successfully, 2020 total actions
44
44
>```
45
45
>
46
-
> The two log files mentioned in this output are the main results of the test execution.
47
-
> You can open them by Ctrl-clicking on the output entry.
48
-
>
49
46
> The remainder of this document describes in detail what you have just accomplished.
50
47
>
51
48
> In order to close the Codespace again, first take note of the name of the Codespace.
52
49
> It is a random combination of and adjective and a noun, mentioned in the bottom left of the browser window.
53
50
> Go to your [GitHub Codespaces Dashboard](https://github.com/codespaces), find the Codespace in your list, click on the "..."in that row and select"Delete".
54
51
>
55
-
> Note that the demo can, of course, als run locally on your computer.
52
+
> Note that the demo can, of course, also run locally on your computer.
56
53
> Clone the repository, open it in Visual Studio Code, start the supplied Development Container, and run the demo as described above.
57
54
> This requires a setup that can run [Development Containers](https://containers.dev/) using [Visual Studio Code](https://code.visualstudio.com/).
58
55
> The [Visual Studio Code documentation](https://code.visualstudio.com/docs/devcontainers/containers) can be a good starting point; however, an in-depth explanation of this is beyond the goals of this Quick Start.
@@ -103,7 +100,7 @@ Current restrictions:
103
100
104
101
The current integration setup is based on a non-safety-certified set of a toolchain and standard libraries.
105
102
As a result, an application compiled and linked with the provided example toolchain will generate system call violations.
106
-
For the used communication example app this happens during application startup/teardown and is indicated by the occurrence of `ioctl`,`clone3` and `madvice` system calls.
103
+
In the communication example of the [`score_starter`](../../score_starter) this happens during application startup/teardown and is indicated by the occurrence of `ioctl`,`clone3` and `madvice` system calls.
107
104
108
105
The full product version intended for production implements process and memory management for high integrity applications according to the C Standard Library.
109
106
When using other standard library implementations, `clone3` and `madvice` might be called.
@@ -130,7 +127,7 @@ The user-space of the pre-built image consists of three main components:
130
127
131
128
The system itself is able to run without any Eclipse S-CORE demo applications.
132
129
Nevertheless, the trampoline application already provides an entry point for a subsequently deployed application binary.
133
-
This entry point is used by the [Eclipse S-CORE Example](#eclipse-s-core-example) application.
130
+
This entry point is used by the [showcases/cli](../../showcases/cli/README.md) application.
134
131
135
132
### Trampoline App (cflinit)
136
133
@@ -140,21 +137,6 @@ Besides the HI applications, it starts [crinit](https://gitext.elektrobitautomot
140
137
which brings up the regular (low integrity) Linux user-land.
141
138
Once all apps are started, it sleeps forever.
142
139
143
-
Below you can see the output generated by `cflinit`.
144
-
145
-
```console
146
-
cflinit: INFO: Hello from EBcLfSA HI init application
147
-
cflinit: INFO: Mounted tmpfs to /dev/shm
148
-
cflinit: INFO: Starting application crinit
149
-
cflinit: INFO: Starting application HI App
150
-
cflinit: ERROR: Could not read /usr/bin/hi_app (2)
151
-
cflinit: INFO: Starting application EBcLfSA HI demo
152
-
cflinit: INFO: Starting application EBcLfSA HI upper
153
-
cflinit: INFO: Finished starting child applications; going to sleep
154
-
```
155
-
156
-
As long as the Eclipse S-CORE example is not yet deployed (detected by a missing `/usr/bin/hi_app` binary) the above `ERROR` occurs and `cflinit` skips starting it.
157
-
158
140
### EBcLfSA HI Demo
159
141
160
142
For technical reasons, the image contains also a secondary demo, with the executables `ebclfsa-hi-demo`, `ebclfsa-hi-upper`, and `ebclfsa-li-demo`.
@@ -197,201 +179,13 @@ to build and deploy the example.
197
179
And please also look at the shortcuts we implemented in the Visual Studio Code workspace to speed up the usage of the application example.
198
180
You find them at the end of this section.
199
181
200
-
### Application Setup
201
-
202
-
The application setup is constructed of two instances of the `scrample` application, a high integrity (HI) instance acting as receiver and a low integrity (LI) instance acting as sender.
203
-
The HI instance is started automatically by `cflinit` and listens in background.
204
-
You start the LI instance manually in a terminal to run the demo.
205
-
Even though both instances rely on the same source code, they do not use the same application binary.
206
-
The HI application instance uses a binary located at `/usr/bin/scrample_sil` with a marked ELF-header, while the unmodified binary for the LI application is located at `/usr/bin/scrample`.
207
-
208
-
The application instances are called with the following arguments:
In order to have those arguments changeable, the HI arguments are not hardcoded into `cflinit`.
217
-
Instead, `cflinit` calls a small wrapper binary `/usr/bin/hi_app` which is based on the implementation in `scrample_integration/src/main.cc`.
218
-
When `hi_app` is executed by `cflinit`, it simply calls `execve` on `/usr/bin/scrample_sil` with the correct set of arguments.
219
-
This way `cflinit` keeps its static entrypoint for the Eclipse S-CORE example app, while the user is still able to specify the used arguments for the HI `scrample` instance.
220
-
221
182
### S-CORE Toolchain in Linux for Safety Applications
222
183
223
184
The demo SDK integrates the [S-CORE toolchain with two extensions](https://github.com/elektrobit-contrib/eclipse-score_toolchains_gcc/releases/tag/0.5.0-beta):
224
185
225
186
- Additional tooling for AArch64 cross-building.
226
187
- Additional tool `lisa-elf-enabler`: It marks an ELF header of an application in a way that Linux for Safety Applications detects it as an HI application.
227
188
228
-
### Bazel Rules for the Example Applications
229
-
230
-
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.
231
-
With those changes, the toolchain can be used via `bazel build --config=eb-aarch64 //images/ebclfsa_aarch64/scrample_integration:<target>`.
232
-
233
-
> [!IMPORTANT]
234
-
> Building inside a sandbox is currently not possible.
235
-
236
-
For building and running the example setup, the following Bazel rules have been created in `scrample_integration/BUILD`:
237
-
238
-
| Target | Dependencies | Description |
239
-
| ------ | ------------ | ----------- |
240
-
| `scrample_sil` | `@score_scrample//src:scrample` | Create copy of `scrample` at `scrample_sil` and add CRC checksum to ELF-header |
This command will take a while to finish, since it performs some downloads and starts the fast-dev image.
259
-
After successful execution LI application instance can be seen in the `ssh_run.log`:
260
-
261
-
```console
262
-
Starting to send data
263
-
Sending sample: 0
264
-
Sending sample: 1
265
-
Sending sample: 2
266
-
Sending sample: 3
267
-
Sending sample: 4
268
-
Sending sample: 5
269
-
Sending sample: 6
270
-
Sending sample: 7
271
-
Sending sample: 8
272
-
Sending sample: 9
273
-
Stop offering service...and terminating, bye bye
274
-
```
275
-
276
-
`qemu_run.log` provides the serial console output of the started fast-dev image, including the following noteworthy parts:
277
-
278
-
1. `cflinit` starting `hi_app` as HI application:
279
-
280
-
```console
281
-
cflinit: INFO: Starting application HI App
282
-
```
283
-
284
-
2. `hi_app` starting `scrample_sil` as HI application:
285
-
286
-
```console
287
-
HI_App: Starting scrample_sil
288
-
```
289
-
290
-
3. The logs from `scrample_sil` as receiver itself
291
-
292
-
```console
293
-
1970/01/01 00:00:01.1905 19125 000 ECU1 IPBR lola log info verbose 2 No explicit applicationID configured. Falling back to using process UID. Ensure unique UIDs for applications using mw::com.
294
-
...
295
-
1970/01/01 00:00:10.10215 102158 000 ECU1 IPBR lola log info verbose 2 Successfully created offer path /tmp/mw_com_lola/service_discovery/6432/1
296
-
score/MapApiLanesStamped: Subscribing to service
297
-
score/MapApiLanesStamped: Received sample: 0
298
-
score/MapApiLanesStamped: Received sample: 1
299
-
score/MapApiLanesStamped: Proxy received valid data
300
-
score/MapApiLanesStamped: Cycle duration 225ms
301
-
score/MapApiLanesStamped: Received sample: 2
302
-
score/MapApiLanesStamped: Proxy received valid data
303
-
score/MapApiLanesStamped: Cycle duration 206ms
304
-
...
305
-
score/MapApiLanesStamped: Received sample: 9
306
-
score/MapApiLanesStamped: Proxy received valid data
307
-
score/MapApiLanesStamped: Cycle duration 202ms
308
-
score/MapApiLanesStamped: Unsubscribing...
309
-
score/MapApiLanesStamped: and terminating, bye bye
310
-
```
311
-
312
-
4. Kernel logs indicating that some performed system calls would not be allowed on a production system.
313
-
For more information on this, check the [previous section](#application--and-integration-specific-violation-of-system-call-restrictions) on application- and integration-specific syscall violations.
314
-
315
-
```console
316
-
SDK:handler_do_el0_svc_pre: syscall __NR_clone3 (435) is not allowed
317
-
```
318
-
319
-
### Building the Application
320
-
321
-
Building all components of the example application can be performed with the `hi_app` rule.
This will first download the image via the `fetch-fastdev-archive` rule and cache the archive.
339
-
Afterwards, the `fastdev-image` rule extracts the archive (containing a disk image and a kernel) to `bazel-bin/images/ebclfsa_aarch64/scrample_integration/ebcl-qemuarm64/`.
340
-
341
-
To start the unmodified base image (without the Eclipse S-CORE example application) manually, the included `run_qemu.sh` script can be used.
This is of course optional, and only needed if a deeper manual look into the image is wished.
348
-
After the image has started up, the password `linux` can be used for the `root` user for login.
349
-
The ssh port of the qemu instance is forwarded to `localhost:2222`.
350
-
Therefore `ssh` and `scp` can be used with the same credentials from inside the development container.
351
-
352
-
```bash
353
-
ssh -p 2222 root@localhost
354
-
```
355
-
356
-
> [!NOTE]
357
-
> Be aware, that running the image via qemu, will change the stored disk image.
358
-
> Bazel will detect this change and overwrite the disk image with the original one from the downloaded archive.
359
-
> If it is planned to have persistent changes on the image, copy the content of `bazel-bin/images/ebclfsa_aarch64/scrample_integration/ebcl-qemuarm64/` to a location outside of `bazel-bin` and adapt the command line argument in the above `run_qemu.sh` call accordingly.
360
-
361
-
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`.
Since the deployment step will change the stored disk image, the `upload` rule stores its output in `bazel-bin/images/ebclfsa_aarch64/scrample_integration/ebcl-qemuarm64-modified/`.
368
-
Running the image with the deployed example applications works the same way as before, just with a different folder for the used image and kernel:
Note that due to the nature of the `scrample_sil` application, which shuts down after having received the defined amount of samples, this command works only once per boot-cycle.
382
-
383
-
To reboot or power-off the running image, `crinit-ctl` with the command line argument `reboot` or `poweroff` can be used.
384
-
385
-
```bash
386
-
# Reboot
387
-
crinit-ctl reboot
388
-
# Poweroff
389
-
crinit-ctl poweroff
390
-
```
391
-
392
189
## Further notes
393
190
394
191
* The toolchain and librares are provided for demonstration and prototyping purposes without further qualification.
395
-
* A second test case for S-CORE persistency is also integrated. You can run it via
0 commit comments