Skip to content

Control your Thunderbolt NVMe SSD using DriverKit on macOS

License

Notifications You must be signed in to change notification settings

SamsungDS/MacVFN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MacVFN (BETA)

This is a port of libvfn for macOS and implemented into xNVMe. It utilizes DriverKit to hook an external PCI NVMe device (through PCIDriverKit), and allows user-space applications to take control of the device.

This is not suitable for production, as it requires disabling SIP, and everything has to be self-signed. The code might also be buggy or have improper memory management, as this is just a proof-of-concept at this point.

State of the code

Consider this a beta release. It works fine for prototyping, testing, and development.

Although it's a port of libvfn, there is no way of running any of the example code from the libvfn project, as they heavily depend on Linux-only APIs. Instead, MacVFN has been implemented in xNVMe as a reference solution. All the examples from xNVMe should work.

TODO list:

Installation

These are the basic steps to build and install the driver:

  1. Disable SIP
  2. Run systemextensionsctl developer on to allow System Extensions from any directory
  3. Identify the newest or matching tagged xNVMe version of MacVFN (or go with master)
  4. Git clone this repo with submodules: git clone --recurse-submodules --branch xnvme_vX.Y.Z https://github.com/SamsungDS/MacVFN.git
  5. Run make build install kill log, approve system extension and type sudo-password as needed
  6. Clone xNVMe with the next branch: git clone -b next https://github.com/xnvme/xnvme
  7. Run make config build install
  8. Check your NVMe device enumerates xnvme enum
  9. Then take the 'uri' and run a command: xnvme idfy MacVFN-1234ABCD --cns 0 --be=driverkit
  10. Or two xnvme_single_sync MacVFN-1234ABCD
  11. Or three xnvme_single_async MacVFN-1234ABCD

Optionally, you can clone and build fio with xNVMe support:

  1. Git clone fio: git clone https://github.com/axboe/fio
  2. Install GNU-make: brew install make
  3. Use gmake to build it: gmake -j
  4. Run a test: ./fio --name=test1 --iodepth=64 --rw=write --bs=512 --size=1GB --loops=1 --numjobs=1 --direct=1 --ioengine=xnvme --filename=MacVFN-1234ABCD --thread=1 --xnvme_dev_nsid=1 --xnvme_be=driverkit --xnvme_sync=driverkit --xnvme_async=driverkit --verify=crc32