config: switch CoCo templates from monolithic image to base + addon

Update all six CoCo configuration templates (coco-dev, snp, tdx for
both Go and Rust runtimes) to use the standard base image instead of
the monolithic confidential image, and add an [[extra_images]] section
for the CoCo addon:

  image = "@IMAGEPATH@"          (was @IMAGECONFIDENTIALPATH@)

  [[hypervisor.qemu.extra_images]]
  name = "coco"
  path = "@COCOIMAGEPATH@"
  verity_params = "@COCOVERITYPARAMS@"

Add COCOIMAGENAME (kata-containers-coco-addon.img), COCOIMAGEPATH, and
COCOVERITYPARAMS to both runtime Makefiles so the placeholders are
substituted at install time.

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:30 +02:00
parent 83e814c056
commit 41361ce93e
10 changed files with 65 additions and 17 deletions

View File

@@ -105,6 +105,9 @@ PKGRUNDIR := $(LOCALSTATEDIR)/run/$(PROJECT_DIR)
KERNELDIR := $(PKGDATADIR)
IMAGEPATH := $(PKGDATADIR)/$(IMAGENAME)
IMAGECONFIDENTIALPATH := $(PKGDATADIR)/$(IMAGECONFIDENTIALNAME)
COCOIMAGENAME := $(PROJECT_TAG)-coco-addon.img
COCOIMAGEPATH := $(PKGDATADIR)/$(COCOIMAGENAME)
COCOVERITYPARAMS :=
INITRDPATH := $(PKGDATADIR)/$(INITRDNAME)
INITRDCONFIDENTIALPATH := $(PKGDATADIR)/$(INITRDCONFIDENTIALNAME)
@@ -626,6 +629,9 @@ USER_VARS += IMAGEPATH
USER_VARS += IMAGEPATH_CLH_AZURE
USER_VARS += IMAGEPATH_NV
USER_VARS += IMAGECONFIDENTIALPATH
USER_VARS += COCOIMAGENAME
USER_VARS += COCOIMAGEPATH
USER_VARS += COCOVERITYPARAMS
USER_VARS += INITRDNAME
USER_VARS += INITRDCONFIDENTIALNAME
USER_VARS += INITRDPATH

View File

@@ -15,7 +15,7 @@
[hypervisor.qemu]
path = "@QEMUPATH@"
kernel = "@KERNELPATH_COCO@"
image = "@IMAGECONFIDENTIALPATH@"
image = "@IMAGEPATH@"
machine_type = "@MACHINETYPE@"
# rootfs filesystem type:
@@ -805,3 +805,8 @@ experimental = @DEFAULTEXPFEATURES@
# If enabled, user can run pprof tools with shim v2 process through kata-monitor.
# (default: false)
enable_pprof = false
[[hypervisor.qemu.extra_images]]
name = "coco"
path = "@COCOIMAGEPATH@"
verity_params = "@COCOVERITYPARAMS@"

View File

@@ -16,7 +16,7 @@
[hypervisor.qemu]
path = "@QEMUPATH@"
kernel = "@KERNELPATH_COCO@"
image = "@IMAGECONFIDENTIALPATH@"
image = "@IMAGEPATH@"
machine_type = "@MACHINETYPE@"
# Enable confidential guest support.
@@ -739,3 +739,8 @@ enable_pprof = false
# to the hypervisor.
# (default: /run/kata-containers/dans)
dan_conf = "@DEFDANCONF@"
[[hypervisor.qemu.extra_images]]
name = "coco"
path = "@COCOIMAGEPATH@"
verity_params = "@COCOVERITYPARAMS@"

View File

@@ -15,7 +15,7 @@
[hypervisor.qemu]
path = "@QEMUPATH@"
kernel = "@KERNELPATH_COCO@"
image = "@IMAGECONFIDENTIALPATH@"
image = "@IMAGEPATH@"
# initrd = "@INITRDPATH@"
machine_type = "@MACHINETYPE@"
# Set to 0 to use Unix Domain Socket (/var/run/tdx-qgs/qgs.socket) instead of vsock.
@@ -717,3 +717,8 @@ enable_pprof = false
# to the hypervisor.
# (default: /run/kata-containers/dans)
dan_conf = "@DEFDANCONF@"
[[hypervisor.qemu.extra_images]]
name = "coco"
path = "@COCOIMAGEPATH@"
verity_params = "@COCOVERITYPARAMS@"

