build/env: add cross compile toolchain for armhf

Moved arm to armel, if anyone wants that in the future.

Change-Id: I57db5c8dff12c02cd2ceb4bd657d5fa63040985c
Reviewed-on: https://go-review.googlesource.com/29684
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Jess Frazelle 2016-09-23 15:41:49 -07:00 коммит произвёл Brad Fitzpatrick
Родитель a0418082eb
Коммит c727f25d9b
6 изменённых файлов: 81 добавлений и 1 удалений

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -1,2 +1,2 @@
The docker image created from this directory can be used to cross compile go
from linux/amd64 to linux/arm.
from linux/amd64 to linux/armel.

53
env/crosscompile/linux-armhf-stretch/Dockerfile поставляемый Normal file
Просмотреть файл

@ -0,0 +1,53 @@
# Copyright 2016 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# Linux builder VM running Debian stretch (i.e. Debian testing)
# Docker tag gobuilders/linux-armhf-stretch
FROM debian:stretch
MAINTAINER golang-dev <golang-dev@googlegroups.com>
ENV DEBIAN_FRONTEND noninteractive
# curl: for getting and unpacking Go 1.4 source
# git-core: for interacting with the Go source & subrepos
# gcc, libc-dev: for building Go's bootstrap 'dist' prog
# gcc-armhf-linux-gnu, libc6-dev-armhf-cross: for armhf builds
# linux-libc-dev(armhf): for asm/errno.h
# procps, lsof, psmisc: misc tools
RUN dpkg --add-architecture armhf \
&& apt-get update && apt-get install -y \
bzip2 \
ca-certificates \
curl \
git-core \
gcc \
libc6-dev \
gcc-arm-linux-gnueabihf \
libc6-dev-armhf-cross \
linux-libc-dev:armhf \
procps \
lsof \
psmisc \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /go1.4-amd64 \
&& ( \
curl --silent https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz | tar -C /go1.4-amd64 -zxv \
) \
&& mv /go1.4-amd64/go /go1.4 \
&& rm -rf /go1.4-amd64 \
&& rm -rf /go1.4/pkg/linux_amd64_race \
/go1.4/api \
/go1.4/blog \
/go1.4/doc \
/go1.4/misc \
/go1.4/test \
&& find /go1.4 -type d -name testdata | xargs rm -rf
RUN curl -o /usr/local/bin/stage0 https://storage.googleapis.com/go-builder-data/buildlet-stage0.linux-amd64-kube \
&& chmod +x /usr/local/bin/stage0
ENV GOROOT_BOOTSTRAP=/go1.4 GOOS=linux GOARCH=arm CC_FOR_TARGET=arm-linux-gnueabihf-gcc

25
env/crosscompile/linux-armhf-stretch/Makefile поставляемый Normal file
Просмотреть файл

@ -0,0 +1,25 @@
# Copyright 2016 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
IMAGE_NAME=$(shell basename $(CURDIR))
STAGING_REPO=gcr.io/go-dashboard-dev
PROD_REPO=gcr.io/symbolic-datum-552
usage:
echo "Use staging, prod, or dev targets. For dev, specify your Docker repository with the REPO=foo argument." ; exit 1
staging: Dockerfile
docker build -t $(STAGING_REPO)/$(IMAGE_NAME):latest .
gcloud docker push $(STAGING_REPO)/$(IMAGE_NAME):latest
prod: Dockerfile
docker build -t $(PROD_REPO)/$(IMAGE_NAME):latest .
gcloud docker push $(PROD_REPO)/$(IMAGE_NAME):latest
# You must provide a REPO=your-repo-name arg when you make
# this targarget. REPO is the name of the Docker repository
# that will be prefixed to the name of the image being built.
dev: Dockerfile
docker build -t $(REPO)/$(IMAGE_NAME):latest .
gcloud docker push $(REPO)/$(IMAGE_NAME):latest

2
env/crosscompile/linux-armhf-stretch/README поставляемый Normal file
Просмотреть файл

@ -0,0 +1,2 @@
The docker image created from this directory can be used to cross compile go
from linux/amd64 to linux/armhf.