[GUIDE] AMI INTEL CPU Microcode Update Guide

[**********. Caution: Possible outdated content ********** ]

[GUIDE] AMI INTEL CPU Microcode Update Guide

Edit: Use this guide with caution and possibly if you have flashback feature or usb rom programmer available just in case. If possible try using MMTool ‘CPU-Patch’ feature instead as it is a whole lot easier. For now as of 1/31/2021 have discovered issues that require further investigation with the advanced method. Use only as last option when all others fail.

I am writing this guide to help others save time and grief when UBU Tool fails to update your cpu microcodes. I found that this information was hard to find and not explained well enough so here are the facts as I know them. This is an advanced mod for intermediate or better users at best.

Tools your going to need:


UEFITool A57 [or A-XX latest release], UEFITool 0.28
UbuTool (Current stable version)

HxD Editor


Note: There was an issue with UefiTool 0.22.1 and advised to use latest release instead.



Step 1 - Load your bios file in UEFITool A57 and select the ‘FIT’ tab:

Load your bios file in UEFITool A57 and select the ‘FIT’ tab on the lower panel. Take note that there will be a number of entries with the first one being a reference to ‘FIT’ table. Then you have a number of references to the location of the actual microcode entries followed by possibly Bios initialization and ACM modules, Bootgaurd modules, and TPM/TXT modules of which may or may not be present depending on the bios.

This is what it will look like:



Select the first microcode entry in the FIT table by doubling clicking item #2 as illustrated above and you will note that UEFITool A40 will automatically finds the actual master microcode file for us to manipulate. In my case my master microcode file resides in the rom module with GUID ‘17088572-377F-44EF-8F4E-B09FFF46A070’.

Sometimes you may find each microcode in their own individual rom module:



In the case of individual microcode rom modules its a lot easier to manage in that probably you won’t need to copy paste the microcode hex values in a hex editor. Just ‘Replace Body’ in UefiTool will be sufficient.


Step 2 - Extract Body of master microcode module and save:

Right click GUID ‘17088572-377F-44EF-8F4E-B09FFF46A070’ and ‘Extract Body’:




Go to the CPU Microcode repository and locate the cpu microcode modules that are appropriate for your platform. Even though my FIT table detailed four modules you really need to update just the one for your particular cpu. The other microcodes I believe are for other generation + server based processors which for most of us not needed.

If you can find your actual existing microcode file inside Ubu module folder, or from an extracted Intel Linux release open it up inside Hxd Edit for the purpose of searching for the start location inside the master microcode file. This is not absolutely necessary but by copying the first 16 bytes of the old header and searching for it you can find where it exists in the master file.

However in most cases it is easier just to use the location data in the FIT table to locate each microcode file but you need to know the size in hex of the old microcode file (listed in the hex table inside UefiTool) and the size of the new file using Hxd edit.


Step 3 - Edit master Microcode rom file in HxD Edit:


Load your master microcode file into a hex editor. Also load in HxD the new microcode update revision you downloaded from the repository and copy all of its content into memory. Its important to take note of their sizes by scrolling to the end of the file in Hxd edit. Your going to need to know the difference in size between the old and new later.

You can find the size of every microcode listed in UefiTool’s FIT table as shown above. In the case of 406F1 UefiTool is telling me that it is 6400KB large. This value is important for the next step in HxD Edit. First you need to know which microcode you need to replace. I usually use HwInfo to dig up those details. My 6850K used 406F1. So lets take a look at the header. In my case I want to replace 406F1 Platform EF revision 1D. If you load up that MC in HxD Edit we see those details in the first two rows of the header.

So goto the start of your particular MC you want to replace, and press Ctrl-E:



You have to copy-paste and insert the new microcode data onto the old data by selecting ‘Paste Insert’ in HxD Edit. This can also be done by searching for the old header using a few bytes of the old MC to search for and replace according to the length of the file. Hx Edit will tell you if and when it will change file size where it is appropriate. In my case this increased the size by 400 hex bytes. Save file.




VERY IMPORTANT TO REMOVE EMPTY ‘FF’ VALUES CORRESPONDING TO SIZE DISCREPANCY OR ADD ‘FF’ VALUES TO MATCH ORIGINAL MICROCODE MASTER BIOS FILE SIZE

