NVIDIA-vBIOS-VFIO-Patcher icon indicating copy to clipboard operation
NVIDIA-vBIOS-VFIO-Patcher copied to clipboard

cannot patch the gtx1080.rom

Open olproff opened this issue 6 years ago • 6 comments

root@debian:/home/olproff/NVIDIA-vBIOS-VFIO-Patcher# ./nvidia_vbios_vfio_patcher.py -i ../gtx1080.dump -o ../gtx1080_patched.bin Opening the ROM file... Scanning for ROM offsets... Traceback (most recent call last): File "./nvidia_vbios_vfio_patcher.py", line 194, in main() File "./nvidia_vbios_vfio_patcher.py", line 168, in main rom.detect_offsets() File "./nvidia_vbios_vfio_patcher.py", line 77, in detect_offsets raise CheckException("Couldn't find the ROM footer!") main.CheckException: Couldn't find the ROM footer!

olproff avatar Dec 05 '17 23:12 olproff

How do you extracted the rom?

ploth avatar Dec 22 '17 22:12 ploth

Hi there

I found your tool via https://forums.lenovo.com/t5/ThinkPad-P-and-W-Series-Mobile/P50-Quadro-M1000M-GPU-Passthrough-to-VM/td-p/3483650

I have a Dell Precision 5520 that has an Nvidia Quadro M1200 - which is the 'enterprise' equivalent of the Nvidia GTX1050 (and seems to have the same board code of GM107).

I get the same error, even though it parses correctly with @awilliam's rom-parser https://github.com/awilliam/rom-parser

I extracted both via the windows registry and the the firmware file downloaded from Dell, and they resulted in the same thing.

Here's the rom.zip

marcosscriven avatar Jul 21 '18 12:07 marcosscriven

The script has only been tested with discrete consumer GPUs in the Pascal series (eg. GTX 10xx), and far as I've heard no one has managed to make it work with a laptop GPU. I originally created it to solve a VFIO passthrough issue with my GTX 1070, and shared it since I figured people could find it useful since it worked with other ROMs I found in the internet.

Unlike rom-parser, this script has no real idea of the underlying structure of the ROM; it's basically two regular expressions to locate and split a desired area of the ROM into its own file, plus a few checks for markers that were constant in all the different ROMs I tested the tool with; I don't know why there are three NDPE markers before the footer (or what that "footer" actually is!), but since they exist in all of the samples I tried, might as well be a little more confident and check for them as well.

If you have two copies of a ROM, one of them a partial copy that works for VFIO passthrough, and the other a full copy that does not work for VFIO passthrough, you could use a hex editor to compare the two files and find out what section of the file you need to cut out to make the full copy identical to the partial one. And, if you'd want to make a script like this one, you could create a script that locates the desired section and splices it for you automatically.

Matoking avatar Jul 21 '18 15:07 Matoking

@Matoking - That's for the help here - not 100% sure what you mean by a 'partial' copy, but I think looking through you mean 'full' is the ones with a header from a firmware updater?

In that case I think the one I have already is 'partial' - it starts with:

00000000: 55aa cceb 4b37 3430 30e9 4c19 77cc 5649  U...K7400.L.w.VI
00000010: 4445 4f20 0d00 0000 9001 7519 0000 4942  DEO ......u...IB
00000020: 4d20 5647 4120 436f 6d70 6174 6962 6c65  M VGA Compatible
00000030: 0100 0000 4000 3456 3039 2f31 322f 3136  [email protected]/12/16

Which looks just like the one described in https://www.youtube.com/watch?v=1IP-h9IKof0

What's confusing is I think I need a 'UEFI' patched bios, per https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF#UEFI_.28OVMF.29_Compatibility_in_VBIOS

This is all an attempt to run Windows using the dGPU (headless) on the laptop, and iGPU on host.

marcosscriven avatar Jul 21 '18 17:07 marcosscriven

@marcosscriven For partial copies, I used ROMs provided by the people in this discussion thread: https://lime-technology.com/forums/topic/51230-video-guidehow-to-pass-through-an-nvidia-gpu-as-primary-or-only-gpu-in-unraid/

I then compared them to full copies you can find on TechPowerup: https://www.techpowerup.com/vgabios/

After testing the tool on a few ROMs and getting identical results, I decided to test it on my GPU which worked perfectly.

Matoking avatar Jul 25 '18 04:07 Matoking

I change this line and it works. FOOTER_REGEX = ( b'564e(([a-z]|[0-9]){348})(4e504453)(([a-z]|[0-9]){56})(4e504445)' with FOOTER_REGEX = (
b'564e(([a-z]|[0-9]){124})(4e504453)(([a-z]|[0-9]){56})(4e504445)' )

geekette86 avatar Oct 11 '18 10:10 geekette86