[Guide] How to flash a modded AMI UEFI BIOS

Since SoniX has presented his wonderful UBU tool (look >here<) it has become very easy to modify any UEFI mode mainboard BIOS regarding their included Option ROM and EFI modules. Unfortunately the real risky part of the BIOS modding operation begins, when the user is going to flash the modded BIOS into the BIOS chip of the mainboard.

Although I only have own experience with ASUS and ASRock mainboards, I decided to write this guide about how to get the modded BIOS properly flashed and working without getting an error message. It would be great, if a user of a Gigabyte or MSI mainboard would write a similar guide.

General warnings/advices:

  1. Warning:
    Before you are going to flash any modded BIOS into any mainboard BIOS chip, you have to make sure, that the source BIOS version definitively has been designed exactly for this mainboard type (incl. Revision number)!

    Flashing a wrong (not matching) BIOS may cause a bricked BIOS chip and an unusable mainboard.
  2. General advices:
    • How to name the BIOS file?
      Usually it is a good idea to give the modded BIOS file the exactly same name (incl. extension) as the original BIOS file (there are some exceptions, see below). This can easily be done by the Windows Explorer (right-click onto the modded BIOS file > “Show advanced options” > “Rename”).
    • Which flash procedure resp. which tool should be used?
      The most risky flashing procedure is the one from within a running OS. That is why I recommend to use either a BIOS flash tool from within the UEFI BIOS or a flash tool, which has been put onto a bootable USB Flash Drive with a DOS environment.
      A very safe method to get a modded BIOS properly flashed is to use the "normal" BIOS flashing tool the mainboard manufacturer is offering within the BIOS. The problem is, that the tool may detect the alteration of the BIOS and refuses to flash it.
      The Company AMI itself offers >here< for their different BIOS platforms (AMIBIOS, Aptio IV and Aptio V) specific BIOS Update Utilities. They are as well available within my OneDrive account (look >here<).
      Another tool, which is able to flash a modded BIOS into the BIOS chip of Intel Chipset mainboards is the "Flash Programming Tool (FPT)", which is part of the related Intel (CS)ME System Tools version. You can find the specific Intel CSME System Tools for your mainboard within the chapter C2 of >this< start post.
    • What can be done, when the "Flash Programming Tool (FPT)" gives an error message due to the BIOS’s WRITE protection?
      Our BIOS Gurus SoniX and Lost_N_BIOS have written guides about how to solve this problem by using different methods. These guides can be found >here< (SoniX’s Guide) and >here< (Lost_N_BIOS’s Guide).


Guide for ASUS mainboards
with an AMI UEFI BIOS

Flashing an ASUS BIOS file with the extension “.ROM”:
    This BIOS file type is not capsuled and usually not write protected. It is most common for ASUS P67 and Z68 mainboards.
    That is why it should be no problem to get an accurately modded BIOS flashed into the BIOS chip by using the ASUS standard tool named “EZ Flash”.


