Page 1 of 30
#1 [GUIDE] AMI INTEL CPU Microcode Update Guide by davidm71 14.10.2017 19:11

avatar

[**********. 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.

#2 RE: [GUIDE] AMI CPU Microcode Update Guide by Fernando 14.10.2017 21:37

avatar

@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!

#3 RE: [GUIDE] AMI CPU Microcode Update Guide by davidm71 14.10.2017 22:08

avatar

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.

#4 Need help to update CPUMicrocodes for my GA-X99-UD4.F23 (Rev1.1) by ammoune78 16.10.2017 11:11

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

#5 RE: Need help to update CPUMicrocodes for my GA-X99-UD4.F23 (Rev1.1) by Fernando 16.10.2017 14:21

avatar

@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)

#6 RE: Need help to update CPUMicrocodes for my GA-X99-UD4.F23 (Rev1.1) by ammoune78 16.10.2017 22:51

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

#7 RE: Need help to update CPUMicrocodes for my GA-X99-UD4.F23 (Rev1.1) by davidm71 17.10.2017 00:59

avatar

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??

#8 RE: Need help to update CPUMicrocodes for my GA-X99-UD4.F23 (Rev1.1) by ammoune78 17.10.2017 02:14

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.

#9 RE: Need help to update CPUMicrocodes for my GA-X99-UD4.F23 (Rev1.1) by ammoune78 17.10.2017 19:26

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.

#10 RE: Need help to update CPUMicrocodes for my GA-X99-UD4.F23 (Rev1.1) by Hominel 29.10.2017 09:36

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

#11 RE: Need help to update CPUMicrocodes for my GA-X99-UD4.F23 (Rev1.1) by Horstfuchs 08.11.2017 21:57

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.

#12 RE: Need help to update CPUMicrocodes for my GA-X99-UD4.F23 (Rev1.1) by Tk23 09.11.2017 19:58

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

#13 RE: Need help to update CPUMicrocodes for my GA-X99-UD4.F23 (Rev1.1) by Hominel 13.11.2017 14:51

Salut

c'est quoi ce BIOS la table CPU _FIT_

Est vide.
Cordialement

#14 RE: Need help to update CPUMicrocodes for my GA-X99-UD4.F23 (Rev1.1) by DoZe 14.11.2017 01:58

@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

#15 RE: Need help to update CPUMicrocodes for my GA-X99-UD4.F23 (Rev1.1) by Maison1 19.12.2017 23:46

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.

Xobor Forum Software von Xobor
Datenschutz