Rootfs/argo cleanup and microcode support
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.shSignature · 1 line
2.39.5
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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.
Signed-off-by Andrew Cooper <[email protected]>
Signature · 3 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
PATCH v2 2/7 Overhaul how Argo is built and packged
In reply to Andrew CooperRight 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
@@ -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
@@ -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
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
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
Re: [PATCH v2 2/7] Overhaul how Argo is built and packged
In reply to Andrew CooperQuoted 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.Signed-off-by Andrew Cooper <[email protected]>
Re: [PATCH v2 2/7] Overhaul how Argo is built and packged
In reply to Andrew CooperQuoted 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.Signed-off-by Andrew Cooper <[email protected]>
Do we need to remove x86_64-argo-linux.sh?
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.Signed-off-by Andrew Cooper <[email protected]>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
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
Signed-off-by Andrew Cooper <[email protected]>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
PATCH v2 3/7 Rework rootfs generation to make a cpio archive
In reply to Andrew CooperRename 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
@@ -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
@@ -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
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.
Signed-off-by Andrew Cooper <[email protected]>Reviewed-by Denis Mukhin <[email protected]>
Signature · 3 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
PATCH v2 4/7 Shrink the rootfs substantially
In reply to Andrew Cooperbash, 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
@@ -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
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
Signed-off-by Andrew Cooper <[email protected]>---
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
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 shutdownSignature · 1 line
2.39.5
Signature · 3 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
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
Signed-off-by Andrew Cooper <[email protected]>---
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@@ -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
-1WORKDIR="${PWD}" COPYDIR="${WORKDIR}/binaries" +UNAME=$(uname -m) -apk update +apk --no-cache updateThis is no-op, no? IIUC the only thing
apk updatedoes 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
PATCH v2 4/7 Shrink the rootfs substantially
In reply to Andrew Cooperbash, 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
@@ -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
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.
Signed-off-by Andrew Cooper <[email protected]>
Signature · 3 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
PATCH v2 5/7 Adjust directory layout for rootfs.cpio.gz
In reply to Andrew CooperAll 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
@@ -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
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/runThis 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
findrecursing into them.Signed-off-by Andrew Cooper <[email protected]>
Signature · 3 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
PATCH v2 6/7 Provide an ARM64 rootfs too
In reply to Andrew CooperThe 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
@@ -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
@@ -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
@@ -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
@@ -37,6 +37,13 @@ case $UNAME in libelf ) ;; + + aarch64) + PKGS+=( + # Xen + libfdt + ) + ;; esac apk add --no-cache "${PKGS[@]}"
Signature · 1 line
2.39.5
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.
Signed-off-by Andrew Cooper <[email protected]>
Signature · 3 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
PATCH v2 7/7 Package microcode for the x86 hardware runners
In reply to Andrew CooperThey 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
@@ -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
@@ -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