1 # armv7-unknown-linux-uclibceabihf
5 This tier supports the ARMv7 processor running a Linux kernel and uClibc-ng standard library. It provides full support for rust and the rust standard library.
7 ## Designated Developers
9 * [@skrap](https://github.com/skrap)
13 This target is cross compiled, and requires a cross toolchain. You can find suitable pre-built toolchains at [bootlin](https://toolchains.bootlin.com/) or build one yourself via [buildroot](https://buildroot.org).
19 Compiling rust for this target has been tested on `x86_64` linux hosts. Other host types have not been tested, but may work, if you can find a suitable cross compilation toolchain for them.
21 If you don't already have a suitable toolchain, download one [here](https://toolchains.bootlin.com/downloads/releases/toolchains/armv7-eabihf/tarballs/armv7-eabihf--uclibc--bleeding-edge-2021.11-1.tar.bz2), and unpack it into a directory.
25 The target can be built by enabling it for a `rustc` build, by placing the following in `config.toml`:
29 target = ["armv7-unknown-linux-uclibceabihf"]
32 [target.armv7-unknown-linux-uclibceabihf]
33 # ADJUST THIS PATH TO POINT AT YOUR TOOLCHAIN
34 cc = "/TOOLCHAIN_PATH/bin/arm-buildroot-linux-uclibcgnueabihf-gcc"
41 ./x.py build --stage 2
44 ## Building and Running Rust Programs
46 To test cross-compiled binaries on a `x86_64` system, you can use the `qemu-arm` [userspace emulation](https://qemu-project.gitlab.io/qemu/user/main.html) program. This avoids having a full emulated ARM system by doing dynamic binary translation and dynamic system call translation. It lets you run ARM programs directly on your `x86_64` kernel. It's very convenient!
50 * Install `qemu-arm` according to your distro.
51 * Link your built toolchain via:
52 * `rustup toolchain link stage2 ${RUST}/build/x86_64-unknown-linux-gnu/stage2`
53 * Create a test program
63 CARGO_TARGET_ARMV7_UNKNOWN_LINUX_UCLIBCEABIHF_RUNNER="qemu-arm -L ${TOOLCHAIN}/arm-buildroot-linux-uclibcgnueabihf/sysroot/" \
64 CARGO_TARGET_ARMV7_UNKNOWN_LINUX_UCLIBCEABIHF_LINKER=${TOOLCHAIN}/bin/arm-buildroot-linux-uclibcgnueabihf-gcc \
65 cargo +stage2 run --target armv7-unknown-linux-uclibceabihf