On Thu, Feb 25, 2021 at 04:31:13PM -0800, Stefano Stabellini wrote:
> On Thu, 25 Feb 2021, Connor Davis wrote:
> > Add a container for cross-compiling xen to riscv64.
> > This just includes the cross-compiler and necessary packages for
> > building xen itself (packages for tools, stubdoms, etc., can be
> > added later).
> >
> > To build xen in the container run the following:
> >
> > $ make XEN_TARGET_ARCH=riscv64 SUBSYSTEMS=xen
>
> The container build failed for me with:
>
> error: failed to initialize alpm library
> (could not find or read directory: /var/lib/pacman/)
> The command '/bin/sh -c pacman --noconfirm -Syu pixman python sh'
> returned a non-zero code: 255
>
Ooof, apparently archlinux/base has been broken for a
few weeks now due to interactions between faccessat2 and the
host's libseccomp version [0]. This thread [1] suggests the next
docker release will have a fix.
As a temporary workaround I got the attached patch to work
(based on this one[2]) if you want to give that a go.
Connor
[0] https://bugs.archlinux.org/task/69563
[1] https://github.com/actions/virtual-environments/issues/2658
[2] https://github.com/MiguelNdeCarvalho/docker-baseimage-archlinux/pull/8/files
diff --git a/automation/build/archlinux/riscv64.dockerfile b/automation/build/archlinux/riscv64.dockerfile
index d94048b6c3..5b3c3b9e3b 100644
--- a/automation/build/archlinux/riscv64.dockerfile
+++ b/automation/build/archlinux/riscv64.dockerfile
@@ -2,6 +2,11 @@ FROM archlinux/base
LABEL maintainer.name="The Xen Project" \
maintainer.email="[email protected]"
+RUN patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst && \
+ curl -LO "https://repo.archlinuxcn.org/x86_64/$patched_glibc" && \
+ bsdtar -C / -xvf "$patched_glibc" && \
+ sed -i 's/#IgnorePkg =/IgnorePkg = glibc/' /etc/pacman.conf
+
# Packages needed for the build
RUN pacman --noconfirm -Syu \
base-devel \
@@ -26,6 +31,9 @@ RUN git clone --recursive -j$(nproc) --progress https://github.com/riscv/riscv-g
# Add compiler path
ENV PATH=/opt/riscv/bin/:${PATH}
+ENV CROSS_COMPILE=riscv64-unknown-linux-gnu-
+ENV XEN_TARGET_ARCH=riscv64
+ENV SUBSYSTEMS=xen
RUN useradd --create-home user
USER user