Rootfs generation (ARM and x86)
cover Rootfs generation (ARM and x86)
Part 3 of the cleanup, reworking rootfs generation.
The Xen side of the change isn't quite ready yet, but this is in a good enough state for review.
Andrew Cooper (3):
Rework rootfs generation to make a cpio archive
Shrink the rootfs substantially
Provide an ARM64 rootfs too
.gitlab-ci.yml | 16 ++++- containerize | 1 + images/alpine/3.18-arm64-base.dockerfile | 6 ++ scripts/alpine-rootfs.sh | 92 ++++++++++++++++++++++++ scripts/x86_64-rootfs-alpine.sh | 60 ---------------- 5 files changed, 114 insertions(+), 61 deletions(-) create mode 100644 images/alpine/3.18-arm64-base.dockerfile create mode 100755 scripts/alpine-rootfs.sh delete mode 100755 scripts/x86_64-rootfs-alpine.sh
Signature · 1 line
2.39.5
PATCH 1/3 Rework rootfs generation to make a cpio archive
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]>
---
.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} (75%).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 +PATHS="bin dev etc home init lib mnt opt root sbin usr var" + +case $1 in + cpio) + find $PATHS | cpio -o -H newc | gzip > "${COPYDIR}/rootfs.cpio.gz" + + # Print the contents for the build log + zcat "${COPYDIR}/rootfs.cpio.gz" | cpio -tv + ;; + + tar) + tar cvzf "${COPYDIR}/initrd.tar.gz" $PATHS + ;; +esac
Signature · 1 line
2.39.5
Re: [PATCH 1/3] Rework rootfs generation to make a cpio archive
Quoted 69 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]>---
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 | 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} (75%).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-basescripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +5
-0@@ -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 /
scripts/alpine-rootfs.sh passwd -d "root" root · line 71
Quoted 10 lines
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +8
-2-tar cvzf "${WORKDIR}/binaries/initrd.tar.gz" \ - bin dev etc home init lib mnt opt root sbin usr var +PATHS="bin dev etc home init lib mnt opt root sbin usr var" + +case $1 in + cpio) + find $PATHS | cpio -o -H newc | gzip > "${COPYDIR}/rootfs.cpio.gz" + + # Print the contents for the build log + zcat "${COPYDIR}/rootfs.cpio.gz" | cpio -tv
add 'v' to cpio above instead?
Quoted 9 lines
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +6
-0+ ;; + + tar) + tar cvzf "${COPYDIR}/initrd.tar.gz" $PATHS + ;; +esacSignature · 1 line
2.39.5
Signature · 3 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
Re: [PATCH 1/3] Rework rootfs generation to make a cpio archive
Quoted 10 lines · Marek Marczykowski-Górecki
Quoted 9 lines · Andrew Cooper
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +0
-0@@ -56,5 +61,17 @@ passwd -d "root" root
Quoted 13 lines
scripts/alpine-rootfs.sh passwd -d "root" root · line 71
Quoted 12 lines
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +8
-2# Create rootfs cd / -tar cvzf "${WORKDIR}/binaries/initrd.tar.gz" \ - bin dev etc home init lib mnt opt root sbin usr var +PATHS="bin dev etc home init lib mnt opt root sbin usr var" + +case $1 in + cpio) + find $PATHS | cpio -o -H newc | gzip > "${COPYDIR}/rootfs.cpio.gz" + + # Print the contents for the build log + zcat "${COPYDIR}/rootfs.cpio.gz" | cpio -tvadd 'v' to cpio above instead?
Oh, of course. There's another instance of this pattern in argo, which I'll fix up too.
~Andrew
Re: [PATCH 1/3] Rework rootfs generation to make a cpio archive
Quoted 24 lines · Andrew Cooper
Quoted 10 lines · Marek Marczykowski-Górecki
Quoted 9 lines · Andrew Cooper
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +0
-0@@ -56,5 +61,17 @@ passwd -d "root" rootQuoted 13 lines
scripts/alpine-rootfs.sh passwd -d "root" root · line 71
Quoted 12 lines
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +8
-2# Create rootfs cd / -tar cvzf "${WORKDIR}/binaries/initrd.tar.gz" \ - bin dev etc home init lib mnt opt root sbin usr var +PATHS="bin dev etc home init lib mnt opt root sbin usr var" + +case $1 in + cpio) + find $PATHS | cpio -o -H newc | gzip > "${COPYDIR}/rootfs.cpio.gz" + + # Print the contents for the build log + zcat "${COPYDIR}/rootfs.cpio.gz" | cpio -tvadd 'v' to cpio above instead?
Quoted 2 lines
Oh, of course. There's another instance of this pattern in argo, which I'll fix up too.
Apparently not.
https://gitlab.com/xen-project/hardware/test-artifacts/-/jobs/9695952322
I expect the -v is getting swallowed by the pipe.
~Andrew
Re: [PATCH 1/3] Rework rootfs generation to make a cpio archive
Quoted 7 lines · Andrew Cooper
Quoted 6 lines · Andrew Cooper
Quoted 5 lines · Marek Marczykowski-Górecki
Quoted 4 lines · Andrew Cooper
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +4
-0+ find $PATHS | cpio -o -H newc | gzip > "${COPYDIR}/rootfs.cpio.gz" + + # Print the contents for the build log + zcat "${COPYDIR}/rootfs.cpio.gz" | cpio -tv
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
add 'v' to cpio above instead?
Oh, of course. There's another instance of this pattern in argo, which I'll fix up too.
Apparently not.
https://gitlab.com/xen-project/hardware/test-artifacts/-/jobs/9695952322I expect the -v is getting swallowed by the pipe.
Great, busybox's cpio prints it to stdout instead of stderr (as normal cpio do)...
Signature · 3 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
Re: [PATCH 1/3] Rework rootfs generation to make a cpio archive
In reply to Andrew CooperQuoted 68 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]>---
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 | 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} (75%).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-basescripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +5
-0@@ -1,4 +1,9 @@ +#!/bin/bash + +set -eu + WORKDIR="${PWD}" +COPYDIR="${WORKDIR}/binaries" apk update@@ -56,5 +61,17 @@ passwd -d "root" root
scripts/alpine-rootfs.sh passwd -d "root" root · line 69
Quoted 10 lines
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +6
-2# Create rootfs cd / -tar cvzf "${WORKDIR}/binaries/initrd.tar.gz" \ - bin dev etc home init lib mnt opt root sbin usr var +PATHS="bin dev etc home init lib mnt opt root sbin usr var" + +case $1 in + cpio) + find $PATHS | cpio -o -H newc | gzip > "${COPYDIR}/rootfs.cpio.gz" +
Paranoia mode: -print0 for find and -0 for cpio to support weird file names?
scripts/alpine-rootfs.sh passwd -d "root" root · line 71
Quoted 2 lines
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +2
-0+ # Print the contents for the build log + zcat "${COPYDIR}/rootfs.cpio.gz" | cpio -tv
I saw other comments about -v and busybox compatibility.
I suppose it depends how important are performances here, otherwise I could suggest the usage of mkfifo before, use -F option to the fifo and use an additional pipeline to compress the file.
mypipe=$(mktemp -u)
mkfifo $mypipe
gzip -c > "${COPYDIR}/rootfs.cpio.gz" < $mypipe & find $PATHS -print0 | cpio -o -H newc -F $mypipe -0 wait # for gzip
rm $mypipe
Quoted 10 lines
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +6
-1+ ;; + + tar) + tar cvzf "${COPYDIR}/initrd.tar.gz" $PATHS + ;; +esac --2.39.5
Frediano
Re: [PATCH 1/3] Rework rootfs generation to make a cpio archive
Quoted 69 lines · Frediano Ziglio
Quoted 67 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]>---
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 | 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} (75%).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-basescripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +5
-0@@ -1,4 +1,9 @@ +#!/bin/bash + +set -eu + WORKDIR="${PWD}" +COPYDIR="${WORKDIR}/binaries" apk update@@ -56,5 +61,17 @@ passwd -d "root" root
Quoted 11 lines
scripts/alpine-rootfs.sh passwd -d "root" root · line 69
Quoted 10 lines
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +6
-2# Create rootfs cd / -tar cvzf "${WORKDIR}/binaries/initrd.tar.gz" \ - bin dev etc home init lib mnt opt root sbin usr var +PATHS="bin dev etc home init lib mnt opt root sbin usr var" + +case $1 in + cpio) + find $PATHS | cpio -o -H newc | gzip > "${COPYDIR}/rootfs.cpio.gz" +Paranoia mode: -print0 for find and -0 for cpio to support weird file names?
This is a tiny alpine rootfs. There aren't any, but weird filenames would be a problem elsewhere too.
Quoted 8 lines
scripts/alpine-rootfs.sh passwd -d "root" root · line 71
Quoted 3 lines
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +2
-0+ # Print the contents for the build log + zcat "${COPYDIR}/rootfs.cpio.gz" | cpio -tvI saw other comments about -v and busybox compatibility.
I suppose it depends how important are performances here, otherwise I could suggest the usage of mkfifo before, use -F option to the fifo and use an additional pipeline to compress the file.
Quoted 6 lines
mypipe=$(mktemp -u)
mkfifo $mypipe
gzip -c > "${COPYDIR}/rootfs.cpio.gz" < $mypipe & find $PATHS -print0 | cpio -o -H newc -F $mypipe -0 wait # for gzip
rm $mypipe
These artefacts are built once, then reused indefinitely. Generating this artefact takes 18s, most of which is the gitlab runner starting up.
~Andrew
Re: [PATCH 1/3] Rework rootfs generation to make a cpio archive
In reply to Andrew CooperQuoted 80 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]---
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 | 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} (75%).gitlab-ci.yml +7
-0@@ -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.gitlab-ci.yml +0
-0@@ -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.shtar
variables:
CONTAINER: alpine:3.18-x86_64-basescripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +4
-0@@ -1,4 +1,9 @@ +#!/bin/bash + +set -eu +WORKDIR="${PWD}"
+COPYDIR="${WORKDIR}/binaries"apk update
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +0
-0@@ -56,5 +61,17 @@ passwd -d "root" root # Create rootfscd /
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +0
-1-tar cvzf "${WORKDIR}/binaries/initrd.tar.gz" \
scripts/alpine-rootfs.sh passwd -d "root" root · line 71
Quoted 10 lines
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +8
-1- bin dev etc home init lib mnt opt root sbin usr var +PATHS="bin dev etc home init lib mnt opt root sbin usr var" + +case $1 in + cpio) + find $PATHS | cpio -o -H newc | gzip > "${COPYDIR}/rootfs.cpio.gz" + + # Print the contents for the build log + zcat "${COPYDIR}/rootfs.cpio.gz" | cpio -tv
Maybe allow $1 to be a filename? E. g. rootfs.cpio.gz or initrd.tar.gz. This way $1 will contain an explicit output artifact format along with the output filename.
What do you think?
Quoted 5 lines
+ ;;
+
+ tar)
+ tar cvzf "${COPYDIR}/initrd.tar.gz" $PATHS
+ ;;
I would add the default case and error out in case of possible mis-use.
Quoted 3 lines
+esac
--
2.39.5
Re: [PATCH 1/3] Rework rootfs generation to make a cpio archive
Quoted 95 lines · Denis Mukhin
Quoted 79 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]---
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 | 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} (75%).gitlab-ci.yml +7
-0@@ -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.gitlab-ci.yml +0
-0@@ -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.shtar
variables:
CONTAINER: alpine:3.18-x86_64-basescripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +4
-0@@ -1,4 +1,9 @@ +#!/bin/bash + +set -eu +WORKDIR="${PWD}"
+COPYDIR="${WORKDIR}/binaries"apk update
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +0
-0@@ -56,5 +61,17 @@ passwd -d "root" root # Create rootfscd /
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +0
-1-tar cvzf "${WORKDIR}/binaries/initrd.tar.gz" \scripts/alpine-rootfs.sh passwd -d "root" root · line 71
Quoted 10 lines
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +8
-1- bin dev etc home init lib mnt opt root sbin usr var +PATHS="bin dev etc home init lib mnt opt root sbin usr var" + +case $1 in + cpio) + find $PATHS | cpio -o -H newc | gzip > "${COPYDIR}/rootfs.cpio.gz" + + # Print the contents for the build log + zcat "${COPYDIR}/rootfs.cpio.gz" | cpio -tvMaybe allow $1 to be a filename? E. g. rootfs.cpio.gz or initrd.tar.gz. This way $1 will contain an explicit output artifact format along with the output filename.
Quoted 8 lines
What do you think?
Quoted 5 lines
+ ;;
+
+ tar)
+ tar cvzf "${COPYDIR}/initrd.tar.gz" $PATHS
+ ;;I would add the default case and error out in case of possible mis-use.
This is bespoke tooling, used as part of Xen's GitlabCI infrastructure.
The parameter is going to last for all of about a week, until we can retire the tests using the tarball, because they're creating routine but intermittent test failure.
I'm not looking to over-engineer the result.
~Andrew
Re: [PATCH 1/3] Rework rootfs generation to make a cpio archive
Quoted 107 lines · Andrew Cooper
Quoted 86 lines · Denis Mukhin
Quoted 84 lines · On Friday, April 11th, 2025 at 3:52 AM, 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]---
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 | 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} (75%).gitlab-ci.yml +7
-0@@ -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.gitlab-ci.yml +0
-0@@ -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.shtar
variables:
CONTAINER: alpine:3.18-x86_64-basescripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +4
-0@@ -1,4 +1,9 @@ +#!/bin/bash + +set -eu +WORKDIR="${PWD}"
+COPYDIR="${WORKDIR}/binaries"apk update
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +0
-0@@ -56,5 +61,17 @@ passwd -d "root" root # Create rootfscd /
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +5
-2-tar cvzf "${WORKDIR}/binaries/initrd.tar.gz" \ - bin dev etc home init lib mnt opt root sbin usr var +PATHS="bin dev etc home init lib mnt opt root sbin usr var" + +case $1 in + cpio) + find $PATHS | cpio -o -H newc | gzip > "${COPYDIR}/rootfs.cpio.gz"Quoted 15 lines
Quoted 6 lines
+
+ # Print the contents for the build log
+ zcat "${COPYDIR}/rootfs.cpio.gz" | cpio -tv
Maybe allow $1 to be a filename? E. g. rootfs.cpio.gz or initrd.tar.gz. This way $1 will contain an explicit output artifact format along with the output filename.What do you think?
Quoted 6 lines
+ ;;
+
+ tar)
+ tar cvzf "${COPYDIR}/initrd.tar.gz" $PATHS
+ ;;
I would add the default case and error out in case of possible mis-use.
Quoted 5 lines
This is bespoke tooling, used as part of Xen's GitlabCI infrastructure.
The parameter is going to last for all of about a week, until we can retire the tests using the tarball, because they're creating routine but intermittent test failure.
Oh, I see, thanks for the details!
Quoted 4 lines
I'm not looking to over-engineer the result.
~Andrew
Re: [PATCH 1/3] Rework rootfs generation to make a cpio archive
In reply to Andrew CooperQuoted 11 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]
Quoted 87 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]---
.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} (75%).gitlab-ci.yml +7
-0@@ -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.gitlab-ci.yml +0
-0@@ -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.shtar
variables:
CONTAINER: alpine:3.18-x86_64-basescripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +4
-0@@ -1,4 +1,9 @@ +#!/bin/bash + +set -eu +WORKDIR="${PWD}"
+COPYDIR="${WORKDIR}/binaries"apk update
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +0
-0@@ -56,5 +61,17 @@ passwd -d "root" root # Create rootfscd /
scripts/alpine-rootfs.sh renamed from scripts/x86_64-rootfs-alpine.sh +14
-3-tar cvzf "${WORKDIR}/binaries/initrd.tar.gz" \ - bin dev etc home init lib mnt opt root sbin usr var +PATHS="bin dev etc home init lib mnt opt root sbin usr var" + +case $1 in + cpio) + find $PATHS | cpio -o -H newc | gzip > "${COPYDIR}/rootfs.cpio.gz" + + # Print the contents for the build log + zcat "${COPYDIR}/rootfs.cpio.gz" | cpio -tv + ;; + + tar) + tar cvzf "${COPYDIR}/initrd.tar.gz" $PATHS + ;; +esac --2.39.5
PATCH 2/3 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]>
I'm still working on the integration of the new rootfs's int Xen, and will hold off until committing that's ready but
https://gitlab.com/xen-project/hardware/xen-staging/-/pipelines/1763510164
shows good early progress.
--- 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 2/3] Shrink the rootfs substantially
Quoted 40 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.
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.
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]>I'm still working on the integration of the new rootfs's int Xen, and will hold off until committing that's ready but
https://gitlab.com/xen-project/hardware/xen-staging/-/pipelines/1763510164
shows good early progress.--- 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 8
Quoted 5 lines
scripts/alpine-rootfs.sh +1
-0@@ -4,33 +4,42 @@ set -eu WORKDIR="${PWD}" COPYDIR="${WORKDIR}/binaries" +UNAME=$(uname -m)
Minor: maybe ARCH/MACHINE ?
Quoted 35 lines
scripts/alpine-rootfs.sh +9
-25-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
scripts/alpine-rootfs.sh set -eu · line 28
Quoted 10 lines
scripts/alpine-rootfs.sh +10
-0+ libuuid + lzo + xz + yajl + + # QEMU + glib + libaio + pixman + )
Minor: indent with "PKGS" ?
Quoted 26 lines
scripts/alpine-rootfs.sh +14
-2+ +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 --
Quoted 3 lines
2.39.5
It looks good to me.
Frediano
PATCH 3/3 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