Hacker News new | ask | show | jobs
by jasomill 862 days ago
On macOS, I typically run it from an .app bundle containing a one-line shell script that execs the following script with the "-monitor vc" option (to enable access to the QEMU monitor via a menu command in the Cocoa GUI; when actively using the monitor, I run the script directly with the "-monitor stdio" option instead, as opening the monitor in the Cocoa GUI hides the emulated Mac's display):

  #!/bin/bash
  export PATH=
  here="$(/opt/ld/bin/realpath -s "$(/usr/bin/dirname "$0")")"
  workdir="$here"
  name="$(/usr/bin/basename "$workdir")"
  qemu='/opt/qemu/bin/qemu-system-ppc'
  
  cd "$workdir" \
      && exec "$qemu" \
          -display cocoa \
          -L pc-bios -boot c -no-reboot \
          -M mac99,via=pmu -m 768 \
          -rtc base=localtime \
          -g 1920x1080x32 \
          -prom-env 'boot-args=-v' \
          -prom-env 'auto-boot?=true' \
          -prom-env 'vga-ndrv?=true' \
          -nodefaults \
          -device pci-ohci,id=usb0 \
          -device usb-kbd,id=keyboard0 \
          -device usb-mouse,id=mouse0 \
          -device VGA,edid=on,vgamem_mb=32,id=vga0 \
          -nic tap,id=nic0,ifname=tap9,script=no,downscript=no,model=sungem,mac=00:50:56:16:65:09 \
          -drive file="$here/disk/Classic.img",format=raw,media=disk,id=hd0 \
          -drive file="$here/../../scratch/$name/Scratch.img",format=raw,media=disk,cache=unsafe,id=hd1 \
          -drive media=cdrom,id=cd0 \
          "$@"
Paths are (obviously) site-specific, realpath is the GNU version — used here to ensure nice-looking absolute paths in light of my heavily symlinked filesystem — and specific details (options supplied in no particular order, $workdir vs $here, etc.) are artifacts of hours of fiddling and not cleaning up afterwards.

I'm currently running a version of QEMU recently built from Git, though I haven't changed this script in years.

For networking, I'm currently using the notarized tap kext bundled with Tunnelblick[1].

Finally, I'm currently using an Intel Mac, so YMMV with Apple Silicon or Linux, though I have no particular reason to believe any command-line changes would be necessary, other than the obvious -display change to something other than cocoa for Linux.

[1] https://www.tunnelblick.net/downloads.html