2023-10-11 15:08:37 +13:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
#
|
|
|
|
# Run a nerves_system_x86_64-based image in QEMU
|
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
# run-qemu.sh [Path to .img file]
|
|
|
|
#
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
IMAGE="$1"
|
|
|
|
DEFAULT_IMAGE="bivouac.img"
|
|
|
|
|
|
|
|
help() {
|
|
|
|
echo
|
|
|
|
echo "Usage:"
|
|
|
|
echo " run-qemu.sh [Path to .img file]"
|
|
|
|
echo
|
|
|
|
echo "Run 'mix firmware.image' to create the starter image. Since qemu isn't"
|
|
|
|
echo "supported by Nerves, we don't have instructions for how to make this a"
|
|
|
|
echo "productive development environment. You should be able to see this"
|
|
|
|
echo "boot, though."
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
[ -n "$IMAGE" ] || IMAGE="$DEFAULT_IMAGE"
|
|
|
|
|
|
|
|
[ -f "$IMAGE" ] || (echo "Error: can't find '$IMAGE'"; help)
|
|
|
|
|
|
|
|
echo "Starting QEMU..."
|
2023-10-12 16:04:33 +13:00
|
|
|
screen -S bivouac-session \
|
|
|
|
qemu-system-x86_64 \
|
|
|
|
-m 4G \
|
2023-10-11 15:08:37 +13:00
|
|
|
-drive file="$IMAGE",if=virtio,format=raw \
|
2023-10-12 16:04:33 +13:00
|
|
|
-drive file="tmp/disk0.img",if=virtio,format=qcow2 \
|
|
|
|
-drive file="tmp/disk1.img",if=virtio,format=qcow2 \
|
|
|
|
-drive file="tmp/disk2.img",if=virtio,format=qcow2 \
|
|
|
|
-nographic \
|
2023-10-11 15:08:37 +13:00
|
|
|
-net nic,model=virtio \
|
|
|
|
-net user,hostfwd=tcp::10022-:22 \
|
2023-10-12 16:04:33 +13:00
|
|
|
-smp cpus=4,maxcpus=4 \
|
|
|
|
-accel kvm
|
|
|
|
|