diff --git a/docker/scripts/0001-Disable-compiler-optimizations-and-inlining.patch b/docker/scripts/0001-Disable-compiler-optimizations-and-inlining.patch new file mode 100644 index 000000000..3009320db --- /dev/null +++ b/docker/scripts/0001-Disable-compiler-optimizations-and-inlining.patch @@ -0,0 +1,25 @@ +From 9bb7f70eb442b0bae3a3508b119b17e04b127630 Mon Sep 17 00:00:00 2001 +From: Levente Liu +Date: Thu, 23 May 2019 10:56:58 +0000 +Subject: [PATCH] Disable compiler optimizations and inlining + +--- + meta/classes/go.bbclass | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass +index 09b01a8..76f6d81 100644 +--- a/meta/classes/go.bbclass ++++ b/meta/classes/go.bbclass +@@ -40,7 +40,7 @@ GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${GO_RPATH_LINK} ${LDFLAGS + GO_LINKMODE ?= "" + GO_LINKMODE_class-nativesdk = "--linkmode=external" + GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} -extldflags '${GO_EXTLDFLAGS}'"' +-export GOBUILDFLAGS ?= "-v ${GO_LDFLAGS}" ++export GOBUILDFLAGS ?= "-v -gcflags='-N -l' ${GO_LDFLAGS}" + export GOPTESTBUILDFLAGS ?= "${GOBUILDFLAGS} -c" + export GOPTESTFLAGS ?= "-test.v" + GOBUILDFLAGS_prepend_task-compile = "${GO_PARALLEL_BUILD} " +-- +1.9.1 + diff --git a/docker/scripts/build.sh b/docker/scripts/build.sh new file mode 100755 index 000000000..687e548dc --- /dev/null +++ b/docker/scripts/build.sh @@ -0,0 +1,29 @@ +#! /usr/bin/env bash +set -eo pipefail + +main() { + local workspace=/home/work/yocto + mkdir -p "$workspace" + cd "$workspace" + + repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-rocko -m imx-4.9.88-2.0.0_ga.xml + repo sync + + sed -i 's/^EULA_ACCEPTED=$/EULA_ACCEPTED=1/' "$workspace/sources/base/setup-environment" + source ./fsl-setup-release.sh + + # Patch go bbclass + cd "$workspace/sources/poky" + git apply /home/work/0001-Disable-compiler-optimizations-and-inlining.patch + + # Patch repo and add covenantsql layer + git clone https://github.com/CovenantSQL/meta-covenantsql.git "$workspace/sources/meta-covenantsql" + echo 'ACCEPT_FSL_EULA = "1"' >>"$workspace/build/conf/local.conf" + echo 'BBLAYERS += " ${BSPDIR}/sources/meta-covenantsql"' >>"$workspace/build/conf/bblayers.conf" + echo 'IMAGE_INSTALL_append = "cql-minerd cql cqld"' >>"$workspace/build/conf/local.conf" + + cd "$workspace" + bitbake core-image-base +} + +main "$@" diff --git a/docker/scripts/init.sh b/docker/scripts/init.sh new file mode 100755 index 000000000..5f2f147b9 --- /dev/null +++ b/docker/scripts/init.sh @@ -0,0 +1,95 @@ +#! /usr/bin/env bash +set -euo pipefail + +config_packages() { + apt-get update + apt-get install -y apt-transport-https + cat >/etc/apt/sources.list <>/etc/sudoers + + mv /root/scripts/build.sh /home/work/ + mv /root/scripts/0001-Disable-compiler-optimizations-and-inlining.patch /home/work + chown -R work:work /home/work +} + +config_locale() { + locale-gen en_US.UTF-8 + update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 + dpkg-reconfigure --frontend=noninteractive locales +} + +main() { + if [[ $UID != 0 ]]; then + >&2 echo "Must run as root" + return 1 + fi + config_packages + config_user + config_locale +} + +main "$@" diff --git a/docker/yocto-builder.Dockerfile b/docker/yocto-builder.Dockerfile new file mode 100644 index 000000000..3d7c19aa2 --- /dev/null +++ b/docker/yocto-builder.Dockerfile @@ -0,0 +1,16 @@ +# Stage: builder +FROM ubuntu:14.04 + +COPY ./docker/scripts /root/scripts +RUN /root/scripts/init.sh + +USER work +WORKDIR /home/work +ENV LC_ALL=en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US.UTF-8 +ENV DISTRO=fsl-imx-wayland +ENV MACHINE=imx7ulpevk +RUN ./build.sh + +CMD "/bin/bash" diff --git a/vendor/github.com/ugorji/go/codec/encode.go b/vendor/github.com/ugorji/go/codec/encode.go index 8462440c3..e4df612a0 100644 --- a/vendor/github.com/ugorji/go/codec/encode.go +++ b/vendor/github.com/ugorji/go/codec/encode.go @@ -364,9 +364,11 @@ func (z *bufioEncWriter) writestr(s string) { // z.writeb(bytesView(s)) // inlined below LOOP: a := len(z.buf) - z.n + fmt.Printf("copying %s to buffer: len=%d, n=%d, a=%d\n", s, len(z.buf), z.n, a) if len(s) > a { z.n += copy(z.buf[z.n:], s[:a]) s = s[a:] + fmt.Printf("copying %s to buffer result: n=%d\n", s, len(z.buf), z.n) z.flush() goto LOOP }