Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instructions for armv6 (Raspberry Pi 1 / Zero) #42

Open
tiziano88 opened this issue Jul 4, 2018 · 3 comments
Open

Instructions for armv6 (Raspberry Pi 1 / Zero) #42

tiziano88 opened this issue Jul 4, 2018 · 3 comments

Comments

@tiziano88
Copy link

I could not find much information about how to cross compile Rust for armv6 in order to run on a Raspberry Pi 1 / Zero, so I wrote my own tutorial (in form of a Dockerfile): https://github.com/tiziano88/rust-raspberry-pi/blob/master/Dockerfile . The trick is really just to not use the gcc-arm-linux-gnueabihf package from Ubuntu, because that is tied to armv7. Would you like to somehow merge our instructions? I am happy to send you a PR for your readme adding a section on armv6 if you agree. Thanks for all the work on this!

@theronic
Copy link

So, cargo build --target=arm-unknown-linux-gnueabihf should work for Raspberry Pi Zero?

@Majkl578
Copy link

@theronic Yes, you only need to change the linker for the resulting binary to work.
Something like this in .cargo/config:

# default target
target = "arm-unknown-linux-gnueabihf"

[target.arm-unknown-linux-gnueabihf]
linker = "/foo/raspberrypi-tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-cc"

I'm currently using official compiler build for manual cross compilation from x86_64 Linux to ARMv6 (for Pi Zero).

@oconnor663
Copy link

Here's an example of the above that just worked for me, but done entirely from the command line rather than a config file:

rustup target add arm-unknown-linux-gnueabi
git clone https://github.com/raspberrypi/tools $HOME/rpi_tools
RUSTFLAGS="-C linker=$HOME/rpi_tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc" cargo build --target arm-unknown-linux-gnueabihf --tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants