Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update unlocker for 7.0 U3 #5

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# MacOS Unlocker for VMware ESXi `v3.0.3`

### *注:中文版 Chinese Version 见 CSDN(打不过就加入行为)https://blog.csdn.net/RGBBB/article/details/122197136*

## 1. Introduction

Unlocker for ESXi is designed for VMware ESXi 6.5, 6.7 and 7.0 3U

The patch code carries out the following modifications dependent on the product
being patched:

* Fix VMware-vex to allow macOS to boot
* Fix libvmkctl to allow vSphere to control the guest

The code is written in Python as it makes the Unlocker easier to run and
maintain on ESXi.

> #### ***IMPORTANT:***
>
> **Always uninstall the previous version of the Unlocker before using a new version. Failure to do this could render VMware unusable.**

## 2. Installation

Copy the distribution file to the ESXi host datastore using scp or some other data transfer system. If you want to use the source version (i.e. from GIT) see "5. Building" first.

Decompress the file from the ESXi console or via SSH:

tar xzvf esxi-unlocker-xxx.tgz

(xxx - will be the version number, for example, 300)

Run the command from the terminal:

./esxi-install.sh

Finally reboot the server.

## 3. Uninstallation

Open the ESXi console or login via SSH and change to the folder where the files were extracted.

Run the command from the terminal:

./esxi-uninstall.sh

Finally reboot the server.

## 4. Notes

A. There is a command added called esxi-smctest.sh which can show if the patch is successful. It must be run from a
terminal or SSH session. The output should be:

```
/bin/vmx
smcPresent = true
custom.vgz false 32486592 B
```

Note: The uncompressed size reported for custom.vgz will vary depending on the ESXi version.

B. The unlocker can be temporarily disabled during boot by editing the boot options and adding "nounlocker".

## 5. Building

If you want to use a version which is not available as a distribution (e.g. the code from "master" branch) you need to first build the package.

Checkout the repository:

git clone https://github.com/shanyungyang/esxi-unlocker.git

