image_to_vm: Default to qemu_uefi on ARM

qemu makes no sense on that platform.
This commit is contained in:
Benjamin Gilbert 2017-05-02 15:02:09 -07:00
parent 791a530a44
commit c98788befc
3 changed files with 23 additions and 2 deletions

View File

@ -100,6 +100,7 @@ fi
. "${BUILD_LIBRARY_DIR}/prod_image_util.sh" || exit 1
. "${BUILD_LIBRARY_DIR}/dev_image_util.sh" || exit 1
. "${BUILD_LIBRARY_DIR}/test_image_content.sh" || exit 1
. "${BUILD_LIBRARY_DIR}/vm_image_util.sh" || exit 1
PROD_IMAGE=0
DEV_IMAGE=0
@ -216,7 +217,7 @@ print_image_to_vm() {
To convert it to a virtual machine image, use:
./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD} ${flags}
The default type is qemu, see ./image_to_vm.sh --help for other options.
The default type is $(get_default_vm_type ${BOARD}), see ./image_to_vm.sh --help for other options.
EOF
}

View File

@ -296,6 +296,22 @@ IMG_interoute_BUNDLE_FORMAT=ova
###########################################################
# Print the default vm type for the specified board
get_default_vm_type() {
local board="$1"
case "$board" in
amd64-usr)
echo "qemu"
;;
arm64-usr)
echo "qemu_uefi"
;;
*)
return 1
;;
esac
}
# Validate and set the vm type to use for the rest of the functions
set_vm_type() {
local vm_type="$1"

View File

@ -28,7 +28,7 @@ DEFINE_string board "${DEFAULT_BOARD}" \
# We default to TRUE so the buildbot gets its image. Note this is different
# behavior from image_to_usb.sh
DEFINE_string format "qemu" \
DEFINE_string format "" \
"Output format, one of: ${VALID_IMG_TYPES[*]}"
DEFINE_string from "" \
"Directory containing rootfs.image and mbr.image"
@ -59,6 +59,10 @@ switch_to_strict_mode
check_gsutil_opts
if [[ -z "${FLAGS_format}" ]]; then
FLAGS_format="$(get_default_vm_type ${FLAGS_board})"
fi
if ! set_vm_type "${FLAGS_format}"; then
die_notrace "Invalid format: ${FLAGS_format}"
fi