All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/2] releases: build and run any QEMU release easily!
@ 2026-10-26 21:07 Pierrick Bouvier
  2026-10-26 21:08 ` [PATCH v4 1/2] tests/docker/dockerfiles: add release.docker Pierrick Bouvier
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Pierrick Bouvier @ 2026-10-26 21:07 UTC (permalink / raw)
  To: qemu-devel
  Cc: peterx, Alex Bennée, mjt, Philippe Mathieu-Daudé,
	Fabiano Rosas, Pierrick Bouvier

This series was inspired by a recent post from Fabiano to provide container
images for migration tests:
https://lore.kernel.org/qemu-devel/24d04a1f-344d-4b90-a307-b582dd9a1128@oss.qualcomm.com/T/#m353f119dc1a24fa437dde8a96d1891629e64303c

The idea to be able to build and run any QEMU (past) release with containers was
in my mind for some time, so I gave it a shot. Finally, it was easier than
expected to obtain a single dockerfile (with a few hacks) that works over all
our releases.

Images have the absolute minimal content possible. It's only qemu binaries,
artifacts (roms, keymap, ...), and libraries. There is no shell or any other
tool included. As a result, images have a size from 581MB (v3.1.0) to 1.1GB
(v11.1.2).

This series adds:
- a unique dockerfile to build any QEMU release. User has to provide an explicit
  Ubuntu version when building a given QEMU version.
- A script build_release_container.sh which automatically detects which ubuntu
  version a given release should be buildable on (based on date). It works
  great, and the heuristic works for all our versions.

TLDR:
$ ./scripts/build_release_container.sh v3.1.0
$ podman run -it --rm qemu/v3.1.0 qemu-system-arm --version

v4
--

- supports build for any version (tag or sha-1)
- adds an optional parameter to build_release_container.sh to use an alternative
  URL for QEMU repo
- simplified Dockerfile by supporting any version >= 3.1.0.
- removed patch 3 generating wrappers to published docker images

v3
--

- extend dockerfile to support ubuntu 12.04, and lower older revision we can
  build from v1.6.1 to v0.12.0.

v2
--

- fix generate_release_links.sh: was missing userns option for podman
- dockerfile: cleanup "|| true" and replaced with proper ifs

Pierrick Bouvier (2):
  tests/docker/dockerfiles: add release.docker
  scripts: add build_release_container.sh

 scripts/build_release_container.sh      | 63 +++++++++++++++++++++++++
 tests/docker/dockerfiles/release.docker | 48 +++++++++++++++++++
 2 files changed, 111 insertions(+)
 create mode 100755 scripts/build_release_container.sh
 create mode 100644 tests/docker/dockerfiles/release.docker

-- 
2.43.0



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v4 1/2] tests/docker/dockerfiles: add release.docker
  2026-10-26 21:07 [PATCH v4 0/2] releases: build and run any QEMU release easily! Pierrick Bouvier
@ 2026-10-26 21:08 ` Pierrick Bouvier
  2026-10-28 23:00   ` Fabiano Rosas
  2026-10-26 21:08 ` [PATCH v4 2/2] scripts: add build_release_container.sh Pierrick Bouvier
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Pierrick Bouvier @ 2026-10-26 21:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: peterx, Alex Bennée, mjt, Philippe Mathieu-Daudé,
	Fabiano Rosas, Pierrick Bouvier

This new dockerfile allows to build a distroless image containing only
qemu stripped release binaries, their lib dependencies, and installed
artifacts (roms, keymap, ...). There is no shell, no python, nothing
else. This is achieved thanks to a multi-stage build, where we add qemu
binaries, artifacts and libraries in a new scratch image. Image has
the minimal size possible.

This is based on Ubuntu, which has the advantage to have working
containers available down to 14.04. Debian old old stable have broken
apt sources for instance.

This unique dockerfile works for all qemu versions >= 3.1.0 (2018).
We could build down to v0.12.0, but it would require more tweaks in the
dockerfile, so we keep it simple instead.

To build the image, you need to provide a qemu and ubuntu version:
$ podman build -f release.Dockerfile --build-arg QEMU_VERSION=v11.1.0 --build-arg UBUNTU_VERSION=24.04 -t qemu/v11.1.0

