Thursday, 30 June 2016

Compiling GO code for the BeagleBone Black

One thing I love about GO is that you can cross compile code for different platforms. 

The Ethereum Foundation use this feature to create developer releases of GETH (the ethereum node written in GO) to many platforms relatively quickly.

It also means that I do not need to wait ages for a slow processor like the Raspberry Pi 1 or the BeagleBone Black to make the build, I can do it from my MacBook.

I first learned how effortless it was from Audrey Lim's go-snap project

There are more details about cross compiling for ARM in the GoArm Wiki

So finally - to compile on Linux or a MacBook for the BBB*

# GOARCH=arm GOOS=linux GOARM=7 go build myBBBprogram.go

Once it has finished you should have a cross compiled executable. All you have to do is to transfer it to the BBB with scp or an sftp utility and you are in business!

*or on a PC if you really have to...

Set Fixed IP Address on BeagleBone Black (Debian)

After a couple of years of serious distractions, I dragged my BeagleBone Blacks out of the cupboard and am putting them to use hosting test software in the office so that people can access them while I am away.

I downloaded the latest Debian because it seems that Arch had not been updated recently

Many things have changed, in particular the connection manager but it is a very simple process.

These commands may require running as root (via Sudo or su)

First find your service name (I have truncated the names of mine for brevity)

connmanctl services
your_network_id            wifi_000c


Then set the IP address, netmask and gateway address

#connmanctl config wifi_000c --ipv4 manual 192.168.0.200 255.255.255.0 192.168.0.1

If you have logged in via SSH and are entering the commands remotely, the BBB will now freeze because you have already changed the IP address and so your connection is frozen.

Reboot and your connection is up on the new address.