feat: Add EB Linux support to QEMU ITF plugin - #123
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the QEMU ITF plugin beyond the existing QNX -kernel flow to support EB Linux images by adding (a) separate disk image handling and (b) architecture selection (x86_64 vs aarch64). It also updates CI/test configuration to make QEMU-based integration tests easier to run on Linux.
Changes:
- Add architecture abstraction and Linux disk-image support (with ephemeral qcow2 overlay) to the QEMU plugin.
- Add EBclfsa aarch64 QEMU integration-test resources + a new ping integration test target.
- Adjust Bazel/CI config to run the relevant tests/builds on Linux hosts and install QEMU in GitHub Actions.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/BUILD | Restrict selected unit tests to Linux platforms. |
| test/resources/ebclfsa_aarch64/config-overlay/etc/config/network/network | Add static network configuration overlay for EBclfsa image customization. |
| test/resources/ebclfsa_aarch64/build_image.sh | New script to boot EBclfsa image in QEMU and deploy tar payloads into the image. |
| test/resources/ebclfsa_aarch64/BUILD | Add rules to extract fastdev archive and build an ITF-ready EBclfsa image. |
| test/resources/ebclfsa_aarch64_qemu/qemu_config.json | Provide QEMU network/SSH/core/RAM settings for EBclfsa integration tests. |
| test/resources/ebclfsa_aarch64_qemu/kernel_cmdline.txt | Provide Linux kernel cmdline for EBclfsa QEMU boot. |
| test/resources/ebclfsa_aarch64_qemu/BUILD | Export EBclfsa QEMU config artifacts and alias image/kernel targets. |
| test/resources/BUILD | Mark OCI image/load targets as Linux-compatible only. |
| test/integration/test_ebclfsa_ping.py | New integration test validating host↔target connectivity. |
| test/integration/BUILD | Add EBclfsa ping test and include it in the manual QEMU test suite; restrict selected tests to Linux. |
| score/itf/plugins/qemu/qemu.py | Add architecture-aware QEMU command construction; support optional kernel cmdline and disk image. |
| score/itf/plugins/qemu/qemu_target.py | Extend target setup to pass architecture/disk/cmdline into QEMU process creation. |
| score/itf/plugins/qemu/qemu_process.py | Wire new QEMU parameters through the process wrapper. |
| score/itf/plugins/qemu/init.py | Add CLI options for disk image/arch/kernel cmdline and create qcow2 overlays for disk images. |
| MODULE.bazel | Add http_file repo for EBclfsa fastdev archive used by integration resources. |
| .github/workflows/itf.yml | Install QEMU + enable KVM perms in CI for general build/test job. |
| .bazelrc | Add --build_tests_only to the qemu-integration test config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e3ae98a to
bfd4ccf
Compare
clanghans
left a comment
There was a problem hiding this comment.
all points addressed. LGTM
c276dd0 to
d6aa834
Compare
revert unneeded changes
This requires using a different machine and architecture, as well as specifying a kernel and rootfs image with kernel command line parameters.
d6aa834 to
3ac4f26
Compare
| ram="1G", | ||
| cores="2", | ||
| cpu="Cascadelake-Server-v5", | ||
| network_adapters=[], | ||
| port_forwarding=[], |
There was a problem hiding this comment.
why drop default params?
There was a problem hiding this comment.
QemuProcess always sets all of them:
itf/score/itf/plugins/qemu/qemu_process.py
Lines 29 to 35 in 63a3f10
Thus it looked unneeded.
| logger.fatal(f"Qemu is not installed under {qemu_path}") | ||
| sys.exit(-1) | ||
|
|
||
| def __find_available_kvm_support(self): |
There was a problem hiding this comment.
whats wrong with detecting accel and setting accordingly?
There was a problem hiding this comment.
QEMU can do it for us. There is no need to replicate that
| "-accel", | ||
| "kvm", | ||
| "-accel", | ||
| "tcg", |
There was a problem hiding this comment.
isnt hardcoded kvm together with "cpu": "cortex-a53", from SUPPORTED_MACHINES going to crash as CPU will be rejected?
There was a problem hiding this comment.
KVM is the accelerator selected with highest priority. If that is not supported QEMU will select tcg. In this case QNX x86_64 runs with KVM and ebclfsa AARCH64 runs with tcg. If that would crash we would have a failing build already.
| "-device", | ||
| f"{self.__arch_config['block_device']},drive=vd0", | ||
| "-drive", | ||
| f"if=none,format=qcow2,file={self.__rootfs},id=vd0", |
There was a problem hiding this comment.
format hardcoded, use _get_image_format()
There was a problem hiding this comment.
There I can be quite sure that it is qcow2, because that one has been created at https://github.com/elektrobit-contrib/eclipse-score_itf/blob/3ac4f262cda9c6f5dd94fd42f3c3c0d075a36a89/score/itf/plugins/qemu/__init__.py#L37-L61
| if not qemu_kernel and not rootfs: | ||
| raise ValueError("At least one of --qemu-kernel or --qemu-rootfs must be specified for QEMU tests.") |
There was a problem hiding this comment.
Previously omitting --qemu-image gave a QemuTarget(None, config) talking to a booted target
There was a problem hiding this comment.
I see. I wondered what nullcontext() was used for. I will fix it tomorrow
| exports_files( | ||
| [ | ||
| "qemu_config.json", | ||
| ], | ||
| visibility = ["//:__subpackages__"], | ||
| ) |
There was a problem hiding this comment.
is it needed when we have filegroup below?
de6c878 to
816f108
Compare
So far the QEMU plugin code has only been able to run QNX images, which are booted via the
-kernelQEMU parameter. This is not enough for Linux images, where the file system is typically not part of the kernel image. In addition to that the EB Linux image is only compiled for AARCH64 for which some architecture abstraction is also needed.The changes aim to be backwards compatible so that existing code using the current interface of the QEMU ITF plugin stay working without changes.
As drive-by fixes Docker tests have been excluded from QNX test runs. Now
bazel test //test/... --config=qemu-integrationworks as well.Next steps
This is only sufficient to run the image, but uploading binaries and test data is still missing. I can either do this in this PR or to keep it small in a future PR. I also plan to add Ubuntu support, which typically seems to come in conjunction with cloud-init.
PR elektrobit-contrib#1 is a preview of the next changes.