Skip to content

Commit

Permalink
Add qemu-nvme docker-image build
Browse files Browse the repository at this point in the history
* libslirp-dev, needed for new userdev

Signed-off-by: Simon A. F. Lund <os@safl.dk>
  • Loading branch information
safl committed Jun 5, 2023
1 parent 5edf28d commit 1945a74
Show file tree
Hide file tree
Showing 3 changed files with 256 additions and 1 deletion.
174 changes: 174 additions & 0 deletions .github/workflows/qemu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
#
# Build a debian:bullseye based docker image
# Build qemu/x86_64-softmmu on Debian Bullseye
# - Containing the qemu-build
# - Containing latest CIJOE
# - envs, guests and scripts for CIJOE
#
# Uses the qemu from https://github.com/OpenMPDK/qemu.git branch: 'for-xnvme'
# Uses the latest CIJOE available from PyPI
#
name: qemu

on:
push:
branches:
- 'qemu'

defaults:
run:
shell: bash

jobs:

build-qemu:

runs-on: ubuntu-latest
container: debian:bullseye

steps:
- name: Prep, 1..4
run: |
apt-get -qy update
apt-get -qy \
-o "Dpkg::Options::=--force-confdef" \
-o "Dpkg::Options::=--force-confold" upgrade
apt-get -qy install \
apt-utils \
aptitude \
pkg-config
apt-get -qy autoclean
- name: Prep, 2..4
run: |
aptitude -q -y -f install \
autoconf \
automake \
bc \
bison \
bridge-utils \
build-essential \
ca-certificates \
cpio \
flex \
gawk \
git \
rsync
- name: Prep, 3..4
run: |
aptitude -q -y -f install \
curl \
file \
libaio-dev \
libglib2.0-0 \
libglib2.0-dev \
libguestfs-tools \
liblzo2-dev \
libpmem-dev \
libvirt-dev \
libvirt0 \
meson \
ninja-build \
python3 \
python3-dev \
python3-distutils \
python3-setuptools \
texinfo \
uuid-dev
- name: Prep, 4..4
run: |
aptitude -q -y -f install \
libpixman-1-0 \
libpixman-1-dev \
libslirp-dev
- name: Grab qemu source
run: |
git clone --recursive https://github.com/OpenMPDK/qemu.git
cd qemu
git checkout for-xnvme
- name: Configure qemu
run: |
mkdir build
mkdir -p /opt/qemu
git -C qemu rev-parse --short HEAD > /opt/qemu/docker_tag.txt
cat /opt/qemu/docker_tag.txt
cd build
../qemu/configure \
--prefix=/opt/qemu \
--python=/usr/bin/python3 \
--audio-drv-list="" \
--disable-docs \
--disable-debug-info \
--disable-opengl \
--disable-virglrenderer \
--disable-vte \
--disable-gtk \
--disable-sdl \
--disable-spice \
--disable-vnc \
--disable-curses \
--disable-xen \
--disable-smartcard \
--disable-libnfs \
--disable-libusb \
--disable-glusterfs \
--disable-tools \
--disable-werror \
--target-list="x86_64-softmmu"
- name: Build qemu
run: |
cd build
make -j $(nproc)
make install
- name: Upload Binaries
uses: actions/upload-artifact@v2
with:
name: qemu-binaries
path: /opt/qemu

build-docker:
needs: build-qemu

runs-on: ubuntu-latest
env:
TAG_DOCKER: latest

steps:
- name: Grab sources
uses: actions/checkout@v2

- name: Create a docker context
run: |
mkdir -p /tmp/docker
- name: Grab the qemu binaries
uses: actions/download-artifact@v2
with:
name: qemu-binaries
path: /tmp/docker/qemu

- name: Build Docker image
run: |
cat /tmp/docker/qemu/docker_tag.txt
TAG_GIT=$(cat /tmp/docker/qemu/docker_tag.txt)
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/xnvme-qemu
docker build \
-t ${IMAGE_ID}:${TAG_GIT} \
-t ${IMAGE_ID}:${TAG_DOCKER} \
-f qemu-nvme/Dockerfile \
/tmp/docker
- name: Log into GitHub Container Registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push to ghcr.io
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/xnvme-qemu
docker push ${IMAGE_ID}:${TAG_DOCKER}
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ doing "verification" with emulated NVMe devices. However, it makes a lot more co
debugging build-issues on the various distributions, and for the basic 'build-linux' jobs, reduces
time spent by about 16min.

## Maintenance
## Maintenance (deps)

When changes are made to Linux distribution support for xNVMe, that is, new distros added, or
current distributions removed, then:
Expand All @@ -51,6 +51,11 @@ current distributions removed, then:
- Click on Package Settings
- Scroll to the bottom and blick on "Change Visilibility"

## Maintenance (qemu)

In addition to the docker-images for build/dependencies, then a docker-image is
provided containing qemu-nvme with bleeding-edge functionality.

## Wishlist

* Generate images for arm64
Expand Down
76 changes: 76 additions & 0 deletions qemu-nvme/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
FROM debian:bullseye

WORKDIR /opt

COPY qemu qemu

RUN chmod +x qemu/bin/qemu-system-x86_64

RUN apt-get -qy update && \
apt-get -qy \
-o "Dpkg::Options::=--force-confdef" \
-o "Dpkg::Options::=--force-confold" upgrade && \
apt-get -qy autoclean && \
apt-get -qy install aptitude

RUN aptitude -q -y -f install \
libaio-dev \
libglib2.0-0 \
libglib2.0-dev \
libguestfs-tools \
liblzo2-dev \
libpmem-dev \
libvirt-dev \
libvirt0

RUN aptitude -q -y -f install \
libpixman-1-0 \
libpixman-1-dev

RUN aptitude -q -y -f install \
bridge-utils \
cloud-image-utils \
git \
htop \
lshw \
openssh-server \
procps \
ssh \
time \
vim

RUN aptitude -q -y -f install \
python3 \
python3-pip

RUN ln -s /usr/bin/python3.8 /usr/bin/python

# Install cijoe and the packages example and qemu packages
RUN pip install cijoe cijoe-pkg-qemu || true
RUN pip3 install cijoe cijoe-pkg-qemu || true

# Setup SSH
RUN echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
RUN systemctl enable ssh
RUN service ssh restart
RUN mkdir -p /root/.ssh
RUN chmod 0700 /root/.ssh
RUN ssh-keygen -b 2048 -t rsa -f /root/.ssh/id_rsa -q -N ""
RUN cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys

# Don't want any of that hastle
RUN echo "Host *" >> /root/.ssh/config
RUN echo " StrictHostKeyChecking no" >> /root/.ssh/config
RUN echo " NoHostAuthenticationForLocalhost yes" >> /root/.ssh/config
RUN echo " UserKnownHostsFile=/dev/null" >> /root/.ssh/config
RUN chmod 0400 /root/.ssh/config

# This does not apply when SSH-ing to localhost, then ENV set by this is cleared
ENV PATH="/opt/qemu/bin:$PATH"
# So we also add it to /root/.profile
RUN echo 'PATH="/opt/qemu/bin:$PATH"' > /root/.profile

# Check that the correct qemu is being called
RUN qemu-system-x86_64 --version

CMD ["bash"]

0 comments on commit 1945a74

Please sign in to comment.