qemu minimal image builder

This commit is contained in:
Alexey Chubukov 2023-12-27 04:31:19 +04:00
parent fd4c28a71d
commit d0dc98def2
Signed by: tea
GPG Key ID: D9C68D34A3CAE37A
6 changed files with 307 additions and 146 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
libvirt-image
qemu-build
qemu-binary
qemu-*
config.log
opt

View File

@ -1,142 +1,5 @@
FROM almalinux:8
RUN dnf distro-sync -y && \
dnf install 'dnf-command(config-manager)' -y && \
dnf config-manager --set-enabled -y powertools && \
dnf install -y centos-release-advanced-virtualization && \
dnf install -y epel-release && \
dnf install -y epel-next-release && \
dnf install -y \
SDL2-devel \
alsa-lib-devel \
bash \
bc \
bison \
brlapi-devel \
bzip2 \
bzip2-devel \
ca-certificates \
capstone-devel \
ccache \
clang \
ctags \
cyrus-sasl-devel \
daxctl-devel \
dbus-daemon \
device-mapper-multipath-devel \
diffutils \
findutils \
flex \
fuse3-devel \
gcc \
gcc-c++ \
gettext \
git \
glib2-devel \
glib2-static \
glibc-langpack-en \
glibc-static \
glusterfs-api-devel \
gnutls-devel \
gtk3-devel \
hostname \
jemalloc-devel \
json-c-devel \
libaio-devel \
libasan \
libattr-devel \
libbpf-devel \
libcacard-devel \
libcap-ng-devel \
libcmocka-devel \
libcurl-devel \
libdrm-devel \
libepoxy-devel \
libfdt-devel \
libffi-devel \
libgcrypt-devel \
libiscsi-devel \
libjpeg-devel \
libnfs-devel \
libpmem-devel \
libpng-devel \
librbd-devel \
libseccomp-devel \
libselinux-devel \
libslirp-devel \
libssh-devel \
libtasn1-devel \
libubsan \
liburing-devel \
libusbx-devel \
libxdp-devel \
libzstd-devel \
llvm \
lttng-ust-devel \
lzo-devel \
make \
mesa-libgbm-devel \
mtools \
ncurses-devel \
nettle-devel \
ninja-build \
nmap-ncat \
numactl-devel \
openssh-clients \
pam-devel \
pcre-static \
pipewire-devel \
pixman-devel \
pkgconfig \
pulseaudio-libs-devel \
python38 \
python38-PyYAML \
python38-numpy \
python38-pip \
python38-setuptools \
python38-wheel \
rdma-core-devel \
sed \
snappy-devel \
socat \
spice-protocol \
spice-server-devel \
swtpm \
systemd-devel \
systemtap-sdt-devel \
tar \
usbredir-devel \
util-linux \
virglrenderer-devel \
vte291-devel \
which \
xfsprogs-devel \
xorriso \
zlib-devel \
zlib-static \
zstd && \
dnf autoremove -y && \
dnf clean all -y && \
rpm -qa | sort > /packages.txt && \
mkdir -p /usr/libexec/ccache-wrappers && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/c++ && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/clang && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/g++ && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc
RUN /usr/bin/pip3.8 install \
meson==0.63.2 \
pillow \
sphinx \
sphinx-rtd-theme \
tomli
ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make"
ENV NINJA "/usr/bin/ninja"
ENV PYTHON "/usr/bin/python3.8"
# As a final step configure the user (if env is defined)
ARG USER
ARG UID
RUN if [ "${USER}" ]; then \
id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
curl -LJO https://download.qemu.org/qemu-8.2.0.tar.xz && \
tar xvJf qemu-8.2.0.tar.xz && \
cd qemu-8.2.0 && \
./configure && \
make && \

139
Dockerfile.qemu-build Normal file
View File

