Skip to contentSkip to conversation

Rootfs/argo cleanup and microcode support

PATCH In review Andrew Cooper 4 participants 22 messages Apr 14, 2025 – Apr 16, 2025

lore
Share & tools
lore
#0 lore raw

v2 cover Rootfs/argo cleanup and microcode support

This series supersedes the others posted. Only minor changes from before; see patches for details.

See the companion Xen series for the testing using these new artefacts.

Andrew Cooper (7):
Rename and adjust x86 containers
Overhaul how Argo is built and packged
Rework rootfs generation to make a cpio archive
Shrink the rootfs substantially
Adjust directory layout for rootfs.cpio.gz
Provide an ARM64 rootfs too
Package microcode for the x86 hardware runners

 .gitlab-ci.yml                                | 26 ++++-
 containerize                                  |  5 +-
 images/alpine/3.18-arm64-base.dockerfile      |  6 ++
 images/alpine/3.18-x86_64-base.dockerfile     |  6 ++
 ...ockerfile => 3.18-x86_64-build.dockerfile} | 35 ++++---
 images/alpine/x86_64-rootfs.dockerfile        |  4 -
 scripts/alpine-rootfs.sh                      | 95 +++++++++++++++++++
 scripts/build-argo.sh                         | 67 +++++++++++++
 scripts/build-linux.sh                        |  8 +-
 scripts/x86-microcode.sh                      | 42 ++++++++
 scripts/x86_64-rootfs-alpine.sh               | 60 ------------
 11 files changed, 272 insertions(+), 82 deletions(-)
 create mode 100644 images/alpine/3.18-arm64-base.dockerfile
 create mode 100644 images/alpine/3.18-x86_64-base.dockerfile
 rename images/alpine/{x86_64-build.dockerfile => 3.18-x86_64-build.dockerfile} (51%)
 delete mode 100644 images/alpine/x86_64-rootfs.dockerfile
 create mode 100755 scripts/alpine-rootfs.sh
 create mode 100755 scripts/build-argo.sh
 create mode 100755 scripts/x86-microcode.sh
 delete mode 100755 scripts/x86_64-rootfs-alpine.sh
Signature · 1 line
2.39.5
#1 lore raw

PATCH v2 1/7 Rename and adjust x86 containers

Insert the Alpine version as we'll need a newer version in due course, and rename 'rootfs' to 'base' as the container really is not a rootfs on it's own.

In base, add bash. It's added later by the rootfs generation anyway, but this way we can write the generation script in bash too.

In build, group and sort the packages. Drop the ones we don't need, or are pulled in by dependencies. Include diffutils, findutils and gawk to avoid warnings in the kernel build.

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Doug Goldstein <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: Jason Andryuk <[email protected]>
CC: Daniel P. Smith <[email protected]>

---
 .gitlab-ci.yml                                |  4 +--
 containerize                                  |  4 +--
 images/alpine/3.18-x86_64-base.dockerfile     |  6 ++++
 ...ockerfile => 3.18-x86_64-build.dockerfile} | 32 ++++++++++++-------
 images/alpine/x86_64-rootfs.dockerfile        |  4 ---
 5 files changed, 30 insertions(+), 20 deletions(-)
 create mode 100644 images/alpine/3.18-x86_64-base.dockerfile
 rename images/alpine/{x86_64-build.dockerfile => 3.18-x86_64-build.dockerfile} (54%)
 delete mode 100644 images/alpine/x86_64-rootfs.dockerfile
.gitlab-ci.yml +2 -2
index 670f9621e26d..fb997cc62162 100644
@@ -28,7 +28,7 @@ stages:
   tags:
     - x86_64
   variables:
-    CONTAINER: alpine:x86_64-build
+    CONTAINER: alpine:3.18-x86_64-build
 
 #
 # ARM64 artifacts
@@ -62,7 +62,7 @@ x86_64-rootfs-alpine-3.18:
   script:
     - . scripts/x86_64-rootfs-alpine.sh
   variables:
-    CONTAINER: alpine:x86_64-rootfs
+    CONTAINER: alpine:3.18-x86_64-base
 
 x86_64-argo-linux-6.6.56:
   extends: .x86_64-artifacts
containerize +2 -2
index 7abeb119ff6a..c23f55ead737 100755
@@ -25,8 +25,8 @@ die() {
 BASE="registry.gitlab.com/xen-project/hardware/test-artifacts"
 case "_${CONTAINER}" in
     _alpine-3.18-arm64-build) CONTAINER="${BASE}/alpine:3.18-arm64-build" ;;
