Ver código fonte

Merge pull request #44 from rcore-os/net

Try to connect to VM.
chyyuu 2 anos atrás
pai
commit
9d47fa1543
1 arquivos alterados com 9 adições e 3 exclusões
  1. 9 3
      examples/riscv/Makefile

+ 9 - 3
examples/riscv/Makefile

@@ -37,6 +37,8 @@ clean:
 	cargo clean
 
 qemu-legacy: kernel $(img)
+# Wait a few seconds, then try to open a connection to the VM so it can test its networking.
+	( sleep 4 && nc localhost 5555 -v < /dev/null) &
 	qemu-system-$(arch) \
 	  $(QEMU_ARGS) \
 		-machine virt \
@@ -47,10 +49,12 @@ qemu-legacy: kernel $(img)
 		-device virtio-blk-device,drive=x0 \
 		-device virtio-gpu-device \
 		-device virtio-mouse-device \
-		# -netdev type=tap,id=net0,script=no,downscript=no \
-		# -device virtio-net-device,netdev=net0
+		-device virtio-net-device,netdev=net0 \
+		-netdev user,id=net0,hostfwd=tcp::5555-:5555
 
 qemu: kernel $(img)
+# Wait a few seconds, then try to open a connection to the VM so it can test its networking.
+	( sleep 4 && nc localhost 5555 -v < /dev/null) &
 	qemu-system-$(arch) \
 	  $(QEMU_ARGS) \
 		-machine virt \
@@ -62,7 +66,9 @@ qemu: kernel $(img)
 		-device virtio-blk-device,drive=x0 \
 		-device virtio-gpu-device \
 		-device virtio-mouse-device \
-		-device virtio-net-device
+		-device virtio-net-device,netdev=net0 \
+		-netdev user,id=net0,hostfwd=tcp::5555-:5555
+
 
 $(img):
 	dd if=/dev/zero of=$@ bs=512 count=32