Skip to content

Commit

Permalink
chnages made based on latest reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
ramagali24 committed Sep 20, 2024
1 parent aa795ab commit 296b43a
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions tools/snp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ usage() {
>&2 echo " stop-guests Stop all SNP guests started by this script"
>&2 echo " where OPTIONS are:"
>&2 echo " -n|--non-upm Build AMDSEV non UPM kernel (sev-snp-devel)"
>&2 echo " -s|--svsm Build coconut-svsm components, launch guest and verify attestation & measurement"
>&2 echo " -s|--svsm Build coconut-svsm components, launch guest and verify attestation & measurement"
>&2 echo " -i|--image Path to existing image file"
>&2 echo " -h|--help Usage information"

Expand Down Expand Up @@ -284,12 +284,11 @@ install_dependencies() {
# Needed to build 6.11.0-rc3 SNP kernel on the host
pip install tomli

#Needed to build Coconut-SVSM
if [ "$SVSM" ]; then
# Needed to build Coconut-SVSM
if $SVSM; then
sudo apt install -y libcunit1 libcunit1-dev build-essential libclang-dev autoconf \
autoconf-archive pkg-config automake libssl-dev libc6-dev gcc-multilib binutils make musl musl-tools
fi


echo "true" > "${dependencies_installed_file}"
}
Expand Down Expand Up @@ -823,11 +822,10 @@ setup_and_launch_guest() {
fi

# ovmf, initrd, kernel and append options
if "$SVSM"; then
add_qemu_cmdline_opts "-initrd ${INITRD_BIN}"
add_qemu_cmdline_opts "-kernel ${KERNEL_BIN}"
add_qemu_cmdline_opts "-append \"${GUEST_KERNEL_APPEND}\""
else
add_qemu_cmdline_opts "-initrd ${INITRD_BIN}"
add_qemu_cmdline_opts "-kernel ${KERNEL_BIN}"
add_qemu_cmdline_opts "-append \"${GUEST_KERNEL_APPEND}\""
if [ -z "$SVSM" ]; then
add_qemu_cmdline_opts "-bios ${OVMF_BIN}"
fi

Expand Down Expand Up @@ -1068,7 +1066,7 @@ get_cpu_code_name() {
esac
}

generate_snp_expected_measurement() {
generate_snp_expected_measurement() {
# Get ovmf, kernel, initrd paths
# Get vcpu type and kernel append command line
local ovmf_path=$(cat "${QEMU_CMDLINE_FILE}" \
Expand Down Expand Up @@ -1194,10 +1192,8 @@ generate_svsm_expected_measurement() {
fi
# Convert svsm_measurement to lowercase
svsm_measurement=$(echo "$svsm_measurement" | tr '[:upper:]' '[:lower:]')
echo ${svsm_measurement}
}


###############################################################################

# Main
Expand Down Expand Up @@ -1328,7 +1324,7 @@ main() {
install_dependencies
wait_and_retry_command verify_snp_guest
setup_guest_attestation
attest_guest
attest_guest
;;

stop-guests)
Expand Down

0 comments on commit 296b43a

Please sign in to comment.