image-builder: support building addon images without /sbin/init check

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 <ffidencio@nvidia.com>
Assisted-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Fabiano Fidêncio
2026-05-10 19:04:06 +02:00
parent e146a24ff5
commit 3edbff730d

View File

@@ -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}"