Skip to content
Ausdauersportler edited this page Nov 27, 2022 · 8 revisions

This page contains just a short construction plan how to create an EFI vBIOS starting with the standard GOP vBIOS.... You may come back here to check it when the detailed construction page becomes too long to follow or the outline gets out of my hands during editing. Please note that this plan may mention tools, which will be explained later on within the real construction example.

Plan

  1. Save the original BIOS of a MXM card named AMDGPU to AMDGPU-ORIG.rom, e.g. saving the W5170M BIOS to a file named W5170M-ORIG.rom. Keep it and make all upcoming modifications of copies of that file. For the sake of simplicity I stick with the example.
  2. Create a copy of W5170M-ORIG.rom and rename it to W5170M-GOP.rom.
  3. Check of this BIOS already contains a GOP part, if not add one manually or with a tool.
  4. Now adjust the OBJ_INFO module within the legacy part of the BIOS to make the backlight of the internal iMac LCD work and test it on the iMac. This is a tricky operation.
  5. Find the firmware of an Apple Mac system which uses the same AMD GPU family (here the MacBookPro12,1 2015). Extract the graphics driver EFI module from this firmware and save it using the GPU family name, here VenusEG2.efi. This is de facto Apples own (pre UEFI 2.0?) implementation of GOP.
  6. Modify the module by changing the FrameBuffer name and save the modified file with the new name M370.efi (this is the name of the GPU within macOS when asking the system_profiler).
  7. compress the M370.efi file using EfiRom to convert it to BIOS code (BIOS is literally just a series of compressed EFI programs)
  8. replace the GOP part in the W5170M-GOP.rom with the compressed EFI code and save it to W5170M-EG2.rom (this is fully functional, but EFI boot picker still depends on modding the firmware)
  9. now either modify your iMac firmware adding the two other modules to it or use OpenCore to load those modules to test your current work
  10. create another copy of the W5170M-EG2.rom and name it W5170M-EFI.rom (this will be the final version not depending on a firmware mod nor ob OpenCore as long as you stick with supported macOS versions)
  11. find and delete the VGA part from the legacy BIOS part, mark it's length in bytes (hexadecimal)
  12. find all address tables and correct the absolute addresses referring to all code and data modules by subtracting the length recorded in the former step, check the success. all tables contain addresses in hexadecimal form and wrong order (big vs. little endian).
  13. now use EfiRom to compress the other two EFI modules in the same way you did it in step 7
  14. add these two compressed parts to the BIOS file created in step 10
  15. flash it to the MXM card and test your success
  16. done

File naming Convention

To avoid any confusion when preparing all modifications this naming scheme will be used during the development. We will create several versions of the BIOS for a single AMDGPU card, in detail named like this:

  1. AMDGPU-ORIG.rom or AMDGPU.rom (Original file, can already contain a GOP)
  2. AMDGPU-GOP.rom (GOP added, iMac connector table modded file)
  3. AMDGPU-EG2.rom(GOP replaced by EG2: needs on OpenCore or iMac firmware modification)
  4. AMDGPU-EFI.rom (EFI modded file: fully standalone EFI modded rom, no iMac firmware mod needed)
  5. AMDGPU-EG2_adj.rom (EG2 modded file : needs OpenCore or iMac firmware modification)
  6. AMDGPU-EFI_adj.rom (fully standalone EFI modded rom with adjustments to enable backlight on boot)