Flashing an ASUS BIOS file with the extension “.CAP”:
    These types of ASUS BIOS files are capsuled and write protected, which makes it impossible to flash a modded .CAP BIOS the usual way.
    There are at least 4 options how to solve this problem:

    1. Usage of the ASUS “USB Flashback” feature (easiest option):
      Many ASUS mainboards with an Intel 7- 8- or 9-Series chipset do support this very easy to use feature to get a modded BIOS flashed. These boards have a special "Flashback USB port" and a special "USB Flashback button". For details please look into your mainboard manual or at >this< ASUS site (maybe the Smart Redirect Addon has to be disabled).
      Procedure:
      • Rename the modded BIOS file according to ASUS "USB BIOS Flashback Rules". The ASUS support is offering a tool named "BIOS Renamer for USB BIOS Flashback" for all mainboards, which support the USB Flashback feature. Furthermore the UBU tool offfers the renaming procedure as well.
      • Copy the modded and renamed BIOS file onto a small sized, freshly FAT32 formatted USB 2.0 Flash drive and insert it into the special "USB Flashback port" (Note: The USB Flashback mechanism is very picky regarding the used USB Flash Drive. So if the procedure should fail, try another USB stick!).
      • Shut down the computer, but don’t power it off.
      • Hit the USB BIOS Flashback button. A LED light will start blinking. Press the button for some seconds (LED light should have blinked 3-4 times).
      • Wait until the LED light doesn’t blink anymore. This means, that the BIOS has been successfully flashed into the BIOS chip of the mainboard.
      • Then all is done. You can power off the computer and remove the USB Flash drive.

    2. Usage of an AMI AFUDOS or AFUWIN Tool:
      The first users, who reported about this option, were the Forum users ValkyrieStar (look >here<) and OldGuy (look >here<).
      Here is a short guide for users, who are running a 64bit Windows OS:
      • Download the following AMI Aptio IV BIOS Tool:
        >AMI AFUWin64 v3.05.04< (can be used while running any 64bit Windows OS)
        Note: This AFUWin tool version is dated 11/07/2015 and not offered by AMI anymore, but the latest, which supports the tricky " /GAN" command suffix (see below).

      • Copy the original (untouched) capsuled BIOS file into the same directory as the file AFUWINx64.exe.

      • Flash the original BIOS by running the following Command Prompt (as Admin):
        afuwinx64.exe <NAME OF THE ORIGINAL BIOS>.CAP
         
      • Remove the capsule header from the modded *.CAP BIOS file and save the modded BIOS as *.ROM file.
        The removal of the capsule header can be done by several BIOS tools. Here is the way how to do it by using the latest UEFITool version (you can get it >here<):

        • Open the *.CAP file, do a right-click onto the listed "AMI Aptio capsule", choose the option "Extract body…" and save it as *.ROM file. Here is the related screenshot:

          Note: Due to the removed capsule header the *.ROM file is a little bit smaller sized than the original *.CAP file. This is normal and nothing to worry about.

      • Replace the original *.CAP BIOS file within the AFUWIN64 folder by the modded *.ROM BIOS file.

      • Flash the modded BIOS by running the following Command Prompt as Admin:
        afuwinx64.exe <NAME OF THE MODDED BIOS>.ROM /GAN

      • The UEFI BIOS should now be fully re-flashed and updated! Reboot and give it a try!

    3. Usage of the ASUS AI Suite:
      Our Forum member Wishbringer reported, that he was able to successfully flash modded *.CAP BIOSes into the BIOS chip of several Intel 7-, 8- and 9-Series Chipset ASUS mainboards by doing the following:
      • Download AI-Suite (when not for Win10 available use Version for 8.1)
      • Start Easy Update for BIOS Update in Windows, select ORIGINAL file (then some timeconsuming checking seems to happen)
      • Before start flashing delete selected original file and replace with modded one (same name, same location).
      • Proceed with bios flash.
      For details please look into >this< post. Big thanks to him!

    4. Usage of a tool named "Flashrom" or its successor "Flashprog":
      You can find a guide about the usage of the "Flashrom" tool within the Annex part of this post.
      Although I have only own experience with the BIOS of my ASRock X570 Pro4 mainboard (having used the Flashrom tool), the method may work with modern ASUS mainboards as well. A list of definitively supported AMD Chipset mainboards can be found >here< at overclock.net Forums.


Guide for ASRock mainboards
with an AMI UEFI BIOS


General information about flashing an ASRock BIOS file:
    The normal procedure to flash an AMI UEFI BIOS into the BIOS chip of an ASRock mainboard is to copy the BIOS onto a FAT32 formatted USB Flash drive, to enter the BIOS, to navigate to the "Tools" section and to choose the "Instant Flash" option. Some BIOSes of older ASRock mainboards can be flashed this way even after having modded it, but all modern ASRock UEFI BIOSes have an internal "Security Flash Check", which may prevent a successful flashing of any modded BIOS (unless the user is able to circumvent the protection).
    Note: Unfortunately the “Instant Flash” tool cannot be used at all with modded 32MB sized ASRock BIOSes (see below).

