diff mbox series

[XEN,v1,2/3] automation: add linux argo test artifacts

Message ID f8abd08a2c3f9e52a166359b0f4c1ecf4c8d1a73.1729183051.git.victorm.lira@amd.com (mailing list archive)
State Superseded
Headers show
Series automation: add x86_64 test (linux argo) | expand

Commit Message

Lira, Victor M Oct. 17, 2024, 5:18 p.m. UTC
From: Victor Lira <victorm.lira@amd.com>

Add dockerfile for building container image that holds test binaries for
Xen Argo test on Linux 6.6.56 x86_64

The build produces the following:
- xen-argo.ko       Linux kernel module
- lib/libargo*      Linux shared library
- argo-exec         Linux user test program

Signed-off-by: Victor Lira <victorm.lira@amd.com>
---
Cc: Doug Goldstein <cardoe@cardoe.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: xen-devel@lists.xenproject.org
---
 .../tests-artifacts/argo/6.6.56.dockerfile    | 95 +++++++++++++++++++
 1 file changed, 95 insertions(+)
 create mode 100644 automation/tests-artifacts/argo/6.6.56.dockerfile

--
2.25.1
diff mbox series

Patch

diff --git a/automation/tests-artifacts/argo/6.6.56.dockerfile b/automation/tests-artifacts/argo/6.6.56.dockerfile
new file mode 100644
index 0000000000..a8e199ad3b
--- /dev/null
+++ b/automation/tests-artifacts/argo/6.6.56.dockerfile
@@ -0,0 +1,95 @@ 
+# syntax=docker/dockerfile:1
+FROM --platform=linux/amd64 alpine:3.18
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV LINUX_VERSION=6.6.56
+ENV USER root
+
+RUN mkdir /build /artifacts
+WORKDIR /build
+ENV BUILDDIR=/build/
+ENV COPYDIR=/artifacts/
+ENV ARGO_SHA="705a7a8a624b42e13e655d3042059b8a85cdf6a3"
+ENV ARGOEXEC_SHA="d900429f6640acc6f68a3d3a4c945d7da60625d8"
+
+RUN apk --no-cache add \
+  \
+  musl-dev  \
+  build-base \
+  libc6-compat \
+  linux-headers \
+  bash \
+  git \
+  curl \
+  flex \
+  bison \
+  elfutils-dev \
+  autoconf \
+  automake \
+  libtool && \
+  \
+  # Prepare Linux sources
+  curl -fsSLO https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-"$LINUX_VERSION".tar.xz && \
+  tar xJf linux-"$LINUX_VERSION".tar.xz && \
+  cd linux-"$LINUX_VERSION" && \
+  make ARCH=x86 defconfig && \
+  make ARCH=x86 xen.config && \
+  ./scripts/config --enable BRIDGE && \
+  ./scripts/config --enable IGC && \
+  ./scripts/config --enable TUN && \
+  cp .config .config.orig && \
+  cat .config.orig | grep XEN | grep =m |sed 's/=m/=y/g' >> .config && \
+  make ARCH=x86 olddefconfig && \
+  make ARCH=x86 modules_prepare && \
+  \
+  # Build Linux kernel module for Xen Argo
+  cd "${BUILDDIR}" && \
+  git clone \
+      --depth=1 --branch=master \
+      https://github.com/OpenXT/linux-xen-argo.git && \
+  git -C "${BUILDDIR}/linux-xen-argo" switch --detach "${ARGO_SHA}" && \
+  make -C "linux-${LINUX_VERSION}" M="${BUILDDIR}/linux-xen-argo/argo-linux" \
+      CFLAGS_MODULE="-Wno-error" KBUILD_MODPOST_WARN=1 && \
+  cp "linux-xen-argo/argo-linux/xen-argo.ko" "${COPYDIR}/xen-argo.ko" && \
+  \
+  # Build Linux libargo shared library, applying fixes to build in Alpine
+  cd "${BUILDDIR}/linux-xen-argo/libargo" && \
+  sed -i "s|AM_INIT_AUTOMAKE|AC_CONFIG_AUX_DIR(.)\nAM_INIT_AUTOMAKE|" configure.ac && \
+  sed -i "s/__SOCKADDR_COMMON (sxenargo_)/sa_family_t sxenargo_family/" src/libargo.h && \
+  sed -i "s/__SOCKADDR_COMMON_SIZE/(sizeof (unsigned short int))/" src/libargo.h && \
+  autoreconf --install && \
+  ./configure  --prefix="${COPYDIR}" CPPFLAGS="-I${PWD}/../argo-linux/include" && \
+  make && \
+  make install && \
+  \
+  # Build Linux user program, modifying for xilinx argo test
+  cd "${BUILDDIR}" && \
+  wget "https://raw.githubusercontent.com/OpenXT/xenclient-oe/${ARGOEXEC_SHA}/recipes-openxt/argo-exec/argo-exec/argo-exec.c" && \
+  sed -i "s|#include <xen/xen.h>||" argo-exec.c && \
+  sed -i "s|ret = shuffle(s, fds\[0\], fds\[1\]);|ret = shuffle(s, 0, 1);|" argo-exec.c && \
+  gcc -I"${BUILDDIR}/linux-xen-argo/libargo/src" \
+      -I"${BUILDDIR}/linux-xen-argo/argo-linux/include" \
+      -L"${COPYDIR}/lib/" \
+      -o argo-exec argo-exec.c -largo && \
+  cp argo-exec "${COPYDIR}" && \
+  \
+  # Clean up
+  cd /build && \
+  rm -fr linux-"$LINUX_VERSION"* linux-xen-argo argo-exec.c && \
+  \
+  apk del \
+  \
+  musl-dev  \
+  build-base \
+  libc6-compat \
+  linux-headers \
+  bash \
+  git \
+  curl \
+  flex \
+  bison \
+  elfutils-dev \
+  autoconf \
+  automake \
+  libtool