-    _alpine-x86_64-rootfs) CONTAINER="${BASE}/alpine:x86_64-rootfs" ;;
-    _alpine-x86_64-build|_) CONTAINER="${BASE}/alpine:x86_64-build" ;;
+    _alpine-3.18-x86_64-base) CONTAINER="${BASE}/alpine:3.18-x86_64-base" ;;
+    _alpine-3.18-x86_64-build|_) CONTAINER="${BASE}/alpine:3.18-x86_64-build" ;;
 esac
 
 # Use this variable to control whether root should be used
images/alpine/3.18-x86_64-base.dockerfile new file +6 -0
new file mode 100644
index 000000000000..a8cb274d5821
@@ -0,0 +1,6 @@
+# syntax=docker/dockerfile:1
+FROM --platform=linux/amd64 alpine:3.18
+LABEL maintainer.name="The Xen Project"
+LABEL maintainer.email="[email protected]"
+
+RUN apk --no-cache add bash
images/alpine/3.18-x86_64-build.dockerfile renamed from images/alpine/x86_64-build.dockerfile +20 -12
similarity index 54%
rename from images/alpine/x86_64-build.dockerfile
rename to images/alpine/3.18-x86_64-build.dockerfile
index 98969a5be1da..eac0cda4fed3 100644
@@ -1,31 +1,39 @@
 # syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 alpine:3.18
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="[email protected]"
+LABEL maintainer.name="The Xen Project"
+LABEL maintainer.email="[email protected]"
 
 RUN apk --no-cache add bash
 
-RUN bash -ex <<EOF
+RUN <<EOF
+#!/bin/bash
+      set -eu
+
       adduser -D user --shell /bin/bash
 
-      DEPS=(
-            musl-dev
+      DEPS=(# Base environment
             build-base
-            libc6-compat
-            linux-headers
-            bash
-            git
             curl
-            flex
+            git
+
+            # Linux build deps
             bison
+            diffutils
             elfutils-dev
+            findutils
+            flex
+            gawk
+            linux-headers
+            openssl-dev
+            perl
+
+            # Argo build deps
             autoconf
             automake
             libtool
-            openssl-dev
       )
 
-      apk add --no-cache "\${DEPS[@]}"
+      apk add --no-cache "${DEPS[@]}"
 EOF
 
 USER user
images/alpine/x86_64-rootfs.dockerfile deleted +0 -4
deleted file mode 100644
index b912e9c1600d..000000000000
@@ -1,4 +0,0 @@
-# syntax=docker/dockerfile:1
-FROM --platform=linux/amd64 alpine:3.18
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="[email protected]"
Signature · 1 line
2.39.5
Reviewed-by on v2 1/7
#2 lore raw

Re: [PATCH v2 1/7] Rename and adjust x86 containers

Quoted 11 lines · Andrew Cooper

Insert the Alpine version as we'll need a newer version in due course, and rename 'rootfs' to 'base' as the container really is not a rootfs on it's own.

In base, add bash. It's added later by the rootfs generation anyway, but this way we can write the generation script in bash too.

In build, group and sort the packages. Drop the ones we don't need, or are pulled in by dependencies. Include diffutils, findutils and gawk to avoid warnings in the kernel build.

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#3 lore raw

PATCH v2 2/7 Overhaul how Argo is built and packged

In reply to Andrew Cooper

Right now, the argo artefacts are a pile of files which the test has to turn back into something which resembles a filesystem. Furthermore, because we do not build modules for the main kernel, it is extra important to make sure that xen-argo.ko doesn't get out of sync.

Build argo conditionally as part of the linux artefact. It's ~100kb all together, compared to ~14M for the kernel.

Produce a single argo.cpio.gz with xen-argo.ko in the standard location. Prune userspace down to just the executables and libraries.

This is cribbed from the existing scripts/x86_64-linux-argo.sh, which stays in place in the short term until Xen can be updated to use the new scheme.

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Doug Goldstein <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>
CC: Jason Andryuk <[email protected]>
CC: Daniel P. Smith <[email protected]>

v2:
* Only build conditionally. Argo is bust with Linux 6.12, which is needed for new hardware runners.
* Parallel build of xen-argo.ko and libargo.
* Use -print0

I tried to make MODPOST work properly, but we don't build enough of it for the kernel, and I didn't feel like adding an extra 10 mins to the build (all modules) just to get the metadata right.

---
 .gitlab-ci.yml         |  2 ++
 scripts/build-argo.sh  | 67 ++++++++++++++++++++++++++++++++++++++++++
 scripts/build-linux.sh |  8 ++++-
 3 files changed, 76 insertions(+), 1 deletion(-)
 create mode 100755 scripts/build-argo.sh
.gitlab-ci.yml +2 -0
index fb997cc62162..790a6d9f9896 100644
@@ -47,6 +47,8 @@ linux-6.6.56-x86_64:
   script: ./scripts/build-linux.sh
   variables:
     LINUX_VERSION: 6.6.56
+    ARGO_SHA: "705a7a8a624b42e13e655d3042059b8a85cdf6a3"
+    ARGOEXEC_SHA: "d900429f6640acc6f68a3d3a4c945d7da60625d8"
 
 #
 # The jobs below here are legacy and being phased out.
scripts/build-argo.sh new file +67 -0

67 lines not on this page · raw message

scripts/build-linux.sh +7 -1
index 652fdba7b9d1..441b8721a490 100755
@@ -8,7 +8,7 @@ fi
 set -ex -o pipefail
 
 WORKDIR="${PWD}"
-COPYDIR="${WORKDIR}/binaries/"
+COPYDIR="${WORKDIR}/binaries"
 UNAME=$(uname -m)
 
 # Build Linux
@@ -45,6 +45,12 @@ case $UNAME in
     x86_64)
         make -j$(nproc) bzImage
         cp arch/x86/boot/bzImage "${COPYDIR}"
