master e741a803e6e7 cached
17 files
15.9 KB
4.9k tokens
1 requests
Download .txt
Repository: SpaceinvaderOne/Dump_GPU_vBIOS
Branch: master
Commit: e741a803e6e7
Files: 17
Total size: 15.9 KB

Directory structure:
gitextract_t35jaopi/

├── .gitignore
├── README.md
├── dump_vbios.sh
└── vBIOSes/
    ├── AMD/
    │   ├── RX580 - Sapphire Pulse -8gb.rom
    │   └── RX6600XT- Sapphire Pulse -8gb.rom.rom
    ├── Nvidia/
    │   ├── GT 1030 - MSI - LowProfile -2gb.rom
    │   ├── GT 710 -MSI 2GD3H -2gb.rom
    │   ├── GT710 - EVGA  -1gb.rom
    │   ├── GTX 1050 Ti - MSI GAMING X 4G.rom
    │   ├── GTX 1060 - Gigabyte WINDFORCE OC 6G GV - N1060WF2OC-6GD.rom
    │   ├── GTX 1080ti - EVGA SC ICX -11gb.rom
    │   ├── GTX 1660 - Inno3D Twin X2 6Gb.rom
    │   ├── GTX 980-EVGA-980SC-4GB.rom
    │   ├── MSI_GeForce_RTX3080_10GB_VENTUS_3X.rom
    │   ├── RTX 2080ti - Palit GamingPro -11gb.rom
    │   └── ZOTAC - GeForce GT 710 - 1GB.rom
    └── readme.txt

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================

.DS_Store


================================================
FILE: README.md
================================================
## **DUMP_GPU_vBIOS**
**Script to dump the vBios from any GPU even if a primary GPU**

This script is designed to be used on an Unraid server (using the user scripts plugin) but could easily be adapted to run on any Linux based OS
The script will dump the vBios of any connected GPU. It will dump the vbios wether the GPU is primary sedondary or only GPU etc.

**How the script works.**
1. It will take take the id of a GPU, make a temporary seabios vm with the card attached, then quickly start and stop the vm with GPU passed through. This will put the GPU in the correct state to dump the vBios.
2. It will then delete the temporary vm as no longer needed.
3. It will dump the vbios of the card then check the size of the vbios. 
4. If the vbios looks correct it will finish the process and put the vbios in the location specified in the script (default /mnt/user/isos/vbios) 
5. However if the vbios looks incorrect and the vbios is under 70kb then it was probably dumped from a primary GPU. This is because the vbios was shadowed during the boot process and so the resulting vbios is a small file which is not correct. So the script will now disconnect the GPU then put the server to sleep. Next it will prompt you to press the power button to resume the server from its sleep state. Once server is woken the script will rescan the pci bus reconnecting the GPU. This now allows the primary gpu to be able to have the vbios dumped correctly. Script will then redump the vbios again putting the vbios in the loaction specified in the script (defualt /mnt/user/isos/vbios)


**Using the script.**

1. Copy the script from here onto your Unraid server as a userscript.
2. Run the script first without making any modifications.
3. Script will report an error saying  "That is NOT a valid PCI device. Please correct the id and rerun the script" as no GPU has been selected. It will list the GPUs in your server. From this list take the ID of the GPU from which you want to dump the vbios. For example "0c:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590]" the id is the first block of character ie 0c:00.0
4. Copy the id and edit the script variable gpuid="xx:xx.x"  removing the contents between the quotations replacing it with the ID for example gpuid="0c:00.0"
5. Give the vbios a name by replacing the contens of the variable vbiosname="gpu vbios.rom" to the name of your gpu etc.
  -- *note if no name is given then script will try and name the vbios based on the the info it finds from lspci*
6. optional - The default location of where the vbios will be dumped is in the isos share in a folder called vbios. You can change this by changing the variable vbioslocation="/mnt/user/isos/vbios/" to the location of your choosing.
7. Save changes and run the script.


**Notes about the script**

The script will put the server to sleep in order to reset a primary GPU in order for a sucessful dump. So your server must support sleep if you want to dump a primary GPU. For other non primary GPUs this is not necessary.

For best results power down server then start server (not reboot)  before using script. Make sure whilst running script no vms or containers are running.

