Contributing to vftool
Contributions to vftool
are welcome. As a minimalist project, the focus is on maintaining simplicity and stability.
Development Setup
To get started with development, you'll need to set up a build environment, which is the same as the command-line installation process.
-
Prerequisites: Ensure you have Xcode or the Xcode Command Line Tools installed.
xcode-select --install
-
Clone the repository:
git clone https://github.com/evansm7/vftool.git cd vftool
-
Build the project:
The compiled binary will be located atmake
build/vftool
. You can runmake clean
to remove build artifacts.
Code Overview
The entire logic of vftool
is contained within a single file: vftool/main.m
.
main()
function: This is the entry point. It handles parsing command-line arguments usinggetopt
and sets up default values.getVMConfig(...)
function: This is the core of the application. It takes the parsed arguments and constructs aVZVirtualMachineConfiguration
object by setting up the bootloader, CPU, memory, and all necessary virtio devices.createPty(...)
function: A helper function for creating and managing the pseudo-terminal for the console.
Code Signing and Entitlements
To interact with Virtualization.framework
, the compiled binary must be signed and include a specific entitlement.
- Entitlements: The required entitlement,
com.apple.security.virtualization
, is defined invftool/vftool.entitlements
. - Signing: The
Makefile
automatically handles signing during the build process using thecodesign
command:
Thesign: build/vftool codesign --entitlements vftool/vftool.entitlements --force -s - $<
-s -
argument creates an ad-hoc signature, which is sufficient for local development and running the tool on your own machine.
Submitting Changes
- Fork the repository on GitHub.
- Create a new branch for your feature or bug fix.
- Make your changes in the
vftool/main.m
file. - Build and test your changes locally.
- Commit your changes and push them to your fork.
- Open a pull request against the
main
branch of the original repository.