mirror of https://gitlab.com/YuriAlek/vfio
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.0 KiB
Bash
40 lines
1.0 KiB
Bash
#!/bin/bash
|
|
|
|
## Check if the script was executed as root
|
|
[[ "$EUID" -ne 0 ]] && echo "Please run as root" && exit 1
|
|
|
|
## Load the config file
|
|
source "${BASH_SOURCE%/*}/config"
|
|
|
|
## Kill the Display Manager
|
|
systemctl stop lightdm
|
|
|
|
## Remove the framebuffer and console
|
|
echo 0 > /sys/class/vtconsole/vtcon0/bind
|
|
echo 0 > /sys/class/vtconsole/vtcon1/bind
|
|
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/unbind
|
|
|
|
# Unload the Kernel Modules that use the GPU
|
|
modprobe -r nvidia_drm
|
|
modprobe -r nvidia_modeset
|
|
modprobe -r nvidia
|
|
modprobe -r snd_hda_intel
|
|
|
|
## Extract the VBIOS
|
|
echo 1 > /sys/bus/pci/devices/$videobusid/rom
|
|
cat /sys/bus/pci/devices/$videobusid/rom > $VBIOS_EXTRACT_PATH
|
|
echo 0 > /sys/bus/pci/devices/$videobusid/rom
|
|
|
|
# Reload the kernel modules
|
|
modprobe snd_hda_intel
|
|
modprobe nvidia_drm
|
|
modprobe nvidia_modeset
|
|
modprobe nvidia
|
|
|
|
## Reload the framebuffer and console
|
|
echo 1 > /sys/class/vtconsole/vtcon0/bind
|
|
echo efi-framebuffer.0 > /sys/bus/platform/drivers/efi-framebuffer/bind
|
|
|
|
# Reload the Display Manager to access X
|
|
systemctl start lightdm
|