aboutsummaryrefslogtreecommitdiff
path: root/go/chromeos
diff options
context:
space:
mode:
Diffstat (limited to 'go/chromeos')
-rwxr-xr-xgo/chromeos/build_go45
-rwxr-xr-xgo/chromeos/go_daisy11
-rwxr-xr-xgo/chromeos/go_daisy_exec10
-rwxr-xr-xgo/chromeos/go_panther11
-rwxr-xr-xgo/chromeos/go_panther_exec10
-rwxr-xr-xgo/chromeos/go_x86-zgb11
-rwxr-xr-xgo/chromeos/go_x86-zgb_exec10
-rwxr-xr-xgo/chromeos/target_cp28
-rwxr-xr-xgo/chromeos/target_sh11
-rwxr-xr-xgo/chromeos/target_tmpdir5
10 files changed, 152 insertions, 0 deletions
diff --git a/go/chromeos/build_go b/go/chromeos/build_go
new file mode 100755
index 00000000..cb882eaf
--- /dev/null
+++ b/go/chromeos/build_go
@@ -0,0 +1,45 @@
+#!/bin/bash
+set -e -o pipefail
+
+# This script builds the go cross compilers for ChromeOS targets.
+#
+# Usage: build_go
+#
+# It assumes that the "x86_64-cros-linux-gnu" toolchain is already installed.
+# It assumes that the "i686-pc-linux-gnu" toolchain is already installed.
+# It assumes that the "armv7a-cros-linux-gnueabi" toolchain is already installed.
+
+if [[ ! -e "make.bash" && -e "src/make.bash" ]]
+then
+ cd src
+fi
+
+# Build the Go toolchain for amd64 targets.
+GOOS="linux" GOARCH="amd64" CGO_ENABLED="1" \
+ CC_FOR_TARGET="x86_64-cros-linux-gnu-gcc" \
+ CXX_FOR_TARGET="x86_64-cros-linux-gnu-g++" \
+ ./make.bash --no-clean
+GOOS="linux" GOARCH="amd64" CGO_ENABLED="1" \
+ CC="x86_64-cros-linux-gnu-gcc" \
+ CXX="x86_64-cros-linux-gnu-g++" \
+ ../bin/go install -v -buildmode=pie std
+
+# Build the Go toolchain for 386 targets.
+GOOS="linux" GOARCH="386" CGO_ENABLED="1" \
+ CC_FOR_TARGET="i686-pc-linux-gnu-gcc" \
+ CXX_FOR_TARGET="i686-pc-linux-gnu-g++" \
+ ./make.bash --no-clean
+GOOS="linux" GOARCH="386" CGO_ENABLED="1" \
+ CC="i686-pc-linux-gnu-gcc" \
+ CXX="i686-pc-linux-gnu-g++" \
+ ../bin/go install -v -buildmode=pie std
+
+# Build the Go toolchain for arm targets.
+GOOS="linux" GOARCH="arm" CGO_ENABLED="1" \
+ CC_FOR_TARGET="armv7a-cros-linux-gnueabi-gcc" \
+ CXX_FOR_TARGET="armv7a-cros-linux-gnueabi-g++" \
+ ./make.bash --no-clean
+GOOS="linux" GOARCH="arm" CGO_ENABLED="1" \
+ CC="armv7a-cros-linux-gnueabi-gcc" \
+ CXX="armv7a-cros-linux-gnueabi-g++" \
+ ../bin/go install -v -buildmode=pie std
diff --git a/go/chromeos/go_daisy b/go/chromeos/go_daisy
new file mode 100755
index 00000000..db4a95ac
--- /dev/null
+++ b/go/chromeos/go_daisy
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+# Invoke the Go cross compiler for daisy.
+# Uses ../go_target to add PIE flags.
+#
+# This is just an example for an arm board.
+
+GOOS="linux" GOARCH="arm" CGO_ENABLED="1" \
+ CC="armv7a-cros-linux-gnueabi-gcc" \
+ CXX="armv7a-cros-linux-gnueabi-g++" \
+ exec go_target "$@"
diff --git a/go/chromeos/go_daisy_exec b/go/chromeos/go_daisy_exec
new file mode 100755
index 00000000..3b9a63dd
--- /dev/null
+++ b/go/chromeos/go_daisy_exec
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# Copy and remotely execute a binary on the daisy device.
+#
+# For this to work, the corresponding entry must exist in
+# ~/.ssh/config and the device must already be setup for
+# password-less authentication. See setup instructions at
+# http://go/chromeos-toolchain-team/go-toolchain
+
+GOOS="linux" GOARCH="arm" exec go_target_exec daisy "$@"
diff --git a/go/chromeos/go_panther b/go/chromeos/go_panther
new file mode 100755
index 00000000..5c06f432
--- /dev/null
+++ b/go/chromeos/go_panther
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+# Invoke the Go cross compiler for panther.
+# Uses ../go_target to add PIE flags.
+#
+# This is just an example for an amd64 board.
+
+GOOS="linux" GOARCH="amd64" CGO_ENABLED="1" \
+ CC="x86_64-cros-linux-gnu-gcc" \
+ CXX="x86_64-cros-linux-gnu-g++" \
+ exec go_target "$@"
diff --git a/go/chromeos/go_panther_exec b/go/chromeos/go_panther_exec
new file mode 100755
index 00000000..64f77b1f
--- /dev/null
+++ b/go/chromeos/go_panther_exec
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# Copy and remotely execute a binary on the panther device.
+#
+# For this to work, the corresponding entry must exist in
+# ~/.ssh/config and the device must already be setup for
+# password-less authentication. See setup instructions at
+# http://go/chromeos-toolchain-team/go-toolchain
+
+GOOS="linux" GOARCH="amd64" exec go_target_exec panther "$@"
diff --git a/go/chromeos/go_x86-zgb b/go/chromeos/go_x86-zgb
new file mode 100755
index 00000000..272efb58
--- /dev/null
+++ b/go/chromeos/go_x86-zgb
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+# Invoke the Go cross compiler for x86-zgb.
+# Uses ../go_target to add PIE flags.
+#
+# This is just an example for an 386 board.
+
+GOOS="linux" GOARCH="386" CGO_ENABLED="1" \
+ CC="i686-pc-linux-gnu-gcc" \
+ CXX="i686-pc-linux-gnu-g++" \
+ exec go_target "$@"
diff --git a/go/chromeos/go_x86-zgb_exec b/go/chromeos/go_x86-zgb_exec
new file mode 100755
index 00000000..b0341f21
--- /dev/null
+++ b/go/chromeos/go_x86-zgb_exec
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# Copy and remotely execute a binary on the x86-zgb device.
+#
+# For this to work, the corresponding entry must exist in
+# ~/.ssh/config and the device must already be setup for
+# password-less authentication. See setup instructions at
+# http://go/chromeos-toolchain-team/go-toolchain
+
+GOOS="linux" GOARCH="386" exec go_target_exec x86-zgb "$@"
diff --git a/go/chromeos/target_cp b/go/chromeos/target_cp
new file mode 100755
index 00000000..6df476e6
--- /dev/null
+++ b/go/chromeos/target_cp
@@ -0,0 +1,28 @@
+#!/bin/bash
+set -e -o pipefail
+
+# Copy a file or directory to the target ChromeOS device.
+#
+# Usage: target_cp <src> <target>:<dest>
+
+src="$1"
+shift
+
+targetdest="$1"
+shift
+
+target="${targetdest%:*}"
+dest="${targetdest#*:}"
+
+if [[ -z "${src}" || -z "${target}" || -z "${dest}" || "${targetdest}" != "${target}:${dest}" || -n "$*" ]]
+then
+ echo "Usage: target_cp <src> <target>:<dest>"
+ exit 1
+fi
+
+if [[ -d ${src} ]]
+then
+ scp -rq ${src} ${target}:${dest}
+else
+ scp -q ${src} ${target}:${dest}
+fi
diff --git a/go/chromeos/target_sh b/go/chromeos/target_sh
new file mode 100755
index 00000000..43c5fac6
--- /dev/null
+++ b/go/chromeos/target_sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+set -e -o pipefail
+
+# Run a command on the target ChromeOS device.
+#
+# Usage: target_sh <cmd> <args>...
+
+target="$1"
+shift
+
+ssh ${target} "$*"
diff --git a/go/chromeos/target_tmpdir b/go/chromeos/target_tmpdir
new file mode 100755
index 00000000..382a0334
--- /dev/null
+++ b/go/chromeos/target_tmpdir
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+# Temporary directory to be used on ChromeOS devices.
+
+echo "/tmp"