Flashing a modded ASRock UEFI BIOS by using the ASRock BIOS tool “Instant Flash”:
(valid for all 8 or16MB sized ASRock AMI UEFI BIOSes)
    The “Security Flash Check” of ASRock mainboard UEFI BIOSes is located either within the BIOS capsule header (valid for AMI Aptio IV BIOSes) or at a specific place outside of it (valid for all AMI Aptio V BIOSes).
    Users of an ASRock mainboard, who are trying to flash a modded, but still protected UEFI BIOS may get an error message like this:


    Thanks to
    a) our BIOS Guru lordkag, who detected the exact position of the related code of ASRock AMI Aptio V BIOSes, and
    b) our UBU maker SoniX, who included the automatic removal of the ASRock security flash check as an additional UBU tool feature,
    it is very easy to circumvent ASRock’s BIOS protection and to get a modded ASRock AMI Aptio UEFI BIOS properly flashed.

    Solution:
    The “Security Flash Check” hex code can be deleted from the ASRock UEFI BIOS without any impact on the integrity or functionality of the BIOS. This can be done either by the user as a separate BIOS modification process or automaticly by the UBU tool (new feature even for a lot of Aptio V BIOSes since UBU v1.50).
    Here is a short guide for UBU newbies:
      Details: (open/hide by a click)

      1. Download the latest UBU tool (you can get it >here<) and unzip it by using WinRAR v5.xx or 7-zip v20.00.
      2. Run the UBU.bat, navigate to your modded ASRock BIOS file (should be named as the original one) and double-click onto it.
      3. After having completed the BIOS scanning by the UBU tool, hit any key and then enter "0" (for Exit) to get access to the UBU Main Menu.
      4. Provided, that you don't want to get any BIOS module updated, enter "0" (for Exit) again.
      5. As last step you will be asked by the UBU tool how the BIOS file should be stored.
        If you want the ASRock "Security Flash Check" code being removed from the BIOS, you should choose the option "1".
      6. After having hit any key, you will find the modded BIOS, but now without the "Security Flash Check", within the UBU folder.
        You can easily verify, whether the UBU tool has removed the "Security Flash Check" or not, by comparing the size of the modded and the original BIOS. If the modded BIOS is a few KB smaller sized than the original one, you can be sure,
        a) that the original BIOS contained ASRock's "Security Flash Check" and
        b) that the UBU tool found it and was able to removed it (not possible with BIOSes of the newest ASRock mainboards).
        Don't worry about the BIOS file size difference. Since the size of the modded BIOS Region is still identical with the original one, the modded BIOS will be successfully flashed despite the size difference of the complete BIOS file.
      7. Flash it from within the BIOS by using the ASRock "Instant Flash" tool.
      8. At the end of the flashing procedure you should get this success message:


Flashing a modded ASRock UEFI BIOS by using the BIOS tool named “Flashprog”:
(maybe useful for ASRock mainboards with a 32MB sized AMI AptioV UEFI BIOS)

Once it will be written you can find a guide about the usage of the Flashprog tool within the Annex part of this post.


Guide for Gigabyte mainboards
with an AMI UEFI BIOS

Usually it is no problem to get a modded AMI Aptio BIOS properly flashed into the BIOS chip of a Gigabyte mainboard by using the Q-Flash utility.
Tip: You should give the modded BIOS the exactly same name as the original BIOS (incl. its extension).

If you should get an "Invalid BIOS Image", please have a look into >this< thread. Within the start post you will find lordkag’s brilliant instructions and >here< a step-by-step guide written by rootuser123 about how to circumvent the "Invalid BIOS Image" message and to get a modded Gigabyte Z170 mainboard BIOS properly flashed.

Tip from our Forum member rootuser 123: Users of a newer Gigabyte motherboard with an EFIFlash.exe file in the BIOS zip file can use the modded efiflash, which has been attached >here< by our Forum member Mov AX, 0xDEAD. The related report from rootuser123 can be found >here<.
In case of any problems while trying to flash a modded Gigabyte BIOS please post your help request >here<.

Another option to get a modded Gigabyte BIOS properly flashed is the usage of the EFIFlash v0.80 tool. For details please look into >this< thread.



Guide for MSI mainboards
with an AMI UEFI BIOS

Since I don’t have any own experience with MSI mainboards, we need someone who wites a short guide about how to get a modded MSI BIOS properly flashed.
Users of an MSI desktop mainboard can try to flash the modded BIOS by using the MSI standard M-Flash tool (don’t forget to rename it similar to the related original BIOS version!). If you should get an integrity error message, I recommend to try either the “Flashrom” tool (see the Annex of this Guide) or to join >here< the MSI Global English Forum for a solution. Thanks to Dogf for the hint.



Guide for Supermicro mainboards
with an AMI UEFI BIOS

You can find a guide written by our Forum member Wishbringer within >this< post. Big thanks to him!



Annex:
How to dump the BIOS Region
and to flash a modded AMI UEFI BIOS
by using a tool like “Flashprog” or “Flashrom”


(valid for mainboards from all manufacturers)


Flashprog (successor of the tool named “Flashrom”) is a utility for identifying, reading, writing, verifying and erasing flash chips. It has been designed to flash BIOS/EFI/coreboot/Firmware/OptionROM images on mainboards, network/graphics/storage controller cards, and various other programmer devices. >Here< is the related Wiki link.
After having successfully tested its predecessor named “Flashtool” with my ASRock X570 Pro4 mainboard, it seems possible for me, that the new Flashprog tool may work with other AMI UEFI mainboards as well.
A big advantage of this tool is the any-time option to reflash the previously working backuped BIOS Region, if anything should not work properly after having flashed an updated or modified BIOS.