To run it, as there is no shell, and no defined entrypoint, you need to
choose the binary you want explicitely:
$ podman run -it --rm qemu/v11.1.0 qemu-system-aarch64 --version

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 tests/docker/dockerfiles/release.docker | 48 +++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 tests/docker/dockerfiles/release.docker

diff --git a/tests/docker/dockerfiles/release.docker b/tests/docker/dockerfiles/release.docker
new file mode 100644
index 00000000000..ca6babde01e
--- /dev/null
+++ b/tests/docker/dockerfiles/release.docker
@@ -0,0 +1,48 @@
+ARG UBUNTU_VERSION="UBUNTU_VERSION_build_arg_must_be_set"
+
+FROM ubuntu:$UBUNTU_VERSION AS build
+
+# add deb-src for apt build-dep
+RUN sed -e 's/Types: deb/Types: deb deb-src/' -i /etc/apt/sources.list.d/* || true
+RUN sed -e 's/# deb-src/deb-src/' -i /etc/apt/sources.list
+# archive.canonical.com is not reachable anymore, and cause a long timeout
+RUN sed -e '/archive.canonical.com/d' -i /etc/apt/sources.list
+
+# build dependencies
+RUN apt update && \
+env DEBIAN_FRONTEND=noninteractive apt install -y git build-essential flex bison
+RUN apt update && \
+env DEBIAN_FRONTEND=noninteractive apt build-dep -y --arch-only qemu
+
+ARG QEMU_VERSION
+RUN echo "QEMU_VERSION=${QEMU_VERSION:?QEMU_VERSION build arg must be set}"
+ARG QEMU_REPO="https://gitlab.com/qemu-project/qemu.git"
+
+RUN cd /tmp && \
+mkdir qemu && cd qemu && git init && \
+git remote add origin "${QEMU_REPO}" && \
+git fetch origin "${QEMU_VERSION}" --depth 1 && \
+git checkout FETCH_HEAD && \
+./configure --prefix=/opt/qemu --disable-docs --disable-werror && \
+make install -j $(nproc) && \
+strip /opt/qemu/bin/* && \
+rm -rf /tmp/*
+
+# retrieve runtime dependencies (libs)
+RUN ldd /opt/qemu/bin/* | grep '=>' | sed -e 's/.*=>//' -e 's/(.*//' | sort -u > /opt/qemu/libs
+# store them in /deps/lib
+RUN mkdir -p /deps/lib && cp --preserve --dereference $(cat /opt/qemu/libs) /deps/lib
+# copy loader (with its original path)
+RUN cp --preserve --parents --dereference /lib*/ld-linux* /deps/
+
+################################################################################
+FROM scratch
+
+COPY --from=build /deps /
+# copy qemu and all associated artifacts (roms, ...)
+COPY --from=build /opt/qemu /usr
+
+# build with:
+# podman build -f release.docker --build-arg QEMU_VERSION=v11.1.0 --build-arg UBUNTU_VERSION=24.04 -t qemu/v11.1.0
+# run with:
+# podman run -it --rm qemu/v11.1.0 qemu-system-aarch64 --version
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v4 2/2] scripts: add build_release_container.sh
  2026-10-26 21:07 [PATCH v4 0/2] releases: build and run any QEMU release easily! Pierrick Bouvier
  2026-10-26 21:08 ` [PATCH v4 1/2] tests/docker/dockerfiles: add release.docker Pierrick Bouvier
@ 2026-10-26 21:08 ` Pierrick Bouvier
  2026-10-28 23:00   ` Fabiano Rosas
  2026-10-27  3:26 ` [PATCH v4 0/2] releases: build and run any QEMU release easily! Philippe Mathieu-Daudé
  2026-10-29  0:10 ` Pierrick Bouvier
  3 siblings, 1 reply; 8+ messages in thread
From: Pierrick Bouvier @ 2026-10-26 21:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: peterx, Alex Bennée, mjt, Philippe Mathieu-Daudé,
	Fabiano Rosas, Pierrick Bouvier

This script allows to easily build a qemu release container, based on
dockerfile introduced in previous commit.

It names image "qemu/$version" and automatically detects which ubuntu
version should be used to build it.

$ ./scripts/build_release_container.sh v3.1.0
$ podman run -it --rm qemu/v3.1.0 qemu-system-arm --version
QEMU emulator version 3.1.0 (-dirty)
Copyright (c) 2003-2018 Fabrice Bellard and the QEMU Project developers

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
---
 scripts/build_release_container.sh | 63 ++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100755 scripts/build_release_container.sh

diff --git a/scripts/build_release_container.sh b/scripts/build_release_container.sh
new file mode 100755
index 00000000000..ae57aa21db3
--- /dev/null
+++ b/scripts/build_release_container.sh
@@ -0,0 +1,63 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+set -euo pipefail
+
+script_dir=$(dirname $(readlink -f $0))
+
+# The oldest buildable release we support is v3.1.0, as previous ones require
+# additional tweaks in Dockerfile.
+# For building previous releases (down to v0.12.0),
+# see: 20261014005338.34657-1-pierrick.bouvier@oss.qualcomm.com
+oldest_release=v3.1.0
+
+if [ $# -lt 1 ] || [ $# -gt 2 ]; then
+    echo "usage: version [git_repo]"
+    echo
+    echo "- version: tag or sha-1 (>= v3.1.0)"
+    echo "- git_repo: (optional) QEMU repository URL"
+    exit 1
+fi
+version=$1;shift
+
+git_repo="https://gitlab.com/qemu-project/qemu.git"
+if [ $# -eq 1 ]; then
+    git_repo=$1;shift
+fi
+
+year=$(date +%Y)
+month=$(date +%m)
+if git rev-parse $version >& /dev/null; then
+    year=$(git log -1 --format='%cd' --date='format:%Y' $version)
+    month=$(git log -1 --format='%cd' --date='format:%m' $version)
+fi
+
+# Ubuntu LTS are published every (even) two years in April.
+ubuntu=
+if [ $((year % 2)) -eq 1 ]; then
+    # pick latest LTS from previous year
+    ubuntu=$((year - 1))
+elif [ $month -gt 6 ]; then
+    # LTS published this year should work
+    ubuntu=$year
+else
+    # pick latest LTS from two years ago
+    ubuntu=$((year - 2))
+fi
+if [ $ubuntu -lt 2014 ]; then
+    # oldest ubuntu release available with containers is 14.04
+    ubuntu=2014
+fi
+ubuntu=$((ubuntu - 2000))
+ubuntu_version=$ubuntu.04
+
+dockerfile=$script_dir/../tests/docker/dockerfiles/release.docker
+docker=$($script_dir/../tests/docker/docker.py probe)
+
+set -x
+$docker build \
+    -f $dockerfile \
+    --build-arg QEMU_VERSION=$version \
+    --build-arg UBUNTU_VERSION=$ubuntu_version \
+    --build-arg QEMU_REPO="$git_repo" \
+    -t qemu/$version
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 0/2] releases: build and run any QEMU release easily!
  2026-10-26 21:07 [PATCH v4 0/2] releases: build and run any QEMU release easily! Pierrick Bouvier
  2026-10-26 21:08 ` [PATCH v4 1/2] tests/docker/dockerfiles: add release.docker Pierrick Bouvier
  2026-10-26 21:08 ` [PATCH v4 2/2] scripts: add build_release_container.sh Pierrick Bouvier
@ 2026-10-27  3:26 ` Philippe Mathieu-Daudé
  2026-10-29  0:10 ` Pierrick Bouvier
  3 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-10-27  3:26 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel; +Cc: peterx, Alex Bennée, mjt, Fabiano Rosas

On 26/10/26 22:07, Pierrick Bouvier wrote:
> This series was inspired by a recent post from Fabiano to provide container
> images for migration tests:
> https://lore.kernel.org/qemu-devel/24d04a1f-344d-4b90-a307-b582dd9a1128@oss.qualcomm.com/T/#m353f119dc1a24fa437dde8a96d1891629e64303c
> 
> The idea to be able to build and run any QEMU (past) release with containers was
> in my mind for some time, so I gave it a shot. Finally, it was easier than
> expected to obtain a single dockerfile (with a few hacks) that works over all
> our releases.
> 
> Images have the absolute minimal content possible. It's only qemu binaries,
> artifacts (roms, keymap, ...), and libraries. There is no shell or any other
> tool included. As a result, images have a size from 581MB (v3.1.0) to 1.1GB
> (v11.1.2).
> 
> This series adds:
> - a unique dockerfile to build any QEMU release. User has to provide an explicit
>    Ubuntu version when building a given QEMU version.
> - A script build_release_container.sh which automatically detects which ubuntu
>    version a given release should be buildable on (based on date). It works
>    great, and the heuristic works for all our versions.
> 
> TLDR:
> $ ./scripts/build_release_container.sh v3.1.0
> $ podman run -it --rm qemu/v3.1.0 qemu-system-arm --version
> 
> v4
> --
> 
> - supports build for any version (tag or sha-1)
> - adds an optional parameter to build_release_container.sh to use an alternative
>    URL for QEMU repo
> - simplified Dockerfile by supporting any version >= 3.1.0.
> - removed patch 3 generating wrappers to published docker images
> 
> v3
> --
> 
> - extend dockerfile to support ubuntu 12.04, and lower older revision we can
>    build from v1.6.1 to v0.12.0.

I haven't read the previous version discussions but so far this is
useful enough to me, so series:
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>

For my bisections I have a crazy script that adapt the ./configure
options between commits (when they are added / removed / renamed
like in [*]); it only covers the options I use. I'm adding to my
TODO a remember to polish and post.

[*] 
https://lore.kernel.org/qemu-devel/CAAdtpL7p+BG=O8b4+fjAhGO4y-ongpcYX0N5gcLDSYq8q9z2Rg@mail.gmail.com/

> 
> v2
> --
> 
> - fix generate_release_links.sh: was missing userns option for podman
> - dockerfile: cleanup "|| true" and replaced with proper ifs
> 
> Pierrick Bouvier (2):
>    tests/docker/dockerfiles: add release.docker
>    scripts: add build_release_container.sh
> 
>   scripts/build_release_container.sh      | 63 +++++++++++++++++++++++++
>   tests/docker/dockerfiles/release.docker | 48 +++++++++++++++++++
>   2 files changed, 111 insertions(+)
>   create mode 100755 scripts/build_release_container.sh
>   create mode 100644 tests/docker/dockerfiles/release.docker
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 2/2] scripts: add build_release_container.sh
  2026-10-26 21:08 ` [PATCH v4 2/2] scripts: add build_release_container.sh Pierrick Bouvier
