Skip to content
This repository has been archived by the owner on May 30, 2018. It is now read-only.

Commit

Permalink
Add bootstrapping ARM64 on ARMv7
Browse files Browse the repository at this point in the history
  • Loading branch information
DieterReuter committed Jan 2, 2016
1 parent e6313c9 commit 2e6ad1b
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
*.tar.gz
*.tbz
*.log
26 changes: 26 additions & 0 deletions README.md
Expand Up @@ -176,6 +176,30 @@ docker run --rm golang-builder tar cf - go1.4.3.linux-armv7.tar.gz | tar xvf -
```


## How to bootstrap a GOLANG 1.5 tarball for ARM64 and PPC64
As there is no Go 1.4 support for ARM64 or PPC64 available, the process to compile
Go 1.5 on these platforms is a little bit different. But luckily Dave Cheney provided
an easy to follow tutorial how to bootstrap a Go 1.5.1 tarball on OSX or Intel Linux.
As we are working mostly on ARM, we just used the same steps on an ARMv7 machine.

### 1. Create a bootstrap tarball for ARM64 on an ARMv7 machine
Everything is available as a shell script, so it's damn easy to reproduce. But you
can find the generated bootstrap tarball for ARM64 as well as the log file from
this script in the release section.
```
time ./bootstrap-tarball-go1.5.1-arm64.sh | tee bootstrap-tarball-go1.5.1-arm64.log
```
```
ls -al *arm64*
-rw-rw-r-- 1 ubuntu ubuntu 11917 Jan 2 15:20 bootstrap-tarball-go1.5.1-arm64.log
-rwxrwxr-x 1 ubuntu ubuntu 1353 Jan 2 15:08 bootstrap-tarball-go1.5.1-arm64.sh
-rw-rw-r-- 1 ubuntu ubuntu 45354608 Jan 2 15:20 go-linux-arm64-bootstrap.tbz
```

### 2. Use the bootstrap tarball on an ARM64 machine to create a pre-compiled GOLANG 1.5 tarball
WIP


## Known issues
On Scaleway one of the GOLANG tests are already failing:
```
Expand All @@ -190,6 +214,7 @@ This failure seems to be already documented in https://github.com/golang/go/issu
## TODO
- [x] include the standard GOLANG tests for all builds
- [x] run builds for ARMv5, ARMv6 and ARMv7
- [ ] run builds for ARM64 (aka Aarch64)
- [ ] automate builds via CI/CD (travis or circle-ci)
- [ ] cleanup README.md
- [x] detailed documentation for building GOLANG from scratch, see http://blog.hypriot.com/post/how-to-compile-go-on-arm/
Expand All @@ -202,6 +227,7 @@ This failure seems to be already documented in https://github.com/golang/go/issu
- Cross compile, http://dave.cheney.net/2015/08/22/cross-compilation-with-go-1-5 by Dave Cheney
- Unofficial ARM tarballs for Go, http://dave.cheney.net/unofficial-arm-tarballs by Dave Cheney
- Issue golang/go/#13066: build: provide ARM release binaries?, https://github.com/golang/go/issues/13066
- Bootstrapping Go 1.5 on non Intel platforms, http://dave.cheney.net/2015/10/16/bootstrapping-go-1-5-on-non-intel-platforms by Dave Cheney


# Acknowledgements
Expand Down
42 changes: 42 additions & 0 deletions bootstrap-tarball-go1.5.1-arm64.sh
@@ -0,0 +1,42 @@
#!/bin/bash
set -ex

# log infos about Linux kernel, OS system release and gcc version
uname -a
cat /etc/*release
gcc --version

# we need this env var for the Go 1.5.x bootstrap build process
GOROOT_BOOTSTRAP=$HOME/go1.5

# install a pre-compiled Go 1.5.x tarball to bootstrap
GO_BOOTSTRAP_GOARM=${GO_BOOTSTRAP_GOARM:-7}
GO_BOOTSTRAP_VERSION=${GO_BOOTSTRAP_VERSION:-1.5.1}
rm -fr "$GOROOT_BOOTSTRAP"
mkdir -p "$GOROOT_BOOTSTRAP"
curl -sSL "https://github.com/hypriot/golang-armbuilds/releases/download/v${GO_BOOTSTRAP_VERSION}/go${GO_BOOTSTRAP_VERSION}.linux-armv${GO_BOOTSTRAP_GOARM}.tar.gz" | tar xz -C "$GOROOT_BOOTSTRAP" --strip-components=1

# clone Go 1.5.x source
GO_VERSION=${GO_VERSION:-1.5.1}
rm -fr $HOME/go
git clone https://go.googlesource.com/go $HOME/go

# now compile Go 1.5.x and package it as a tarball
pushd $HOME/go/src
git checkout release-branch.go1.5
echo "Bootstrap Go for linux/arm64."
rm -fr ../../go-linux-arm64-bootstrap
time GOROOT_BOOTSTRAP=$HOME/go1.5 GOOS=linux GOARCH=arm64 ./bootstrap.bash 2>&1
#echo "Bootstrap Go for linux/ppc64"
#rm -fr ../../go-linux-ppc64-bootstrap
#time GOROOT_BOOTSTRAP=$HOME/go1.5 GOOS=linux GOARCH=ppc64 ./bootstrap.bash 2>&1
cd ../..
pwd
ls -al go-linux-*-bootstrap.tbz
popd
mv $HOME/go-linux-*-bootstrap.tbz .

# cleanup
rm -fr $HOME/go
rm -fr $HOME/go1.5
rm -fr $HOME/go-linux-*-bootstrap

0 comments on commit 2e6ad1b

Please sign in to comment.