Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Install nanoflash

The command nanoflash and its twin cargo-nanoflash come from crates.io: a download through cargo binstall, or a build with cargo install. They also come as an archive from GitHub Releases, or as a build from the repository. The crates nanoflash and nanoflash-cli are on crates.io. The browser package nanoflash is on npm.

From crates.io

cargo binstall downloads the archive of the release of nanoflash-cli that matches the host, and installs both commands without a build. It reads [package.metadata.binstall] of nanoflash-cli (see Release archives):

$ cargo binstall nanoflash-cli

cargo install builds both commands for the host with Rust 1.95 or later. --locked uses the dependency versions of the release:

$ cargo install --locked nanoflash-cli

From GitHub Releases

Each release of the command has one archive per target. Release archives lists the six targets and what each archive holds.

Linux and macOS

Download, check and unpack the archive of your host, then copy both commands to a directory of your PATH. On a Linux host with an Intel or AMD processor:

$ base=https://github.com/AlixANNERAUD/nanoflash/releases/latest/download
$ curl -fsSLO "$base/nanoflash-x86_64-unknown-linux-musl.tar.gz"
$ curl -fsSLO "$base/nanoflash-x86_64-unknown-linux-musl.sha256"
$ sha256sum -c nanoflash-x86_64-unknown-linux-musl.sha256
nanoflash-x86_64-unknown-linux-musl.tar.gz: OK
$ tar -xzf nanoflash-x86_64-unknown-linux-musl.tar.gz
$ install -m 755 nanoflash-x86_64-unknown-linux-musl/nanoflash \
    nanoflash-x86_64-unknown-linux-musl/cargo-nanoflash ~/.local/bin/
$ nanoflash --version

sha256sum -c (shasum -a 256 -c on macOS) reads the checksum file and needs the archive in the same directory.

Windows

Download, check and unpack the archive with PowerShell. The checksum file holds the hash in lower case and Get-FileHash prints it in upper case, so the comparison ignores case (-eq does):

> $base = "https://github.com/AlixANNERAUD/nanoflash/releases/latest/download"
> $name = "nanoflash-x86_64-pc-windows-msvc"
> Invoke-WebRequest "$base/$name.zip" -OutFile "$name.zip"
> Invoke-WebRequest "$base/$name.sha256" -OutFile "$name.sha256"
> (Get-FileHash "$name.zip" -Algorithm SHA256).Hash -eq (Get-Content "$name.sha256").Split(" ")[0]
True
> Expand-Archive "$name.zip" -DestinationPath .

Check where an archive came from

The checksum file comes from the same release as the archive, so it detects a damaged download only. To check where an archive came from, verify its build provenance with the GitHub command line:

$ gh attestation verify nanoflash-x86_64-unknown-linux-musl.tar.gz --repo AlixANNERAUD/nanoflash

macOS: remove the quarantine attribute

The binaries are not signed and not notarised. A browser marks the downloaded archive with the quarantine attribute, and macOS then refuses to run the binaries. Remove the attribute from the unpacked directory (Apple silicon, then Intel):

$ xattr -dr com.apple.quarantine nanoflash-aarch64-apple-darwin
$ xattr -dr com.apple.quarantine nanoflash-x86_64-apple-darwin

An archive that curl downloads has no quarantine attribute.

From the repository

To install the state of the main branch, which can be newer than the last release, build the command from the repository with Rust 1.95 or later. This builds both commands for the host:

$ cargo install --locked --git https://github.com/AlixANNERAUD/nanoflash nanoflash-cli

Linux: get access to serial ports

A user needs the permission to open a serial port. On Debian, Ubuntu and Fedora the group dialout has it. On Arch Linux the group is uucp. Add yourself to the group, then log in again:

$ sudo usermod -aG dialout "$USER"

The browser package

npm install nanoflash

See Use the browser package.