How to recompile my bios? (ASROCK Z390)

Sorry for this post, but I could not find any guide showing this, though I know it must be here.

I used https://github.com/LongSoft/Universal-IFR-Extractor to extract the body from the p32 image module and can make my simple changes, but I can’t for the life of me figure out how to recompile, so that I can flash.

A want to change a couple of max values for varname 0x598 and 0x59F

For flashing, I can see that “Intel CSME System Tools v12 r17 - (2019-08-04)” is recommended in this post: Intel Management Engine: Drivers, Firmware & System Tools

Guidance would be appreciated!

@kavalan - UEFITool should be used to extract your setup PE32 body, then from that get your IFR file to use to modify via hex, then replace PE32 body via UEFITool once you are done with your edits

Do not flash BIOS with FPT unless you have first dumped BIOS region via FPT, then edit that, then reflash it with FPT. Do not flash stock BIOS, or edit and flash stock BIOS, in any way with FPT

I’m not sure what you are editing here, since you have not linked or specified the exact model, but normally a “max” allowed amount is not something you can easily edit in this way.

Thanks for the reply and the advice about FPT.

For modifying the IFR, are you saying I must make the changes to the extracted .efi binary?

What I am trying to do is not related to raid, but help is always appreciated, so here are the details.

I am trying to allow a higher Short and Long Power Limit. My bios is limited to 130/140 but for overclocking I need to set this higher. I currently do this with the intel tool in windows, but I do not use Windows as my primary OS.

Here are the relevant parts from the extracted IFR. You are saying it is not possible to change these max values?

