I'm learning the mit6.858. In Lab1, I need to set up the lab environment on my M2 Mac using qemu (version 7.2.0 installed by homebrew).
I follow the instruction of the lab hints and run the course VM Image with this shell scripts:
#!/bin/bash
if ! command -v qemu-system-x86_64 > /dev/null; then
echo "You do not have QEMU installed."
echo "If you are on a Linux system, install QEMU and try again."
echo "Otherwise, follow the lab instructions for your OS instead of using this script."
exit
fi
# can we use the -nic option?
version=$(qemu-system-x86_64 --version \
| grep 'QEMU emulator version' \
| sed 's/QEMU emulator version \([0-9]\)\.\([0-9]\).*/\1.\2/')
major=$(echo "$version" | cut -d. -f1)
minor=$(echo "$version" | cut -d. -f2)
net=()
if (( major > 2 || major == 2 && minor >= 12 )); then
net=("-nic" "user,ipv6=off,model=virtio,hostfwd=tcp:127.0.0.1:2222-:2222,hostfwd=tcp:127.0.0.1:8080-:8080,hostfwd=tcp:127.0.0.1:8888-:8888")
else
net=("-netdev" "user,id=n1,ipv6=off,hostfwd=tcp:127.0.0.1:2222-:2222,hostfwd=tcp:127.0.0.1:8080-:8080,hostfwd=tcp:127.0.0.1:8888-:8888" "-device" "virtio-net,netdev=n1")
fi
qemu-system-x86_64 \
-m 2048 \
-nographic -serial mon:stdio \
"$@" \
# -enable-kvm \
"${net[@]}" \
6.858-x86_64-v22.vmdk
But I got this output:
SeaBIOS (version rel-1.16.1-0-g3208b098f51a-prebuilt.qemu.org)
iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+7EFD11A0+7EF311A0 CA00
Booting from Hard Disk...
Boot failed: could not read the boot disk
Booting from Floppy...
Boot failed: could not read the boot disk
Booting from DVD/CD...
Boot failed: Could not read from CDROM (code 0003)
Booting from ROM...
iPXE (PCI 00:03.0) starting execution...ok
iPXE initialising devices...ok
iPXE 1.20.1+ (g4bd0) -- Open Source Network Boot Firmware -- http://ipxe.org
Features: DNS HTTP iSCSI TFTP AoE ELF MBOOT PXE bzImage Menu PXEXT
net0: 52:54:00:12:34:56 using 82540em on 0000:00:03.0 (open)
[Link:up, TX:0 TXE:0 RX:0 RXE:0]
Configuring (net0 52:54:00:12:34:56)...... ok
net0: 10.0.2.15/255.255.255.0 gw 10.0.2.2
Nothing to boot: No such file or directory (http://ipxe.org/2d03e13b)
No more network devices
No bootable device.
When I type ctrlA+X
to quit, I got another lines of output.
QEMU: Terminated
./6.858-x86_64-v22.sh: line 30: -nic: command not found
My homebrew installation is correct. I'd like to know how to start the course VM correctly on M2 mac.