mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-07-07 10:45:21 +00:00
image-builder: support building extension images without /sbin/init check
Extension images (e.g. the CoCo guest components extension) 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 extension 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:
committed by
Fabiano Fidêncio
parent
e85a19a8a6
commit
1906a44413
@@ -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}" \
|
||||
@@ -456,6 +457,12 @@ setup_selinux() {
|
||||
}
|
||||
|
||||
setup_systemd() {
|
||||
# Extension content images (e.g. the gpu extension) carry no /etc and are not
|
||||
# bootable systemd rootfses, so there is nothing to set up here.
|
||||
if [[ ! -d "${mount_dir}/etc" ]]; then
|
||||
info "No /etc in rootfs; skipping systemd machine-id setup"
|
||||
return 0
|
||||
fi
|
||||
info "Creating empty machine-id to allow systemd to bind-mount it"
|
||||
touch "${mount_dir}/etc/machine-id"
|
||||
}
|
||||
@@ -715,8 +722,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}"
|
||||
|
||||
Reference in New Issue
Block a user