@ 2026-10-28 23:00   ` Fabiano Rosas
  2026-10-29  0:01     ` Pierrick Bouvier
  0 siblings, 1 reply; 8+ messages in thread
From: Fabiano Rosas @ 2026-10-28 23:00 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: peterx, Alex Bennée, mjt, Philippe Mathieu-Daudé,
	Pierrick Bouvier

Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> writes:

> This script allows to easily build a qemu release container, based on
> dockerfile introduced in previous commit.
>
> It names image "qemu/$version" and automatically detects which ubuntu
> version should be used to build it.
>
> $ ./scripts/build_release_container.sh v3.1.0
> $ podman run -it --rm qemu/v3.1.0 qemu-system-arm --version
> QEMU emulator version 3.1.0 (-dirty)
> Copyright (c) 2003-2018 Fabrice Bellard and the QEMU Project developers
>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
> ---
>  scripts/build_release_container.sh | 63 ++++++++++++++++++++++++++++++
>  1 file changed, 63 insertions(+)
>  create mode 100755 scripts/build_release_container.sh
>
> diff --git a/scripts/build_release_container.sh b/scripts/build_release_container.sh
> new file mode 100755
> index 00000000000..ae57aa21db3
> --- /dev/null
> +++ b/scripts/build_release_container.sh
> @@ -0,0 +1,63 @@
> +#!/usr/bin/env bash
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +set -euo pipefail
> +
> +script_dir=$(dirname $(readlink -f $0))
> +
> +# The oldest buildable release we support is v3.1.0, as previous ones require
> +# additional tweaks in Dockerfile.
> +# For building previous releases (down to v0.12.0),
> +# see: 20261014005338.34657-1-pierrick.bouvier@oss.qualcomm.com
> +oldest_release=v3.1.0
> +
> +if [ $# -lt 1 ] || [ $# -gt 2 ]; then
> +    echo "usage: version [git_repo]"
> +    echo
> +    echo "- version: tag or sha-1 (>= v3.1.0)"
> +    echo "- git_repo: (optional) QEMU repository URL"
> +    exit 1
> +fi
> +version=$1;shift
> +
> +git_repo="https://gitlab.com/qemu-project/qemu.git"
> +if [ $# -eq 1 ]; then
> +    git_repo=$1;shift
> +fi
> +
> +year=$(date +%Y)
> +month=$(date +%m)
> +if git rev-parse $version >& /dev/null; then
> +    year=$(git log -1 --format='%cd' --date='format:%Y' $version)
> +    month=$(git log -1 --format='%cd' --date='format:%m' $version)
> +fi
> +
> +# Ubuntu LTS are published every (even) two years in April.
> +ubuntu=
> +if [ $((year % 2)) -eq 1 ]; then
> +    # pick latest LTS from previous year
> +    ubuntu=$((year - 1))
> +elif [ $month -gt 6 ]; then
> +    # LTS published this year should work
> +    ubuntu=$year
> +else
> +    # pick latest LTS from two years ago
> +    ubuntu=$((year - 2))
> +fi
> +if [ $ubuntu -lt 2014 ]; then
> +    # oldest ubuntu release available with containers is 14.04
> +    ubuntu=2014
> +fi
> +ubuntu=$((ubuntu - 2000))
> +ubuntu_version=$ubuntu.04
> +
> +dockerfile=$script_dir/../tests/docker/dockerfiles/release.docker
> +docker=$($script_dir/../tests/docker/docker.py probe)

For docker this gives:

 ERROR: docker: 'docker buildx build' requires 1 argument                                                                                                                      
 Usage:  docker buildx build [OPTIONS] PATH | URL | -

I think it expects a . or - since the dockerfile is passed with -f
below. Going back to

  docker=$script_dir/../tests/docker/docker.py

makes it work.

> +
> +set -x
> +$docker build \
> +    -f $dockerfile \
> +    --build-arg QEMU_VERSION=$version \
> +    --build-arg UBUNTU_VERSION=$ubuntu_version \
> +    --build-arg QEMU_REPO="$git_repo" \
> +    -t qemu/$version


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 1/2] tests/docker/dockerfiles: add release.docker
  2026-10-26 21:08 ` [PATCH v4 1/2] tests/docker/dockerfiles: add release.docker Pierrick Bouvier
@ 2026-10-28 23:00   ` Fabiano Rosas
  0 siblings, 0 replies; 8+ messages in thread
From: Fabiano Rosas @ 2026-10-28 23:00 UTC (permalink / raw)
  To: Pierrick Bouvier, qemu-devel
  Cc: peterx, Alex Bennée, mjt, Philippe Mathieu-Daudé,
	Pierrick Bouvier

Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> writes:

> This new dockerfile allows to build a distroless image containing only
> qemu stripped release binaries, their lib dependencies, and installed
> artifacts (roms, keymap, ...). There is no shell, no python, nothing
> else. This is achieved thanks to a multi-stage build, where we add qemu
> binaries, artifacts and libraries in a new scratch image. Image has
> the minimal size possible.
>
> This is based on Ubuntu, which has the advantage to have working
> containers available down to 14.04. Debian old old stable have broken
> apt sources for instance.
>
> This unique dockerfile works for all qemu versions >= 3.1.0 (2018).
> We could build down to v0.12.0, but it would require more tweaks in the
> dockerfile, so we keep it simple instead.
>
> To build the image, you need to provide a qemu and ubuntu version:
> $ podman build -f release.Dockerfile --build-arg QEMU_VERSION=v11.1.0 --build-arg UBUNTU_VERSION=24.04 -t qemu/v11.1.0
>
> To run it, as there is no shell, and no defined entrypoint, you need to
> choose the binary you want explicitely:
> $ podman run -it --rm qemu/v11.1.0 qemu-system-aarch64 --version
>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
> ---
>  tests/docker/dockerfiles/release.docker | 48 +++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
>  create mode 100644 tests/docker/dockerfiles/release.docker
>
> diff --git a/tests/docker/dockerfiles/release.docker b/tests/docker/dockerfiles/release.docker
> new file mode 100644
> index 00000000000..ca6babde01e
> --- /dev/null
> +++ b/tests/docker/dockerfiles/release.docker
> @@ -0,0 +1,48 @@
> +ARG UBUNTU_VERSION="UBUNTU_VERSION_build_arg_must_be_set"
> +
> +FROM ubuntu:$UBUNTU_VERSION AS build
> +
> +# add deb-src for apt build-dep
> +RUN sed -e 's/Types: deb/Types: deb deb-src/' -i /etc/apt/sources.list.d/* || true
> +RUN sed -e 's/# deb-src/deb-src/' -i /etc/apt/sources.list
> +# archive.canonical.com is not reachable anymore, and cause a long timeout
> +RUN sed -e '/archive.canonical.com/d' -i /etc/apt/sources.list
> +
> +# build dependencies
> +RUN apt update && \
> +env DEBIAN_FRONTEND=noninteractive apt install -y git build-essential flex bison
> +RUN apt update && \
> +env DEBIAN_FRONTEND=noninteractive apt build-dep -y --arch-only qemu
> +
> +ARG QEMU_VERSION
> +RUN echo "QEMU_VERSION=${QEMU_VERSION:?QEMU_VERSION build arg must be set}"
> +ARG QEMU_REPO="https://gitlab.com/qemu-project/qemu.git"
> +
> +RUN cd /tmp && \
> +mkdir qemu && cd qemu && git init && \
> +git remote add origin "${QEMU_REPO}" && \
> +git fetch origin "${QEMU_VERSION}" --depth 1 && \
> +git checkout FETCH_HEAD && \
> +./configure --prefix=/opt/qemu --disable-docs --disable-werror && \
> +make install -j $(nproc) && \
> +strip /opt/qemu/bin/* && \
> +rm -rf /tmp/*
> +
> +# retrieve runtime dependencies (libs)
> +RUN ldd /opt/qemu/bin/* | grep '=>' | sed -e 's/.*=>//' -e 's/(.*//' | sort -u > /opt/qemu/libs
> +# store them in /deps/lib
> +RUN mkdir -p /deps/lib && cp --preserve --dereference $(cat /opt/qemu/libs) /deps/lib
> +# copy loader (with its original path)
> +RUN cp --preserve --parents --dereference /lib*/ld-linux* /deps/
> +
> +################################################################################
> +FROM scratch
> +
> +COPY --from=build /deps /
> +# copy qemu and all associated artifacts (roms, ...)
> +COPY --from=build /opt/qemu /usr
> +
> +# build with:
> +# podman build -f release.docker --build-arg QEMU_VERSION=v11.1.0 --build-arg UBUNTU_VERSION=24.04 -t qemu/v11.1.0
> +# run with:
> +# podman run -it --rm qemu/v11.1.0 qemu-system-aarch64 --version

Reviewed-by: Fabiano Rosas <farosas@suse.de>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 2/2] scripts: add build_release_container.sh
  2026-10-28 23:00   ` Fabiano Rosas
@ 2026-10-29  0:01     ` Pierrick Bouvier
  0 siblings, 0 replies; 8+ messages in thread