In some cases it is necessary to keep the size of your old main microcode master file the same as before especially if there are other BootGuard and other modules following your microcode file inside the firmware volume. This is easily accomplished by adjusting the amount of ‘FF’ bytes at the end of the file. If that is not possible then your going to have to adjust the FIT table’s reference to those other modules at the end by taking note by how much they have been offset. Note: On my bios files I did not need to do this but I found someone that had extra modules referenced in their FIT Table and apparently changing the master MC file size alters those location addresses.



Step 4 - Update Microcode Rom file using UefiTool:
DO NOT DO THIS ON THE MASTER BIOS FILE AS IT WILL CHANGE FILE SIZES AND CORRUPT!! INSTEAD DO A MANUAL COPY PASTE IN HEX EDITOR OF MICROCODE DATA!!

Use latest UefiTool to replace body of that file back into your bios file and save. For some reason UefiTool A40 refused to replace the body of that file. Not sure why.


Step 5 - Make corrections to the FIT table:


Now it is necessary to correct the actual fit table. There are two ways to accomplish this step. The easiest is just to open the whole bios file in a hex edit and search for the FIT table however you can also extract the actual FIT table as a whole but lets keep it simple. So after the file has been saved open the master bios file in a hex editor and search for ‘FIT’ :



You will see the addresses for each cpu microcode file under the FIT descriptor. The address will be in little endian detailed back wards for each byte. Those should be the same addresses detailed in UefiTool A40 FIT Table you saw earlier. Recommend you verify the old and new address in Hxd Edit. Make your changes and correct the start address for each file. I used Windows calculator in programmer hex mode.

For example if my first file was 6400 bytes and the new one 6800 bytes you need to add the 400 byte differential to each following address assuming the others stayed the same. In this case you only alter the 2nd, 3rd and 4th values. Important to note that in Hxd Edit you can get the file size by scrolling to end of the file and taking note of the offset. In my case the end offset was 67FF which means its a 6800 byte file. Got to know how to count in hex to do this right.