View File

@@ -129,6 +129,9 @@ KERNELDIR := $(PKGDATADIR)
IMAGEPATH := $(PKGDATADIR)/$(IMAGENAME)
IMAGECONFIDENTIALPATH := $(PKGDATADIR)/$(IMAGECONFIDENTIALNAME)
COCOIMAGENAME := $(PROJECT_TAG)-coco-addon.img
COCOIMAGEPATH := $(PKGDATADIR)/$(COCOIMAGENAME)
COCOVERITYPARAMS :=
INITRDPATH := $(PKGDATADIR)/$(INITRDNAME)
INITRDCONFIDENTIALPATH := $(PKGDATADIR)/$(INITRDCONFIDENTIALNAME)
@@ -681,6 +684,9 @@ USER_VARS += IMAGECONFIDENTIALNAME
USER_VARS += IMAGEPATH
USER_VARS += IMAGEPATH_CLH_AZURE
USER_VARS += IMAGECONFIDENTIALPATH
USER_VARS += COCOIMAGENAME
USER_VARS += COCOIMAGEPATH
USER_VARS += COCOVERITYPARAMS
USER_VARS += INITRDNAME
USER_VARS += INITRDCONFIDENTIALNAME
USER_VARS += INITRDPATH

View File

@@ -15,7 +15,7 @@
[hypervisor.qemu]
path = "@QEMUPATH@"
kernel = "@KERNELCONFIDENTIALPATH@"
image = "@IMAGECONFIDENTIALPATH@"
image = "@IMAGEPATH@"
machine_type = "@MACHINETYPE@"
# rootfs filesystem type:
@@ -773,3 +773,8 @@ kubelet_root_dir = "@DEFKUBELETROOTDIR@"
# cold_plug_vfio != no_port AND pod_resource_api_sock != "" => kubelet
# based cold plug.
pod_resource_api_sock = "@DEFPODRESOURCEAPISOCK@"
[[hypervisor.qemu.extra_images]]
name = "coco"
path = "@COCOIMAGEPATH@"
verity_params = "@COCOVERITYPARAMS@"

View File

@@ -15,7 +15,7 @@
[hypervisor.qemu]
path = "@QEMUPATH@"
kernel = "@KERNELCONFIDENTIALPATH@"
image = "@IMAGECONFIDENTIALPATH@"
image = "@IMAGEPATH@"
machine_type = "@MACHINETYPE@"
# rootfs filesystem type:
@@ -781,3 +781,8 @@ kubelet_root_dir = "@DEFKUBELETROOTDIR@"
# cold_plug_vfio != no_port AND pod_resource_api_sock != "" => kubelet
# based cold plug.
pod_resource_api_sock = "@DEFPODRESOURCEAPISOCK@"
[[hypervisor.qemu.extra_images]]
name = "coco"
path = "@COCOIMAGEPATH@"
verity_params = "@COCOVERITYPARAMS@"

View File

@@ -14,7 +14,7 @@
[hypervisor.qemu]
path = "@QEMUPATH@"
kernel = "@KERNELCONFIDENTIALPATH@"
image = "@IMAGECONFIDENTIALPATH@"
image = "@IMAGEPATH@"
machine_type = "@MACHINETYPE@"
tdx_quote_generation_service_socket_port = @QEMUTDXQUOTEGENERATIONSERVICESOCKETPORT@
@@ -758,3 +758,8 @@ kubelet_root_dir = "@DEFKUBELETROOTDIR@"
# cold_plug_vfio != no_port AND pod_resource_api_sock != "" => kubelet
# based cold plug.
pod_resource_api_sock = "@DEFPODRESOURCEAPISOCK@"
[[hypervisor.qemu.extra_images]]
name = "coco"
path = "@COCOIMAGEPATH@"
verity_params = "@COCOVERITYPARAMS@"

View File

