SkillAgentSearch skills...

MobilePassThrough

Make GPU passthrough on notebooks easy and accessible!

Install / Use

/learn @T-vK/MobilePassThrough
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

MobilePassThrough

Introduction

The goal of this project is to make GPU passthrough on x64 notebooks/tablets as easy and accessible as possible.
To achieve that goal I have written a collection of scripts accessible via mbpt.sh

MBPT vs MBPT Live

  • You can either flash the MBPT Live ISO to a USB device and boot it to try it out without actually messing with your system. (Download here or run ./mbpt.sh live build to build it yourself.)
  • Or you can let ./mbpt.sh auto set everything up on your exisitng Linux installation.

Either way it is 100% automated, no user interaction required:

On the host system (Linux):

  • [x] Automatically install the required dependencies
  • [x] Automatically configure the kernel parameters to support GPU passthrough
  • [ ] Automatically install Bumblebee and the Nvidia GPU driver if required (I removed this feature because it was too error-prone. Instead we'll just use nouveau or whatever is installed already.)
  • [x] Automatically check if and to what extend your device is compatible with GPU passthrough.
  • [x] Automatically create and configure a virtual machine that is fully configured for GPU passthrough.
  • [x] Automatically download the Windows 10 installation iso from Microsoft.
  • [x] Automatically compile/set up LookingGlass
  • [x] Automatically build an ACPI fake battery (to circumvent Nvidia's Error 43)
  • [x] Automatically patch OVMF with your vBIOS ROM (to circumvent Nvidia's Error 43)

In the virtual machine (Windows)

  • [x] Automatically install the required drivers (ivshmem, other vfio drivers, Intel/Nvidia display drivers)
  • [x] Automatically compile/install/start LookingGlass
  • [x] Automatically configure the network
  • [x] Automatically set up RDP
  • [x] Automatically install and autostart LookingGlass

And there is also a lot of advanced stuff that I managed to fully automate, like:

  • [x] Automatically rebinding the dGPU to the vfio drivers (when the VM starts)
  • [x] Automatically rebinding the dGPU to the nvidia/amd drivers (when the VM exits)
  • [x] Automatically creating a vGPU from the (Intel) iGPU (when the VM starts) to allow sharing the iGPU with the VM (aka "mediated iGPU passthough" using GVT-g) (So your VM can safe a ton of battery life when it doesn't need the dGPU.)

Screenshot of the compatibility check (./mbpt.sh check)

example output

Currently supported distributions

  • Fedora 34
  • Ubuntu 21.04 (Currently not working. Some dependencies won't be installed automatically.)

Limitations

  • The project is currently only really being tested on Fedora and Ubuntu (currently broken). But it has been written in a somewhat distribution-agnostic way, meaning it might just work on other distributions and if not, you might just have to add a new script to scripts/utils/manager-specific/. (For example the project currently supports the package managers dnf and apt, if your distro uses pacman, you have to add a pacman script that can be called the same way as the apt script.)
  • This project currently only supports Windows 10 x64 VMs and hopefully Windows 11 x64 VMs at some point. (For older Windows versions you have to figure out the driver installation etc. on your own.)
  • Only tested for Intel+Nvidia and Intel+AMD systems. (Although the compatibility-check (./mbpt.sh check) should actually work on any hardware.)
  • Expect bugs. I have only tested this on a handful of devices and I have constantly changed the scripts without testing everything every time.
  • Automated vBIOS ROM extraction will fail in most cases. You might have to extract it from a BIOS update. (You may not need the vBIOS ROM though.)
  • This project takes a couple of measures to circumvent Nvidia's infamous Error 43, which you normally see in the Windows device manager when you pass a mobile Nvidia GPU through to a Windows VM. But even with these measures, some systems will still show Error 43.
  • Some AMD GPUs will give you an Error 43 as well (e.g. Radeon RX Vega M GL). I have no idea how to circumvent that one yet.

Measures taken agains error 43

  • Hide that the VM is a VM
  • Change the vendor ID
  • Provide the VM with a fake battery
  • Provide the VM with the vBios ROMs
  • Patch OVMF, hardcoding your dGPU vBIOS ROM in it
  • Installing the latest Nvidia driver
  • (Another measure you can take yourself is installing a recent Nvidia driver in your VM. See this)
  • Other projects that may help, but are very outdated and currently don't work: NVIDIA-vBIOS-VFIO-Patcher, nvidia-kvm-patcher.

How to use?

BIOS/UEFI configuration

  • Enable Intel VT-x / AMD-V as well as Intel VT-d / AMD's IOMMU in the BIOS / UEFI.
  • On some (gaming) notebooks the integrated graphics of the CPU are disabled. If that is the case for you, you need to enable them in the BIOS/UEFI. (Some vendors actually disable the CPU integrated GPU completely and don't offer UEFI options to enable it. Modding your BIOS could potentially fix that. See the "UEFI / BIOS modding" for more information on that.)
  • You might also have to disable secure boot in the UEFI. (Mainly to use Nvida's proprietary driver on Linux while your VM is not running.)
  • It might also be necessary to disable fastboot in the UEFI.
  • It is highly recommended to have your Linux installed/booted in UEFI mode (rather than in legacy mode).
  • If your drive doesn't show up during the installation in UEFI mode, make sure the SATA mode is set to AHCI in the UEFI, even if you don't use SATA.

Installation and configuration

  • Open a terminal and install git and MobilePassThrough by typing the following, pressing enter after each line:
    sudo dnf install git -y # Install git
    git clone https://github.com/T-vK/MobilePassThrough.git # Clone the project
    cd MobilePassThrough # Enter the project directory
    ./mbpt.sh configure # Create a custom config file interactively (optional)
    ./mbpt.sh auto # Dependency installation; kernel param config; bumblebee / nvidia driver installation; windows ISO download; reboot to load new kernel params; create a helper iso with drivers and autounattended config for Windows; create and start VM; install Windows in the VM fully unattended; install drivers and looking glass in the VM automatically; check for error 43 automatically and show a warning if it occurs
    
  • Once the installation finished you should be able to open Remmina and connect to rdp://192.168.99.2
  • Then in the second terminal run:
    cd MobilePassThrough # Enter the project directory
    cd ./thirdparty/LookingGlass/client/build/ # Enter the directoy containing the looking glass client executable
    ./looking-glass-client # Run the looking glass client
    
  • From now on, start the VM with ./mbpt.sh start

How to use mbpt.sh

$ ./mbpt.sh help
mbpt.sh COMMAND [ARG...]
mbpt.sh [ -h | --help ]

mbpt.sh is a wrapper script for a collection of tools that help with GPU passthrough on mobile devices like notebooks and convertibles.

Options:
  -h, --help       Print usage

Commands:
    auto         Automatically run check, setup and install
    configure    Interactively guides you through the creation of your config file
    check        Check if and to what degree your notebook is capable of running a GPU passthrough setup
    setup        Install required dependencies and set required kernel parameters
    install      Create and install the VM
    start        Start the VM
    live         Create / Flash a Live ISO image of this project
    vbios        Dump the vBIOS ROM from the running system or extract it from a BIOS update

Examples:
    # Install required dependencies and set required kernel parameters
    mbpt.sh setup

    # Check if and to what degree your notebook is capable of running a GPU passthrough setup
    mbpt.sh check

    # Interactively guides you through the creation of your config file
    mbpt.sh configure

    # Generate a helper iso file that contains required drivers and a helper-script for your Windows VM
    mbpt.sh iso

    # Create the VM and install Windows in it (Will overwrite an older instance if one exists!)
    mbpt.sh install

    # Start the VM
    mbpt.sh start

    # Create a Live ISO
    mbpt.sh live buid

    # Flash a Live ISO to the USB drive /dev/sdx
    mbpt.sh live flash /dev/sdx

    # Print the qemu command that would have been used to start the VM
    mbpt.sh start dry-run

    # Print the qemu command that would have been used to install the VM
    mbpt.sh install dry-run

    # Print the libvirt XML that would have been used to start the VM
    mbpt.sh start get-xml

    # Print the libvirt XML that would have been used to install the VM
    mbpt.sh install get-xml

    # Dump the vBIOS ROM of the GPU with the PCI address 01:00.0 to ./my-vbios.rom (This will most likely fail)
    mbpt.sh vbios dump 01:00.0 ./my-vbios.rom

    # Extract all the vBIOS ROMs of a given BIOS update to the directory ./my-roms
    mbpt.sh vbios extract /path/to/my-bios-update.exe ./my-roms

Hardware requirements to get GPU-passthrough to work on mobile

  • Device needs to be (mostly) compatible with Linux.
    Note: most Laptops should be these days

  • At least two GPUs (typically Intel's iGPU and an Nvidia GPU)
    Note: If you have Thunderbolt 3, you might be able to use an eGPU. See: https://egpu.io
    Note2: Theoretically it's possible to get this to work with only one GPU, but then you wouldn't be able to use your host system directly while running the VM, not to mention the like 50 othe

Related Skills

View on GitHub
GitHub Stars177
CategoryDevelopment
Updated17d ago
Forks21

Languages

Shell

Security Score

85/100

Audited on Mar 12, 2026

No findings