Installation
Prerequisites
- Megaton requires
DevKitA64from DevKitPro. (Select theswitch-devgroup) - For Rust support (building mods written in Rust), a Rust toolchain for the host system
(i.e. the system used to build the mod) and
gitare required to clone and build the Rust compiler for theaarch64-unknown-hermittarget.
Install Megaton
The megaton CLI is a single binary, which can be installed in 3 ways:
- (Recommended) Install from prebuilt binary with
cargo-binstallcargo binstall megaton-cmd --git https://github.com/Pistonite/megaton - Install from source with
cargocargo install megaton-cmd --git https://github.com/Pistonite/megaton - Download the binary from the latest release on GitHub
Install Megaton Rust Toolchain
Megaton implements the Hermit ABI to bind Rust
Standard Library to NNSDK. This requires a custom Rust toolchain. Megaton will install
this toolchain at ~/.cache/megaton/rust-toolchain
Run the following command to install the toolchain, or upgrade the toolchain in the future
megaton toolchain install
This compiles LLVM and bootstraps the Rust compiler, which will take a while.
To keep the build artifact, use the -k/--keep flag: megaton toolchain install -k.
This will make it faster to rebuild the toolchain in the future when upgrading. However,
this will consume 10-20GB of disk spaces.
You can check if the toolchain is installed with
megaton toolchain check
Or directly with rustc (megaton is the name of the toolchain)
rustc +megaton -vV
Upgrading
To upgrade megaton, simply reinstall the latest version with cargo/cargo-binstall,
or replace the binary with the latest release on GitHub if you installed it manually.
To upgrade the custom Rust toolchain, run megaton toolchain install after upgrading megaton.