There are some checks the script will make to check that you have in fact put in the id of the gpu and not some other hardware. However these checks can be disabled by changing the varaiable from safety="yes" to safety="no"

Changing the variable forcereset="no" to forcereset="yes" will make the script always forcereset the gpu before dumping vbios (if set to no it will only force reset if it thinks its dumping a primary gpu)


================================================
FILE: dump_vbios.sh
================================================
#!/bin/bash
# Script to dump GPU vbios from any Unraid GPU 
# by SpaceinvaderOne

##### Read the readme for how to use this script #####

##### FILL IN THE  VARIABLES BELOW #######################################################################

###################
gpuid="xxxxxx"
###################
		
#####Name the vbios for example gtx2080ti.rom	

### Naming of the vbios is optional ....  if you do not rename it here then the script will name it based off the details found about the gpu dumped

###################
vbiosname="gpu vbios.rom"
###################

##### Location to put vbios (change if you dont want to use below location) if location doesnt exist it will be created for you.

###################
vbioslocation="/mnt/user/isos/vbios/"
###################

##### Runs checks on device to see if it is in fact a GPU. Recommended to leave set as "yes"

###################
safety="yes"
###################

########## DO NOT CHANGE BELOW THIS LINE #################################################################

gpuid=$(echo "$gpuid" | sed 's/ *$//')

gpuid=$(echo "$gpuid" | sed 's/^ *//g')

dumpid="0000:$gpuid"

mygpu=$(lspci -s $gpuid)

disconnectid=$(echo "$dumpid" | sed 's?:?\\:?g')

disconnectid2=$(echo "$disconnectid" | sed 's/\(.*\)0/\11/')

vganame=$( lspci | grep -i "$gpuid" )

forcereset="no"



########## Script functions #################################################################
checkgpuiscorrect() {
	mygpu=$(lspci -s $gpuid) || { notvalidpci; exit; } 
	echo "You have selected this device to dump the vbios from"
	if grep -i 'VGA compatible controller' <<< "$mygpu"  ; then 
		if grep -i 'Intel' <<< "$mygpu"  ; then 
			echo "This looks like its an integrated INTEL GPU and vbios dump will most likely FAIL"
			echo "Please select a dedicated GPU to dump vbios from"
			echo "If you really want to try then rerun script changing variable to safety=off"
		else
			echo
			echo "This does look like a valid GPU to me. Continuing ........."
			echo
		fi
	elif  grep -i 'Audio Device' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like an AUDIO device"
	echo "Maybe you have selected the audio part of your GPU ?"
	echo "Please edit the script and make sure to put the id of ONLY the VGA part of your GPU"
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are all the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'USB controller' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a USB controller"
	echo "Some GPUs have a USB part to them. Maybe you selected that ?"
	echo "Please edit the script and make sure to put the id of ONLY the VGA part of your GPU"
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'Serial bus controller' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a USB type C controller"
	echo "Some GPUs have a USB type C part to them. Maybe you selected that ?"
	echo "Please edit the script and make sure to put the id of ONLY the VGA part of your GPU"
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'Network controller' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a NETWORK adapter "
	echo "Please correct the id and rerun the script."
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'Ethernet controller' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a NETWORK adapter "
	echo "Please correct the id and rerun the script."
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'SATA controller' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a SATA controller "
	echo "Please correct the id and rerun the script."
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'Non-Volatile memory controller' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a NVME controller "
	echo "Please correct the id and rerun the script."
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'PCI bridge' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a PCI bridge "
	echo "Please correct the id and rerun the script."
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'Host bridge' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a HOST bridge "
	echo "Please correct the id and rerun the script."
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'SMBus' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a SMBus controller "
	echo "Please correct the id and rerun the script."
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	elif  grep -i 'Encryption controller' <<< "$mygpu"  ; then 
	echo
	echo "This doesn't look like a GPU to me. It looks like a Encryption controller "
	echo "Please correct the id and rerun the script."
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	else
	echo "$mygpu"
	echo
	echo "This doesn't look like a GPU to me. Please correct the id and rerun the script."
	echo "If you are 100 % sure this is the VGA part of your GPU then rerun script changing variable to safety=off"
	echo
	echo "These are the GPUs that I can see in your server"
	lspci | grep -i 'vga'
	exit
	fi
	
}