+
+        # Build argo if requested
+        if [[ -n "${ARGO_SHA}" ]]; then
+            make modules_prepare
+            . "${WORKDIR}/scripts/build-argo.sh"
+        fi
         ;;
 
     aarch64)
Signature · 1 line
2.39.5
#4 lore raw

Re: [PATCH v2 2/7] Overhaul how Argo is built and packged

scripts/build-linux.sh fi · line 11

Quoted 8 lines · Andrew Cooper
scripts/build-linux.sh +1 -1
@@ -8,7 +8,7 @@ fi
 set -ex -o pipefail
 
 WORKDIR="${PWD}"
-COPYDIR="${WORKDIR}/binaries/"
+COPYDIR="${WORKDIR}/binaries"

Is this change intentional? It has worse failure mode if "binaries" dir wouldn't exist for some reason...

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#5 lore raw

Re: [PATCH v2 2/7] Overhaul how Argo is built and packged

Quoted 11 lines · Marek Marczykowski-Górecki

scripts/build-linux.sh fi · line 11

Quoted 8 lines · Andrew Cooper
scripts/build-linux.sh +1 -1
@@ -8,7 +8,7 @@ fi
 set -ex -o pipefail
 
 WORKDIR="${PWD}"
-COPYDIR="${WORKDIR}/binaries/"
+COPYDIR="${WORKDIR}/binaries"

Is this change intentional? It has worse failure mode if "binaries" dir wouldn't exist for some reason...

Yes it is intentional.  It causes problems when we derive new variables from COPYDIR.

binaries/ always exists.  It's in the base repo.

~Andrew

Reviewed-by on v2 2/7
#6 lore raw

Re: [PATCH v2 2/7] Overhaul how Argo is built and packged

In reply to Andrew Cooper
Quoted 8 lines · Andrew Cooper

Right now, the argo artefacts are a pile of files which the test has to turn back into something which resembles a filesystem. Furthermore, because we do not build modules for the main kernel, it is extra important to make sure that xen-argo.ko doesn't get out of sync.

Build argo conditionally as part of the linux artefact. It's ~100kb all together, compared to ~14M for the kernel.

Quoted 7 lines

Produce a single argo.cpio.gz with xen-argo.ko in the standard location. Prune userspace down to just the executables and libraries.

This is cribbed from the existing scripts/x86_64-linux-argo.sh, which stays in place in the short term until Xen can be updated to use the new scheme.

#7 lore raw

Re: [PATCH v2 2/7] Overhaul how Argo is built and packged

In reply to Andrew Cooper
Quoted 8 lines · Andrew Cooper

Right now, the argo artefacts are a pile of files which the test has to turn back into something which resembles a filesystem. Furthermore, because we do not build modules for the main kernel, it is extra important to make sure that xen-argo.ko doesn't get out of sync.

Build argo conditionally as part of the linux artefact. It's ~100kb all together, compared to ~14M for the kernel.

Quoted 7 lines

Produce a single argo.cpio.gz with xen-argo.ko in the standard location. Prune userspace down to just the executables and libraries.

This is cribbed from the existing scripts/x86_64-linux-argo.sh, which stays in place in the short term until Xen can be updated to use the new scheme.

Do we need to remove x86_64-argo-linux.sh?

#8 lore raw

Re: [PATCH v2 2/7] Overhaul how Argo is built and packged

Quoted 9 lines · Stefano Stabellini
Quoted 8 lines · Andrew Cooper

Right now, the argo artefacts are a pile of files which the test has to turn back into something which resembles a filesystem. Furthermore, because we do not build modules for the main kernel, it is extra important to make sure that xen-argo.ko doesn't get out of sync.

Build argo conditionally as part of the linux artefact. It's ~100kb all together, compared to ~14M for the kernel.

Quoted 8 lines
Quoted 7 lines

Produce a single argo.cpio.gz with xen-argo.ko in the standard location. Prune userspace down to just the executables and libraries.