Here is a short guide about how to use its predecessor named “Flashtool”:
    Details: (open/hide by a click)
    1. Download and unzip the attached package named “Flashrom v1.2 Utilities”, which contains all required tools and files.
    2. Run any Windows OS, insert a 2-8 GB sized USB Flash Drive, do a quick FAT32 formatting and give the drive a meaningful name like “FLASHROM”.
    3. Create a bootable USB Flash Drive with a FREEDOS image by using the tool Rufus, which is within the “Flashrom Utilities” package.
      Here is a screenshot about the most important Rufus settings:

    4. Copy the Flashrom files named flashrom.exe and CWSDPMI.EXE into the root of the just created bootable USB Flash Drive.
    5. Boot off the USB Flash Drive in LEGACY mode (CSM should be set within the mainboard BIOS to "ENABLED").
    6. Once you have access to the DOS image, type
      flashrom -p internal -r BACKUP.ROM
      and hit the "Enter" key. Wait until the process has been finished.
      You hopefully will see something like this on your desktop screen:



    7. Now you can shut down your PC and remove the USB Flash Drive. Don’t forget to enter the BIOS during the next start of the PC and to restore your desired BOOT order and options.
    8. The just created file named BACKUP.ROM is a clean complete BIOS Region dump of your mainboard and should be stored outside of your PC to be able to recover the original BIOS Region later on, if something should go wrong at any time.
    9. Now you should use a copy of the backup.rom file as source for the UBU work updating the desired BIOS modules.
    10. Once you have finished the desired UBU processing and saved the product as “BACKUP.ROM”, rename it to “MOD.ROM” and copy it onto the already previously used USB Flash Drive.
    11. Boot off the USB Flash Drive in LEGACY mode again, type
      flashrom -p internal -w MOD.ROM
      and hit the “Enter” key.
      Now wait until the erasing, flashing and verification process has been finished.
      Users, who want to get a logfile about what exactly has been checked, detected and done by the tool, should execute the command with the suffix “ -o writelog.txt” (thanks to hancor for the info).
      Here is the picture you hopefully will get:

    12. Then you can shut down your PC and remove the USB Flash Drive.
    13. Start the PC, enter the BIOS, set everything to "DEFAULT" and restore your specific non-DEFAULT BIOS settings.
    14. After the reboot your mainboard is using the updated BIOS.
Additional information about the Flashrom tool can be gotten on >this< Wikipedia page.
All credits regarding the usage of the Flashrom tool go to its makers, to "The Stilt" at overclock.net and to our Forum member aGeoM for his admirable work to make the related videos and to pursuade me to do the required tests.


Disclaimer:
The BIOS modification itself is not risky at all, but flashing a modded BIOS may end with an unbootable system or even with a bricked mainboard/PC.
Neither the maker of the used BIOS Flashing tool nor the author of this guide will overtake any responsability, if anything should go wrong.
Everything needs to be done by people, who
a) understand, what they are doing, and
b) know, that they alone are responsable for their action.


Good luck!
Dieter (alias Fernando)

Flashrom v1.2 Utilities.rar (1.34 MB)

6 Likes

This HxD method can be bad because capsule header is not always have size of 0x1000, it can be 0x50, 0x800, 0x1000 and 0x2000 (and other values theoretically, but I didn’t saw them).
To properly remove CAP file header, open the file with UEFITool, select “AMI Aptio capsule” (root element of items tree), press right mouse button, select “Extract body…” and save the result.

@ CodeRush:

Thanks for your comment. I didn’t kow, that the ASRock BIOS capsule header may have different sizes.
As a consequence I have written a new guide by using your “UEFITool”, hoping that it is ok for you and easy to understand for the users.
Additional question:
What do you think about a direct download link to your currently latest UEFITool version within the start post of this thread?
The problem will be to keep the mirror link up-to-date. Maybe you can give me an info or just post here, when you have released a new UEFITool version.

@Fernando , you can link it directly, if you wish.
Why so complex way to run UEFITool? There are nothing that required admin rights and BIOS file can be opened by dragging it onto UEFITool.exe file, so the first half can be simplified.

Thanks, I will do it.

I will think about a simplification. On the other hand you should keep in mind, that I write my guides for newbees, who want to know step by step what they have to do.

1 Like

I have trouble doing USB flashing modded bioses if my P8Z77-V Pro is running a newer bios than 1805. Asus added some kind of verification to prevent flashing non ASUS-bioses in versions newer than 18xx

So I have to downgrade to 1805 (using USB flash) and after 1805 is flashed, flashing a newer modded bios is possible.

Or is this procedure not really necessary??

@ MartiniGM:
Welcome at Win-RAID Forum!

I have never had a problem to flash a modded v2104 BIOS into the BIOS chip of my ASUS P8Z77-V, when I used the USB Flashback method.