@@ -16,16 +16,16 @@
"s390x": ["shim-v2-rust", "qemu", "virtiofsd", "kernel", "rootfs-image", "rootfs-initrd"]
},
"qemu-snp": {
"x86_64": ["shim-v2-go", "qemu-snp-experimental", "kernel", "rootfs-image-confidential", "ovmf-sev"]
"x86_64": ["shim-v2-go", "qemu-snp-experimental", "kernel", "rootfs-image", "rootfs-image-coco-addon", "ovmf-sev"]
},
"qemu-snp-runtime-rs": {
"x86_64": ["shim-v2-rust", "qemu-snp-experimental", "kernel", "rootfs-image-confidential", "ovmf-sev"]
"x86_64": ["shim-v2-rust", "qemu-snp-experimental", "kernel", "rootfs-image", "rootfs-image-coco-addon", "ovmf-sev"]
},
"qemu-tdx": {
"x86_64": ["shim-v2-go", "qemu-tdx-experimental", "kernel", "rootfs-image-confidential", "ovmf-tdx"]
"x86_64": ["shim-v2-go", "qemu-tdx-experimental", "kernel", "rootfs-image", "rootfs-image-coco-addon", "ovmf-tdx"]
},
"qemu-tdx-runtime-rs": {
"x86_64": ["shim-v2-rust", "qemu-tdx-experimental", "virtiofsd", "kernel", "rootfs-image-confidential", "ovmf-tdx"]
"x86_64": ["shim-v2-rust", "qemu-tdx-experimental", "virtiofsd", "kernel", "rootfs-image", "rootfs-image-coco-addon", "ovmf-tdx"]
},
"qemu-se": {
"s390x": ["shim-v2-go", "qemu", "virtiofsd", "kernel", "rootfs-initrd-confidential", "boot-image-se"]
@@ -52,13 +52,13 @@
"x86_64": ["shim-v2-rust", "qemu-tdx-experimental", "kernel-nvidia-gpu", "rootfs-image-nvidia-gpu-confidential", "ovmf-tdx"]
},
"qemu-coco-dev": {
"x86_64": ["shim-v2-go", "qemu", "kernel", "kernel-debug", "rootfs-image-confidential"],
"s390x": ["shim-v2-go", "qemu", "kernel", "rootfs-image-confidential"]
"x86_64": ["shim-v2-go", "qemu", "kernel", "kernel-debug", "rootfs-image", "rootfs-image-coco-addon"],
"s390x": ["shim-v2-go", "qemu", "kernel", "rootfs-image", "rootfs-image-coco-addon"]
},
"qemu-coco-dev-runtime-rs": {
"x86_64": ["shim-v2-rust", "qemu", "kernel", "kernel-debug", "rootfs-image-confidential"],
"aarch64": ["shim-v2-rust", "qemu", "kernel", "kernel-debug", "rootfs-image-confidential", "ovmf"],
"s390x": ["shim-v2-rust", "qemu", "kernel", "rootfs-image-confidential"]
"x86_64": ["shim-v2-rust", "qemu", "kernel", "kernel-debug", "rootfs-image", "rootfs-image-coco-addon"],
"aarch64": ["shim-v2-rust", "qemu", "kernel", "kernel-debug", "rootfs-image", "rootfs-image-coco-addon", "ovmf"],
"s390x": ["shim-v2-rust", "qemu", "kernel", "rootfs-image", "rootfs-image-coco-addon"]
},
"clh": {
"x86_64": ["shim-v2-go", "cloud-hypervisor", "virtiofsd", "nydus", "kernel", "kernel-debug", "rootfs-image", "rootfs-initrd"],

View File

@@ -42,14 +42,20 @@ esac
[[ "${CROSS_BUILD}" == "true" ]] && container_image_bk="${container_image}" && container_image="${container_image}-cross-build"
# Variants (targets) that build a measured rootfs as of now are:
# - rootfs-image-confidential
# - rootfs-image (the base image, measured; root hash labelled "base")
# - rootfs-image-coco-addon
# - rootfs-image-nvidia-gpu
# - rootfs-image-nvidia-gpu-confidential
#
# The base image is shared between non-confidential and confidential guests.
# Only confidential configurations enforce its dm-verity hash via
# @KERNELVERITYPARAMS@; non-confidential guests boot the data partition directly.
#
# shellcheck disable=SC2154
root_hash_dir="${repo_root_dir}/tools/packaging/kata-deploy/local-build/build"
verity_variants=(
"confidential:KERNELVERITYPARAMS"
"base:KERNELVERITYPARAMS"
"coco-addon:COCOVERITYPARAMS"
"nvidia-gpu:KERNELVERITYPARAMS_NV"
"nvidia-gpu-confidential:KERNELVERITYPARAMS_CONFIDENTIAL_NV"
)