This is cribbed from the existing scripts/x86_64-linux-argo.sh, which stays in place in the short term until Xen can be updated to use the new scheme.

Do we need to remove x86_64-argo-linux.sh?

Yes, but 4.20 still uses it.

One thing I'm not sure about is whether "keep latest artefact" is just artefacts from the latest run, or the latest of each named artefact.

Now is as good a time to experiment as any.

~Andrew

#9 lore raw

Re: [PATCH v2 2/7] Overhaul how Argo is built and packged

Quoted 16 lines · Andrew Cooper
Quoted 15 lines · Stefano Stabellini
Quoted 14 lines · Andrew Cooper

Right now, the argo artefacts are a pile of files which the test has to turn back into something which resembles a filesystem. Furthermore, because we do not build modules for the main kernel, it is extra important to make sure that xen-argo.ko doesn't get out of sync.

Build argo conditionally as part of the linux artefact. It's ~100kb all together, compared to ~14M for the kernel.

Produce a single argo.cpio.gz with xen-argo.ko in the standard location. Prune userspace down to just the executables and libraries.

This is cribbed from the existing scripts/x86_64-linux-argo.sh, which stays in place in the short term until Xen can be updated to use the new scheme.

Quoted 7 lines
Quoted 2 lines
Quoted 1 line

Do we need to remove x86_64-argo-linux.sh?

Yes, but 4.20 still uses it.

One thing I'm not sure about is whether "keep latest artefact" is just artefacts from the latest run, or the latest of each named artefact.

I think it's latest run for a branch. If newer job (on a branch) doesn't include an artifact anymore, it will be gone. Jobs referencing it won't see it immediately, regardless of expire time.

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#10 lore raw

PATCH v2 3/7 Rework rootfs generation to make a cpio archive

In reply to Andrew Cooper

Rename the script as we're going to use it for ARM64 shortly, and have it take a tar or cpio parameter to determine the output format.

Turn it into a proper bash script, and provide the cpio form under the new artefact naming scheme.

No functional change.

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Doug Goldstein <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

v2:
* Use -print0
* Don't dedup $PATHS. It's going to change between cpio and tar in subsequent patches.

---
 .gitlab-ci.yml                                |  9 +++++++-
 ...6_64-rootfs-alpine.sh => alpine-rootfs.sh} | 21 +++++++++++++++++--
 2 files changed, 27 insertions(+), 3 deletions(-)
 rename scripts/{x86_64-rootfs-alpine.sh => alpine-rootfs.sh} (71%)
.gitlab-ci.yml +8 -1
index 790a6d9f9896..b7d187168df2 100644
@@ -42,6 +42,13 @@ linux-6.6.86-arm64:
 #
 # x86_64 artifacts
 #
+alpine-3.18-x86_64-rootfs:
+  extends: .x86_64-artifacts
+  script:
+    - ./scripts/alpine-rootfs.sh cpio
+  variables:
+    CONTAINER: alpine:3.18-x86_64-base
+
 linux-6.6.56-x86_64:
   extends: .x86_64-artifacts
   script: ./scripts/build-linux.sh
@@ -62,7 +69,7 @@ x86_64-kernel-linux-6.6.56:
 x86_64-rootfs-alpine-3.18:
   extends: .x86_64-artifacts
   script:
-    - . scripts/x86_64-rootfs-alpine.sh
+    - ./scripts/alpine-rootfs.sh tar
   variables:
     CONTAINER: alpine:3.18-x86_64-base
 
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +19 -2
similarity index 71%
rename from scripts/x86_64-rootfs-alpine.sh
rename to scripts/alpine-rootfs.sh
index b70b3a54ede5..75e2f8648ce5 100755
@@ -1,4 +1,9 @@
+#!/bin/bash
+
+set -eu
+
 WORKDIR="${PWD}"
+COPYDIR="${WORKDIR}/binaries"
 
 apk update
 
@@ -56,5 +61,17 @@ passwd -d "root" root
 
 # Create rootfs
 cd /
-tar cvzf "${WORKDIR}/binaries/initrd.tar.gz" \
-    bin dev etc home init lib mnt opt root sbin usr var
+case $1 in
+    cpio)
+        PATHS="bin dev etc home init lib mnt opt root sbin usr var"
+        find $PATHS -print0 | cpio -0 -H newc -o | gzip > "${COPYDIR}/rootfs.cpio.gz"
+
+        # Print the contents for the build log
+        zcat "${COPYDIR}/rootfs.cpio.gz" | cpio -tv
+        ;;
+
+    tar)
+        PATHS="bin dev etc home init lib mnt opt root sbin usr var"
+        tar cvzf "${COPYDIR}/initrd.tar.gz" $PATHS
+        ;;
+esac
Signature · 1 line
2.39.5
Reviewed-by on v2 3/7
#11 lore raw

