Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
awyl committed Nov 23, 2021
0 parents commit 41c9b11
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 0 deletions.
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Build PowerMonkey

These scripts are created to ease the so many steps to build [PowerMonkey](https://github.com/psyq321/PowerMonkey). If you do not understand what you are doing, you probably shouldn't be running this. Read about EFI and boot process. PowerMonkey github has a good explanation.

## <u>DISCLAIMER</u>
I merely provide you a script to build PowerMoney EFI because it is not the easiest task. Using these EFI binaries are potentially dangerous and could damage your computer. I am not responsible for any damages that might cause. Use at your own risk.

## Software Used
- https://github.com/tianocore/edk2 stable202108
- https://github.com/psyq321/PowerMonkey 0.14
- Python 3.10.0
- NASM 2.15.05

## How to use

### Prerequisite
1. Windows 10 build 17063 and newer
2. Visual Studio 2019, with C++ workload installed.

### Step 1
In a command prompt,
```
git clone https://github.com/awyl/Build-PowerMonkey.git
```

### Step 2
```
cd Build-PowerMonkey
setup.bat
```

### Step 3

Edit `CONFIGURATION.c`. Set your undervolt value.
Open the file in a text editor, it should be very self-explanatory.

### Step 4
```
build.bat
```

### Step 5
Copy the content of `EFI` folder to the folder of same name in your EFI partition. You can also copy the folder to an FAT32 formatted usb stick. If you use usb stick, you should replace `fs0` in `startup.nsh` to `fs1`.

### Step 6

Reboot your computer and go into BIOS.
- Turn off `Secure Boot`
- Change the boot file to `EFI\shellx64.efi`.

13 changes: 13 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@echo off

set PYTHON_HOME=%cd%\python
set PYTHONPATH=%cd%\python
set PYTHON_COMMAND=%cd%\python\python.exe
set NASM_PREFIX=%cd%\nasm\

copy /y CONFIGURATION.c edk2\MdeModulePkg\Application\PowerMonkeyApp
cd edk2
build -m MdeModulePkg/Application/PowerMonkeyApp/PowerMonkey.inf
copy Build\MdeModule\RELEASE_VS2019\X64\PowerMonkey.efi ..\EFI

cd ..
58 changes: 58 additions & 0 deletions setup.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
@echo off
REM Download Edk2

git clone https://github.com/tianocore/edk2.git
cd edk2
git checkout edk2-stable202108
git submodule update --init
cd ..

REM Download PowerMonkey
git clone https://github.com/psyq321/PowerMonkey.git
copy PowerMonkey\PowerMonkeyApp\CONFIGURATION.c .
move PowerMonkey\PowerMonkeyApp edk2\MdeModulePkg\Application
powershell -command "(gc edk2/MdeModulePkg/MdeModulePkg.dsc).replace('/HelloWorld.inf', \"/HelloWorld.inf`r`n MdeModulePkg/Application/PowerMonkeyApp/PowerMonkey.inf`r`n\") | Set-Content edk2/MdeModulePkg/MdeModulePkg.dsc"
echo ACTIVE_PLATFORM = MdeModulePkg/MdeModulePkg.dsc > edk2/Conf/target.txt
echo TARGET = RELEASE >> edk2/Conf/target.txt
echo TARGET_ARCH = X64 >> edk2/Conf/target.txt
echo TOOL_CHAIN_CONF = Conf/tools_def.txt >> edk2/Conf/target.txt
echo TOOL_CHAIN_TAG = VS2019 >> edk2/Conf/target.txt
echo BUILD_RULE_CONF = Conf/build_rule.txt >> edk2/Conf/target.txt


REM Download Python
curl https://www.python.org/ftp/python/3.10.0/python-3.10.0-embed-amd64.zip --output python.zip
mkdir python
tar -xf python.zip -C python
echo Lib/site-packages> python\python310._pth
echo python310.zip>> python\python310._pth
echo .>> python\python310._pth
echo import site>> python\python310._pth
cd python
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
cd ..

REM Download NASM
curl https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/nasm-2.15.05-win64.zip --output nasm.zip
mkdir nasm
tar -xf nasm.zip --strip-components=1 -C %cd%\nasm

REM Download shell.efi
mkdir EFI
cd EFI
curl -L https://github.com/tianocore/edk2/raw/UDK2018/ShellBinPkg/UefiShell/X64/Shell.efi --output shellx64.efi
echo fs0:\EFI\Boot\PowerMonkey.efi > startup.nsh
echo fs0:\EFI\Microsoft\Boot\bootmgfw.efi >> startup.nsh
cd ..

REM Build EDK2 tools
set PYTHON_HOME=%cd%\python
set PYTHONPATH=%cd%\python
set PYTHON_COMMAND=%cd%\python\python.exe
set PATH=%cd%\python;%PATH%
set NASM_PREFIX=%cd%\nasm\
cd edk2
python -m pip install -r pip-requirements.txt
edksetup.bat Rebuild
cd ..

0 comments on commit 41c9b11

Please sign in to comment.