stevezhengshiqi / XiaoMi-Pro

XiaoMi NoteBook Pro for macOS Mojave & High Sierra
BSD Zero Clause License
83 stars 10 forks source link

BIOS DVMT, Speedshift, 0xE2, fans fixes. #8

Open ghost opened 6 years ago

ghost commented 6 years ago

Hello there! I'm glad to show some of the Cyb's works on XMNBP BIOS modding! What's done:

  1. The most important - DVMT set to 64MB -> i booted without IntelDVMTFixup
  2. Native Intel HWP - better CPU power management with MBP15,2 profile.
  3. 0xE2 LOCK disable - now we can boot vanilla kernel without any patches on Clover side.
  4. Nuvoton Embedded Controller firmware mod - now fans kicks in on 55 degrees Celsius, which means that laptop stays quiet 95% of the time (even when i use IDE, which is actually awesome). Also he managed to make BIOS and EC region R\W, which means we can make further modifications in every point.

The work itself is now more like Proof-of-Concept, mods are based on Insyde's H20UVE utility to patch UEFI variables, for that Cyb is using CMD + PowerShell scripts, which makes a bit of a trouble to use it (PowerShell execution policy is ugly and often makes problems). Now he's working on a Python executable to make things a lot easier for basic user. Windows environment is needed. Just to try i will upload some scripts, here it is exps5.5_en.zip. I will hold on EC mod as it's dangerous and untested (in "shit happens" case you should have programator and disassemble the laptop to restore it's functionality), but for now all is awesome for me.

ghost commented 6 years ago

So, as an addition - my suggestion is to revert basic GPU injection method as it should work far more better with normal DVMT, because WhateverGreen is now a bit fat, clumsy solution in terms of Intel graphics. It's awesome, but as it's in stage of initial development there may be problems.

gplast commented 6 years ago

Hello @PavelLJ, i'm always looking and following this repository. Both @stevezhengshiqi and you are doing a great job and im really thankful about that, because i like so much that i mess around with my laptop :P Can you please share with me the script for EC mod, i really want to test it also and i can give you my feedback if you want to test it. Really this is something that is been bothering me since i got the laptop. I followed a lot of forums where they talk about it, by no one managed to do what you did. I will understand if you dont want to share it :)

gplast commented 6 years ago

Also when i run DVMT_set.cmd i get this error message: Now parsing Variable Information. Succeed to get bios data. Complete parsing Variable Information!!! Saving Variable Information to file: sasetup_my.txt Successfully read variables FAILED!

Can you please tell me what i might doing wrong?

ghost commented 6 years ago

@gplast That's actually what I told about - it's PowerShell error. Basically you can bypass it - Wait untill FAILED message, execute bin/patchscript_dvmt.ps1 and after that execute h2ouve -sv sasetup_patched.txt -n SaSetup under / folder, so you completing script work from point it's stopped. Blame PowerShell policy for that clumsy way of solving problems

gplast commented 6 years ago

Thank you very much, i managed to run the script by

Also i would like to mention that all the other scripts can run without a problem just by double ckicking on them.

stevezhengshiqi commented 6 years ago

@PavelLJ You and Cyb really did a great job. I just have a small suggestion. Because IntelGraphicsFixup is not maintained anymore, WhateverGreen is probably a better choice. Also, IntelGraphicsDVMTFixup doesn't work well on our device in Mojave. The way to remove DVMT patch is like this:

ghost commented 6 years ago

Update - EC mod is tested and working as expected. Mi Notebook Pro EC.zip That's still PowerShell scripting, but it's too long to wait for rewrite. Big thanks to Cyb

biox86 commented 6 years ago

Darn, I was so excited that I downloaded everything but after unzipping the file I found out that the scripts have cmd extension. Do you think there will be a way to do every operation on osx or windows will ever be needed and the future python script will be for windows too? I just have a single disk with osx and I'm wondering how could I bypass this limitation without installing win and restoring osx or buying a 2nd ssd. Do you think the scripts could work through a VM with parallel or VMware? I don't know if the BIOS is reachable from there or if you are going to get lost in something simulated from the programs.

ghost commented 6 years ago
  1. Yeah, scripts are only for Windows now :( Btw you can use Windows PE flash drive, there is a lot of "live-udb" bundles of Windows 10
  2. Should be usable after Python rewrite on both macOS and Windows
  3. Should work with VM i think, but better use Live-USB (Windows 10 Strelec for example)
biox86 commented 6 years ago

Thanks for the info. I’ll try booting win from a flash drive then. I’ll let you know as soon as I try.

johnnynunez commented 6 years ago

What is your efi now with new EC? @PavelLJ

ghost commented 6 years ago

@johnnync13 nothing special, i just deleted the kernel patch about CFG LOCK, because one of these bios mods unlocked them.

johnnynunez commented 6 years ago

@PavelLJ are there any bios mod version for Xiaomi mi Air 8550u?

alexmenn commented 6 years ago

Im having troubles with windows in Parallels to do it. Here are my error when I try to execute (as admin) any script. How can I fix it? img_1746

biox86 commented 6 years ago

Mh, I had no time to try any script yet, but maybe it’s related to my assumption that the vm emulates the bios in some way and the script cannot get access to the “real” one. You could try with a portable version of win (booting from a usb) as I have been told to. To do that you need a working version of Windows and you need to download a few gb of frameworks directly from microsoft’s website (needed to prepare the usb). I’ll try that for sure, infortunately I had no time from work to do that yet.

alexmenn commented 6 years ago

I've tried with sergei strelec live windows 10 but his version does not have Power Shell installed. How can I get a live windows 10 with power shell? Or how can I add Power Shell to an existing live usb (w10)?

biox86 commented 6 years ago

It seems to be possible opening the command prompt in WinPE, it’s probably just “hidden”. Take a look at this page: https://www.sevecek.com/EnglishPages/Lists/Posts/Post.aspx?ID=47

alexmenn commented 6 years ago

What I mean, is that WindowsPE live, I could run CMD, but when I try to execute the scripts, the CMD shell says "power shell command does not exist" (or something like that).

biox86 commented 6 years ago

Oh, my bad. I thought you could not open the power shell. Guess you need to wait PavelLJ’s answer then.

ghost commented 6 years ago

Hey there guys. I'm not able to answer question about making this work on some of Windows Live revisions, but maybe Windows To Go is an option?

ghost commented 6 years ago

@johnnync13 No, but basically you should just get the IFR number of the option you need to change and the number of the option's setting to apply it, this mod should work on Air too. (Basically it was Air 2016 mod which we changed to work with Mi Notebook Pro)

alexmenn commented 6 years ago

Hi again! I can confirm that Bob.Ombs.Modified.Win10PEx64.v4.0 WindowsPE allowed me to patch BIOS with your scripts, that version has powershell :) I just get error in DVMT script, I attach the .txt. Now I want to try if the patches work or not. How can I try this?