(if you don't have git installed you can download ZIP archive from GitHub instead)

Enter the directory and build:

cd esxi-unlocker
./esxi-build.py

If everything went correctly the output should be:

ESXi-Build for macOS

Timestamping files...

Creating unlocker.tgz...
etc/
etc/rc.local.d/
etc/rc.local.d/unlocker.py

Creating esxi-unlocker-300.tgz...
unlocker.tgz
esxi-install.sh
esxi-uninstall.sh
esxi-smctest.sh
readme.txt

The package you need to copy in the example above is esxi-unlocker-300.tgz (NOT unlocker.tgz!).

#### GitHub Build

##### Triggered

If you add a tag to any commit in the semver format `*.*.*` a triggered build will run and create a release.

##### Manual

Fork the repository, click on actions, select manual CI and then run.

This will build a new draft release for you which you can upload to your esxi using curl or wget.

If you add a tag in the format `*.*.*` a triggered build will run without needing.

## 6. Thanks

Thanks to Zenith432 for originally building the C++ unlocker and Mac Son of Knife (MSoK) for all the testing and support.

Thanks also to Sam B for finding the solution for ESXi 6 and helping me with debugging expertise. Sam also wrote the code for patching ESXi ELF files and modified the unlocker code to run on Python 3 in the ESXi 6.5 environment.

### History:

26/09/18 3.0.0 - First release

01/05/20 3.0.1 - Fix for ESXi 7.0

10/18/20 3.0.2 - Fix for ESXi 7.0 U1 (7.0.1)

10/29/20 3.0.3 - Release process automated

(c) 2011-2018 Dave Parsons
10 changes: 5 additions & 5 deletions esxi-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
sys.exit(1)

# TODO: Change for a new release
VERSION = '3.0.2'
FILEVER = '302'
FILENAME = 'esxi-unlocker-302.tgz'
VERSION = '3.0.3'
FILEVER = '303'
FILENAME = 'esxi-unlocker-303.tgz'

TIMESTAMP = '{:%Y%m%d%H%M.%S}'.format(datetime.datetime.now())
TOUCH = 'touch -t ' + TIMESTAMP
GTARUNLOCKER = '/usr/local/bin/gtar czvf unlocker.tgz etc'
GTARDISTRIB = '/usr/local/bin/gtar czvf ' + FILENAME + \
GTARUNLOCKER = 'tar czvf unlocker.tgz etc'
GTARDISTRIB = 'tar czvf ' + FILENAME + \
' unlocker.tgz esxi-install.sh esxi-uninstall.sh esxi-smctest.sh readme.txt'


Expand Down
3 changes: 2 additions & 1 deletion esxi-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
set -e
#set -x

echo VMware Unlocker 3.0.2
echo VMware Unlocker 3.0
echo ===============================
echo Copyright: Dave Parsons 2011-18
echo Powered by sysin.org

# Ensure we only use unmodified commands
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
Expand Down
3 changes: 2 additions & 1 deletion esxi-uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
set -e
#set -x

echo VMware Unlocker 3.0.2
echo VMware Unlocker 3.0
echo ===============================
echo Copyright: Dave Parsons 2011-18
echo Powered by sysin.org

# Ensure we only use unmodified commands
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
Expand Down
9 changes: 7 additions & 2 deletions etc/rc.local.d/unlocker.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
0x0A/10 0x06/06 6x byte Padding
0x10/16 0x08/08 Q ptr Internal VMware routine
0x18/24 0x30/48 48B byte Data

updated 2021.10.17 [email protected]
"""

import codecs
Expand Down Expand Up @@ -342,8 +344,8 @@ def main():
patchsmc(destvmx, True)

# Patch 32-bit libvmkctl to return Apple SMC present
os.makedirs(joinpath(destfolder, 'lib'))
if os.path.isfile(srclib32):
os.makedirs(joinpath(destfolder, 'lib'))
shutil.copy2(srclib32, destlib32)
patchvmkctl(destlib32)

Expand All @@ -355,7 +357,10 @@ def main():

# Build the gzipped tar file custom.tgz
print('\nCreating custom.tgz...')
subprocess.call('/bin/tar czvf custom.tgz bin lib lib64', shell=True)
if os.path.isfile(srclib32):
subprocess.call('/bin/tar czvf custom.tgz bin lib lib64', shell=True)
else:
subprocess.call('/bin/tar czvf custom.tgz bin lib64', shell=True)

# Build the vmtar file custom.vmtar
print('\nCreating custom.vmtar...')
Expand Down
16 changes: 9 additions & 7 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
macOS Unlocker V3.0.2 for VMware ESXi
macOS Unlocker V3.0.3 for VMware ESXi
=====================================

1. Introduction
Expand Down Expand Up @@ -77,7 +77,7 @@ Checkout the repository:
(if you don't have git installed you can download ZIP archive from GitHub instead)

Enter the directory and build:

cd esxi-unlocker
./esxi-build.py

Expand All @@ -92,14 +92,14 @@ If everything went correctly the ouput should be:
etc/rc.local.d/
etc/rc.local.d/unlocker.py

Creating esxi-unlocker-301.tgz...
Creating esxi-unlocker-300.tgz...
unlocker.tgz
esxi-install.sh
esxi-uninstall.sh
esxi-smctest.sh
readme.txt

The package you need to copy in the example above is esxi-unlocker-301.tgz (NOT unlocker.tgz!).
The package you need to copy in the example above is esxi-unlocker-300.tgz (NOT unlocker.tgz!).

6. Thanks
---------
Expand All @@ -113,8 +113,10 @@ modified the unlocker code to run on Python 3 in the ESXi 6.5 environment.

History
-------
26/09/18 3.0.0 - First release
01/05/20 3.0.1 - Fix for ESXi 7.0
10/18/20 3.0.1 - Fix for ESXi 7.0 U1 (7.0.1)
26/09/2018 3.0.0 - First release
01/05/2020 3.0.1 - Fix for ESXi 7.0
10/18/2020 3.0.2 - Fix for ESXi 7.0 U1 (7.0.1)
10/17/2020 3.0.3 - Fix for ESXi 7.0 U3 (7.0.3)

(c) 2011-2018 Dave Parsons
Powered by sysin.org