Jump to content
CodeRush

[UEFIPatch] UEFI patching utility

1,987 posts in this topic

Recommended Posts

Advertisement

Hi CodeRush, i am currently installing a dedicated ML partition to verify if the issue is reproductible or not.

I will test the new compiled version and report as soon as possible.

And thanks a lot for the modified BIOS, much appreciated :)

Share this post


Link to post
Share on other sites

Hi thanks for your work,

 

No sucess with the uefi from the Asrock H61M-S v 1.50

 

eurisko$ ./PMPatch H61MS1.50 MODH61MS1.50
PMPatch 0.5.10 PowerManagement modules not found.
Trying to apply patch #1 Nested PowerManagement module at 00A83594 patched.
Patched module too big after compression.
Trying to apply patch #2 Nested PowerManagement module at 00A83594 patched.
Patched module too big after compression.
Trying to apply patch #3 Nested PowerManagement module at 00A83594 patched.
Patched module too big after compression.
Trying to apply patch #4 Nested PowerManagement module at 00A83594 patched.
Patched module too big after compression.
Trying to apply patch #5 Nested PowerManagement module at 00A83594 patched.
Patched module too big after compression.
AMI nest module at 001A0048 not patched: Repacked module can't be inserted.
Phoenix nest modules not found.
CpuPei module at 0039F240 not patched: Patch pattern not found.

 

Thanks!

Share this post


Link to post
Share on other sites

eurisko, thanks for report, will look at it after 5. Feb.

Asrock are using LZMA to compress BIOS modules, and I think a small tweak of compression parameters may help.

Another option is to eliminate some dead code (if any) with NOPs to earn some space.

Please wait a bit, I don't have time for programming now.

Share this post


Link to post
Share on other sites

Noob question: does this mean a successfull patch?

 

 

PMPatch 0.5.10

PowerManagement module at 00459ECC patched.

AMI nest modules not found.

Phoenix nest modules not found.

CpuPei module at 001FBB6C not patched: Patch pattern not found.

Output file generated.

 

If yes, then Intel® Desktop Board DH77DF bios version 0107 patched.

Please confirm that.

 

Great job!

Share this post


Link to post
Share on other sites

giacomoleopardo, it does, but the problem is with flashing that modified BIOS on Intel boards. BIOS modules on modern Intel boards are protected by RSA-based digital signature, so the modified BIOS will be refused to flash in almost all cases. There is actually a method to flash it, but it's risky. Read this topic from the beginning to know more, I've already explained it.

I don't have Intel board to test it myself, thats why I can't guarantee it works, but you can try it, if you wish.

Share this post


Link to post
Share on other sites

Anyone try this on ASUS laptops? I'm using this for my desktop (ASUS Maximus V Gene) without any issues, but there is Flashback intact in case of failures. I want to try this on my Zenbook (UX32VD-DB71). Any pointers?

 

 