1- Native Intel HWP - I will try with that SMBIOS :) 2- 0xE2 LOCK disable - what patches can I disable in Clover? KernelPM and so? sasetup_my.txt

ghost commented 6 years ago

I just get error in DVMT script, I attach the .txt.

Is your BIOS v603? Please attach error screenshot 1 - Right 2 - Right, only KernelPM and Pike. R. Alpha kernel patch

ghost commented 6 years ago

In case someone not noticed, there is a separate repo for mods - https://github.com/cybsuai/Mi-Notebook-Pro-tweaks @stevezhengshiqi I guess it's time to include this in your install guide

stevezhengshiqi commented 6 years ago

@PavelLJ Cool, I will include this.

alexmenn commented 6 years ago

@PavelLJ here you are the screenshot. And yes, I have v603 :) Any idea? I've installed all scripts with a distro of WindowsPE with Power Shell :), except of DVMT because of this error: img_1811

FallenChromium commented 6 years ago

@alexmenn Ouch, I thought you launched the PowerShell script itself to see the error, because this one is not informative. Script saying "FAILED" when the new, patched file wasn't created by the PowerShell script. Take a screenshot of the PowerShell runned after this script

alexmenn commented 6 years ago

@FallenChromium I've tried the script in Powershell and same error. Here is PowerShell screen after script

img_1842

FallenChromium commented 6 years ago

Lol, you should not run .cmd file in PowerShell but .ps1 file in PowerShell, it's located in bin/ folder. I recommend you to read the .cmd to understand what does it do, then you will understand what to open in PowerShell.

alexmenn commented 6 years ago

Okay @FallenChromium ! Here you are the error code again :) Any idea? img_1850

FallenChromium commented 6 years ago

@alexmenn It's really hard to help like that. I tried to say that you need to understand what script does. Well, it's dumping setup file, calling .ps1 to modify it and then flashing new one into BIOS SPI. If you would do every command from cmd manually then you can determine the issue and then show what happened. (including calling .ps1 in the right directory, your error shows that PowerShell can't find the file, which is unsurprising because you launched script being in bin folder)

alexmenn commented 6 years ago

Sorry, no idea what are you talking about. My english is not perfect and my skills in windows/scripts are limited.

I tried too what @gplast said:

running power shell as an administrator run this command: Set-ExecutionPolicy -ExecutionPolicy Unrestricted write A and press enter, and Reboot System then run again the script and everything works

But not success at all, I think because im running windows 10 live usb PE, I dont have windows installed, and I think that because of this, when I reboot, the command returns back.

webfalter commented 5 years ago

Thanks, it worked great on a Xiaomi Pro

Is it possible to apply it to another Xiaomi? Or would DVMT etc. be rewritten for it. Xiaomi Air 12 inches m3-6Y30

BorlanDD commented 5 years ago

Hi there! I have XMAKB5R0P0906 BIOS version. I would like to install macOS on my laptop, but first I would like to ask a question. Can I install these tweaks on my BIOS version? Sorry for my English.

stevezhengshiqi commented 5 years ago

@BorlanDD Yes, you can. They support XMAKB5R0P0906. Don't forget to run unlockbios.cmd at first.

BorlanDD commented 5 years ago

How can I check what DVMT I set? I'm not quite sure if I did everything right. And I didn't find how to disable KernelPM and Pike. R. Alpha kernel patch. Can you help me with this, please?

stevezhengshiqi commented 5 years ago

@BorlanDD Try to delete the following code in config.plist. If you can boot into macOS without these codes, then your DVMT set works.

  <key>framebuffer-fbmem</key>
  <data>AACQAA==</data>

and

  <key>framebuffer-stolenmem</key>
  <data>AAAwAQ==</data>
TobiasBouma commented 5 years ago

Hi,

Some users report that this will work with the GTX version, but omit the BIOS version.

I'm running BIOS XMAKB5RRP0804, EC XMAKB5RRP04. I'm really only interested in undervolting - the fans work as intended and I'm getting quite competitive temperature readings already.

Will this work? I'm finally having a stable build as it is and prefer asking here over backing up large amounts of data.

Cheers!