From: Pierrick Bouvier @ 2026-10-29  0:01 UTC (permalink / raw)
  To: Fabiano Rosas, qemu-devel
  Cc: peterx, Alex Bennée, mjt, Philippe Mathieu-Daudé

On 10/28/2026 3:00 PM, Fabiano Rosas wrote:
> Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> writes:
> 
>> This script allows to easily build a qemu release container, based on
>> dockerfile introduced in previous commit.
>>
>> It names image "qemu/$version" and automatically detects which ubuntu
>> version should be used to build it.
>>
>> $ ./scripts/build_release_container.sh v3.1.0
>> $ podman run -it --rm qemu/v3.1.0 qemu-system-arm --version
>> QEMU emulator version 3.1.0 (-dirty)
>> Copyright (c) 2003-2018 Fabrice Bellard and the QEMU Project developers
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
>> ---
>>  scripts/build_release_container.sh | 63 ++++++++++++++++++++++++++++++
>>  1 file changed, 63 insertions(+)
>>  create mode 100755 scripts/build_release_container.sh
>>
>> diff --git a/scripts/build_release_container.sh b/scripts/build_release_container.sh
>> new file mode 100755
>> index 00000000000..ae57aa21db3
>> --- /dev/null
>> +++ b/scripts/build_release_container.sh
>> @@ -0,0 +1,63 @@
>> +#!/usr/bin/env bash
>> +# SPDX-License-Identifier: GPL-2.0-or-later
>> +
>> +set -euo pipefail
>> +
>> +script_dir=$(dirname $(readlink -f $0))
>> +
>> +# The oldest buildable release we support is v3.1.0, as previous ones require
>> +# additional tweaks in Dockerfile.
>> +# For building previous releases (down to v0.12.0),
>> +# see: 20261014005338.34657-1-pierrick.bouvier@oss.qualcomm.com
>> +oldest_release=v3.1.0
>> +
>> +if [ $# -lt 1 ] || [ $# -gt 2 ]; then
>> +    echo "usage: version [git_repo]"
>> +    echo
>> +    echo "- version: tag or sha-1 (>= v3.1.0)"
>> +    echo "- git_repo: (optional) QEMU repository URL"
>> +    exit 1
>> +fi
>> +version=$1;shift
>> +
>> +git_repo="https://gitlab.com/qemu-project/qemu.git"
>> +if [ $# -eq 1 ]; then
>> +    git_repo=$1;shift
>> +fi
>> +
>> +year=$(date +%Y)
>> +month=$(date +%m)
>> +if git rev-parse $version >& /dev/null; then
>> +    year=$(git log -1 --format='%cd' --date='format:%Y' $version)
>> +    month=$(git log -1 --format='%cd' --date='format:%m' $version)
>> +fi
>> +
>> +# Ubuntu LTS are published every (even) two years in April.
>> +ubuntu=
>> +if [ $((year % 2)) -eq 1 ]; then
>> +    # pick latest LTS from previous year
>> +    ubuntu=$((year - 1))
>> +elif [ $month -gt 6 ]; then
>> +    # LTS published this year should work
>> +    ubuntu=$year
>> +else
>> +    # pick latest LTS from two years ago
>> +    ubuntu=$((year - 2))
>> +fi
>> +if [ $ubuntu -lt 2014 ]; then
>> +    # oldest ubuntu release available with containers is 14.04
>> +    ubuntu=2014
>> +fi
>> +ubuntu=$((ubuntu - 2000))
>> +ubuntu_version=$ubuntu.04
>> +
>> +dockerfile=$script_dir/../tests/docker/dockerfiles/release.docker
>> +docker=$($script_dir/../tests/docker/docker.py probe)
> 
> For docker this gives:
> 
>  ERROR: docker: 'docker buildx build' requires 1 argument                                                                                                                      
>  Usage:  docker buildx build [OPTIONS] PATH | URL | -
> 
> I think it expects a . or - since the dockerfile is passed with -f
> below. Going back to
> 
>   docker=$script_dir/../tests/docker/docker.py
> 
> makes it work.
>

Thanks for catching it, fixed by adding context with '.'.

I switched to direct call because our cache mechanism does not allow to
change build args for a given tag.

>> +
>> +set -x
>> +$docker build \
>> +    -f $dockerfile \
>> +    --build-arg QEMU_VERSION=$version \
>> +    --build-arg UBUNTU_VERSION=$ubuntu_version \
>> +    --build-arg QEMU_REPO="$git_repo" \
>> +    -t qemu/$version



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v4 0/2] releases: build and run any QEMU release easily!
  2026-10-26 21:07 [PATCH v4 0/2] releases: build and run any QEMU release easily! Pierrick Bouvier
                   ` (2 preceding siblings ...)
  2026-10-27  3:26 ` [PATCH v4 0/2] releases: build and run any QEMU release easily! Philippe Mathieu-Daudé
@ 2026-10-29  0:10 ` Pierrick Bouvier
  3 siblings, 0 replies; 8+ messages in thread
From: Pierrick Bouvier @ 2026-10-29  0:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: peterx, Alex Bennée, mjt, Philippe Mathieu-Daudé,
	Fabiano Rosas

On 10/26/2026 1:07 PM, Pierrick Bouvier wrote:
> This series was inspired by a recent post from Fabiano to provide container
> images for migration tests:
> https://lore.kernel.org/qemu-devel/24d04a1f-344d-4b90-a307-b582dd9a1128@oss.qualcomm.com/T/#m353f119dc1a24fa437dde8a96d1891629e64303c
> 
> The idea to be able to build and run any QEMU (past) release with containers was
> in my mind for some time, so I gave it a shot. Finally, it was easier than
> expected to obtain a single dockerfile (with a few hacks) that works over all
> our releases.
> 
> Images have the absolute minimal content possible. It's only qemu binaries,
> artifacts (roms, keymap, ...), and libraries. There is no shell or any other
> tool included. As a result, images have a size from 581MB (v3.1.0) to 1.1GB
> (v11.1.2).
> 
> This series adds:
> - a unique dockerfile to build any QEMU release. User has to provide an explicit
>   Ubuntu version when building a given QEMU version.
> - A script build_release_container.sh which automatically detects which ubuntu
>   version a given release should be buildable on (based on date). It works
>   great, and the heuristic works for all our versions.
> 
> TLDR:
> $ ./scripts/build_release_container.sh v3.1.0
> $ podman run -it --rm qemu/v3.1.0 qemu-system-arm --version
> 
> v4
> --
> 
> - supports build for any version (tag or sha-1)
> - adds an optional parameter to build_release_container.sh to use an alternative
>   URL for QEMU repo
> - simplified Dockerfile by supporting any version >= 3.1.0.
> - removed patch 3 generating wrappers to published docker images
> 
> v3
> --
> 
> - extend dockerfile to support ubuntu 12.04, and lower older revision we can
>   build from v1.6.1 to v0.12.0.
> 
> v2
> --
> 
> - fix generate_release_links.sh: was missing userns option for podman
> - dockerfile: cleanup "|| true" and replaced with proper ifs
> 
> Pierrick Bouvier (2):
>   tests/docker/dockerfiles: add release.docker
>   scripts: add build_release_container.sh
> 
>  scripts/build_release_container.sh      | 63 +++++++++++++++++++++++++
>  tests/docker/dockerfiles/release.docker | 48 +++++++++++++++++++
>  2 files changed, 111 insertions(+)
>  create mode 100755 scripts/build_release_container.sh
>  create mode 100644 tests/docker/dockerfiles/release.docker
> 

Sent v5, fixing build with docker:
https://lore.kernel.org/qemu-devel/20261029000853.15166-1-pierrick.bouvier@oss.qualcomm.com/T/#

Regards,
Pierrick


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-10-29  0:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-26 21:07 [PATCH v4 0/2] releases: build and run any QEMU release easily! Pierrick Bouvier
2026-10-26 21:08 ` [PATCH v4 1/2] tests/docker/dockerfiles: add release.docker Pierrick Bouvier
2026-10-28 23:00   ` Fabiano Rosas
2026-10-26 21:08 ` [PATCH v4 2/2] scripts: add build_release_container.sh Pierrick Bouvier
2026-10-28 23:00   ` Fabiano Rosas
2026-10-29  0:01     ` Pierrick Bouvier
2026-10-27  3:26 ` [PATCH v4 0/2] releases: build and run any QEMU release easily! Philippe Mathieu-Daudé
2026-10-29  0:10 ` Pierrick Bouvier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.