GO9PCPU 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/bash
  2. set -e
  3. trap : 2
  4. $HARVEY/util/ufs -root=$HARVEY &
  5. ufspid=$!
  6. export machineflag=q35
  7. if [ "$(uname)" = "Linux" ] && [ -e /dev/kvm ]; then
  8. export kvmflag='-enable-kvm'
  9. export machineflag='pc,accel=kvm'
  10. if [ ! -w /dev/kvm ]; then
  11. # we don't have access as a regular user
  12. export kvmdo=sudo
  13. fi
  14. fi
  15. read -r cmd <<EOF
  16. $kvmdo qemu-system-x86_64 -s -cpu Opteron_G1 -smp 4 -m 2048 $kvmflag \
  17. -serial stdio \
  18. --machine $machineflag \
  19. -net nic,model=rtl8139 \
  20. -net user,id=user.0,\
  21. hostfwd=tcp::5555-:1522,\
  22. hostfwd=tcp::9999-:9,\
  23. hostfwd=tcp::17010-:17010,\
  24. hostfwd=tcp::1666-:1666,\
  25. hostfwd=tcp::5356-:5356,\
  26. hostfwd=tcp::17013-:17013 \
  27. -object filter-dump,id=f1,netdev=user.0,file=/tmp/vm0.pcap \
  28. -append "service=cpu nobootprompt=tcp maxcores=1024 fs=10.0.2.2 auth=10.0.2.2 nvram=/boot/nvram nvrlen=512 nvroff=0 acpiirq=1" \
  29. -kernel $HARVEY/sys/src/9/amd64/harvey.32bit $*
  30. EOF
  31. echo $cmd
  32. eval $cmd
  33. kill $ufspid
  34. wait
  35. # TO ENABLE FACTOTUM replace append with this
  36. #-append "nobootprompt=tcp maxcores=1024 fs=10.0.2.2 auth=10.0.2.2 nvram=/boot/nvram nvrlen=512 nvroff=0" \
  37. # -nographic \
  38. #-S -gdb tcp::1234 \
  39. # -nographic \
  40. #-kernel mnt/hdd/kernel $*
  41. # if you need the dump.
  42. #-object filter-dump,id=f1,netdev=user.0,file=/tmp/vm0.pcap \
  43. #sudo qemu-system-x86_64 -s -cpu phenom -smp 8 -m 4096 -nographic \
  44. #-net nic,model=rtl8139 mnt/hdd268mb.img \
  45. #-net user,hostfwd=tcp::5555-:23 \
  46. #-object filter-dump,id=f1,netdev=user.0,file=/tmp/vm0.pcap \
  47. #-kernel mnt/hdd/kernel $*
  48. #
  49. #sudo qemu-system-x86_64 -s -cpu phenom -smp 8 -m 6024 -nographic -net nic,model=rtl8139 mnt/hdd268mb.img -netdev user,id=mynet0 -kernel mnt/hdd/kernel $*
  50. #sudo qemu-system-x86_64 -s -cpu phenom -smp 8 -m 6024 -nographic -net nic,model=rtl8139 mnt/hdd268mb.img -netdev user,id=mynet0,net=192.168.76.0/24,dhcpstart=192.168.76.9 -kernel mnt/hdd/kernel $*
  51. #