From 5e94a5506934600b10e4146172fdaa6d49d88f7a Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Fri, 28 Jul 2017 14:39:53 -0700 Subject: [PATCH 1/2] build_library: Add missing die function Signed-off-by: Geoff Levand --- build_library/qemu_template.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build_library/qemu_template.sh b/build_library/qemu_template.sh index 75741a7470..4648fcd513 100755 --- a/build_library/qemu_template.sh +++ b/build_library/qemu_template.sh @@ -39,6 +39,11 @@ Any arguments after -a and -p will be passed through to qemu, -- may be used as an explicit separator. See the qemu(1) man page for more details. " +die(){ + echo "${1}" + exit 1 +} + check_conflict() { if [ -n "${CLOUD_CONFIG_FILE}${CONFIG_IMAGE}${SSH_KEYS}" ]; then echo "The -u -c and -a options cannot be combined!" >&2 From e76030e0e9d0db33ea9758f836956e6e073fba02 Mon Sep 17 00:00:00 2001 From: Geoff Levand Date: Fri, 28 Jul 2017 14:39:53 -0700 Subject: [PATCH 2/2] build_library: Update qemu script to run on arm64 machines Signed-off-by: Geoff Levand --- build_library/qemu_template.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/build_library/qemu_template.sh b/build_library/qemu_template.sh index 4648fcd513..8424aa2fb1 100755 --- a/build_library/qemu_template.sh +++ b/build_library/qemu_template.sh @@ -147,14 +147,18 @@ if [ "${SAFE_ARGS}" -eq 1 ]; then # Disable KVM, for testing things like UEFI which don't like it set -- -machine accel=tcg "$@" else - case "${VM_BOARD}" in - amd64-usr) + case "${VM_BOARD}+$(uname -m)" in + amd64-usr+x86_64) # Emulate the host CPU closely in both features and cores. set -- -machine accel=kvm -cpu host -smp "${VM_NCPUS}" "$@" ;; - arm64-usr) - #FIXME(andrejro): tune the smp parameter - set -- -machine virt -cpu cortex-a57 -machine type=virt -smp 1 "$@" ;; - *) die "Unsupported arch" ;; + amd64-usr+*) + set -- -machine pc-q35-2.8 -cpu kvm64 -smp 1 -nographic "$@" ;; + arm64-usr+aarch64) + set -- -machine virt,accel=kvm,gic-version=3 -cpu host -smp "${VM_NCPUS}" -nographic "$@" ;; + arm64-usr+*) + set -- -machine virt -cpu cortex-a57 -smp 1 -nographic "$@" ;; + *) + die "Unsupported arch" ;; esac fi @@ -218,7 +222,7 @@ case "${VM_BOARD}" in "$@" ;; arm64-usr) - qemu-system-aarch64 -nographic \ + qemu-system-aarch64 \ -name "$VM_NAME" \ -m ${VM_MEMORY} \ -netdev user,id=eth0,hostfwd=tcp::"${SSH_PORT}"-:22,hostname="${VM_NAME}" \