Re: [PATCH v2 3/7] Rework rootfs generation to make a cpio archive

Quoted 10 lines · Andrew Cooper

Rename the script as we're going to use it for ARM64 shortly, and have it take a tar or cpio parameter to determine the output format.

Turn it into a proper bash script, and provide the cpio form under the new artefact naming scheme.

No functional change.

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#12 lore raw

PATCH v2 4/7 Shrink the rootfs substantially

In reply to Andrew Cooper

bash, busybox, musl and zlib are all in the base container.

python3 and ncurses are in principle used by bits of Xen, but not in anything we test in CI. argp-standlone, curl, dbus, libfdt, libgcc and sudo aren't used at all (for x86 at least).

libbz2 and libuuid were pulled in transitively before, and need to be included explicitly now.

Use apk --no-cache to avoid keeping a ~2M package index on disk.

Remove the modules scan on boot. We don't have or build any. This removes a chunk of warnings on boot.

This shrinks the rootfs from ~30M down to ~8M.

No practical change.

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Doug Goldstein <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

---
 scripts/alpine-rootfs.sh | 60 +++++++++++++++++++++++-----------------
 1 file changed, 34 insertions(+), 26 deletions(-)
scripts/alpine-rootfs.sh +34 -26
index 75e2f8648ce5..72c29e0a0a13 100755
@@ -4,33 +4,42 @@ set -eu
 
 WORKDIR="${PWD}"
 COPYDIR="${WORKDIR}/binaries"
+UNAME=$(uname -m)
 
-apk update
+apk --no-cache update
 
-# xen runtime deps
-apk add musl
-apk add libgcc
-apk add openrc
-apk add busybox
-apk add sudo
-apk add dbus
-apk add bash
-apk add python3
-apk add zlib
-apk add lzo
-apk add ncurses
-apk add yajl
-apk add libaio
-apk add xz
-apk add util-linux
-apk add argp-standalone
-apk add libfdt
-apk add glib
-apk add pixman
-apk add curl
-apk add udev
-apk add pciutils
-apk add libelf
+PKGS=(
+    # System
+    openrc
+    udev
+    util-linux
+
+    # Xen toolstack runtime deps
+    libbz2
+    libuuid
+    lzo
+    xz
+    yajl
+
+    # QEMU
+    glib
+    libaio
+    pixman
+    )
+
+case $UNAME in
+    x86_64)
+        PKGS+=(
+            # System
+            pciutils
+
+            # QEMU
+            libelf
+            )
+        ;;
+esac
+
+apk add --no-cache "${PKGS[@]}"
 
 # Xen
 cd /
@@ -45,7 +54,6 @@ rc-update add dmesg sysinit
 rc-update add hostname boot
 rc-update add hwclock boot
 rc-update add hwdrivers sysinit
-rc-update add modules boot
 rc-update add killprocs shutdown
 rc-update add mount-ro shutdown
 rc-update add savecache shutdown
Signature · 1 line
2.39.5
#13 lore raw

Re: [PATCH v2 4/7] Shrink the rootfs substantially

Quoted 6 lines · Andrew Cooper

bash, busybox, musl and zlib are all in the base container.

python3 and ncurses are in principle used by bits of Xen, but not in anything we test in CI. argp-standlone, curl, dbus, libfdt, libgcc and sudo aren't used at all (for x86 at least).

Quoted 7 lines

libbz2 and libuuid were pulled in transitively before, and need to be included explicitly now.

Use apk --no-cache to avoid keeping a ~2M package index on disk.

Remove the modules scan on boot. We don't have or build any. This removes a chunk of warnings on boot.

Strictly speaking there is xen-argo.ko, but that's handled manually anyway, so probably not worth mentioning.

Quoted 3 lines

This shrinks the rootfs from ~30M down to ~8M.

No practical change.

This also adds some preparation (the case on uname -m) for ARM64 rootfs, would be nice to mention it too. Especially since libfdt removed here will be re-added for ARM.

Quoted 16 lines

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Doug Goldstein <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

---
 scripts/alpine-rootfs.sh | 60 +++++++++++++++++++++++-----------------
 1 file changed, 34 insertions(+), 26 deletions(-)
scripts/alpine-rootfs.sh +0 -0
index 75e2f8648ce5..72c29e0a0a13 100755

scripts/alpine-rootfs.sh set -eu · line 9

Quoted 7 lines
scripts/alpine-rootfs.sh +2 -1
@@ -4,33 +4,42 @@ set -eu
 
 WORKDIR="${PWD}"
 COPYDIR="${WORKDIR}/binaries"
+UNAME=$(uname -m)
 
-apk update
+apk --no-cache update

This is no-op, no? IIUC the only thing apk update does is updating the cache, which you disabled...