notvalidpci() {
	echo "That is NOT a valid PCI device. Please correct the id and rerun the script"
 	echo
 	echo "These are all the GPUs that I can see in your server. Please choose one of these"
 	lspci | grep -i 'vga'
}
	

checklocation() {
	# check if vbios location exists and if not create it
	echo
	echo "Checking if location to put vbios file exists"
		if [ ! -d "$vbioslocation" ] ; then
 
			echo "Vbios folder created at "$mountlocation" "
			echo
			mkdir -vp "$vbioslocation" # make the directory as it doesnt exist
		else
			echo "Vbios folder "$mountlocation" already exists"
			echo
		fi
}

buildtempvm() {
cat > /tmp/dumpvbios.xml << EOF
<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm'>
<name>dumpvbios</name>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<memoryBacking>
<nosharepages/>
</memoryBacking>
<vcpu placement='static'>1</vcpu>
<cputune>
<vcpupin vcpu='0' cpuset='0'/>
</cputune>
<os>
<type arch='x86_64' machine='pc-q35-3.0'>hvm</type>
</os>
<cpu mode='host-passthrough' check='none' >
</cpu>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/local/sbin/qemu</emulator>
<controller type='pci' index='1' model='pcie-root-port'>
<model name='pcie-root-port'/>
<target chassis='1' port='0x8'/>
</controller>
<hostdev mode='subsystem' type='pci' managed='yes' xvga='yes'>
<driver name='vfio'/>
<source>
<address domain='0x${dumpid:0:4}' bus='0x${dumpid:5:2}' slot='0x${dumpid:8:2}' function='0x${dumpid:11:1}'/>;
</source>
</hostdev>
</devices>
</domain>
EOF
}

isgpuprimary () {
	# Check Primary GPU and wether gpu has already been disconnected
	# Disconnect GPU and set server to sleep mode then rescan bus
	if [ "$forcereset" = "yes" ] ; then	
			echo "Disconnecting the graphics card"
			echo "1" | tee -a /sys/bus/pci/devices/$disconnectid/remove
			echo "Entered suspended (sleep) state ......"
			echo
			echo " PRESS POWER BUTTON ON SERVER TO CONTINUE"
			echo
			echo -n mem > /sys/power/state
			echo "Rescanning pci bus"
			echo "1" | tee -a /sys/bus/pci/rescan
			echo "Graphics card has now sucessfully been disconnected and reconnected"
			echo "It is now ready to begin the dump vbios process"
			echo
			
	elif [ "$forcereset" = "no" ] ; then			
			echo "I will try and dump the vbios without disconnecting and reconnecting the GPU"
			echo "This normally only works if the GPU is NOT the Primary or the only GPU"
			echo "I will check the vbios at the end. If it seems wrong I will then retry after disconnecting the GPU"
			echo

	else 
			echo "forcereset is set as "$forcereset" this is not a recognised option"
			echo "Please set forcereset to either yes or no "
			exit
	fi
}


startstopvm() {
	
	echo "Defining temp vm with gpu attached"
	virsh define /tmp/dumpvbios.xml 
	echo "Starting the temp vm to allow dump"
	virsh start dumpvbios
	echo "Waiting for a few seconds ....."
	echo
	sleep 9
	echo "Stopping the temp vm "
	virsh destroy dumpvbios
	echo "Removing the temp vm"
	virsh undefine dumpvbios

}

dumpvbios() {
	# if no name was given for vbios then make name from vga name from lspci
	if [ "$vbiosname" = "gpu vbios.rom" ] ; then
		vbiosname=$( echo "$vganame" |  awk 'NR > 1 {print $1}' RS='[' FS=']' )
	fi
	echo
	cd /sys/bus/pci/devices/"$dumpid"/ 
	echo 1 > rom
	echo
	echo "Okay dumping vbios file named "$vbiosname" to the location "$vbioslocation" "
	cat rom > "$vbioslocation""$vbiosname" || needtobind
	echo 0 > rom
}

needtobind() {
	echo
	echo "Um.... somethings gone wrong and I couldn't dump the vbios for some reason"
	echo "Sometimes when this happens all we need to do to fix this is 'stub' or 'bind to the vfio' the gpu and reboot the server"
	echo
	echo "This can be done in Unraid 6.8.3 with the use of the vfio config plugin or if you are on Unraid 6.9 or above it can be done"
	echo "directly from the gui in Tools/System Devices .....So please do this and run the script again"
	echo
	exit 
}


