Skip to content

Commit

Permalink
qemu: make it possible to use qemu within a docker container
Browse files Browse the repository at this point in the history
This makes it easier to test different qemu version. Just pointing to
another DOCKER_QEMU_VERSION, instead of request the lab to update the
qemu-workers.

Signed-off-by: Anders Roxell <[email protected]>
  • Loading branch information
roxell committed Nov 12, 2021
1 parent 498f709 commit 7135c15
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions devices/qemu_arm64
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{% set PROJECT = PROJECT|default("") %}
{% extends PROJECT+"qemu.jinja2" %}

{% if USE_DOCKER is defined and USE_DOCKER == true %}
{% set DOCKER_QEMU_BINARY = DOCKER_QEMU_BINARY|default("/usr/bin/qemu-system-aarch64") %}
{% endif %}
{% set DEPLOY_OS = DEPLOY_OS|default("oe") %}
{% set ROOTFS_URL_COMP = ROOTFS_URL_COMP|default("gz") %}
{% set GS_MACHINE = GS_MACHINE|default("virt,accel=kvm") %}
Expand Down
3 changes: 3 additions & 0 deletions devices/qemu_i386
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{% set PROJECT = PROJECT|default("") %}
{% extends PROJECT+"qemu.jinja2" %}

{% if USE_DOCKER is defined and USE_DOCKER == true %}
{% set DOCKER_QEMU_BINARY = DOCKER_QEMU_BINARY|default("/usr/bin/qemu-system-i386") %}
{% endif %}
{% set BOOT_OS_PROMPT = BOOT_OS_PROMPT|default("root@intel-core2-32:") %}
{% set DEPLOY_OS = DEPLOY_OS|default("oe") %}
{% set ROOTFS_URL_COMP = ROOTFS_URL_COMP|default("gz") %}
Expand Down
3 changes: 3 additions & 0 deletions devices/qemu_x86_64
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{% set PROJECT = PROJECT|default("") %}
{% extends PROJECT+"qemu.jinja2" %}

{% if USE_DOCKER is defined and USE_DOCKER == true %}
{% set DOCKER_QEMU_BINARY = DOCKER_QEMU_BINARY|default("/usr/bin/qemu-system-x86_64") %}
{% endif %}
{% set BOOT_OS_PROMPT = BOOT_OS_PROMPT|default("root@intel-corei7-64:") %}
{% set DEPLOY_OS = DEPLOY_OS|default("oe") %}
{% set ROOTFS_URL_COMP = ROOTFS_URL_COMP|default("gz") %}
Expand Down
13 changes: 13 additions & 0 deletions qemu.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,20 @@
{% set TARGET_BOOT_TIMEOUT = TARGET_BOOT_TIMEOUT|default(10) %}
{% set auto_login = auto_login|default(true) %}
{% set AUTO_LOGIN_USERNAME = AUTO_LOGIN_USERNAME|default("root") %}
{% set USE_DOCKER = USE_DOCKER|default(false) %}
{% if USE_DOCKER is defined and USE_DOCKER == true %}
{% set DOCKER_QEMU_CONTAINER = DOCKER_QEMU_CONTAINER|default("linaro/lkft-qemu-should-not-used-for-long") %}
{% set DOCKER_QEMU_VERSION = DOCKER_QEMU_VERSION|default('latest') %}
{% endif %}

{% block global_settings %}
{{ super() }}
{% if guestfs_virtio is defined and guestfs_virtio == true %}
guestfs_interface: virtio
{% endif %}
{% if USE_DOCKER is defined and USE_DOCKER == true %}
netdevice: user
{% endif %}
{% endblock global_settings %}

{% block actions %}
Expand Down Expand Up @@ -153,6 +161,11 @@

{% block boot_target %}
- boot:
{% if USE_DOCKER is defined and USE_DOCKER == true %}
docker:
binary: {{ DOCKER_QEMU_BINARY }}
image: {{ DOCKER_QEMU_CONTAINER}}:{{ DOCKER_QEMU_VERSION}}
{% endif %}
{% if auto_login == true %}
{% include "include/boot_target/auto_login.jinja2" %}
{% block auto_login_commands %}
Expand Down

0 comments on commit 7135c15

Please sign in to comment.