@ -0,0 +1,139 @@
FROM almalinux:8
MAINTAINER tea@brass.host
RUN dnf distro-sync -y && \
dnf install 'dnf-command(config-manager)' -y && \
dnf config-manager --set-enabled -y powertools && \
dnf install -y centos-release-advanced-virtualization && \
dnf install -y epel-release && \
dnf install -y epel-next-release && \
dnf install -y \
SDL2-devel \
alsa-lib-devel \
bash \
bc \
bison \
brlapi-devel \
bzip2 \
bzip2-devel \
ca-certificates \
capstone-devel \
ccache \
clang \
ctags \
cyrus-sasl-devel \
daxctl-devel \
dbus-daemon \
device-mapper-multipath-devel \
diffutils \
findutils \
flex \
fuse3-devel \
gcc \
gcc-c++ \
gettext \
git \
glib2-devel \
glib2-static \
glibc-langpack-en \
glibc-static \
glusterfs-api-devel \
gnutls-devel \
gtk3-devel \
hostname \
jemalloc-devel \
json-c-devel \
libaio-devel \
libasan \
libattr-devel \
libbpf-devel \
libcacard-devel \
libcap-ng-devel \
libcmocka-devel \
libcurl-devel \
libdrm-devel \
libepoxy-devel \
libfdt-devel \
libffi-devel \
libgcrypt-devel \
libiscsi-devel \
libjpeg-devel \
libnfs-devel \
libpmem-devel \
libpng-devel \
librbd-devel \
libseccomp-devel \
libselinux-devel \
libslirp-devel \
libssh-devel \
libtasn1-devel \
libubsan \
liburing-devel \
libusbx-devel \
libxdp-devel \
libzstd-devel \
llvm \
lttng-ust-devel \
lzo-devel \
make \
mesa-libgbm-devel \
mtools \
ncurses-devel \
nettle-devel \
ninja-build \
nmap-ncat \
numactl-devel \
openssh-clients \
pam-devel \
pcre-static \
pipewire-devel \
pixman-devel \
pkgconfig \
pulseaudio-libs-devel \
python38 \
python38-PyYAML \
python38-numpy \
python38-pip \
python38-setuptools \
python38-wheel \
rdma-core-devel \
sed \
snappy-devel \
socat \
spice-protocol \
spice-server-devel \
swtpm \
systemd-devel \
systemtap-sdt-devel \
tar \
usbredir-devel \
util-linux \
virglrenderer-devel \
vte291-devel \
which \
xfsprogs-devel \
xorriso \
zlib-devel \
zlib-static \
zstd && \
dnf autoremove -y && \
dnf clean all -y && \
rpm -qa | sort > /packages.txt && \
mkdir -p /usr/libexec/ccache-wrappers && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/c++ && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/cc && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/clang && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/g++ && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc
RUN /usr/bin/pip3.8 install \
meson==0.63.2 \
pillow \
sphinx \
sphinx-rtd-theme \
tomli
ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make"
ENV NINJA "/usr/bin/ninja"
ENV PYTHON "/usr/bin/python3.8"
WORKDIR /src

View File

@ -1,9 +1,17 @@
all:libvirt
all:libvirt-image
libvirt:
libvirt-image: qemu-binary
buildah bud -t repo.brass.host/libvirt/libvirt -f Dockerfile.libvirt
touch libvirt-image
qemu:
buildah bud -t repo.brass.host/libvirt/qemu -f Dockerfile.qemu
qemu-build:
buildah bud -t repo.brass.host/libvirt/qemu-build -f Dockerfile.qemu-build
touch qemu-build
qemu-binary: qemu-build
podman stop qemu-builder ; podman rm qemu-builder || true
podman run --rm --name qemu-builder -v $(PWD):/src repo.brass.host/libvirt/qemu-build sh ./build.sh
touch qemu-binary
# buildah from almalinux:8 --name "qemu-build" -v $(PWD):/src
.PHONY: all qemu libvirt

66
build.sh Normal file
View File

@ -0,0 +1,66 @@
#!/bin/bash
QEMU_VERSION=8.2.0
set -e
if ! [[ -f qemu-${QEMU_VERSION}.tar.xz ]]
then
curl -LJO https://download.qemu.org/qemu-${QEMU_VERSION}.tar.xz
fi
if ! [[ -d qemu-${QEMU_VERSION} ]]
then
tar xvJf qemu-${QEMU_VERSION}.tar.xz
fi
cd qemu-${QEMU_VERSION}
rm -rf build
mkdir -p build
cd build
../configure \
--prefix=qemu \
--localstatedir=var \
--enable-kvm \
--enable-gnutls \
--enable-guest-agent \
--enable-iconv \
--enable-kvm \
--enable-libiscsi \
--enable-libpmem \
--enable-libssh \
--enable-libusb \
--enable-libudev \
--enable-linux-aio \
--enable-lzo \
--enable-malloc-trim \
--enable-modules \
--enable-mpath \
--enable-smartcard \
--enable-spice \
--enable-spice-protocol \
--enable-system \
--enable-tcg \
--enable-tools \
--enable-tpm \
--enable-trace-backend=dtrace \
--enable-virtiofsd \
--enable-vhost-kernel \
--enable-vhost-net \
--enable-vhost-user \
--enable-vhost-user-blk-server \
--enable-vhost-vdpa \
--enable-vhost-vsock \
--enable-vnc \
--enable-vnc-png \
--enable-vnc-sasl \
--enable-werror \
--enable-xkbcommon \
--enable-attr \
--enable-avx2 \
--enable-cap-ng \
--enable-capstone=internal \
--enable-coroutine-pool \
--enable-curl \
--enable-debug-info \
--enable-docs \
make -j 8
make install DESTDIR=/opt
cd /opt
tar -cJf /src/qemu/${QEMU_VERSION}.tar.xz ./

