Skip to content

feat: Add EB Linux support to QEMU ITF plugin - #123

Open
lurtz wants to merge 6 commits into
eclipse-score:mainfrom
elektrobit-contrib:add-eb-linux-support-to-qemu-plugin
Open

feat: Add EB Linux support to QEMU ITF plugin#123
lurtz wants to merge 6 commits into
eclipse-score:mainfrom
elektrobit-contrib:add-eb-linux-support-to-qemu-plugin

Conversation

@lurtz

@lurtz lurtz commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

So far the QEMU plugin code has only been able to run QNX images, which are booted via the -kernel QEMU 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-integration works 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread test/resources/ebclfsa_aarch64/build_image.sh Outdated
Comment thread test/resources/ebclfsa_aarch64/build_image.sh Outdated
Comment thread test/resources/ebclfsa_aarch64/build_image.sh Outdated
Comment thread test/resources/ebclfsa_aarch64/BUILD
Comment thread score/itf/plugins/qemu/__init__.py
@lurtz
lurtz force-pushed the add-eb-linux-support-to-qemu-plugin branch from e3ae98a to bfd4ccf Compare July 16, 2026 09:01
@lurtz
lurtz marked this pull request as ready for review July 16, 2026 09:55
Comment thread .github/workflows/itf.yml Outdated
Comment thread .github/workflows/itf.yml Outdated
Comment thread score/itf/plugins/qemu/__init__.py
Comment thread score/itf/plugins/qemu/__init__.py Outdated
Comment thread score/itf/plugins/qemu/qemu.py
Comment thread score/itf/plugins/qemu/__init__.py
Comment thread score/itf/plugins/qemu/__init__.py Outdated

@clanghans clanghans left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all points addressed. LGTM

@lurtz
lurtz force-pushed the add-eb-linux-support-to-qemu-plugin branch from c276dd0 to d6aa834 Compare August 10, 2026 09:31
lurtz added 2 commits August 10, 2026 09:39
This requires using a different machine and architecture, as well as
specifying a kernel and rootfs image with kernel command line
parameters.
@lurtz
lurtz force-pushed the add-eb-linux-support-to-qemu-plugin branch from d6aa834 to 3ac4f26 Compare August 10, 2026 09:40
@lurtz
lurtz enabled auto-merge August 10, 2026 11:34
Comment on lines -30 to -34
ram="1G",
cores="2",
cpu="Cascadelake-Server-v5",
network_adapters=[],
port_forwarding=[],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why drop default params?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QemuProcess always sets all of them:

self._qemu = Qemu(
self._path_to_qemu_image,
self._available_ram,
self._available_cores,
network_adapters=self._network_adapters,
port_forwarding=self._port_forwarding,
)

Thus it looked unneeded.

logger.fatal(f"Qemu is not installed under {qemu_path}")
sys.exit(-1)

def __find_available_kvm_support(self):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whats wrong with detecting accel and setting accordingly?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QEMU can do it for us. There is no need to replicate that

"-accel",
"kvm",
"-accel",
"tcg",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isnt hardcoded kvm together with "cpu": "cortex-a53", from SUPPORTED_MACHINES going to crash as CPU will be rejected?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format hardcoded, use _get_image_format()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread score/itf/plugins/qemu/__init__.py Outdated
Comment on lines +114 to +115
if not qemu_kernel and not rootfs:
raise ValueError("At least one of --qemu-kernel or --qemu-rootfs must be specified for QEMU tests.")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously omitting --qemu-image gave a QemuTarget(None, config) talking to a booted target

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I wondered what nullcontext() was used for. I will fix it tomorrow

Comment thread test/resources/ebclfsa_aarch64/BUILD Outdated
Comment on lines +81 to +86
exports_files(
[
"qemu_config.json",
],
visibility = ["//:__subpackages__"],
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it needed when we have filegroup below?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@lurtz
lurtz force-pushed the add-eb-linux-support-to-qemu-plugin branch from de6c878 to 816f108 Compare August 11, 2026 14:38
draganbjedov
draganbjedov previously approved these changes Aug 12, 2026
@lurtz
lurtz added this pull request to the merge queue Aug 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

5 participants