1
0

GO9PTERM 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/bash
  2. set -e
  3. trap : 2
  4. $HARVEY/linux_amd64/bin/centre -i "" -ninep-dir=$HARVEY &
  5. centrepid=$!
  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. # The -usb flag is necessary for the system to recognize usb devices
  16. # To specify a specific device you must follow the following format:
  17. # -device usb-host,hostbus='X',hostaddr='Y'
  18. # The 'X'/'Y' values can be found with lsusb(8) (Linux/BSD)
  19. # Provided is an example lsusb(8) output:
  20. # Bus 002 Device 004: ID 056a:00e6 Wacom Co., Ltd TPCE6
  21. # Where 'X'== 2 and 'Y'== 4
  22. # vmware-cpuid-freq=on,+invtsc exposes the 0x40000000 hypervisor cpuid values to
  23. # the guest, which we can use to identify the TSC frequency
  24. read -r cmd <<EOF
  25. $kvmdo qemu-system-x86_64 -s -cpu max,vmware-cpuid-freq=on,+invtsc -smp 4 -m 2048 $kvmflag \
  26. -usb \
  27. -serial stdio \
  28. --machine $machineflag \
  29. -net nic,model=rtl8139 \
  30. -net user,id=user.0,\
  31. hostfwd=tcp::5555-:1522,\
  32. hostfwd=tcp::9999-:9,\
  33. hostfwd=tcp::17010-:17010,\
  34. hostfwd=tcp::1666-:1666,\
  35. hostfwd=tcp::5356-:5356,\
  36. hostfwd=tcp::17013-:17013 \
  37. -object filter-dump,id=f1,netdev=user.0,file=/tmp/vm0.pcap \
  38. -append "service=terminal nobootprompt=tcp maxcores=1024 fs=10.0.2.2 auth=10.0.2.2 nvram=/boot/nvram nvrlen=512 nvroff=0 acpiirq=1 mouseport=ps2 vgasize=1024x768x24 monitor=vesa" \
  39. -kernel $HARVEY/sys/src/9/amd64/harvey.32bit $*
  40. EOF
  41. echo $cmd
  42. eval $cmd
  43. kill $centrepid
  44. wait
  45. # TO ENABLE FACTOTUM replace append with this
  46. #-append "nobootprompt=tcp maxcores=1024 fs=10.0.2.2 auth=10.0.2.2 nvram=/boot/nvram nvrlen=512 nvroff=0" \
  47. # -nographic \
  48. #-S -gdb tcp::1234 \
  49. # -nographic \
  50. #-kernel mnt/hdd/kernel $*
  51. # if you need the dump.
  52. #-object filter-dump,id=f1,netdev=user.0,file=/tmp/vm0.pcap \
  53. #sudo qemu-system-x86_64 -s -cpu phenom -smp 8 -m 4096 -nographic \
  54. #-net nic,model=rtl8139 mnt/hdd268mb.img \
  55. #-net user,hostfwd=tcp::5555-:23 \
  56. #-object filter-dump,id=f1,netdev=user.0,file=/tmp/vm0.pcap \
  57. #-kernel mnt/hdd/kernel $*
  58. #
  59. #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 $*
  60. #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 $*
  61. #