The USB Flashback method should work nevertheless.

I don’t think, that this is necessary.
Questions:
1. How did you try to flash your modded BIOS?
2. What has been updated/modified within the BIOS?

Regards
Fernando

Is there a BIOS for Asrock Z68 Pro 3 NON- M in the interwebs that has TRIM enabled RAID0? If so where to get it and will the guide work for it?
I’m sorry to be rude and demand help here but I’m in a hurry and searched everywhere and have not found anything for my board.

HJALMAR

@ HJALMAR:
Welcome at Win-RAID Forum!

None of the original BIOSes for 6-Series chipset mainboards natively does support the TRIM in RAID0 feature, because all mainboard manufacturers insert just the original Intel RAID ROM modules and they do not support this feature for 6-Series chipset RAID0 systems.

Nevertheless you are able to get TRIM working within your Z68 RAID0 system, when you insert a “Universally TRIM modified” Intel RAID ROM version (look >here<) into the BIOS. You can do it manually by using >this< guide or let it be done by the UBU tool according >these< instructions.
EDIT:
I just have seen >here<, that you found already someone, who has done the BIOS modding for you.

Before you are going to flash the modded BIOS, you should prepare it according to my guide (= start post of this thread).
EDIT:
I just have realized, that your BIOS is not capsuled. So you should be able to flash the modded BIOS without any problem.

To be in a hurry is no reason to be rude, especially not, if you want help.

Regards
Fernando

Thank you so much for the help, and again sorry. Guess I tried to be polite and rude at the same time. But thanks again my BIOS is all sorted and works like a charm.

You know how we dont have usb flashback on our p8b** boards?
well maybe this code which contains the ami uefi signing keys/system could help.
EDIT by Fernando: Thepiratebay link removed
what do you think guys?
or could you help me do one of those hardware programmers things?

@ lgrootnoob:
Welcome at Win-RAID Forum!
<blockquote><font size=“1”>Zitat von <a class=“nopad” href=“u1565_lgrootnoob.html” style=“color:”>lgrootnoob</a> im Beitrag <a class=“nopad” href=“t154f16-Tool-quot-UEFI-BIOS-Updater-quot-UBU-58.html#msg8106”>#878</a>


You know how we dont have usb flashback on our p8b** boards?
well maybe this code which contains the ami uefi signing keys/system could help.[/quote]Since we do not want to offer illegal software, I have removed your link to “ThePirateBay”.
<blockquote><font size=“1”>Zitat
or could you help me do one of those hardware programmers things?[/quote]You can find [Guide] Flashing modified AMI Aptio UEFI using AFU a guide how to get a modded AMI UEFI BIOS successfully flashed into the BIOS chip of ASUS mainboards without the USB FlashBack feature.

Regards
Fernando

Thank you for the link, i will try it tonight.
Sorry for the link, i didnt realize that wasnt allowed here.
I wont do it again.

i tried it out.
afudos on the p8b75mcsm and it didnt work.
when i flash with /gan and reboot it turns on, then off and does normal post. then i pull the bios and sue ubu to see if the modules are updated. and no, its the same modules but the md5sum is different from the original rom.
p b k doesnt flash cause it cant get secure flash perms or whatever.
i even removed the .cap header with uefitool.
and winsce64 crashes when i try to flash the nvram
I have a raspberry pi so im gonna try spi.
is this the spi header? https://imgur.com/A5og80Nthe gold dots?

Ty for the post this works to for flash whit external programers because the rom whit the header exceed the size of the serial flash chip and programers like ezp2010 say file to large.

I am sorry, that you didnt get any answer.
Maybe it would have been better to post your question into >this< thread. Pacman is our Raspberry P1 expert.

@ Darkdead:
Welcome at Win-RAID Forum!

Has your post been an answer to lgrootnoob’s question?

Regards
Dieter (alias Fernando)

I found out that with MMTool v5 I can now finally update the microcode on my ASRock X99 OC Formula. The problem is that when I try to go flash it in the BIOS it tells me about the secure flash failed message. Using the latest version of UEFITool 0.19.6 doesn’t help because it doesn’t give the option to “extract body” of the image file. The only option I have is “extract as is”.

@ SimpleTech:

Alternatively you can remove the image header of the BIOS by using a Hex Editor.
As far as I could see the real BIOS starts at offset 200000.

Tried that and it doesn’t work. It’s trimming the BIOS file from 16.0 MB to 14.0 MB and the ASRock Instant Flash Utility in the UEFI doesn’t read it.

@ SimpleTech:

Maybe ASRock has changed their BIOS protection against any modification.
You should ask CodeRush or lordkag for a solution.