1
0
mirror of https://github.com/rancher/os.git synced 2025-07-05 19:16:13 +00:00
os/scripts/mk-ros.sh
Ivan Mikushin 356f25be20 cross-build is back
`HOST_ARCH=arm64 ./make.sh minimal` builds vmlinuz and initrd for arm64 on arm64 (sourcing .docker-env.arm64 in the process)
`ARCH=arm ./make.sh rootfs` builds rootfs.tar.gz for arm on your current docker environment
2016-03-15 09:01:10 -07:00

20 lines
524 B
Bash
Executable File

#!/bin/bash
set -ex
ros="$1"
ARCH=${ARCH:?"ARCH not set"}
VERSION=${VERSION:?"VERSION not set"}
cd $(dirname $0)/..
strip_bin=$(which strip)
[ "${ARCH}" == "arm" ] && export GOARM=6
if [ "${TOOLCHAIN}" != "" ]; then
export CC=/usr/bin/${TOOLCHAIN}-gcc
export CGO_ENABLED=1
strip_bin=/usr/${TOOLCHAIN}/bin/strip
fi
GOARCH=${ARCH} go build -tags netgo -installsuffix netgo -ldflags "-X github.com/rancher/os/config.VERSION=${VERSION} -linkmode external -extldflags -static" -o ${ros}
${strip_bin} --strip-all ${ros}