Quoted 70 lines
scripts/alpine-rootfs.sh +32 -25
-# xen runtime deps
-apk add musl
-apk add libgcc
-apk add openrc
-apk add busybox
-apk add sudo
-apk add dbus
-apk add bash
-apk add python3
-apk add zlib
-apk add lzo
-apk add ncurses
-apk add yajl
-apk add libaio
-apk add xz
-apk add util-linux
-apk add argp-standalone
-apk add libfdt
-apk add glib
-apk add pixman
-apk add curl
-apk add udev
-apk add pciutils
-apk add libelf
+PKGS=(
+    # System
+    openrc
+    udev
+    util-linux
+
+    # Xen toolstack runtime deps
+    libbz2
+    libuuid
+    lzo
+    xz
+    yajl
+
+    # QEMU
+    glib
+    libaio
+    pixman
+    )
+
+case $UNAME in
+    x86_64)
+        PKGS+=(
+            # System
+            pciutils
+
+            # QEMU
+            libelf
+            )
+        ;;
+esac
+
+apk add --no-cache "${PKGS[@]}"
 
 # Xen
 cd /
@@ -45,7 +54,6 @@ rc-update add dmesg sysinit
 rc-update add hostname boot
 rc-update add hwclock boot
 rc-update add hwdrivers sysinit
-rc-update add modules boot
 rc-update add killprocs shutdown
 rc-update add mount-ro shutdown
 rc-update add savecache shutdown
Signature · 1 line
2.39.5
Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#14 lore raw

Re: [PATCH v2 4/7] Shrink the rootfs substantially

Quoted 10 lines · Marek Marczykowski-Górecki
Quoted 9 lines · Andrew Cooper

bash, busybox, musl and zlib are all in the base container.

python3 and ncurses are in principle used by bits of Xen, but not in anything we test in CI. argp-standlone, curl, dbus, libfdt, libgcc and sudo aren't used at all (for x86 at least).

libbz2 and libuuid were pulled in transitively before, and need to be included explicitly now.

Quoted 6 lines
Quoted 4 lines

Use apk --no-cache to avoid keeping a ~2M package index on disk.

Remove the modules scan on boot. We don't have or build any. This removes a chunk of warnings on boot.

Strictly speaking there is xen-argo.ko, but that's handled manually anyway, so probably not worth mentioning.

Hmm, it's an awkward way around in the series, but yes.  The lack of doing any of the normal module work in the kernel build is what causes xen-argo.ko to be more special than I'd like.

Quoted 7 lines
Quoted 4 lines

This shrinks the rootfs from ~30M down to ~8M.

No practical change.

This also adds some preparation (the case on uname -m) for ARM64 rootfs, would be nice to mention it too. Especially since libfdt removed here will be re-added for ARM.

"Factor out some x86-isms in preparation for ARM64 support."

Quoted 17 lines
Quoted 17 lines

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Doug Goldstein <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

---
 scripts/alpine-rootfs.sh | 60 +++++++++++++++++++++++-----------------
 1 file changed, 34 insertions(+), 26 deletions(-)
scripts/alpine-rootfs.sh +0 -0
index 75e2f8648ce5..72c29e0a0a13 100755
@@ -4,33 +4,42 @@ set -eu
 
Quoted 8 lines

scripts/alpine-rootfs.sh set -eu · line 9

Quoted 6 lines
scripts/alpine-rootfs.sh +2 -1
 WORKDIR="${PWD}"
 COPYDIR="${WORKDIR}/binaries"
+UNAME=$(uname -m)
 
-apk update
+apk --no-cache update

This is no-op, no? IIUC the only thing apk update does is updating the cache, which you disabled...

Lovely.  This ought to be upgrade, so we pull in updates to the packages in the base image.

~Andrew

#15 lore raw

PATCH v2 4/7 Shrink the rootfs substantially

In reply to Andrew Cooper

bash, busybox, musl and zlib are all in the base container.

python3 and ncurses are in principle used by bits of Xen, but not in anything we test in CI. argp-standlone, curl, dbus, libfdt, libgcc and sudo aren't used at all (for x86 at least).

libbz2 and libuuid were pulled in transitively before, and need to be included explicitly now.

Use apk --no-cache to avoid keeping a ~2M package index on disk. Use apk upgrade in case there are changes to the base container.

Remove the modules scan on boot. We don't have or build any (except argo, and that's handled specially). This removes a chunk of warnings on boot.

This shrinks the rootfs from ~30M down to ~8M.

Factor out some x86-isms in preparation for ARM64 support.

No practical change.

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Doug Goldstein <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

v2.1:
* Extend commit message
* Use apk upgrade

https://gitlab.com/xen-project/hardware/test-artifacts/-/jobs/9713228239
https://gitlab.com/xen-project/hardware/test-artifacts/-/jobs/9713228242

---
 scripts/alpine-rootfs.sh | 60 +++++++++++++++++++++++-----------------
 1 file changed, 34 insertions(+), 26 deletions(-)
