Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/runtime/config/configuration-clh-snp.toml.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
[hypervisor.clh]
path = "@CLHSNPPATH@"
igvm = "@IGVMPATH@"
image = "@IMAGEPATH@"

# rootfs filesystem type:
# - ext4 (default)
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/virtcontainers/hypervisor_config_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ func validateHypervisorConfig(conf *HypervisorConfig) error {
return fmt.Errorf("Missing image, initrd, and igvm path")
} else if conf.ImagePath != "" && conf.InitrdPath != "" {
return fmt.Errorf("Image and initrd path cannot be both set")
} else if conf.IgvmPath != "" && (conf.ImagePath != "" || conf.InitrdPath != "") {
return fmt.Errorf("Igvm and image or initrd path cannot be both set")
} else if conf.IgvmPath != "" && conf.InitrdPath != "" {
return fmt.Errorf("Igvm and initrd path cannot be both set")
}

if err := conf.CheckTemplateConfig(); err != nil {
Expand Down
22 changes: 20 additions & 2 deletions tools/osbuilder/image-builder/image_builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,27 @@ create_rootfs_image() {
fi

if [ "${KATA_BUILD_CC}" == "yes" ] && [ -b "${device}p2" ]; then
info "veritysetup format rootfs device: ${device}p1, hash device: ${device}p2"
setup_cmd="veritysetup format ${device}p1 ${device}p2"

case "${DM_VERITY_FORMAT}" in
veritysetup)
# Partition format compatible with "veritysetup open" but not with kernel's
# "dm-mod.create" command line parameter.
;;
kernelinit)
# Partition format compatible with kernel's "dm-mod.create" command line
# parameter but not with "veritysetup open".
setup_cmd+=" --no-superblock"
;;
*)
error "DM_VERITY_FORMAT(${DM_VERITY_FORMAT}) is incorrect (must be veritysetup or kernelinit)"
return 1
;;
esac

info "${setup_cmd}"
local image_dir=$(dirname "${image}")
veritysetup format "${device}p1" "${device}p2" > "${image_dir}"/root_hash.txt 2>&1
eval "${setup_cmd}" > "${image_dir}"/root_hash.txt 2>&1
fi

losetup -d "${device}"
Expand Down