sh 用于为NTC CHIP和PocketCHIP或任何其他arm 7设备构建golang 1.9的Bash脚本。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 用于为NTC CHIP和PocketCHIP或任何其他arm 7设备构建golang 1.9的Bash脚本。相关的知识,希望对你有一定的参考价值。

#!/bin/bash
#######################
# Downloads and builds golang.
# Does not install godoc, you may want to `go get` that after install.

# To install:
#   sudo tar -C /usr/local -xzfv go1.9.linux-arm7.tar.gz
#   export PATH=$PATH:/usr/local/go/bin

# If you are on a CHIP Pro and don't have room for the archive and it's contents:
#   cat go1.9.linux-arm7.tar.gz | ssh -t chip@chip.local "tar xzfv - -C ~/"
#   login and move ~/go to /usr/local/


REPO="https://go.googlesource.com/go"
BRANCH="go1.9"

_GOBIN="$(which go)"
if [ "$(uname)" == "Darwin" ]; then
    export GOROOT_BOOTSTRAP="$(readlink -n ${_GOBIN}|sed 's/bin\/go//g')"
else
    export GOROOT_BOOTSTRAP="$(readlink -f ${_GOBIN}|sed 's/bin\/go//g')"
fi
export GOOS="linux"                  # Target OS
export GOARCH="arm"                  # Target arch
export GOARM="7"                     # Target Floating point version (VFPv3)
export GOROOT_FINAL="/usr/local/go/"
export GO_BUILDROOT="$BRANCH.$GOOS-$GOARCH$GOARM"

echo
echo "#######################"
echo "# Options"
echo "#######################"
printenv|grep GO

if [ ! -d "go/" ]; then
  echo
  echo "#######################"
  echo "# Fetching go src"
  echo "#######################"
  git clone ${REPO}
fi

echo
echo "#######################"
echo "# Verifying branch"
echo "#######################"
cd go
git checkout $BRANCH
cd src

echo
echo "#######################"
echo "# Building go"
echo "#######################"
# Build golang
./make.bash
cd ../../

echo
echo "#######################"
echo "# Setting up buildroot"
echo "#######################"
if [ ! -d $GO_BUILDROOT/go/ ]; then
  mkdir -p $GO_BUILDROOT/go/api
  mkdir -p $GO_BUILDROOT/go/bin
  #  mkdir -p $GO_BUILDROOT/go/blog # No.
  mkdir -p $GO_BUILDROOT/go/doc
  mkdir -p $GO_BUILDROOT/go/lib
  mkdir -p $GO_BUILDROOT/go/misc
  mkdir -p $GO_BUILDROOT/go/pkg
  mkdir -p $GO_BUILDROOT/go/src
  mkdir -p $GO_BUILDROOT/go/test
fi

rsync -av --progress go/api  $GO_BUILDROOT/go/
rsync -av --progress go/doc  $GO_BUILDROOT/go/
rsync -av --progress go/lib  $GO_BUILDROOT/go/
rsync -av --progress go/misc $GO_BUILDROOT/go/
rsync -av --progress go/test $GO_BUILDROOT/go/
rsync -av --progress go/src $GO_BUILDROOT/go/
rsync -av --progress go/pkg  $GO_BUILDROOT/go/ --exclude '*linux_amd64*' --exclude '*bootstrap*'
rsync -av --progress go/bin/linux_arm/  $GO_BUILDROOT/go/bin/
rsync -av --progress go/{AUTHORS,CONTRIBUTORS,CONTRIBUTING.md,favicon.ico,LICENSE,PATENTS,README.md,robots.txt,VERSION} $GO_BUILDROOT/go/

echo
echo "#######################"
echo "# Building Archive"
echo "#######################"
tar -czvf $GO_BUILDROOT.tar.gz -C $GO_BUILDROOT go/

echo "Done."

以上是关于sh 用于为NTC CHIP和PocketCHIP或任何其他arm 7设备构建golang 1.9的Bash脚本。的主要内容,如果未能解决你的问题,请参考以下文章

Pocketchip安装Love2D(最新11.3)折腾分享[成功]

NTC温度采集之数据拟合——freemat软件实现

电池中的NTC电阻是啥电阻

温度传感器的AD值,电压和电阻的计算方法

NTC热敏电阻目前常用的采用电桥和单片机测量方法

电源bat ntc cnd分别是啥意思