scripts/alpine-rootfs.sh +34 -26
index 75e2f8648ce5..b01de9709d02 100755
@@ -4,33 +4,42 @@ set -eu
 
 WORKDIR="${PWD}"
 COPYDIR="${WORKDIR}/binaries"
+UNAME=$(uname -m)
 
-apk update
+apk --no-cache upgrade
 
-# xen runtime deps
-apk add musl
-apk add libgcc
-apk add openrc
-apk add busybox
-apk add sudo
-apk add dbus
-apk add bash
-apk add python3
-apk add zlib
-apk add lzo
-apk add ncurses
-apk add yajl
-apk add libaio
-apk add xz
-apk add util-linux
-apk add argp-standalone
-apk add libfdt
-apk add glib
-apk add pixman
-apk add curl
-apk add udev
-apk add pciutils
-apk add libelf
+PKGS=(
+    # System
+    openrc
+    udev
+    util-linux
+
+    # Xen toolstack runtime deps
+    libbz2
+    libuuid
+    lzo
+    xz
+    yajl
+
+    # QEMU
+    glib
+    libaio
+    pixman
+    )
+
+case $UNAME in
+    x86_64)
+        PKGS+=(
+            # System
+            pciutils
+
+            # QEMU
+            libelf
+            )
+        ;;
+esac
+
+apk add --no-cache "${PKGS[@]}"
 
 # Xen
 cd /
@@ -45,7 +54,6 @@ rc-update add dmesg sysinit
 rc-update add hostname boot
 rc-update add hwclock boot
 rc-update add hwdrivers sysinit
-rc-update add modules boot
 rc-update add killprocs shutdown
 rc-update add mount-ro shutdown
 rc-update add savecache shutdown
Signature · 1 line
2.39.5
Reviewed-by on v2 4/7
#16 lore raw

Re: [PATCH v2.1 4/7] Shrink the rootfs substantially

Quoted 15 lines · Andrew Cooper

bash, busybox, musl and zlib are all in the base container.

python3 and ncurses are in principle used by bits of Xen, but not in anything we test in CI. argp-standlone, curl, dbus, libfdt, libgcc and sudo aren't used at all (for x86 at least).

libbz2 and libuuid were pulled in transitively before, and need to be included explicitly now.

Use apk --no-cache to avoid keeping a ~2M package index on disk. Use apk upgrade in case there are changes to the base container.

Remove the modules scan on boot. We don't have or build any (except argo, and that's handled specially). This removes a chunk of warnings on boot.

Quoted 7 lines

This shrinks the rootfs from ~30M down to ~8M.

Factor out some x86-isms in preparation for ARM64 support.

No practical change.

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#17 lore raw

PATCH v2 5/7 Adjust directory layout for rootfs.cpio.gz

In reply to Andrew Cooper

All tests using the rootfs currently modify it with:

mkdir proc
mkdir run
mkdir srv
mkdir sys
rm var/run

This is because the rootfs doesn't have the correct top level directories. Furthermore, dev is currently included when it oughtn't to be.

srv is easy. It's an empty directory and can be included in PATHS.

dev, proc, run and sys are all mount points, which OpenRC knows how to populate on boot. Create only the top level directories in rootfs, without find recursing into them.

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Doug Goldstein <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

v2:
* New

---
 scripts/alpine-rootfs.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
scripts/alpine-rootfs.sh +5 -2
index 72c29e0a0a13..53547b5c5282 100755
@@ -71,8 +71,11 @@ passwd -d "root" root
 cd /
 case $1 in
     cpio)
-        PATHS="bin dev etc home init lib mnt opt root sbin usr var"
-        find $PATHS -print0 | cpio -0 -H newc -o | gzip > "${COPYDIR}/rootfs.cpio.gz"
+        {
+            PATHS="bin etc home init lib mnt opt root sbin srv usr var"
+            find $PATHS -print0
+            echo -ne "dev\0proc\0run\0sys\0"
+        } | cpio -0 -H newc -o | gzip > "${COPYDIR}/rootfs.cpio.gz"
 
         # Print the contents for the build log
         zcat "${COPYDIR}/rootfs.cpio.gz" | cpio -tv
Signature · 1 line
2.39.5
Reviewed-by on v2 5/7
#18 lore raw

Re: [PATCH v2 5/7] Adjust directory layout for rootfs.cpio.gz

Quoted 11 lines · Andrew Cooper

All tests using the rootfs currently modify it with:

mkdir proc
mkdir run
mkdir srv
mkdir sys
rm var/run

This is because the rootfs doesn't have the correct top level directories. Furthermore, dev is currently included when it oughtn't to be.

Quoted 7 lines

srv is easy. It's an empty directory and can be included in PATHS.

