A docker-based build system for cross-compiling Go applications for ARM SoCs (like the Raspberry Pi) using Tamago.
$ go install github.com/jphastings/tbd@latest
$ cd path/to/go/app
$ tbd
Usage: tbd <target-device> [output-path] [path-to-main-package]
$ tbd rpi /Volumes/sd-card cmd/app-name
rpi: Pulling from jphastings/tbd
Status: Image is up to date for jphastings/tbd:rpi
=> Downloading RPi firmware:
LICENCE.broadcom, bootcode.bin, fixup.dat, start.elf
=> Building Go Application
go: downloading github.com/f-secure-foundry/tamago v0.0.0-20210601073428-3d51445fa773
=> Preparing kernel file
=> Build successful!
The tbd
program is a purpose-built docker client which pulls and runs the tamago-build docker image for the specified target with the appropriate arguments.
The tamago-build docker images are specific to each build target (currently only rpi
exists). They use tamago-go to compile the given Go application for ARM SoCs, using multiarch/crossbuild for cross compilation tooling to provide the kernel and boot files needed for the built output to Just Work™.
Potential improvements:
- Add Dockerfiles for the other supported hardware
- Use a different image for cross-compilation tooling (multiarch/crossbuild is large)