Skip to content

Instantly share code, notes, and snippets.

@arbruijn
Created August 9, 2026 16:59
Show Gist options
  • Select an option

  • Save arbruijn/cb1541b894ef4f3592c046f5b88989db to your computer and use it in GitHub Desktop.

Select an option

Save arbruijn/cb1541b894ef4f3592c046f5b88989db to your computer and use it in GitHub Desktop.
build qemu for triton on linux
#!/bin/bash
# See https://blog.getutm.app/2026/introducing-triton-directx-11-driver-for-qemu/
set -e
DIR=$HOME/tmp/neptune
mkdir -p "$DIR"
cd "$DIR"
PREFIX="$DIR/inst"
mkdir -p $PREFIX
export LD_LIBRARY_PATH="$PREFIX/lib/x86_64-linux-gnu:$PREFIX/lib"
export PKG_CONFIG_PATH="$PREFIX/lib/x86_64-linux-gnu/pkgconfig:$PREFIX/lib/pkgconfig"
export NPT_D3D11_LIBRARY_PATH=$PREFIX/lib/x86_64-linux-gnu/libdxvk_d3d11.so
export NPT_DXGI_LIBRARY_PATH=$PREFIX/lib/x86_64-linux-gnu/libdxvk_dxgi.so
export NPT_D3D12_LIBRARY_PATH=$PREFIX/lib/x86_64-linux-gnu/libvkd3d-proton-d3d12.so
export VIRGL_LOG_LEVEL=debug
# dxvk
[ ! -d dxvk ] && git clone https://github.com/osy/dxvk --depth 2
cd dxvk
git submodule update --init --recursive
meson setup build -Dnative_sdl2=disabled -Dnative_sdl3=disabled -Dnative_glfw=disabled \
-Dnative_headless=true -Dbuildtype=release -Db_ndebug=true \
-Dc_args=-U_GLIBCXX_ASSERTIONS -Dcpp_args=-U_GLIBCXX_ASSERTIONS \
-Dprefix=$PREFIX --pkg-config-path=$PREFIX/lib/pkgconfig
ninja -C build install
cd ..
# virglrenderer
[ ! -d virglrenderer ] && git clone https://github.com/utmapp/virglrenderer --branch macos-next --depth 2
cd virglrenderer
meson setup build -Dneptune=true -Dvenus=false -Dtests=false -Dprefix=$PREFIX \
--pkg-config-path=$PREFIX/lib/pkgconfig --pkg-config-path=$PREFIX/lib/x86_64-linux-gnu/pkgconfig
ninja -C build install
cd ..
# qemu
[ ! -d qemu ] && git clone https://github.com/utmapp/qemu --branch utm-edition --depth 2
cd qemu
[ ! -f build/build.ninja ] && \
./configure --target-list=x86_64-softmmu --prefix=$PREFIX \
--disable-werror --disable-docs --enable-plugins --disable-spice --enable-slirp --enable-virglrenderer
ninja -C build install
cd ..
# d3d12
[ ! -d vkd3d-proton ] && git clone https://github.com/HansKristian-Work/vkd3d-proton
cd vkd3d-proton
git checkout v3.0.1
git submodule update --init --recursive
meson setup build -Dprefix=$PREFIX
ninja -C build install
cd ..
# run
$PREFIX/bin/qemu-system-x86_64 -name windows-10,process=windows-10,debug-threads=on \
-machine q35,hpet=off,smm=on,vmport=off,accel=kvm \
-global kvm-pit.lost_tick_policy=discard \
-global ICH9-LPC.disable_s3=1 \
-cpu host,+hypervisor,+invtsc,l3-cache=on,migratable=no,hv_passthrough \
-smp cores=8,threads=1,sockets=1 \
-m 8G \
-device virtio-balloon \
-pidfile windows-10/windows-10.pid -rtc base=localtime,clock=host,driftfix=slew \
-device virtio-rng-pci,rng=rng0 -object rng-random,id=rng0,filename=/dev/urandom -device qemu-xhci,id=spicepass \
-device usb-ehci,id=input -device usb-kbd,bus=input.0 -k en-us -device usb-tablet,bus=input.0 \
-audiodev pa,id=audio0 -device intel-hda -device hda-micro,audiodev=audio0 \
-device virtio-net-pci,netdev=nic -netdev user,hostname=windows-10,hostfwd=tcp::22220-:22,id=nic \
-global driver=cfi.pflash01,property=secure,value=on \
-drive if=pflash,format=raw,unit=0,file=/usr/share/OVMF/OVMF_CODE_4M.fd,readonly=on \
-drive if=pflash,format=raw,unit=1,file=windows-10/OVMF_VARS.fd \
-drive media=cdrom,index=0,file=windows-10/windows-10.iso \
-drive media=cdrom,index=1,file=windows-10/virtio-win.iso \
-device virtio-blk-pci,drive=SystemDisk -drive id=SystemDisk,if=none,format=qcow2,file=windows-10/disk.qcow2,discard=unmap,detect-zeroes=unmap,cache=writeback,aio=threads \
-monitor unix:windows-10/windows-10-monitor.socket,server,nowait -serial none \
-drive media=cdrom,index=2,file=windows-10/unattended.iso \
-nodefaults -vga none -device virtio-ramfb-gl,hostmem=8G,blob=true,venus=true,neptune=true \
-display sdl,gl=on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment