summaryrefslogtreecommitdiffstats
path: root/scripts/setup_guest_driver.sh
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-13 18:36:21 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-13 18:36:21 -0400
commit00e54c13c7c9030c4d5f7151467f2d85a3730e29 (patch)
tree17a45239df8d2e4912ff3697ed06e85a10b969de /scripts/setup_guest_driver.sh
downloadopen-iov-00e54c13c7c9030c4d5f7151467f2d85a3730e29.tar.gz
open-iov-00e54c13c7c9030c4d5f7151467f2d85a3730e29.zip
Initial commit: Open-IOV vGPU-IO complete stack
- Firmware decompilation: GSP 570.144W (28.5MB ELF, RV64IMAC), 132 decompiled C files - Kernel modules: nvidia.ko (34MB, OpenRM), open-iov-vfio.ko (2.8MB, VFIO mdev), gsp-vgpu.ko (1.8MB, guest driver) - Userspace: libiov.so/libvgpu.so (76KB), example_vgpu (28KB), rpc_emulator.c - PCI config space emulation (256B with PM, MSI, MSI-X, PCIe caps) - 12 RPC types fully mapped from firmware decompilation - BAR trap, WPR, scheduling, notification, migration emulation - Helper scripts: load_vgpu_stack, create_mdev, launch_qemu_vgpu, test_vgpu_stack, setup_guest_driver, unload_vgpu_stack - Architecture documentation - Wiki: 10 technical documents - Git LFS for large binaries (.ko, .bin, .iso, .img, .o, ghidra repos) - nvidia-open-gpu-kernel-modules as submodule
Diffstat (limited to 'scripts/setup_guest_driver.sh')
-rwxr-xr-xscripts/setup_guest_driver.sh99
1 files changed, 99 insertions, 0 deletions
diff --git a/scripts/setup_guest_driver.sh b/scripts/setup_guest_driver.sh
new file mode 100755
index 0000000..f4f2757
--- /dev/null
+++ b/scripts/setup_guest_driver.sh
@@ -0,0 +1,99 @@
+#!/bin/bash
+# setup_guest_driver.sh - Setup NVIDIA driver in QEMU guest
+# Run this INSIDE the guest VM after installation
+
+set -euo pipefail
+
+echo "=========================================="
+echo "Setting up NVIDIA driver in guest"
+echo "=========================================="
+
+# Check if running as root
+if [[ $EUID -ne 0 ]]; then
+ echo "ERROR: This script must be run as root"
+ exit 1
+fi
+
+# Check kernel version
+KERNEL_VER=$(uname -r)
+echo "Kernel: $KERNEL_VER"
+
+# Install dependencies
+echo "Installing build dependencies..."
+apt-get update
+apt-get install -y \
+ build-essential \
+ dkms \
+ linux-headers-"$KERNEL_VER" \
+ linux-headers-generic \
+ pciutils \
+ clinfo
+
+# Check for NVIDIA GPU in guest
+echo "Checking for NVIDIA GPU in guest..."
+lspci -d 10de: | grep -E "VGA|3D controller" || {
+ echo "WARNING: No NVIDIA GPU detected in guest"
+ echo "Make sure QEMU is started with -device vfio-pci,sysfsdev=..."
+}
+
+# Option 1: Install from Ubuntu repository (easiest)
+echo ""
+echo "Choose installation method:"
+echo " 1) Ubuntu repository (nvidia-driver-550-open)"
+echo " 2) NVIDIA runfile (latest)"
+echo " 3) Build from source (open-gpu-kernel-modules)"
+read -p "Select [1-3]: " choice
+
+case $choice in
+ 1)
+ echo "Installing from Ubuntu repository..."
+ apt-get install -y nvidia-driver-550-open
+ ;;
+ 2)
+ echo "Downloading NVIDIA runfile..."
+ RUNFILE="NVIDIA-Linux-x86_64-570.144.run"
+ wget -q "https://us.download.nvidia.com/XFree86/Linux-x86_64/570.144/$RUNFILE"
+ chmod +x "$RUNFILE"
+ ./"$RUNFILE" --silent --dkms --no-opengl-files
+ ;;
+ 3)
+ echo "Building from open-gpu-kernel-modules source..."
+ git clone https://github.com/NVIDIA/open-gpu-kernel-modules.git /tmp/open-gpu-kernel-modules
+ cd /tmp/open-gpu-kernel-modules
+ git checkout 570.144
+ make -C kernel-open/modules SYSSRC=/usr/src/linux-headers-"$KERNEL_VER" -j$(nproc)
+ make -C kernel-open/modules SYSSRC=/usr/src/linux-headers-"$KERNEL_VER" modules_install
+ depmod -a
+ ;;
+ *)
+ echo "Invalid choice"
+ exit 1
+ ;;
+esac
+
+# Install firmware
+echo "Installing GSP firmware..."
+mkdir -p /lib/firmware/nvidia/tu102/gsp
+# Firmware files should be copied from host or downloaded
+# For TU104 (Turing), we need:
+# - bootloader-535.113.01.bin
+# - booter_load-535.113.01.bin
+# - gsp-535.113.01.bin
+echo "Copy firmware files to /lib/firmware/nvidia/tu102/gsp/"
+echo " (bootloader, booter_load, gsp binaries)"
+
+# Load driver
+echo "Loading NVIDIA driver..."
+modprobe nvidia
+
+# Verify
+echo ""
+echo "=========================================="
+echo "Verification"
+echo "=========================================="
+nvidia-smi
+echo ""
+dmesg -T | grep -i nvidia | tail -20
+
+echo ""
+echo "Setup complete! Recommended: reboot the guest" \ No newline at end of file