diff --git a/.github/workflows/build-kata-static-tarball-amd64.yaml b/.github/workflows/build-kata-static-tarball-amd64.yaml index ade4eb9e77..09ddfd05d0 100644 --- a/.github/workflows/build-kata-static-tarball-amd64.yaml +++ b/.github/workflows/build-kata-static-tarball-amd64.yaml @@ -32,6 +32,7 @@ jobs: - qemu-snp-experimental - qemu-tdx-experimental - rootfs-image + - rootfs-image-tdx - rootfs-initrd - rootfs-initrd-sev - shim-v2 diff --git a/tools/packaging/guest-image/build_image.sh b/tools/packaging/guest-image/build_image.sh index 3eac34c619..230538d1cc 100755 --- a/tools/packaging/guest-image/build_image.sh +++ b/tools/packaging/guest-image/build_image.sh @@ -22,6 +22,7 @@ readonly osbuilder_dir="$(cd "${repo_root_dir}/tools/osbuilder" && pwd)" export GOPATH=${GOPATH:-${HOME}/go} arch_target="$(uname -m)" +final_image_name="kata-containers" final_initrd_name="kata-containers-initrd" image_initrd_extension=".img" @@ -59,7 +60,7 @@ build_image() { fi ( cd "${install_dir}" - ln -sf "${image_name}" kata-containers.img + ln -sf "${image_name}" "${final_image_name}${image_initrd_extension}" ) } @@ -86,6 +87,7 @@ main() { image_type=image destdir="$PWD" prefix="/opt/kata" + image_suffix="" image_initrd_suffix="" builddir="${PWD}" while getopts "h-:" opt; do @@ -113,6 +115,11 @@ main() { initrd_os_version=$(get_from_kata_deps "assets.initrd.architecture.${arch_target}.sev.version") initrd_name="kata-${initrd_distro}-${initrd_os_version}-${image_initrd_suffix}.${image_type}" final_initrd_name="${final_initrd_name}-${image_initrd_suffix}" + elif [ "${image_initrd_suffix}" == "tdx" ]; then + img_distro=$(get_from_kata_deps "assets.image.architecture.${arch_target}.name") + img_os_version=$(get_from_kata_deps "assets.image.architecture.${arch_target}.version") + image_name="kata-${img_distro}-${img_os_version}-${image_initrd_suffix}.${image_type}" + final_image_name="${final_image_name}-${image_initrd_suffix}" fi ;; prefix=*) diff --git a/tools/packaging/kata-deploy/local-build/Makefile b/tools/packaging/kata-deploy/local-build/Makefile index 091e3dc217..eb161e82b8 100644 --- a/tools/packaging/kata-deploy/local-build/Makefile +++ b/tools/packaging/kata-deploy/local-build/Makefile @@ -42,6 +42,7 @@ all: serial-targets \ serial-targets: ${MAKE} -f $(MK_PATH) -j 1 V= \ rootfs-image-tarball \ + rootfs-image-tdx-tarball \ rootfs-initrd-sev-tarball \ rootfs-initrd-tarball \ cloud-hypervisor-tarball @@ -100,6 +101,9 @@ qemu-tdx-experimental-tarball: rootfs-image-tarball: ${MAKE} $@-build +rootfs-image-tdx-tarball: kernel-tdx-experimental-tarball + ${MAKE} $@-build + rootfs-initrd-sev-tarball: kernel-sev-tarball ${MAKE} $@-build diff --git a/tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh b/tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh index c09eb75017..c65f4cd80e 100755 --- a/tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh +++ b/tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh @@ -95,6 +95,7 @@ options: qemu-snp-experimental qemu-tdx-experimental rootfs-image + rootfs-image-tdx rootfs-initrd rootfs-initrd-sev shim-v2 @@ -135,8 +136,10 @@ install_cached_tarball_component() { #Install guest image install_image() { - local jenkins="${jenkins_url}/job/kata-containers-main-rootfs-image-$(uname -m)/${cached_artifacts_path}" - local component="rootfs-image" + local image_type="${1:-"image"}" + local initrd_suffix="${2:-""}" + local jenkins="${jenkins_url}/job/kata-containers-main-rootfs-${image_type}-$(uname -m)/${cached_artifacts_path}" + local component="rootfs-${image_type}" local osbuilder_last_commit="$(get_last_modification "${repo_root_dir}/tools/osbuilder")" local guest_image_last_commit="$(get_last_modification "${repo_root_dir}/tools/packaging/guest-image")" @@ -156,7 +159,12 @@ install_image() { && return 0 info "Create image" - "${rootfs_builder}" --imagetype=image --prefix="${prefix}" --destdir="${destdir}" + "${rootfs_builder}" --imagetype=image --prefix="${prefix}" --destdir="${destdir}" --image_initrd_suffix="${initrd_suffix}" +} + +#Install guest image for tdx +install_image_tdx() { + install_image "image-tdx" "tdx" } #Install guest initrd @@ -310,6 +318,8 @@ install_kernel_experimental() { install_kernel_tdx_experimental() { local kernel_url="$(get_from_kata_deps assets.kernel-tdx-experimental.url)" + export MEASURED_ROOTFS=yes + install_kernel_helper \ "assets.kernel-tdx-experimental.version" \ "kernel-tdx-experimental" \ @@ -600,6 +610,8 @@ handle_build() { rootfs-image) install_image ;; + rootfs-image-tdx) install_image_tdx ;; + rootfs-initrd) install_initrd ;; rootfs-initrd-sev) install_initrd_sev ;;