From 3edbff730d04815ac693746dab54110c80bfe472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Sun, 10 May 2026 19:04:06 +0200 Subject: [PATCH] image-builder: support building addon images without /sbin/init check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addon images (e.g. the CoCo guest components addon) are not full root filesystems -- they contain only the binaries and configuration that get bind-mounted into the real rootfs at boot. The existing check_rootfs() validation requires /sbin/init and systemd, which are not present in addon images. Add a SKIP_ROOTFS_CHECK environment variable that, when set to "yes", bypasses the check_rootfs() call. Forward the variable into the container environment when using the Docker-based build path so it works in both direct and containerised invocations. Signed-off-by: Fabiano FidĂȘncio Assisted-by: Cursor --- tools/osbuilder/image-builder/image_builder.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/osbuilder/image-builder/image_builder.sh b/tools/osbuilder/image-builder/image_builder.sh index 5d98c98aff..66ccc0139d 100755 --- a/tools/osbuilder/image-builder/image_builder.sh +++ b/tools/osbuilder/image-builder/image_builder.sh @@ -179,6 +179,7 @@ build_with_container() { --env NSDAX_BIN="${nsdax_bin}" \ --env SKIP_DAX_HEADER="${SKIP_DAX_HEADER}" \ --env MEASURED_ROOTFS="${MEASURED_ROOTFS}" \ + --env SKIP_ROOTFS_CHECK="${SKIP_ROOTFS_CHECK:-no}" \ --env SELINUX="${SELINUX}" \ --env DEBUG="${DEBUG}" \ --env ARCH="${ARCH}" \ @@ -715,8 +716,10 @@ main() { exit $? fi - if ! check_rootfs "${rootfs}" ; then - die "Invalid rootfs" + if [[ "${SKIP_ROOTFS_CHECK:-no}" != "yes" ]]; then + if ! check_rootfs "${rootfs}" ; then + die "Invalid rootfs" + fi fi local skip_dax="${SKIP_DAX_HEADER:-no}"