Update Android and RPi instructions

This commit is contained in:
Milan Nikolic 2018-05-06 12:47:05 +02:00
parent 30c57a1102
commit 9d293edb6e
5 changed files with 20 additions and 202 deletions

View file

@ -1,20 +1,18 @@
### Raspberry Pi example
To compile example for Raspberry Pi you will need RPi toolchain and userspace libraries, and Go must be cross compiled for linux/arm with that toolchain.
To cross compile example for Raspberry Pi you will need [RPi toolchain](https://github.com/raspberrypi/tools/tree/master/arm-bcm2708) and [userspace libraries](https://github.com/raspberrypi/firmware) (opt/vc).
There is a bootstrap.sh script that you can use to cross compile Go and OpenAL.
Export path to RPi toolchain:
Compile Go and OpenAL, /usr/local is prefix where Go and RPi toolchain and libraries will be installed:
export RPI_HOME=/opt/tools/arm-bcm2708/arm-linux-gnueabihf
./bootstrap.sh /usr/local
Add toolchain bin directory to PATH:
After build is complete point GOROOT to new Go installation in /usr/local, and add toolchain bin directory to PATH:
export GOROOT=/usr/local/go
export PATH=/usr/local/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:${PATH}
export PATH=${RPI_HOME}/bin:${PATH}
And compile example:
CGO_CFLAGS="-I/usr/local/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/include -I/usr/local/vc/include -I/usr/local/vc/include/interface/vcos -I/usr/local/vc/include/interface/vmcs_host/linux -I/usr/local/vc/include/interface/vcos/pthreads" \
CGO_LDFLAGS="-L/usr/local/vc/lib -L/usr/local/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/lib -ldl" \
CC=arm-linux-gnueabihf-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm GOARM=6 ${GOROOT}/bin/go build -v -x
CC=arm-linux-gnueabihf-gcc \
CGO_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads --sysroot=${RPI_HOME}/arm-linux-gnueabihf/sysroot" \
CGO_LDFLAGS="-L/opt/vc/lib -L/opt/vc/lib64 --sysroot=${RPI_HOME}/arm-linux-gnueabihf/sysroot" \
CGO_ENABLED=1 GOOS=linux GOARCH=arm go build