123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #!/bin/bash
- set -e
- trap : 2
- $HARVEY/linux_amd64/bin/centre -i "" -ninep-dir=$HARVEY &
- centrepid=$!
- export machineflag=q35
- if [ "$(uname)" = "Linux" ] && [ -e /dev/kvm ]; then
- export kvmflag='-enable-kvm'
- export machineflag='pc,accel=kvm'
- if [ ! -w /dev/kvm ]; then
- # we don't have access as a regular user
- export kvmdo=sudo
- fi
- fi
- # vmware-cpuid-freq=on,+invtsc exposes the 0x40000000 hypervisor cpuid values to
- # the guest, which we can use to identify the TSC frequency
- read -r cmd <<EOF
- $kvmdo qemu-system-x86_64 -s -cpu max,vmware-cpuid-freq=on,+invtsc -smp 4 -m 2048 $kvmflag \
- -initrd plan9_amd64/uroot.cpio.lzma \
- -usb \
- -serial stdio \
- --machine $machineflag \
- -net nic,model=rtl8139 \
- -net user,id=user.0,\
- hostfwd=tcp::5555-:1522,\
- hostfwd=tcp::9999-:9,\
- hostfwd=tcp::17010-:17010,\
- hostfwd=tcp::1666-:1666,\
- hostfwd=tcp::5356-:5356,\
- hostfwd=tcp::17013-:17013 \
- -object filter-dump,id=f1,netdev=user.0,file=/tmp/vm0.pcap \
- -append "service=uroot 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" \
- -kernel $HARVEY/sys/src/9/amd64/harvey.32bit $*
- EOF
- echo $cmd
- eval $cmd
- kill $centrepid
- wait
|