0x377E5 QuestionId: 0xE94 equals value 0x1 {12 06 94 0E 01 00}
0x377EB Numeric: e{a1#Long Duration Power Limit, VarStoreInfo (VarOffset/VarName): 0x598, VarStore: 0x1, QuestionId: 0x1D, Size: 4, Min: 0x0, Max 0x82, Step: 0x1 {07 9A 2E 1B 2F 1B 1D 00 01 00 98 05 10 12 00 00 00 00 82 00 00 00 01 00 00 00}
0x37805 Default: DefaultId: 0x0, Value (32 bit): 0x0 {5B 09 00 00 02 00 00 00 00}
0x3780E Default: DefaultId: 0x1, Value (32 bit): 0x0 {5B 09 01 00 02 00 00 00 00}
0x37817 End {29 02}

and

0x378DB Numeric: e{a1#Short Duration Power Limit, VarStoreInfo (VarOffset/VarName): 0x59F, VarStore: 0x1, QuestionId: 0x1F, Size: 4, Min: 0x0, Max 0x8C, Step: 0x1 {07 9A 32 1B 33 1B 1F 00 01 00 9F 05 10 12 00 00 00 00 8C 00 00 00 01 00 00 00}
0x378F5 Default: DefaultId: 0x0, Value (32 bit): 0x0 {5B 09 00 00 02 00 00 00 00}
0x378FE Default: DefaultId: 0x1, Value (32 bit): 0x0 {5B 09 01 00 02 00 00 00 00}
0x37907 End {29 02}

You’re welcome. yes, if you are wanting to modify BIOS, you must extract the setup PE32 body, get your IFR so you know what values are used for each setting, then use that info to modify the PE32 body (yes, the extracted binary is what you edit) - that is how a mod is done.

I didn’t mention RAID???

I still cannot properly advise you on changing these things, you have not given a link to your BIOS or the exact motherboard model, so I cannot check myself. The above is not complete, so I can’t even advise on that, at least not for sure.
Also, this may not be the only place you need to edit, not all BIOS rely on setup module to control these functions. You’ll have to see what happens post-edit on setup, then if no change you’ll need to edit other modules (or make this visible in your BIOS)

The above, in general, “may” be changeable directly in setup, I’m not certain without having the BIOS to look at myself. If you want to change those and see what happens, you need to edit the setup PE32 module
For first one, extract setup module PE32 body. Then find this string in hex editor and change the 82 to whatever you want in hex (82 = 130 in hex) >> 07 9A 2E 1B 2F 1B 1D 00 01 00 98 05 10 12 00 00 00 00 82 00 00 00 01 00 00 00
Same for second setting (8C = 140 in hex) >> 07 9A 32 1B 33 1B 1F 00 01 00 9F 05 10 12 00 00 00 00 8C 00 00 00 01 00 00 00
Then replace Setup PE32 body with your edited version.

Here’s hex values for decimal if you are not sure.
http://online.sfsu.edu/chrism/hexval.html

Sorry, not used to people being so helpful.

I am wary of messing this up.

This is the motherboard: https://www.asrock.com/MB/Intel/Z390M-ITXac/index.asp#Manual

I am using bios version 4.1

I haven’t had a chance to dump and look through the binary for hex values.

Project for tomorrow.

* Edit - Hello again. So I dumped the bios with fpt in efi shell. Made the modifications and replaced the body with UEFITOOL 0.26.0

I then flashed again with fpt.efi -bios -f bios.bin which went smoothly.

And… my system is not bricked! yay.

However, the limit remains in the bios as it says “Invalid input” when trying to input 150

Any advice how to get around this? Thanks

@kavalan - thanks for system BIOS link finally If you are wary of messing up, you should ask someone to do for you. This setting may be controlled by several modules in the BIOS (NVRAM in 2-3 locations + several-MANY times in a few of those, Setup Module, AMITSE/SetupData Module)
Also, in setup module alone, now that I can check, for each of those you mention above there is 3x instances (each with different Hex string ID’s) that need/should be changed.
Did you notice that in your IFR? If you didn’t notice that, then it still may only be the setup module that needs edited, you’ll have to test more to find out.

Please upload both your original FPT dump (So I can edit for you), and your edited one, so I can check your edit and tell you if it’s OK or not. And, please let me know what value you want each set to

On your final comment about your BIOS test, before you edited the BIOS, did it also tell you invalid input when you tried to set 150? Also, does it actually say “Invalid Input” or does it say “Please enter a value within 0-1xx”?

And now that I can look at BIOS, back to my original comment, this may be one of the things you can’t easily change (similar to some “Max Voltage” limits)
I’ve made a test edit on setup module, editing all 6 instances to 150, looks OK/Valid in AMIBCP, but that’s not a sure sign it will work on booted BIOS.

I guess I’ll cross the NVRAM possibility if this doesn’t work out…

Here are the dumped and edited bios. I only edited the two instances that you pointed me to.
https://transfer.sh/sVMM4/dumped.bin
https://transfer.sh/Wn5WR/edited.bin

The setting behaviour has not changed between flashing my modified bios. When setting a high number it says invalid input and fills in the highest allowed i.e. 130/140

I would like to set the max limit to 250, if possible.

@kavalan - I checked NVRAM, and the AMITSE/SetupData module, those only contain a “Set” value, if it was set to something specific, in this case it is not and those modules do not store the min/max values.

I didn’t notice the multiple instances until you finally linked me to your board/BIOS, so I could look at the IFR myself, as soon as I search for those two items I see three of each (some in hidden or debug areas)
I’d need to see images of your BIOS to know which is the exact one you can currently see, so in place of that we just edit all 3 for each. I checked your edit, looks good for those two instances you gave me above (all in spoiler below)

Numeric: e{a1#Long Duration Power Limit, VarStoreInfo (VarOffset/VarName): 0x598, VarStore: 0x1, QuestionId: 0x1D, Size: 4, Min: 0x0, Max 0x82, Step: 0x1 {07 9A 2E 1B 2F 1B 1D 00 01 00 98 05 10 12 00 00 00 00 82 00 00 00 01 00 00 00}
0x37809 Default: DefaultId: 0x0, Value (32 bit): 0x0 {5B 09 00 00 02 00 00 00 00}
0x37812 Default: DefaultId: 0x1, Value (32 bit): 0x0 {5B 09 01 00 02 00 00 00 00}

Numeric: e{a1#Long Duration Power Limit, VarStoreInfo (VarOffset/VarName): 0x598, VarStore: 0x1, QuestionId: 0x20D, Size: 4, Min: 0x0, Max 0x82, Step: 0x1 {07 9A 2E 1B 2F 1B 0D 02 01 00 98 05 10 12 00 00 00 00 82 00 00 00 01 00 00 00}
0x3E641 Default: DefaultId: 0x0, Value (32 bit): 0x0 {5B 09 00 00 02 00 00 00 00}
0x3E64A Default: DefaultId: 0x1, Value (32 bit): 0x0 {5B 09 01 00 02 00 00 00 00}

Numeric: e{a1#Long Duration Power Limit, VarStoreInfo (VarOffset/VarName): 0x598, VarStore: 0x1, QuestionId: 0x4C0, Size: 4, Min: 0x0, Max 0x82, Step: 0x1 {07 9A 2E 1B 2F 1B C0 04 01 00 98 05 10 12 00 00 00 00 82 00 00 00 01 00 00 00}
0x4773D Default: DefaultId: 0x0, Value (32 bit): 0x0 {5B 09 00 00 02 00 00 00 00}
0x47746 Default: DefaultId: 0x1, Value (32 bit): 0x0 {5B 09 01 00 02 00 00 00 00}

------------------------------

Numeric: e{a1#Short Duration Power Limit, VarStoreInfo (VarOffset/VarName): 0x59F, VarStore: 0x1, QuestionId: 0x1F, Size: 4, Min: 0x0, Max 0x8C, Step: 0x1 {07 9A 32 1B 33 1B 1F 00 01 00 9F 05 10 12 00 00 00 00 8C 00 00 00 01 00 00 00}
0x378F9 Default: DefaultId: 0x0, Value (32 bit): 0x0 {5B 09 00 00 02 00 00 00 00}
0x37902 Default: DefaultId: 0x1, Value (32 bit): 0x0 {5B 09 01 00 02 00 00 00 00}

Numeric: e{a1#Short Duration Power Limit, VarStoreInfo (VarOffset/VarName): 0x59F, VarStore: 0x1, QuestionId: 0x210, Size: 4, Min: 0x0, Max 0x8C, Step: 0x1 {07 9A 32 1B 33 1B 10 02 01 00 9F 05 10 12 00 00 00 00 8C 00 00 00 01 00 00 00}
0x3E784 Default: DefaultId: 0x0, Value (32 bit): 0x0 {5B 09 00 00 02 00 00 00 00}
0x3E78D Default: DefaultId: 0x1, Value (32 bit): 0x0 {5B 09 01 00 02 00 00 00 00}

Numeric: e{a1#Short Duration Power Limit, VarStoreInfo (VarOffset/VarName): 0x59F, VarStore: 0x1, QuestionId: 0x4C2, Size: 4, Min: 0x0, Max 0x8C, Step: 0x1 {07 9A 32 1B 33 1B C2 04 01 00 9F 05 10 12 00 00 00 00 8C 00 00 00 01 00 00 00}
0x4782D Default: DefaultId: 0x0, Value (32 bit): 0x0 {5B 09 00 00 02 00 00 00 00}
0x47836 Default: DefaultId: 0x1, Value (32 bit): 0x0 {5B 09 01 00 02 00 00 00 00}


Here, since I already had this module edited for my own testing, please test and see if you can set 150 now or not, if yes, I will redo for you with 250 instead of 150
http://s000.tinyupload.com/index.php?fil…683037887650255

Flash via >> FPTw.exe -bios -f dumpedm.bin
Or put on with programmer if that’s what you’ve been using, up to you.
If you hav2e programmer, you should unlock FD, then you can write all regions with FPT instead of just BIOS region

Just flashed your file and indeed it does allow setting to 150. awesome.

If you could do the same for 250, I would be very grateful. Thanks!

Sweet! Yes, will do!
Did you confirm it’s actually applying too, in windows where you used to have to change it?

I’ll edit the 250 one into this post, give me a second
* Edit @kavalan - 250 >> http://s000.tinyupload.com/index.php?fil…516622240094780

Works exactly as expected. Confirmed before and after tests show that power limit throttling is no longer a concern.

I am sure that I could not have done it without your assistance, or I would have screwed it up. Cheers!

@kavalan - thanks for confirmation! You would have figured it out, you were more than halfway there already by yourself

Hey sorry to dig up such an old post, I was trying to update the bios of an ASROCK Z390 pro4 from 4.5 to 4.7 and it said the update was complete and it went into a restart loop. I used a CH341A programmer and used a BIOS from ASROCK. After further reading, I should have had a BIOS dump on hand. So I was wondering if anyone had a BIOS dump that they cod send to me or upload or something. I haven’t tried to build a computer in 20 years and am fumbling my way through.
Thanks
Brent

Unclear what you did, unclear what you mean. Asrock has a complete firmware image, should work/ start, but you loose machine specific data.

So why didn’t you dump your own firmware before overwriting it? And why do you want a foreign dump now?

I didn’t do a firmware dump before I wrote over it as I didn’t really know what I was doing as it was late. Where can I get the ASRock firmware from. Just trying different things to get it going again.

From Asrock, support page for the board, just as trivial as that. But you wrote you did use your programmer with a bios from asrock?

If you don’t want to explain more precisely what you did, which file you used and what the result was, we won’t be able to help you.

Hey, thanks, with what you said, i was on the right track. My motherboard came with the 4.50 BIOS installed and i tried to flash it and it wouldnt restart. I then used the CH341A with the one software, i cant remeber what it was and had the wrong type of chip selected and it changed it into that chip. I then loaded the ASROCK 4.50 BIOS into NEOProgrammer 2.2.0.3 and deleted the chip and selected all the things, unhooked the CH314A and Viola, it all works again.
I just wasnt sure if i needed to use just the downloadable BIOS upgrade off ASROCK or i needed a BIOS dump that may have more info or something like that. I have to reflash the MAC address now i think and it shoul all be okay.