79
deps Normal file
View File

@ -0,0 +1,79 @@
edk2-ovmf
ld-linux-x86-64.so.2()(64bit)
ld-linux-x86-64.so.2(GLIBC_2.3)(64bit)
libaio.so.1()(64bit)
libaio.so.1(LIBAIO_0.1)(64bit)
libaio.so.1(LIBAIO_0.4)(64bit)
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.17)(64bit)
libc.so.6(GLIBC_2.28)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libcapstone.so.4()(64bit)
libcurl.so.4()(64bit)
libepoxy.so.0()(64bit)
libfdt
libfdt.so.1()(64bit)
libfdt.so.1(LIBFDT_1.2)(64bit)
libgbm.so.1()(64bit)
libgcc_s.so.1()(64bit)
libgcc_s.so.1(GCC_3.0)(64bit)
libgcc_s.so.1(GCC_3.3.1)(64bit)
libgcc_s.so.1(GCC_3.4)(64bit)
libgcc_s.so.1(GCC_4.7.0)(64bit)
libgcrypt.so.20()(64bit)
libgcrypt.so.20(GCRYPT_1.6)(64bit)
libgfapi.so.0()(64bit)
libgfapi.so.0(GFAPI_3.4.0)(64bit)
libgfapi.so.0(GFAPI_3.5.0)(64bit)
libgfapi.so.0(GFAPI_6.0)(64bit)
libglib-2.0.so.0()(64bit)
libgmodule-2.0.so.0()(64bit)
libgnutls.so.30()(64bit)
libgnutls.so.30(GNUTLS_3_4)(64bit)
libibverbs.so.1()(64bit)
libibverbs.so.1(IBVERBS_1.0)(64bit)
libibverbs.so.1(IBVERBS_1.1)(64bit)
libiscsi
liblzo2.so.2()(64bit)
libm.so.6()(64bit)
libm.so.6(GLIBC_2.2.5)(64bit)
libnuma.so.1()(64bit)
libnuma.so.1(libnuma_1.1)(64bit)
libpixman-1.so.0()(64bit)
libpmem
libpmem.so.1()(64bit)
libpmem.so.1(LIBPMEM_1.0)(64bit)
libpng16.so.16()(64bit)
libpng16.so.16(PNG16_0)(64bit)
libpthread.so.0()(64bit)
libpthread.so.0(GLIBC_2.12)(64bit)
libpthread.so.0(GLIBC_2.2.5)(64bit)
libpthread.so.0(GLIBC_2.3.2)(64bit)
librados.so.2()(64bit)
librbd.so.1()(64bit)
librdmacm.so.1()(64bit)
librdmacm.so.1(RDMACM_1.0)(64bit)
libsasl2.so.3()(64bit)
libseccomp
libseccomp.so.2()(64bit)
libsnappy.so.1()(64bit)
libssh.so.4()(64bit)
libssh.so.4(LIBSSH_4_5_0)(64bit)
libssh.so.4(LIBSSH_4_7_0)(64bit)
liburing.so.1()(64bit)
libusbredirparser.so.1()(64bit)
libusbredirparser.so.1(USBREDIRPARSER_0.8.0)(64bit)
libusbx
libutil.so.1()(64bit)
libutil.so.1(GLIBC_2.2.5)(64bit)
libz.so.1()(64bit)
libz.so.1(ZLIB_1.2.0)(64bit)
lzo
mesa-dri-drivers
mesa-libEGL
mesa-libGL
qemu-kvm-common(x86-64)
qemu-kvm-ui-opengl(x86-64)
rtld(GNU_HASH)
snappy
usbredir