cleanup() {
	if [ -e /tmp/dumpvbios.xml ] ; then
		rm /tmp/dumpvbios.xml 
	fi
}


checkvbios() {
	filepath="$vbioslocation""$vbiosname"
	if [ -n "$(find "$filepath" -prune -size -2000c)" ]; then
		needtobind
	
	
	elif [ -n "$(find "$filepath" -prune -size -70000c)" ]; then
	    printf '%s is less than 70kb\n' "$filepath"
		echo "This seems too small. Probably the GPU is Primary and needs disconnecting and reconnecting to get proper vbios"
		echo
		echo "Running again"
		forcereset="yes"
		buildtempvm
		isgpuprimary
		startstopvm
		dumpvbios
		cleanup
		if [ -n "$(find "$filepath" -prune -size -70000c)" ]; then
		    printf '%s is less than 70kb\n' "$filepath"
			echo "This seems small but maybe its correct. Please try it. All done !"
			exit
		fi
		echo
		echo "vbios seems to be correct. All done :)"
		exit
		
	else
	echo
	echo "vbios seems to be correct. All done :)"
	exit	
	fi
}



########## run functions #################################################################
if [ "$safety" = "no" ] ; then	
echo "Safety checks are disabled. Continuing ......"
else
checkgpuiscorrect
fi
checklocation
buildtempvm
isgpuprimary
startstopvm
dumpvbios
checkvbios
exit


================================================
FILE: vBIOSes/readme.txt
================================================

Here I will build a collection of dumped vBIOSes to be used to help passthrough a GPU for Linux kvm/qemu virtual machines

At the moment there are not many here. Over time I hope this will increase. So if you. have dumped a vbios and want to contribute
please make sure to name the vbios correctly with type, vendor and model and memory size.
For example

RTX 2080ti - Palit GAMING PRO - 11G 
Download .txt
gitextract_t35jaopi/

├── .gitignore
├── README.md
├── dump_vbios.sh
└── vBIOSes/
    ├── AMD/
    │   ├── RX580 - Sapphire Pulse -8gb.rom
    │   └── RX6600XT- Sapphire Pulse -8gb.rom.rom
    ├── Nvidia/
    │   ├── GT 1030 - MSI - LowProfile -2gb.rom
    │   ├── GT 710 -MSI 2GD3H -2gb.rom
    │   ├── GT710 - EVGA  -1gb.rom
    │   ├── GTX 1050 Ti - MSI GAMING X 4G.rom
    │   ├── GTX 1060 - Gigabyte WINDFORCE OC 6G GV - N1060WF2OC-6GD.rom
    │   ├── GTX 1080ti - EVGA SC ICX -11gb.rom
    │   ├── GTX 1660 - Inno3D Twin X2 6Gb.rom
    │   ├── GTX 980-EVGA-980SC-4GB.rom
    │   ├── MSI_GeForce_RTX3080_10GB_VENTUS_3X.rom
    │   ├── RTX 2080ti - Palit GamingPro -11gb.rom
    │   └── ZOTAC - GeForce GT 710 - 1GB.rom
    └── readme.txt
Condensed preview — 17 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (17K chars).
[
  {
    "path": ".gitignore",
    "chars": 11,
    "preview": "\n.DS_Store\n"
  },
  {
    "path": "README.md",
    "chars": 3679,
    "preview": "## **DUMP_GPU_vBIOS**\n**Script to dump the vBios from any GPU even if a primary GPU**\n\nThis script is designed to be use"
  },
  {
    "path": "dump_vbios.sh",
    "chars": 12186,
    "preview": "#!/bin/bash\n# Script to dump GPU vbios from any Unraid GPU \n# by SpaceinvaderOne\n\n##### Read the readme for how to use t"
  },
  {
    "path": "vBIOSes/readme.txt",
    "chars": 393,
    "preview": "\nHere I will build a collection of dumped vBIOSes to be used to help passthrough a GPU for Linux kvm/qemu virtual machin"
  }
]

// ... and 13 more files (download for full content)

About this extraction

This page contains the full source code of the SpaceinvaderOne/Dump_GPU_vBIOS GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 17 files (15.9 KB), approximately 4.9k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!