Thanks again for all your hard work! (=

Share this post


Link to post
Share on other sites

There is little to no difference between AMI BIOSes on modern ASUS desktops and ASUS laptops, so I can't see why it won't work.

The main problem is again with flashing, because EZ Flash or BUpdater can refuse to flash a modified BIOS and I don't know how to bypass that protection, but there is a way to integrate a patch into BIOS without taking much risk:

1. Download Intel Flash Programming Tool compatible with your laptop. You can try FPT v8 (99% chance to work) from my FTK toolset.

2. If you are using FTK, go to Win32 or Win64 folder and run biosbkp.bat as Administrator using right-click menu.

3. I'm assuming you can boot to Windows on your laptop, if not - here is an image of DOS-bootable USB-Flash with FTK, that can be written with dd, named FTK_x.y.z_bin.zip.

4. Anyway, run Command Prompt as Administrator and cd to FTK/Win32 or FTK/Win64 folder.

5. Enter fpt -bios -d bck.bin command, if it ends with green "FPT Operation Passed" message - you have now a dump of your BIOS region.

6. Patch this dump file with PMPatch, producing bck.mod file. Copy that modified file to FTK/Win32 or FTK/Win64 folder.

7. Flash your modified dump back by executing fpt -bios -f bck.mod command. If it doesn't fails and green "FPT Operation Passed" message is present - you are done.

8. Reboot and see what happens. I can't guarantee anything, but there is only a little chance of fail, as I see it.

You can try it on your desktop board first to see it working.

I'm thinking about an automated solution for that, because it's easy to a write a batch file for doing all of that things in one seat. Will do it a bit later when I have more time for programming.

Share this post


Link to post
Share on other sites

EDIT:

I'm removing PMAP from public access because it's too dangerous and easy to brick your PC by using it. Sorry.

Share this post


Link to post
Share on other sites

PMPatch 0.5.10

PowerManagement module at 00302920 not patched: Patch pattern not found.

AMI nest modules not found.

Phoenix nest modules not found.

CpuPei module at 0057D5A8 not patched: Patch pattern not found.

 

Bios version 2.9

Share this post


Link to post
Share on other sites

PMPatch 0.5.10

PowerManagement module at 00302920 not patched: Patch pattern not found.

AMI nest modules not found.

Phoenix nest modules not found.

CpuPei module at 0057D5A8 not patched: Patch pattern not found.

 

Bios version 2.9

Looks like already patched BIOS.

Is it definitely incompatible with original kext? If so, we need to find new patch pattern to perform. Thank you for report.

Share this post


Link to post
Share on other sites

HI i tryed to batch my sabertooth x79 bios

what i did was down load latest bios to usb and patched in terminal and renamed to bois file after patching

the bios loaded ok put i couldnt boot up after removing null cpu management kext

i had to reload the kext file and i could boot up

but my overclock was unstable so i replaced with standard bios

i hope the info helps with your development

Share this post


Link to post
Share on other sites

I have seen some issues with x79 boards, but I really don't know why OC can become unstable after the patch.

Repacking BEOS and becoming issues from it is only a sign of weak BIOS programming, which is common for ASUS boards.

Thank you for report but I don't know how to fix that.

Share this post


Link to post
Share on other sites

Looks like already patched BIOS.

Is it definitely incompatible with original kext? If so, we need to find new patch pattern to perform. Thank you for report.

Yes I think its incompatible as I get a kernel panic if I dont use NullCPUPowerManagement.kext. Tried on bioses 2.10, 2.9 and beta 2.94 for my board in sig.

Share this post


Link to post
Share on other sites

Here is the result

I wrote a batch file and prepared a set of tools (now for Windows and Intel-based machines only) to make all things from my previous post automatically.

For anyone who has unpatched BIOS and want to test this automatic Dump->Patch->Flash solution - you are welcome.

It works on ASUS Maximus IV Gene-Z and it will not work on Intel boards, but I hope it will work on any non-Intel board, including laptop ones.

PowerManagement AutoPatcher aka PMAP v0.1 for Windows

Download it, unpack and run PMAP.bat as Administrator. Thank you in advance and please report your results here.

 

Not working on hp 4530s

PowerManagement Autopatcher v0.1
This program will dump your BIOS region,
patch it with PMPatch and flash the resulting file back to BIOS chip.
WARNING: BIOS flashing is dangerous and requires exclusive access to SPI chip.
Please disable any antivirus software,
virtualisation or sandboxing tools before running this batch file.
Press any key to continue if you are ready.
Press any key to continue . . .
Reading BIOS dump to dump.bin file.
Intel (R) Flash Programming Tool. Version: 8.1.10.1286
Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
Platform: Intel(R) HM65 Express Chipset
Reading HSFSTS register... Flash Descriptor: Valid
--- Flash Devices Found ---
MX25L3205D ID:0xC22016 Size: 4096KB (32768Kb)

- Reading Flash [0x400000] 2560KB of 2560KB - 100% complete.
Writing flash contents to file "dump.bin"...
Memory Dump Complete
FPT Operation Passed
Patching dump.bin with PMPatch
PMPatch 0.5.10
PowerManagement modules not found.
AMI nest modules not found.
Trying to apply patch #1
Nested PowerManagement2.efi module at 01689340 patched.
Phoenix nest module at 00030048 patched.
CpuPei modules not found.
Output file generated.
Flashing modified BIOS dump to BIOS chip
Intel (R) Flash Programming Tool. Version: 8.1.10.1286
Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
Platform: Intel(R) HM65 Express Chipset
Reading HSFSTS register... Flash Descriptor: Valid
--- Flash Devices Found ---
MX25L3205D ID:0xC22016 Size: 4096KB (32768Kb)

Error 280: Failed to disable write protection for the BIOS space!
Flashing modified BIOS failed. Please report in PMPatch topic on InsanelyMac.com
forum. Exiting.
Press any key to continue . . .

Share this post


Link to post
Share on other sites

@CodeRush,

 

 

osxfr33ks-Mac-Pro-2:G74sx osxfr33k$ ./PMPatch G74SxAS.203 G74SxAS.203_patch

PMPatch 0.5.10

PowerManagement modules not found.

Trying to apply patch #1

Nested PowerManagement module at 00F900AC patched.

AMI nest module at 000B7720 patched.

Phoenix nest modules not found.

CpuPei module at 0027C2C0 not patched: Patch pattern not found.

Output file generated.

 

 

I have an Asus Gamers Laptop G74SX that I have to use the speedstep patching from that thread. Did your patch work on this particular UEFI bios and will I be able to update the bios on the notebook?

 

Asus Laptops use Asus brand boards not Intel as far as I know. Of course they are intel chipsets.

 

 

EDITED:

 

I attached both the original files from Asus and patched file.

G74SxAS203.zip

G74SxAS.203_patch.zip

Share this post


Link to post
Share on other sites
Here is the result

 

Not working on hp 4530s

PowerManagement Autopatcher v0.1
This program will dump your BIOS region,
patch it with PMPatch and flash the resulting file back to BIOS chip.
WARNING: BIOS flashing is dangerous and requires exclusive access to SPI chip.
Please disable any antivirus software,
virtualisation or sandboxing tools before running this batch file.
Press any key to continue if you are ready.
Press any key to continue . . .
Reading BIOS dump to dump.bin file.
Intel (R) Flash Programming Tool. Version: 8.1.10.1286
Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
Platform: Intel(R) HM65 Express Chipset
Reading HSFSTS register... Flash Descriptor: Valid
--- Flash Devices Found ---
MX25L3205D ID:0xC22016 Size: 4096KB (32768Kb)

- Reading Flash [0x400000] 2560KB of 2560KB - 100% complete.
Writing flash contents to file "dump.bin"...
Memory Dump Complete
FPT Operation Passed
Patching dump.bin with PMPatch
PMPatch 0.5.10
PowerManagement modules not found.
AMI nest modules not found.
Trying to apply patch #1
Nested PowerManagement2.efi module at 01689340 patched.
Phoenix nest module at 00030048 patched.
CpuPei modules not found.
Output file generated.
Flashing modified BIOS dump to BIOS chip
Intel (R) Flash Programming Tool. Version: 8.1.10.1286
Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
Platform: Intel(R) HM65 Express Chipset
Reading HSFSTS register... Flash Descriptor: Valid
--- Flash Devices Found ---
MX25L3205D ID:0xC22016 Size: 4096KB (32768Kb)

Error 280: Failed to disable write protection for the BIOS space!
Flashing modified BIOS failed. Please report in PMPatch topic on InsanelyMac.com
forum. Exiting.
Press any key to continue . . .

Try booting tour laptop by holding down: win+left atrow+right arrow when you hit the power button.

Share this post


Link to post
Share on other sites

Yes I think its incompatible as I get a kernel panic if I dont use NullCPUPowerManagement.kext. Tried on bioses 2.10, 2.9 and beta 2.94 for my board in sig.

Will look at it then. X79 boards are hard to patch, and I don't know if they can be patched at all, but not trying is not an option.

 

I tested the latest windows version on a MSI GT60 Laptop with the latest bios version. The result is in the picture (attechment)

Thanks for report, there is an example of normal PMAP log with all things gone right.

 

Not working on hp 4530s

BIOS write protection kicks in. Intel boards behave similar.

Read a manual to your laptop for instructions on disabling write protection. Try TimeWalker's method too.

Patch a normal BIOS file with PMPatch and try flashing it with HP flashing tools.

Report your results.

 

I have an Asus Gamers Laptop G74SX that I have to use the speedstep patching from that thread.

Did your patch work on this particular UEFI bios and will I be able to update the bios on the notebook?

If it patches and generates patched file then this patched file must be working. I can't guarantee it, but there was no corrupted image produced since version 0.5.3, and thre is only report of having isssues with OC stability after flashing patched BIOS.

Try PMAP first, if it works, you don't need anything else. If not - report and I will try to guide you further.

Share this post


Link to post
Share on other sites

ASUS Sabertooth x79

Can you also try flashing patched BIOS with biosrefl.bat from FTK? Can you try not latest BIOS version but a one ore two previous ones? You can flash any version you want with FTK.

I think I know why this OC issues may be present, but I need more testing before I can fully explain it.

Share this post


Link to post
Share on other sites

@codeRush.

sorry i didnt use your tool correctly in my first post my mistake was only puting bios file in terminal once. but i hve just but bios file in twice. and genarated a patched file.

this is my read out from terminal.

 

 

Desktop/SABERTOOTH-X79-ASUS-3305.CAP\ 2

PMPatch 0.5.10

PowerManagement modules not found.

AMI nest modules not found.

Phoenix nest modules not found.

CpuPei module at 0079A518 patched.

CpuPei module at 007DA518 patched.

Output file generated.

 

Now the motherboard will not read the patched file from the usb stick

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Mayday Alaska
      Hi everybody.
      I'm trying to run MacOS High Sierra on tis configuration:
       
      i5-6600
      ASRock h170 Fatal1ty Performance
      RX 480 8gb
       
      The problem is that I'm not familiar with ASRock motherboards and their BIOS. Can anyone help me setting it up?
       
      Thanks to everyone who will help.
    • By Slice
      Now I want to add vector graphics support in Clover. See rev 4560 and later.
      It is not working yet but designers may begin to create Vector Themes.
      It supposed to consist of SVG elements and has design size. It will be rendered to any screen size scaled from design size.
       
      What application in macOS can create SVG graphics?
      Inkscape is not working in macOS 10.11+. Pity.
      LibreOffice Draw works with SVG but buggy.
      Boxy SVG cost 10$ but looks good enough. It creates the best in simplicity files and have more then enough features.
      Illustrator is good but expensive.
       
      How to improve SVG file?
      Clover has restricted support for SVG. It is your job to make compatible file and as small as possible to speedup rendering.
      Some helps:
      Help:Inkscape – From invalid to valid SVG Inkscape files
      From invalid to valid SVG Adobe Illustrator files
      From invalid to valid SVG files of other editors: BKchem, ChemDraw and CorelDRAW
      Help:Illustrator – Assistance with creating and saving SVG images in Adobe Illustrator that will pass W3C validation
      User:Quibik/Cleaning up SVG files manually
      Later I will write own instructions specific to Clover abilities.
       
      How to create SVG fonts?
      You can google to find ready-to-use SVG fonts.  I found some problems with too beaty fonts: slow rendering and overflow crash. Be careful.
      You can get ttf or otf fonts and convert them into svg by using online WEB services. Not a problem to google.
      But then I want to find a way to simplify the font to reduce a size and speedup rendering.
      You can create own font by FontForge It is opensource and available for Windows, Mac and GNU+Linux. It creates otf font which you can convert to svg font.
       
      Pictures from Badruzeus
      https://www.insanelymac.com/forum/applications/core/interface/file/attachment.php?id=301597
    • By ErmaC
      Please be advised that this is not a discussion topic.
       

      This topic is a "direct" line of communication between the Developers of Clover (Clover Team).
      Unless a Developer/Coder asks for more information, all the critical information of a post should be contained in the subject and first post.
      Every post will be responded to in some fashion before being locked.
       
       
       
       

      Invalid Posts
      Since we are strictly interested in issue reports on this topic, the following post/reply are likely to be deleted immediately:
      1. Discussion topic aka OFF-TOPIC (What do you all think?)
      2. Invalid issue reports
      3. Feedback / Suggestion threads.
      4. Posts requesting information about the bootloader.
      5. Posts made on other forums (Don't spam.)
      6. "Accomplishment" threads, threads to advertise screenshots unrelated to bug reports.
      7. Posts requesting status updates on existing issues.
       
       
    • By nysander
      I start this topic to make my Lenovo Thinkpad W540 usable with High Sierra
       
      I followed many guides but this one started by @tluck made me most progress: 
      My setup as in signature
       
      I will update first post with statuses of working features:
       
      Graphics:
      Nvidia Quadro - disabled
      Intel HD 4600 - working @ 1920x1080 and 1,5GB RAM (had to set ig-plaform-id as Haswell desktop, mobile do not work)
      using intelGraphicsFixUp.kext
       
      Sound:
      internal speakers and mic works with AppleACL.kext and profile 28

      USB:
      i boot MacOS from USB drive and it works, mouse and pendrive also works
      USB power not work yet, so USB WiFi dongle and iPhone connection not work (no power @ USB)
      IOReq finds only USB 3.0 controller not USB 2.0 even though I have 2 ports USB 3.0 and 2 ports USB 2.0
       
       
      Integrated Camera:
      recognised in IOReq but not working now (probably due to USB)
       
      Bluetooth:
      as USB but works without problem

      Ethernet:
      works with intelMausiEthernet.kext

      Keyboard:
      internal is PS2 so VoodooPS2Controller.kext is needed - some mappings I would like to have different but works

      Touchpad:
      works with VoodooPS2Controller.kext from @tluck topic
       
      Trackpoint:
      One time works mostly not - debugging in progress
       
      Batery Status:
      not working
       
      Integrated WiFi:
      intel -  not working
       
      Sleep / Hibernate:
      not working
       
      Backlight:
      not working
       
      Other found issues:
      besides that graphics works @ 1920x1080 and have a lots of ram window shadows (especially dock shadow) looks bad
       
      External VGA:
      not tested yet
       
      External Mini Display Port / Thunderbolt:
      not tested yet
       
      I will post my clover / debug config later
       
       
×