Installing Rust
In this practical you will identify the BeagleBone Black's processor architecture, select a compatible Rust toolchain, transfer the installer over USB networking, and compile your first Rust programme directly on the BeagleBone Black.
Practical Checklist
1. Identify the target architecture
-
Connect to the BeagleBone Black over SSH, as in the Getting Started practical. On the BeagleBone, check its machine architecture:
uname -mExpected result:
armv7luname -mreports the machine hardware architecture as described by the running Linux kernel. Thelinarmv7ldenotes little-endian ARMv7. -
Use the result of
uname -mto identify the correct Rust download target.uname -mreturnedarmv7l. This establishes the processor architecture, but a compiler binary must also match the operating system and its application binary interface (ABI). Rust therefore uses a more descriptive identifier, called a target triple.For this BeagleBone Black, the mapping is:
Linux architecture Rust target armv7l โ armv7-unknown-linux-gnueabihfTarget component How it relates to our BeagleBone armv7Matches the ARMv7 processor identified by uname -m; thelinarmv7lindicates little-endian operation and is not included in Rust's architecture fieldunknownA generic vendor designation, not an unknown CPU linuxThe operating system running on the BeagleBone gnueabihfThe GNU/Linux hard-float ABI used by the board's Debian system libraries We will use this exact target name to select the archive in Section 2.
2. Obtain the standalone Rust installer
-
On the computer, visit the Rust standalone installer downloads. Using the target triple derived from
uname -min Section 1, locate the stable.tar.xzarchive forarmv7-unknown-linux-gnueabihf.The example in this practical uses Rust 1.95.0. If you select a different version, substitute that same version number in the download URL and extracted directory name.
-
On the computer, stream the installer directly to the BeagleBone using the USB-network SSH connectioni:
curl -LO https://static.rust-lang.org/dist/rust-1.95.0-armv7-unknown-linux-gnueabihf.tar.xz | ssh debian@192.168.7.2 "cat > rust.tar.xz"curl -LO https://static.rust-lang.org/dist/rust-1.95.0-armv7-unknown-linux-gnueabihf.tar.xz mv rust-1.95.0-armv7-unknown-linux-gnueabihf.tar.xz rust.tar.xz scp rust.tar.xz debian@192.168.7.2:/home/debian/
3. Install Rust on the BeagleBone
-
In your BeagleBone SSH session, extract the archive, enter its directory and run the included installer:
tar xf rust.tar.xz cd rust-1.95.0-armv7-unknown-linux-gnueabihf sudo ./install.shThe standalone toolchain includes
rustc,cargo, and standard Rust tooling. Unlikerustup, the standalone installer does not automatically manage future toolchain updates. -
Verify that the Rust compiler and Cargo are accessible from
PATH:which rustc cargoCheck their versions:
rustc --version cargo --version