Skip to content

A homebrew tap for qemu with support for 3d accelerated guests

Notifications You must be signed in to change notification settings

yashomer1994/homebrew-qemu-virgl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 

Repository files navigation

3D accelerated qemu on MacOS

ubuntu

What is it for

If you own a Mac (x86 or ARM) and want to have a full Linux desktop for development or testing, you'll find that having a responsive desktop is a nice thing. The graphical acceleration is possible thanks to the work of Akihiko Odaki. I've only packaged it into an easily-installable brew repository while the changes are not yet merged into upstream.

Features:

  • Support for both ARM and X86 acceleration with Hypervisor.framework (works without root or kernel extensions)
  • Support for OpenGL acceleration in the guest (both X11 and Wayland)
  • Works on large screens (5k+)
  • Dynamically changing guest resolution on window resize
  • Properly handle sound output when plugging/unplugging headphones

Installation

brew install knazarov/qemu-virgl/qemu-virgl

Or brew tap knazarov/qemu-virgl and then brew install qemu-virgl.

Usage

Qemu has many command line options and emulated devices, so the sections are specific to your CPU (Intel/M1).

For the best experience, maximize the qemu window when it starts. To release the mouse, press Ctrl-Alt-g.

Usage - M1 Macs

First, create a disk image you'll run your Linux installation from (tune image size as needed):

qemu-img create hdd.raw 64G

Download an ARM based Ubuntu image:

curl -O https://cdimage.ubuntu.com/focal/daily-live/current/focal-desktop-arm64.iso

Copy the firmware:

cp $(dirname $(which qemu-img))/../share/qemu/edk2-aarch64-code.fd .
cp $(dirname $(which qemu-img))/../share/qemu/edk2-arm-vars.fd .

Install the system from the CD image:

qemu-system-aarch64 \
         -machine virt,accel=hvf,highmem=off \
         -cpu cortex-a72 -smp 2 -m 4G \
         -device intel-hda -device hda-output \
         -device virtio-gpu-pci \
         -device virtio-keyboard-pci \
         -device virtio-net-pci,netdev=net \
         -device virtio-mouse-pci \
         -display cocoa,gl=es \
         -netdev user,id=net,ipv6=off \
         -drive "if=pflash,format=raw,file=./edk2-aarch64-code.fd,readonly=on" \
         -drive "if=pflash,format=raw,file=./edk2-arm-vars.fd,discard=on" \
         -drive "if=virtio,format=raw,file=./hdd.raw,discard=on" \
         -cdrom focal-desktop-arm64.iso \
         -boot d

Run the system without the CD image to boot into the primary partition:

qemu-system-aarch64 \
         -machine virt,accel=hvf,highmem=off \
         -cpu cortex-a72 -smp 2 -m 4G \
         -device intel-hda -device hda-output \
         -device virtio-gpu-pci \
         -device virtio-keyboard-pci \
         -device virtio-net-pci,netdev=net \
         -device virtio-mouse-pci \
         -display cocoa,gl=es \
         -netdev user,id=net,ipv6=off \
         -drive "if=pflash,format=raw,file=./edk2-aarch64-code.fd,readonly=on" \
         -drive "if=pflash,format=raw,file=./edk2-arm-vars.fd,discard=on" \
         -drive "if=virtio,format=raw,file=./hdd.raw,discard=on"

Usage - Intel Macs

First, create a disk image you'll run your Linux installation from (tune image size as needed):

qemu-img create hdd.raw 64G

Download an x86 based Ubuntu image:

curl -O https://cdimage.ubuntu.com/focal/daily-live/current/focal-desktop-amd64.iso

Install the system from the CD image:

qemu-system-x86_64 \
         -machine accel=hvf \
         -cpu Haswell-v4 -smp 2 -m 4G \
         -device intel-hda -device hda-output \
         -device virtio-vga \
         -device virtio-keyboard-pci \
         -device virtio-net-pci,netdev=net \
         -device virtio-mouse-pci \
         -display cocoa,gl=es \
         -netdev user,id=net,ipv6=off \
         -drive "if=virtio,format=raw,file=hdd.raw,discard=on" \
         -cdrom focal-desktop-amd64.iso \
         -boot d

Run the system without the CD image to boot into the primary partition:

qemu-system-x86_64 \
         -machine accel=hvf \
         -cpu Haswell-v4 -smp 2 -m 4G \
         -device intel-hda -device hda-output \
         -device virtio-vga \
         -device virtio-keyboard-pci \
         -device virtio-net-pci,netdev=net \
         -device virtio-mouse-pci \
         -display cocoa,gl=es \
         -netdev user,id=net,ipv6=off \
         -drive "if=virtio,format=raw,file=hdd.raw,discard=on"

About

A homebrew tap for qemu with support for 3d accelerated guests

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%