For extra points if your adding an extra microcode update file it is also important to correct the FIT header to reflect how many microcode entries are present. As such I have found that the 9th byte (or byte #08) counting from start of the ‘FIT’ header line stores the number of entries. The example above is showing ‘1A’ entries though if you only have 5 microcodes it should be set at ‘06’ assuming there are no other Bootguard or other ACM type modules references in FIT. In my case the ‘1A’ covers more than enough microcode and Boot + Initialization type modules.




Step 6 - ADVANCED SECTION:

FOLLOWING SECTION FOR ADVANCED USERS AND NOT ADVISED FOR GENERAL MODDING AS COULD BRICK YOUR BOARD


Sometimes changing the size of the microcode file could have an impact on the the location of anything else that follows it in the rom volume such as PEI programs that could get shifted down if your not careful. This is an extremely rare possibility but better safe than sorry. Most of the time the Microcode master file is the last one in the volume and it is not a concern but this is how you check for this possibility.

It has been advised that it is safer to relocate your microcode module to either the very last space in the firmware volume, or the very first module in the ‘DXE’ section of your firmware volume such that any other future modifications will not affect the location of your microcodes. They should be in a fixed location.

Load your Rom file in UefiTool A40 and look for the module named ‘PeiCore’ and expand it open to reveal the ‘TE Image Section’ or the ‘Pe32 Image Section’ and once you have selected take note of all the base offset addresses on the right hand side.

Look for the ‘Address of Entry Point’ and ‘Image Base Address’:




Also open your main rom file inside HxD Edit and scroll to the very end:



The first address at FFFFC0 points to the FIT table and is only important if you changed the location of the FIT table. The Second address at the end at FFFFE0 points to the PeiCore Entry Point and as detailed equals the address of the Entry point in UefiTool A40
plus the Image Base Address as shown above.

I would check those addresses before and after your modifications are made. For the most part its really not going to impact the microcode mod except in very rare circumstances.


Anyhow after that save your bios file and scrub it through UBUTool to make sure you did it right and even try to load it in MMTool to make sure its not corrupt. Then save to usb disk and cross your fingers and flash!

If there are other details I am not aware of or mistakes I ask the community to help fine tune this guide.

Thank you.

@davidm71 :
Thank you very much for having taken the time writing this important guide, which was missing here until now.
This will help many users, who are interested in optimizing the function of their CPU.
You have done a good job!

Thank you Fernando but I am sure it needs more work as I am only an intermediate and there are others out there with more knowledge that I hope will contribute to making it better.

Hey guys, I just want to update the X99-UD4 Rev1.1 F23 bios with latest CPU Microcodes, but UBU can’t as the message listed! Please need help because my CPU SE version doesn’t work with this current bios version. Here’s the bios link from GIGABYTE: GA-X99-UD4.F23 (Rev1.1) Thank’s

@ammoune78 :
Welcome to the Win-RAID Forum!

Since this already existing thread seems to match the topic of your request, I have moved your post here and hope, that you will get support by davidm71, the author of the CPU Microcode Update Guide (= start post).

Good luck!
Dieter (alias Fernando)

I’m very proud and happy here, you do a very nice help for community Fernando! Thanks a lot!

davidm71 is a friend, and i came here to disturb it hahahhh, i will have a nice support with him, thanks davidm71

Yo Ammoune fellow Oz enthusiast! Hows it going?! About modding your microcodes just follow my guide. Important to copy-paste over new MC’s over old MC’s on the extracted file. Just don’t do it on the main bios file or youll have problems. If anything is different please make your notes here. Good luck man!

Edit: @ammoune78 What kind of cpu??

Hey, good feeling!

The CPU I’m trying to use is an Engineering Sample Ebay , It makes the board unstable when installed on ASUS X99-A and keep rebooting the GA-X99-UD4!

I followed all the steps from the beginning until the last step when trying to make same file size, I also didn’t understood the meaning of the main BIOS, what I’m doing is just working on a F23 version 1.1 downloaded from GIGABYTE BOARD Support download page! Putting the resulted file in a UBU generated or the downloaded one without keeping the same original size, when flashing Corrupted BIOS file image.

I also have seen that the BIOS Image loose it’s security, and the image can be modified without any message like: Aptio Image Signature may become invalid after ANY modifications in GIGABYTE BIOS.

Or can you make it for me, thought that it is simple for you, as I don’t know how to adjust the file size to fit the original.

sorry for the translation



Hello
I saw on the motherboard Gigabyte Z370 the cpu 6700K and 7700K code,
mb_bios_z370-aorus ultra-gaming_f5
CPUID Revision: 000506E3h 6700K
CPUID Revision: 000906E9h 7700K
Why insert codes that are not supposedly compatible with the Z370 chip?
I inserted the CPUID 8700K 000906EAh CPUID code of the processor 8700K in the bios of my motherboard Z170 gaming 3 EU the processor does not appear in the profiles,
In my table FIT I have
CPUID Revision: 000506E3h 6700K
CPUID Revision: 000906E9h 7700K
CPUID Revision: 000906EAh 8700K
would you be able to help me



Cdt,


Bonjour

J’ai vu sur la carte mère Gigabyte Z370 le code cpu 6700K et 7700K,
mb_bios_z370-aorus-ultra-gaming_f5
CPUID Revision : 000506E3h 6700K
CPUID Revision : 000906E9h 7700K

Pourquoi insérer des codes qui ne sont soit disant pas compatibles avec le chip Z370 ?


J’ai insére le CPUID 8700K 000906EAh le code CPUID du processeur 8700K dans le bios de ma carte mère Z170 gaming 3 EU le processeur apparaît pas dans les profils,

Dans ma table FIT J’ai bien

CPUID Revision : 000506E3h 6700K
CPUID Revision : 000906E9h 7700K
CPUID Revision : 000906EAh 8700K






vous serait-il possible de m’aider

I tried doing this today, but had to give up in the end. I have an MSI X99 board too and was able to mod my older bioses thanks to your tutorials. This, however, get’s even more into the hex editing which is arguably not a strong suit of mine and where I sometimes simply don’t know what you mean.
Maybe I’m just lacking some in-depth comp sci knowledge since I did have to look up “endian”. “Got to know how to count in hex to do this right.” - Game over for me, unfortunately.

In any case, this tutorial is a lot of hard work which I’m sure everyone can appreciate.

Hi
@Hominel try this is z170xg3 lastest fw updated by z370 aorus lastest fw with coffelake new microcode mei rst and gop.
its possible run sky or kaby in z370 main and viceversa?
in asus z370 bioses also is present sky and kaby microcode and difference on pin is very slighty

Z170XG3.zip (5.5 MB)

23172726_701052093437813_3499654988783655730_n.jpg

Salut

c’est quoi ce BIOS la table CPU FIT

Est vide.
Cordialement

@Hominel :

https://downloadmirror.intel.com/18931/e…B%20Handout.pdf

Section 2.5 :

https://www.csee.umbc.edu/portal/help/ar…re/24535901.pdf


FIT explanation

I have a question on this FIT extracted from bios. In the second line is the first microcode and in the fifth line the fourth microcode. In the next line are adresses for BIOS ACM, then BootGuard Key Manifest and in the last line is BootGuard Boot Policy.
The first and second microcode will increase by 400h (2048 bytes).
So I add 400h to the third line and 800h to the fourth and fifth line address.
Currently it is not possibe to replace the complete microcode module which is 800h bigger due to following error message: reconstructVolume: no space left to insert non-UEFI data, need 10h (16) byte(s) more.
Can I delete the third and fourth microcode from the microcode file which are never used and then set the lines four (third microcode) and five (fourth microcode) of the FIT to 00s to get space in the complete bios file?

Original:
5F 46 49 54 5F 20 20 20 08 00 00 00 00 01 00 00
90 00 DD FF 00 00 00 00 00 00 00 00 00 01 01 00
90 80 DE FF 00 00 00 00 00 00 00 00 00 01 01 00
90 00 E0 FF 00 00 00 00 00 00 00 00 00 01 01 00
90 50 E1 FF 00 00 00 00 00 00 00 00 00 01 01 00
00 00 F8 FF 00 00 00 00 00 00 00 00 00 01 02 00
80 91 F8 FF 00 00 00 00 41 02 00 00 00 01 0B 00
00 81 F8 FF 00 00 00 00 DF 02 00 00 00 01 0C 00

Mod:
5F 46 49 54 5F 20 20 20 08 00 00 00 00 01 00 00
90 00 DD FF 00 00 00 00 00 00 00 00 00 01 01 00
90 84 DE FF 00 00 00 00 00 00 00 00 00 01 01 00
90 08 E0 FF 00 00 00 00 00 00 00 00 00 01 01 00
90 58 E1 FF 00 00 00 00 00 00 00 00 00 01 01 00
00 00 F8 FF 00 00 00 00 00 00 00 00 00 01 02 00
80 91 F8 FF 00 00 00 00 41 02 00 00 00 01 0B 00
00 81 F8 FF 00 00 00 00 DF 02 00 00 00 01 0C 00

Thanks for help.



If the new MC is 400 hex bytes larger you add 400 + DD0090 - and make the correction and do the same for the next three lines containing microcode address locations.

As far as running out of space did you first extract the microcode file using ubutool? and then try to reinsert into the bios?

Replacement of microcode is not possible due to 16 bytes are required without deletion of the third or fourh microcode. When deleted it is possible.
Then I removed in FIT the line for the third and fourth microcode and put up the three addresses below on these position and set to FF the two last lines of this FIT but UEFITool A45 does not recognize the FIT afterwards.

FIT is then:
5F 46 49 54 5F 20 20 20 06 00 00 00 00 01 00 00
90 00 DD FF 00 00 00 00 00 00 00 00 00 01 01 00
90 84 DE FF 00 00 00 00 00 00 00 00 00 01 01 00
00 00 F8 FF 00 00 00 00 00 00 00 00 00 01 02 00
80 91 F8 FF 00 00 00 00 41 02 00 00 00 01 0B 00
00 81 F8 FF 00 00 00 00 DF 02 00 00 00 01 0C 00
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF



What bios file and what microcode your trying to update?

The attached bios with the attached microcode. Change the file ending to 7z for extraction of both. Even in first line was changed to 5F 46 49 54 5F 20 20 20 06 00 00 00 00 01 00 00 now due to two lines less.

MOD_E16JBIMS.doc (4.06 MB)



Try this out for size. Recommend you open it up in UEFITool version A40 to see that the FIT Table is correct and scrub it with UBU if you want…

MOD_E16JBIMS.doc (3.96 MB)