dev, proc, run and sys are all mount points, which OpenRC knows how to populate on boot. Create only the top level directories in rootfs, without find recursing into them.

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#19 lore raw

PATCH v2 6/7 Provide an ARM64 rootfs too

In reply to Andrew Cooper

The only extra package needed is libfdt.

The older ARM64 rootfs configured modloop, networking and sysctl, but none of this is used in any of the testing, so is omitted here for now.

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Doug Goldstein <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

---
 .gitlab-ci.yml                           | 7 +++++++
 containerize                             | 1 +
 images/alpine/3.18-arm64-base.dockerfile | 6 ++++++
 scripts/alpine-rootfs.sh                 | 7 +++++++
 4 files changed, 21 insertions(+)
 create mode 100644 images/alpine/3.18-arm64-base.dockerfile
.gitlab-ci.yml +7 -0
index b7d187168df2..d70ddd99e529 100644
@@ -33,6 +33,13 @@ stages:
 #
 # ARM64 artifacts
 #
+alpine-3.18-arm64-rootfs:
+  extends: .arm64-artifacts
+  script:
+    - ./scripts/alpine-rootfs.sh cpio
+  variables:
+    CONTAINER: alpine:3.18-arm64-base
+
 linux-6.6.86-arm64:
   extends: .arm64-artifacts
   script: ./scripts/build-linux.sh
containerize +1 -0
index c23f55ead737..38a434ab7075 100755
@@ -24,6 +24,7 @@ die() {
 #
 BASE="registry.gitlab.com/xen-project/hardware/test-artifacts"
 case "_${CONTAINER}" in
+    _alpine-3.18-arm64-base) CONTAINER="${BASE}/alpine:3.18-arm64-base" ;;
     _alpine-3.18-arm64-build) CONTAINER="${BASE}/alpine:3.18-arm64-build" ;;
     _alpine-3.18-x86_64-base) CONTAINER="${BASE}/alpine:3.18-x86_64-base" ;;
     _alpine-3.18-x86_64-build|_) CONTAINER="${BASE}/alpine:3.18-x86_64-build" ;;
images/alpine/3.18-arm64-base.dockerfile new file +6 -0
new file mode 100644
index 000000000000..ab597c75b80e
@@ -0,0 +1,6 @@
+# syntax=docker/dockerfile:1
+FROM --platform=linux/arm64/v8 alpine:3.18
+LABEL maintainer.name="The Xen Project"
+LABEL maintainer.email="[email protected]"
+
+RUN apk --no-cache add bash
scripts/alpine-rootfs.sh +7 -0
index 53547b5c5282..e52908a3d588 100755
@@ -37,6 +37,13 @@ case $UNAME in
             libelf
             )
         ;;
+
+    aarch64)
+        PKGS+=(
+            # Xen
+            libfdt
+            )
+        ;;
 esac
 
 apk add --no-cache "${PKGS[@]}"
Signature · 1 line
2.39.5
Reviewed-by on v2 6/7
#20 lore raw

Re: [PATCH v2 6/7] Provide an ARM64 rootfs too

Quoted 6 lines · Andrew Cooper

The only extra package needed is libfdt.

The older ARM64 rootfs configured modloop, networking and sysctl, but none of this is used in any of the testing, so is omitted here for now.

Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#21 lore raw

PATCH v2 7/7 Package microcode for the x86 hardware runners

In reply to Andrew Cooper

They are all out of date, to different degrees.

Install jq into the x86_64 build container so we can parse the Github latest release information in an acceptable way.

The resulting archive must be uncompressed, in order to work during early boot.

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Doug Goldstein <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

---
 .gitlab-ci.yml                             |  4 +++
 images/alpine/3.18-x86_64-build.dockerfile |  3 ++
 scripts/x86-microcode.sh                   | 42 ++++++++++++++++++++++
 3 files changed, 49 insertions(+)
 create mode 100755 scripts/x86-microcode.sh
.gitlab-ci.yml +4 -0
index d70ddd99e529..74335363d5ed 100644
@@ -64,6 +64,10 @@ linux-6.6.56-x86_64:
     ARGO_SHA: "705a7a8a624b42e13e655d3042059b8a85cdf6a3"
     ARGOEXEC_SHA: "d900429f6640acc6f68a3d3a4c945d7da60625d8"
 
+microcode-x86:
+  extends: .x86_64-artifacts
+  script: ./scripts/x86-microcode.sh
+
 #
 # The jobs below here are legacy and being phased out.
 #
images/alpine/3.18-x86_64-build.dockerfile +3 -0
index eac0cda4fed3..c4ff30e1f138 100644
@@ -27,6 +27,9 @@ RUN <<EOF
             openssl-dev
             perl
 
+            # Microcode
+            jq
+
             # Argo build deps
             autoconf
             automake
scripts/x86-microcode.sh new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
2.39.5