cmd/buildlet: Basic support for linux-s390x revdial

Change-Id: Ia9889d88be2ec78168e0070f251f653e0f780904
Reviewed-on: https://go-review.googlesource.com/20220
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/cmd/buildlet/stage0/Makefile b/cmd/buildlet/stage0/Makefile
index 93738ab..759f7ab 100644
--- a/cmd/buildlet/stage0/Makefile
+++ b/cmd/buildlet/stage0/Makefile
@@ -13,3 +13,7 @@
 buildlet-stage0.linux-amd64-kube: stage0.go
 	GOOS=linux GOARCH=amd64 go build -o $@
 	cat $@ | (cd ../../upload && go run upload.go --public --cacheable=false go-builder-data/$@)
+
+buildlet-stage0.linux-s390x: stage0.go
+	GOOS=linux GOARCH=s390x go build -o $@
+	cat $@ | (cd ../../upload && go run upload.go --public --cacheable=false go-builder-data/$@)
diff --git a/cmd/buildlet/stage0/stage0.go b/cmd/buildlet/stage0/stage0.go
index a6cbf4f..0585bc4 100644
--- a/cmd/buildlet/stage0/stage0.go
+++ b/cmd/buildlet/stage0/stage0.go
@@ -72,11 +72,23 @@
 	if onScaleway {
 		cmd.Args = append(cmd.Args, scalewayBuildletArgs()...)
 	}
+	if runtime.GOOS == "linux" && runtime.GOARCH == "s390x" {
+		cmd.Args = append(cmd.Args, s390xBuildletArgs()...)
+	}
 	if err := cmd.Run(); err != nil {
 		sleepFatalf("Error running buildlet: %v", err)
 	}
 }
 
+func s390xBuildletArgs() []string {
+	return []string{
+		"--halt=false",
+		"--workdir=/data/golang/workdir",
+		"--reverse=linux-s390x-ibm",
+		"--coordinator=farmer.golang.org:443",
+	}
+}
+
 func scalewayBuildletArgs() []string {
 	var modes []string // e.g. "linux-arm", "linux-arm-arm5"
 	// tags are of form "buildkey_linux-arm_HEXHEXHEX"