From 9a4257b5a0dd8fbabd4881483d10b877cac5edfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20G=C3=BCnzler?= Date: Mon, 24 Feb 2020 12:47:07 +0100 Subject: [PATCH] balena-engine: Patch out hardcoded CC for cross-compile Port of meta-virtualization/docker commit: https://git.yoctoproject.org/cgit/cgit.cgi/meta-virtualization/commit/recipes-containers/docker/docker-ce_git.bb?id=e7787cb01be91d3798594687a475d5b085f29ede Since commit applied in moby [61a3285 Support cross-compile for arm] it hardcoded var-CC to support cross-compile for arm Correct it with "${parameter:-word}" format, it is helpful for user define toolchains (Use Default Values. If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted.) https://github.com/moby/moby/commit/61a3285864d3f1b489f48f765b61b2c7bd300372 --- ...dcoded-CC-on-cross-compile-docker-ce.patch | 60 +++++++++++++++++++ .../recipes-containers/balena/balena_git.bb | 1 + 2 files changed, 61 insertions(+) create mode 100644 meta-balena-common/recipes-containers/balena/balena/0001-imporve-hardcoded-CC-on-cross-compile-docker-ce.patch diff --git a/meta-balena-common/recipes-containers/balena/balena/0001-imporve-hardcoded-CC-on-cross-compile-docker-ce.patch b/meta-balena-common/recipes-containers/balena/balena/0001-imporve-hardcoded-CC-on-cross-compile-docker-ce.patch new file mode 100644 index 0000000000..0f257f1bd9 --- /dev/null +++ b/meta-balena-common/recipes-containers/balena/balena/0001-imporve-hardcoded-CC-on-cross-compile-docker-ce.patch @@ -0,0 +1,60 @@ +From 1263fdb50a540e9db742694b7cee08284ad986d0 Mon Sep 17 00:00:00 2001 +From: Hongxu Jia +Date: Wed, 17 Jul 2019 17:34:04 +0800 +Subject: [PATCH] imporve hardcoded CC on cross compile + +Since commit applied in moby [61a3285 Support cross-compile for arm] +it hardcoded var-CC to support cross-compile for arm + +Correct it with "${parameter:-word}" format, it is helpful for user +define toolchains + +(Use Default Values. If parameter is unset or null, the expansion of +word is substituted. Otherwise, the value of parameter is substituted.) + +Upstream-Status: Submitted [https://github.com/moby/moby/pull/39546] + +Signed-off-by: Hongxu Jia +--- + hack/make/.binary | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/import/hack/make/.binary b/src/import/hack/make/.binary +index 53de6749e5..66f4ca05f3 100644 +--- a/src/import/hack/make/.binary ++++ b/src/import/hack/make/.binary +@@ -44,27 +44,27 @@ if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARC + # must be cross-compiling! + case "$(go env GOOS)/$(go env GOARCH)" in + windows/amd64) +- export CC=x86_64-w64-mingw32-gcc ++ export CC="${CC:-x86_64-w64-mingw32-gcc}" + export CGO_ENABLED=1 + ;; + linux/arm) + case "${GOARM}" in + 5|"") +- export CC=arm-linux-gnueabi-gcc ++ export CC="${CC:-arm-linux-gnueabi-gcc}" + export CGO_ENABLED=1 + ;; + 7) +- export CC=arm-linux-gnueabihf-gcc ++ export CC="${CC:-arm-linux-gnueabihf-gcc}" + export CGO_ENABLED=1 + ;; + esac + ;; + linux/arm64) +- export CC=aarch64-linux-gnu-gcc ++ export CC="${CC:-aarch64-linux-gnu-gcc}" + export CGO_ENABLED=1 + ;; + linux/amd64) +- export CC=x86_64-linux-gnu-gcc ++ export CC="${CC:-x86_64-linux-gnu-gcc}" + export CGO_ENABLED=1 + ;; + esac +-- +2.23.0 diff --git a/meta-balena-common/recipes-containers/balena/balena_git.bb b/meta-balena-common/recipes-containers/balena/balena_git.bb index c54d865499..6f31c8e139 100644 --- a/meta-balena-common/recipes-containers/balena/balena_git.bb +++ b/meta-balena-common/recipes-containers/balena/balena_git.bb @@ -25,6 +25,7 @@ SRC_URI = "\ file://var-lib-docker.mount \ file://balena.conf.systemd \ file://balena-tmpfiles.conf \ + file://0001-imporve-hardcoded-CC-on-cross-compile-docker-ce.patch \ " S = "${WORKDIR}/git"