Jump to content
InsanelyMac Forum
CodeRush

[UEFIPatch] UEFI patching utility

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 notacone
      These are the Original iMac17,1 Firmware 0105_B20 ACPI Tables.
      They have been extracted from the firmware file provided in 10.12.4 update, so they are clean and unloaded.
      All tables are available in hex cut/new file/paste order so they are untouched and unloaded.
      I believe these files can serve to better study Skylake architecture implementation in Sierra.
      10.12.4-10.12.6 : IM171_0105_B20-10.12.4.firmware update ACPI Tables.zip
      10.13.0+ : IM171_0110_B00 10.13.0GM ACPI Tables.zip
    • By partha.slg123
      Hackintosh High Sierra 10.13.3 USB Installer Boot Into USB DIrectly Enter Exit Option Menu. Clover Boot Menu Not Showing. Plz Help .................
       

       
      My System Specification :

      CPU : Core i5 6400
      MB : Asus H110M-CS
      RAM : 8GB DDR 4
      HDD : WD 1TB For Windows And WD 500 GB For Hackintosh
      Bootloader : Clover
    • By gorans
      Hi,
       
      after updating HS my WOL stopped working. It worked for sure in El Capitan, not sure in what version of HS stopped to work. I'm using Ozmosis as bootloader and IntelMausiEthernet (in S/L/E) for network. I created ssdt.aml with ssdtPRGen, and put it in EFI/Oz/Acpi/Load/.
      WOL is enabled in BIOS, wake for network access is checked
      pmset -g System-wide power settings: DestroyFVKeyOnStandby 0 Currently in use: standby 0 Sleep On Power Button 1 womp 1 hibernatefile /var/vm/sleepimage powernap 0 networkoversleep 1 disksleep 10 sleep 15 autopoweroffdelay 28800 hibernatemode 0 autopoweroff 0 ttyskeepawake 1 displaysleep 15 standbydelay 10800 If I put machine to sleep, WOL works for a short time, but not working if I let it sleep for a while.
       
      I deleted Ethernet in Network, rebooted and recreated it, but still the same.
       
      Hardware:
      MOBO:     Gigabyte Z97-D3H rev 1.1
      processor:    i5-4460 Haswell
      graphic:    Gigabyte GeForce GT 740 OC GDDR5 2GB (GV-N740D5OC-2GI)
      memory:    2 x 8GB Kingston
      disks:    Samsung SSD 850 EVO 120GB
              Seagate 2TB
              LG DVD±RW
      Sound:     VoodooHDA
      Network:    IntelMausiEthernet.kext
       
      Any advice?
       
      Best regards,
      Goran
    • By M3G4DR01D
      Hello everyone, I have an Asus gl502vmk (i7 kabylake + GTX 1060 6 gb) laptop and I tried all the patches/kexts to get the brightness with fn keys/touchpad (I2C ELAN 1200 works with VooDoo I2C kext v1.0 but no gestures/preference pane)/Keyboard backlight to work but no success so far, any help would be appreciated, thanks in advance.
      [EDIT] (10/04/2018)
      Battery status now works, thanks to @RehabMan turned out to be incorrect SMBIOS (used iMac instead of Mbp) lol, but it drains crazy fast (~1.5 - 2 hours while on standby (all apps quited!), on windows 10 it lasts 4 - 5 hours, and on linux it lasts 6 ~ 7 hours!)
      And with VoodooI2C v2.0.1 + VoodooI2CHID kext and patched DSDT, the touchpad is now detected in the sys pref pane but still no input.
      Sound works with VoodooHDA v2.9.1, but the only issue is that the jack sense isn't working (the output device doesn't auto switch to headphone when connected)
       
      [EDIT 2] (11/04/2018)
      The system brightness now works thanks to @onejay09 but I have no brightness slider, and there are 4 extra brightness levels (brightness stops increasing after 12 levels)  and the brightness keys are not mapped correctly, plus the brightness decreases when I plug in the ac adapter, then increases if I unplug it???, the brightness level isn't also saved after reboot.
      battery still drains crazy fast (~1.5 - 2 hours, even with brightness at 50%, so apparently it is a power management issue).
      and I also have shutdowns while in sleep mode (I tried darkwake=10 and darkwake-0 and darkwake=no)
       
      P.S. I have uploaded my new report files, thanks!
       
      Latest report files (11/04/2018): https://www95.zippyshare.com/v/AMOpP0AY/file.html
    • By liuhongxin1993
      ASUS X99-E-10G WS
      I76950X
      Request to optimize
      Sleep/Wake issues, CPU Power States


      origin.zip
      ioregMac Pro.zip
      config.plist
      kexts.zip
×