@@ -16,6 +16,10 @@ Run "${image}" with "${memory}" MB memory "${cpus}" cpus and "${serial_port_path
1616 Process ${result }
1717 Set Test Variable ${image_copy } /tmp/resin${random } .img
1818
19+ # detect image architecture by checking for ARM64 EFI bootloader
20+ ${result } = Run Buffered Process strings ${image } | grep -Eo "BOOTAA64" shell=yes
21+ Run Keyword And Return If ${result.rc } == 0 Run aarch64 image
22+
1923 # firmware is 'dos' (legacy x86 DTs) or 'gpt' (generic-amd64 DT)
2024 ${result } = Run Buffered Process fdisk -l "${image } " | sed -nE 's/^Disklabel type: (\\w+)$/\\1/p' shell=yes
2125 Process ${result }
@@ -27,6 +31,13 @@ Run "${image}" with "${memory}" MB memory "${cpus}" cpus and "${serial_port_path
2731 Run Keyword And Return If ${result.rc } == 0 Run "${firmware } " image with "kvm" acceleration
2832 Run Keyword And Return If ${result.rc } != 0 Run "${firmware } " image with "tcg" acceleration
2933
34+ Run aarch64 image
35+ # https://www.qemu.org/docs/master/system/qemu-manpage.html
36+ # .. depending on the target architecture: kvm, xen, hvf, nvmm, whpx (default: tcg)
37+ ${result } = Run Buffered Process test -r /dev/kvm && test -w /dev/kvm shell=yes
38+ Run Keyword And Return If ${result.rc } == 0 Run "aarch64" image with "kvm" acceleration
39+ Run Keyword And Return If ${result.rc } != 0 Run "aarch64" image with "tcg" acceleration
40+
3041Run "gpt" image with "${acceleration}" acceleration
3142 # qemu-system-x86_64 defunct process without shell
3243 ${handle } = Start Process qemu-system-x86_64 -device ahci,id\=ahci -drive file\=${image_copy } ,media\=disk,cache\=none,format\=raw,if\=none,id\=disk -device ide-hd,drive\=disk,bus\=ahci.0 -device virtio-net-pci,netdev\=n1 -netdev \"user,id\=n1,dns\=127.0.0.1,guestfwd\=tcp:10.0.2.100:80-cmd:netcat haproxy 80,guestfwd\=tcp:10.0.2.100:443-cmd:netcat haproxy 443\" -m ${memory } -nographic -machine type\=q35 -accel ${acceleration } -smp ${cpus } -chardev socket,id\=serial0,path\=${serial_port_path } ,server\=on,wait\=off -serial chardev:serial0 -bios /usr/share/ovmf/OVMF.fd -nodefaults shell=yes
@@ -36,3 +47,11 @@ Run "dos" image with "${acceleration}" acceleration
3647 # qemu-system-x86_64 defunct process without shell
3748 ${handle } = Start Process qemu-system-x86_64 -device ahci,id\=ahci -drive file\=${image_copy } ,media\=disk,cache\=none,format\=raw,if\=none,id\=disk -device ide-hd,drive\=disk,bus\=ahci.0 -device virtio-net-pci,netdev\=n1 -netdev \"user,id\=n1,dns\=127.0.0.1,guestfwd\=tcp:10.0.2.100:80-cmd:netcat haproxy 80,guestfwd\=tcp:10.0.2.100:443-cmd:netcat haproxy 443\" -m ${memory } -nographic -machine type\=pc -accel ${acceleration } -smp ${cpus } -chardev socket,id\=serial0,path\=${serial_port_path } ,server\=on,wait\=off -serial chardev:serial0 shell=yes
3849 Return From Keyword ${handle }
50+
51+ Run "aarch64" image with "${acceleration}" acceleration
52+ # qemu-system-aarch64 defunct process without shell
53+ # Resize image to 4G otherwise the data partition isn't big enough for user apps
54+ ${result } = Run Buffered Process qemu-img resize ${image_copy } 4G shell=yes
55+ Process ${result }
56+ ${handle } = Start Process qemu-system-aarch64 -drive file\=${image_copy } ,media\=disk,cache\=none,format\=raw -device virtio-net-device,netdev\=n1 -netdev \"user,id\=n1,dns\=127.0.0.1,guestfwd\=tcp:10.0.2.100:80-cmd:netcat haproxy 80,guestfwd\=tcp:10.0.2.100:443-cmd:netcat haproxy 443\" -m ${memory } -nographic -machine type\=virt -accel ${acceleration } -smp ${cpus } -chardev socket,id\=serial0,path\=${serial_port_path } ,server\=on,wait\=off -serial chardev:serial0 -cpu cortex-a72 -bios /usr/share/AAVMF/AAVMF_CODE.fd -nodefaults shell=yes
57+ Return From Keyword ${handle }
0 commit comments