Received: from 9.mo177.mail-out.ovh.net (9.mo177.mail-out.ovh.net [46.105.72.238]) by mx.groups.io with SMTP id smtpd.web09.4187.1606255542607447565 for ; Tue, 24 Nov 2020 14:05:43 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=softfail (domain: 3mdeb.com, ip: 46.105.72.238, mailfrom: maciej.pijanowski@3mdeb.com) Received: from player787.ha.ovh.net (unknown [10.108.57.178]) by mo177.mail-out.ovh.net (Postfix) with ESMTP id 4C1EA139836 for ; Tue, 24 Nov 2020 23:05:40 +0100 (CET) Received: from 3mdeb.com (89-66-159-90.dynamic.chello.pl [89.66.159.90]) (Authenticated sender: maciej.pijanowski@3mdeb.com) by player787.ha.ovh.net (Postfix) with ESMTPSA id 7571818AC67D2; Tue, 24 Nov 2020 22:05:38 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-104R005fbb7154c-2f75-41a3-9233-0baf61f07cb2, BC82A14BF08680DC96B4491CA353477796433981) smtp.auth=maciej.pijanowski@3mdeb.com Subject: Re: [meta-virtualization][PATCH] balena-engine: add recipe To: Bruce Ashfield Cc: meta-virtualization@lists.yoctoproject.org References: <20201124172012.318030-1-maciej.pijanowski@3mdeb.com> From: "Maciej Pijanowski" Message-ID: Date: Tue, 24 Nov 2020 23:05:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: X-Ovh-Tracer-Id: 9489928839925673649 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedujedrudegkedgudehlecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefuvfhfhffkffgfgggjtgesrgdtreertdefjeenucfhrhhomhepofgrtghivghjucfrihhjrghnohifshhkihcuoehmrggtihgvjhdrphhijhgrnhhofihskhhiseefmhguvggsrdgtohhmqeenucggtffrrghtthgvrhhnpeefiedutedvjeekjeehhefgueffuedvheetgffghfdtjeejkeegvdeiveegieejudenucffohhmrghinhephihotghtohhprhhojhgvtghtrdhorhhgpdgsrghlvghnrgdqvghnghhinhgvpghgihhtrdgssgdpghhithhhuhgsrdgtohhmpdgsrghlvghnrgdrihhopdefmhguvggsrdgtohhmnecukfhppedtrddtrddtrddtpdekledrieeirdduheelrdeltdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehplhgrhigvrhejkeejrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepmhgrtghivghjrdhpihhjrghnohifshhkihesfehmuggvsgdrtghomhdprhgtphhtthhopehmvghtrgdqvhhirhhtuhgrlhhiiigrthhiohhnsehlihhsthhsrdihohgtthhophhrohhjvggtthdrohhrgh Content-Type: multipart/alternative; boundary="------------9FBFCCA8362BF4BFABAD76DB" Content-Language: en-US --------------9FBFCCA8362BF4BFABAD76DB Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 24.11.2020 19:03, Bruce Ashfield wrote: > > > On Tue, Nov 24, 2020 at 12:20 PM Maciej Pijanowski > > wrote= : > > As explained in [1], I have created the balena-engine recipe which > could be > used in "regular" Yocto/OE builds (outside of the balenaOS). The > recipe is mostly a copy of the original recipe from meta-balena, > stripped from the balenaOS-specific parts so it can be compiled and > build outside of it. This recipe was tested at build and runtime > on the dunfell release on two targets: RPi4 and qemux86-64. > > > Thanks for the contribution, it is most appreciated. The recipe > unfortunately raises some concerns ..and something that we can work > through. > =C2=A0 > > > [1] https://lists.yoctoproject.org/g/meta-virtualization/message/591= 3 > > Signed-off-by: Maciej Pijanowski > > --- > =C2=A0...dcoded-CC-on-cross-compile-docker-ce.patch |=C2=A0 60 +++++= ++ > =C2=A0.../balena-engine/balena-tmpfiles.conf=C2=A0 =C2=A0 =C2=A0 =C2= = =A0 |=C2=A0 =C2=A02 + > =C2=A0.../balena-engine/balena-engine_git.bb > =C2=A0 =C2=A0 =C2=A0 =C2=A0 | 159 +++++= +++++++++++++ > =C2=A03 files changed, 221 insertions(+) > =C2=A0create mode 100644 > recipes-containers/balena-engine/balena-engine/0001-imporve-hardcode= d-CC-on-cross-compile-docker-ce.patch > =C2=A0create mode 100644 > recipes-containers/balena-engine/balena-engine/balena-tmpfiles.conf > =C2=A0create mode 100644 > recipes-containers/balena-engine/balena-engine_git.bb > > > diff --git > a/recipes-containers/balena-engine/balena-engine/0001-imporve-hardco= ded-CC-on-cross-compile-docker-ce.patch > b/recipes-containers/balena-engine/balena-engine/0001-imporve-hardco= ded-CC-on-cross-compile-docker-ce.patch > new file mode 100644 > index 000000000000..0f257f1bd964 > --- /dev/null > +++ > b/recipes-containers/balena-engine/balena-engine/0001-imporve-hardco= ded-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.=C2=A0 If parameter is unset or null, the expan= sion of > +word is substituted.=C2=A0 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)" !=3D > "$(go env GOHOSTOS)/$(go env GOHOSTARC > +=C2=A0 =C2=A0 =C2=A0 =C2=A0# must be cross-compiling! > +=C2=A0 =C2=A0 =C2=A0 =C2=A0case "$(go env GOOS)/$(go env GOARCH)" i= n > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0windows/amd6= 4) > +-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 export CC=3Dx86_64-w64-mingw32-gcc > ++=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 export CC=3D"${CC:-x86_64-w64-mingw32-gcc}" > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0export CGO_ENABLED=3D1 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0;; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0linux/arm) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0case "${GOARM}" in > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A05|"") > +-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 export CC=3Darm-linux-gnueabi-gcc > ++=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0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0 =C2=A0 =C2=A0esac > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0;; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0linux/arm64) > +-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 export CC=3Daarch64-linux-gnu-gcc > ++=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 export CC=3D"${CC:-aarch64-linux-gnu-gcc}" > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0export CGO_ENABLED=3D1 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0;; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0linux/amd64) > +-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 export CC=3Dx86_64-linux-gnu-gcc > ++=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= = =A0 =C2=A0 export CC=3D"${CC:-x86_64-linux-gnu-gcc}" > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0export CGO_ENABLED=3D1 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0;; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0esac > +-- > +2.23.0 > diff --git > a/recipes-containers/balena-engine/balena-engine/balena-tmpfiles.con= f > b/recipes-containers/balena-engine/balena-engine/balena-tmpfiles.con= f > new file mode 100644 > index 000000000000..548a25d3ae49 > --- /dev/null > +++ > b/recipes-containers/balena-engine/balena-engine/balena-tmpfiles.con= f > @@ -0,0 +1,2 @@ > +L=C2=A0 =C2=A0 =C2=A0 /run/docker.pid -=C2=A0 =C2=A0 =C2=A0 =C2=A0-= = =C2=A0 =C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 =C2= =A0 > =C2=A0/run/balena-engine.pid > +L=C2=A0 =C2=A0 =C2=A0 /run/balena.pid -=C2=A0 =C2=A0 =C2=A0 =C2=A0-= = =C2=A0 =C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 =C2= =A0 > =C2=A0/run/balena-engine.pid > diff --git a/recipes-containers/balena-engine/balena-engine_git.bb > > b/recipes-containers/balena-engine/balena-engine_git.bb > > new file mode 100644 > index 000000000000..5d78dc02350f > --- /dev/null > +++ b/recipes-containers/balena-engine/balena-engine_git.bb > > @@ -0,0 +1,159 @@ > +HOMEPAGE =3D "https://www.balena.io/" > +SUMMARY =3D "A Moby-based container engine for IoT" > +DESCRIPTION =3D "Balena is a new container engine purpose-built for > embedded \ > +and IoT use cases and compatible with Docker containers. Based on > Docker=E2=80=99s \ > +Moby Project, balena supports container deltas for 10-70x more > efficient \ > +bandwidth usage, has 3.5x smaller binaries, uses RAM and storage > more \ > +conservatively, and focuses on atomicity and durability of > container \ > +pulling." > +LICENSE =3D "Apache-2.0" > +LIC_FILES_CHKSUM =3D > "file://src/import/LICENSE;md5=3D4859e97a9c7780e77972d989f0823f28" > + > +inherit systemd go pkgconfig useradd > + > +BALENA_VERSION =3D "19.03.13-dev" > +BALENA_BRANCH=3D "master" > + > +SRCREV =3D "074a481789174b4b6fd2d706086e8ffceb72e924" > +SRC_URI =3D "\ > +=C2=A0 =C2=A0 =C2=A0 > =C2=A0git://github.com/balena-os/balena-engine.git;branch=3D${BALENA= _BRANCH};destsuffix=3Dgit/src/import > > \ > +=C2=A0 =C2=A0 =C2=A0 > =C2=A0file://0001-imporve-hardcoded-CC-on-cross-compile-docker-ce.pa= tch \ > > The fact that we have to duplicate that patch, exposes an issue. > > It comes down to the fact that we already have containerd, moby, runc, > etc, recipes. > > Having vendored copies for all of the engine variants is a problem, > and one what I'm looking to solve.=C2=A0 I can help on that front, but i= t > won't be until after I've finished getting k3s working and merged. Ok. I will start with the simpler fixes for v2 and we will go back to that= . > > See more specific comments below. > > =C2=A0 > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 file://balena-tmpfiles.conf \ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0" > + > +S =3D "${WORKDIR}/git" > + > +PV =3D "${BALENA_VERSION}+git${SRCREV}" > + > +SECURITY_CFLAGS =3D "${SECURITY_NOPIE_CFLAGS}" > +SECURITY_LDFLAGS =3D "" > + > +SYSTEMD_PACKAGES =3D "${PN}" > +SYSTEMD_SERVICE_${PN} =3D "balena-engine.service balena-engine.sock= et" > +GO_IMPORT =3D "import" > +USERADD_PACKAGES =3D "${PN}" > +GROUPADD_PARAM_${PN} =3D "-r balena-engine" > + > +DEPENDS_append_class-target =3D " systemd" > +RDEPENDS_${PN}_class-target =3D "curl util-linux iptables tini > systemd bash" > +RRECOMMENDS_${PN} +=3D "kernel-module-nf-nat > kernel-module-br-netfilter kernel-module-nf-conntrack-netlink > kernel-module-xt-masquerade kernel-module-xt-addrtype" > + > +# oe-meta-go recipes try to build go-cross-native > > > oe-meta-go shouldn't be relevant anymore .. neither should those > _remove's. > > =C2=A0 > > +DEPENDS_remove_class-native =3D "go-cross-native" > +DEPENDS_append_class-native =3D " go-native" > + > +INSANE_SKIP_${PN} +=3D "already-stripped" > + > +FILES_${PN} +=3D " \ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0/lib/systemd/system/* \ > > > /lib shouldn't be hardcoded. > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0/home/root \ > > > neither should /home/root/ > > =C2=A0 > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0/boot/init \ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0/boot/storage-driver \ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0${localstatedir} \ > +=C2=A0 =C2=A0 =C2=A0 =C2=A0" > + > +DOCKER_PKG=3D"github.com/docker/docker > " > + > +# By default no extra LDFLAGS needed when compiling mobynit > +MOBYNIT_EXTRA_LDFLAGS ??=3D "" > + > +do_configure[noexec] =3D "1" > + > +do_compile() { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0export PATH=3D${STAGING_BINDIR_NATIVE}/$= {HOST_SYS}:$PATH > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0export GOCACHE=3D"${B}/.cache" > +=C2=A0 =C2=A0 =C2=A0 =C2=A0export GOHOSTOS=3D"linux" > +=C2=A0 =C2=A0 =C2=A0 =C2=A0export GOOS=3D"linux" > +=C2=A0 =C2=A0 =C2=A0 =C2=A0case "${TARGET_ARCH}" in > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0x86_64) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0GOARCH=3Damd64 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0;; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0i586|i686) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =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C2=A0 =C2=A0aarch64) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0# ARM64 is invalid for Go 1.4 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0GOARCH=3Darm64 > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*) > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0GOARCH=3D"${TARGET_ARCH}" > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; > +=C2=A0 =C2=A0 =C2=A0 =C2=A0esac > +=C2=A0 =C2=A0 =C2=A0 =C2=A0export GOARCH > > > There are already classes that deal with the arch mapping, it doesn't > belong in individual recipes. > > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0# Set GOPATH. See 'PACKAGERS.md'. Don't = rely on > +=C2=A0 =C2=A0 =C2=A0 =C2=A0# docker to download its dependencies bu= t rather > +=C2=A0 =C2=A0 =C2=A0 =C2=A0# use dependencies packaged independentl= y. > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cd ${S}/src/import > +=C2=A0 =C2=A0 =C2=A0 =C2=A0rm -rf .gopath > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mkdir -p .gopath/src/"$(dirname "${DOCKE= R_PKG}")" > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf ../../../.. .gopath/src/"${DOCKER= _PKG}" > +=C2=A0 =C2=A0 =C2=A0 =C2=A0export > GOPATH=3D"${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_D= IR_TARGET}/${prefix}/local/go" > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0export CGO_ENABLED=3D"1" > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0# Pass the needed cflags/ldflags so that= cgo > +=C2=A0 =C2=A0 =C2=A0 =C2=A0# can find the needed headers files and = libraries > +=C2=A0 =C2=A0 =C2=A0 =C2=A0export CGO_CFLAGS=3D"${CFLAGS} --sysroot= = =3D${STAGING_DIR_TARGET}" > +=C2=A0 =C2=A0 =C2=A0 =C2=A0export CGO_LDFLAGS=3D"${LDFLAGS}=C2=A0 > --sysroot=3D${STAGING_DIR_TARGET}" > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0export DOCKER_GITCOMMIT=3D"${SRCREV}" > +=C2=A0 =C2=A0 =C2=A0 =C2=A0export DOCKER_BUILDTAGS=3D"no_buildkit n= o_btrfs no_cri > no_devmapper no_zfs exclude_disk_quota exclude_graphdriver_btrfs > exclude_graphdriver_devicemapper exclude_graphdriver_zfs" > > > As we've already solved in the other docker/moby recipes, we any > setting of buildtags needs to be by variable, so it can be > overriden=C2=A0by bbappends, etc. > > =C2=A0 > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0export DOCKER_LDFLAGS=3D"-s" > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0VERSION=3D${BALENA_VERSION} ./hack/make.= sh dynbinary-balena > > > And here we are with the repeated moby build infrastructure. > > I am curious as to why mainline moby won't work for this. I have no idea, but can look into that. > > =C2=A0 > > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0# Compile mobynit > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cd .gopath/src/"${DOCKER_PKG}"/cmd/mobyn= it > +=C2=A0 =C2=A0 =C2=A0 =C2=A0go build -ldflags '-extldflags "-static > ${MOBYNIT_EXTRA_LDFLAGS}"' . > > > This shouldn't be using 'go' directly, at the least, it should be > using the variables as defined in the go classes.=C2=A0 > > But again, this is solving and duplicating all the fixes that we've > had to do over time in the existing moby recipe. .. this is less than > ideal. and anything that we haven't solved there, we should actually > be fixing there. I will drop the mobynit completely from this recipe. This was actually also done lately in the meta-balena: https://github.com/balena-os/meta-balena/commit/29844ed3bd936c581e20b72df1= 33a2b6ed498512 > =C2=A0 > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0cd - > +} > + > +do_install() { > +=C2=A0 =C2=A0 =C2=A0 =C2=A0mkdir -p ${D}/${bindir} > +=C2=A0 =C2=A0 =C2=A0 =C2=A0install -m 0755 > ${S}/src/import/bundles/dynbinary-balena/balena-engine > ${D}/${bindir}/balena-engine > +=C2=A0 =C2=A0 =C2=A0 =C2=A0# install -d ${D}/boot > +=C2=A0 =C2=A0 =C2=A0 =C2=A0# install -m 0755 ${S}/src/import/cmd/mo= bynit/mobynit > ${D}/boot/init > +=C2=A0 =C2=A0 =C2=A0 =C2=A0# echo ${BALENA_STORAGE} > ${D}/boot/sto= rage-driver > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/bale= na > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/bale= nad > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/bale= na-containerd > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/bale= na-containerd-shim > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/bale= na-containerd-ctr > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/bale= na-runc > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/bale= na-proxy > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/bale= na-engine-daemon > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/bale= na-engine-containerd > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine > ${D}/${bindir}/balena-engine-containerd-shim > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine > ${D}/${bindir}/balena-engine-containerd-ctr > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/bale= na-engine-runc > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/bale= na-engine-proxy > > > Outside of the branding, what's the difference between these binaries > and when we build the upstream project variants ? I think we only care about the balena-engine for the purpose of this layer, really. From what I understand, the first ones are used in the balenaOS and I shou= ld have dropped them in the initial recipe port. > > =C2=A0 > > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0install -d ${D}${systemd_unitdir}/system > +=C2=A0 =C2=A0 =C2=A0 =C2=A0install -m 0644 > ${S}/src/import/contrib/init/systemd/balena-engine.socket > ${D}/${systemd_unitdir}/system > +=C2=A0 =C2=A0 =C2=A0 =C2=A0install -m 0644 > ${S}/src/import/contrib/init/systemd/balena-engine.service > ${D}/${systemd_unitdir}/system > > > The init system is variable, and should be checked before attempting > to install services. > > =C2=A0 > > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0install -d ${D}/home/root/.docker > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf .docker ${D}/home/root/.balena > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf .docker ${D}/home/root/.balena-en= gine > > > As mentioned above /home/room, shouldn't be hardcoded. > > =C2=A0 > > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0install -d ${D}${localstatedir}/lib/dock= er > > > Now we are polluting namespaces. A balena recipe making directories > called "docker". This is the issue I had with k3s and CNI, and my > concern about all the vendored versions we are getting in the > container recipes. > > =C2=A0 > > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf docker ${D}${localstatedir}/lib/b= alena > +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf docker ${D}${localstatedir}/lib/b= alena-engine > + > +=C2=A0 =C2=A0 =C2=A0 =C2=A0install -d ${D}${sysconfdir}/tmpfiles.d > +=C2=A0 =C2=A0 =C2=A0 =C2=A0install -m 0644 ${WORKDIR}/balena-tmpfil= es.conf > ${D}${sysconfdir}/tmpfiles.d/ > +} > + > +BBCLASSEXTEND =3D " native" > > > Where is this being used natively ? I see no usecase for the purpose of meta-virt. In case of balenaOS it was used to build the containers probably. Will drop that. > > Bruce > > =C2=A0 > > --=20 > 2.25.1 > > > > > > > --=20 > - Thou shalt not follow the NULL pointer, for chaos and madness await > thee at its end > - "Use the force Harry" - Gandalf, Star Trek II > > >=20 > --=20 Maciej Pijanowski Embedded Firmware Team Leader GPG: 9963C36AAC3B2B46 https://3mdeb.com | @3mdeb_com --------------9FBFCCA8362BF4BFABAD76DB Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable


On 24.11.2020 19:03, Bruce Ashfield wrote:


On Tue, Nov 24, 2020 at 12:20 PM Maciej Pijanowski <maciej.pijanowski@3mdeb.com> wrote:
As explained in [1], I have created the balena-engine recipe which could be
used in "regular" Yocto/OE builds (outside of the balenaOS). The
recipe is mostly a copy of the original recipe from meta-balena,
stripped from the balenaOS-specific parts so it can be compiled and
build outside of it. This recipe was tested at build and runtime
on the dunfell release on two targets: RPi4 and qemux86-64.

Thanks for the contribution, it is most appreciated. The recipe unfortunately raises some concerns .. and something that we can work through.
=C2=A0

[1] https://lists.yoctoproject.org/g/meta-virtualization/message/5913

Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>=
---
=C2=A0...dcoded-CC-on-cross-compile-docker-ce.patch |=C2=A0 60= +++++++
=C2=A0.../balena-engine/balena-tmpfiles.conf=C2=A0 =C2=A0 =C2= =A0 =C2=A0 |=C2=A0 =C2=A02 +
=C2=A0.../balena-engine/balena-engine_git.bb=C2=A0 =C2=A0 =C2=A0 =C2=A0 | 159 ++++++++++++++++++
=C2=A03 files changed, 221 insertions(+)
=C2=A0create mode 100644 recipes-containers/balena-engine/balena-engine/0001-imporve-hardcoded-CC-o= n-cross-compile-docker-ce.patch
=C2=A0create mode 100644 recipes-containers/balena-engine/balena-engine/balena-tmpfiles= .conf
=C2=A0create mode 100644 recipes-containers/balena-engine/balena-engine_git= .bb

diff --git a/recipes-containers/balena-engine/balena-engine/0001-imporve-hardcoded-CC= -on-cross-compile-docker-ce.patch b/recipes-containers/balena-engine/balena-engine/0001-imporve-hardcoded-CC= -on-cross-compile-docker-ce.patch
new file mode 100644
index 000000000000..0f257f1bd964
--- /dev/null
+++ b/recipes-containers/balena-engine/balena-engine/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 <hongxu.jia@windriver.com> +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.=C2=A0 If parameter is unset or null, the expansion of
+word is substituted.=C2=A0 Otherwise, the value of parameter = is substituted.)
+
+Upstream-Status: Submitted [https://github.com/moby/moby/pull/39546]
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> +---
+ 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)" !=3D "$(go env GOHOSTOS)/$(go env GOHOSTARC
+=C2=A0 =C2=A0 =C2=A0 =C2=A0# must be cross-compiling!
+=C2=A0 =C2=A0 =C2=A0 =C2=A0case "$(go env GOOS)/$(go env GOAR= CH)" in
+=C2=A0 =C2=A0 =C2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m64)
+-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 export CC=3Daarch64-linux-gnu-gcc
++=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 export CC=3D"${CC:-aarch64-linux-gnu-gcc}"
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0export CGO_ENABLED=3D1
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0;;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0linux/= amd64)
+-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 export CC=3Dx86_64-linux-gnu-gcc
++=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 export CC=3D"${CC:-x86_64-linux-gnu-gcc}"
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0export CGO_ENABLED=3D1
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0;;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0esac
+--
+2.23.0
diff --git a/recipes-containers/balena-engine/balena-engine/balena-tmpfil= es.conf b/recipes-containers/balena-engine/balena-engine/balena-tmpfiles.conf
new file mode 100644
index 000000000000..548a25d3ae49
--- /dev/null
+++ b/recipes-containers/balena-engine/balena-engine/balena-tmpfil= es.conf
@@ -0,0 +1,2 @@
+L=C2=A0 =C2=A0 =C2=A0 /run/docker.pid -=C2=A0 =C2=A0 =C2=A0 = =C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2= =A0 =C2=A0 =C2=A0/run/balena-engine.pid
+L=C2=A0 =C2=A0 =C2=A0 /run/balena.pid -=C2=A0 =C2=A0 =C2=A0 = =C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0-=C2=A0 =C2= =A0 =C2=A0 =C2=A0/run/balena-engine.pid
diff --git a/recipes-containers/balena-engine/balena-engine_git= .bb b/recipes-containers/balena-engine/balena-engine_git= .bb
new file mode 100644
index 000000000000..5d78dc02350f
--- /dev/null
+++ b/recipes-containers/balena-engine/balena-engine_git= .bb
@@ -0,0 +1,159 @@
+HOMEPAGE =3D "https://www.balena.io/"
+SUMMARY =3D "A Moby-based container engine for IoT"
+DESCRIPTION =3D "Balena is a new container engine purpose-built for embedded \
+and IoT use cases and compatible with Docker containers. Based on Docker=E2=80=99s \
+Moby Project, balena supports container deltas for 10-70x more efficient \
+bandwidth usage, has 3.5x smaller binaries, uses RAM and storage more \
+conservatively, and focuses on atomicity and durability of container \
+pulling."
+LICENSE =3D "Apache-2.0"
+LIC_FILES_CHKSUM =3D "file://src/import/LICENSE;m= d5=3D4859e97a9c7780e77972d989f0823f28"
+
+inherit systemd go pkgconfig useradd
+
+BALENA_VERSION =3D "19.03.13-dev"
+BALENA_BRANCH=3D "master"
+
+SRCREV =3D "074a481789174b4b6fd2d706086e8ffceb72e924"
+SRC_URI =3D "\
+=C2=A0 =C2=A0 =C2=A0 =C2=A0git://github.com/balena-os/balena-engine.git;branch=3D${BALENA_BRANCH};destsuff= ix=3Dgit/src/import \
+=C2=A0 =C2=A0 =C2=A0 =C2=A0file://0001-imporve-h= ardcoded-CC-on-cross-compile-docker-ce.patch \
The fac= t that we have to duplicate that patch, exposes an issue.

It come= s down to the fact that we already have containerd, moby, runc, etc, recipes.

Having vendored copies for all of the engine variants is a problem, and one what I'm looking to solve.=C2=A0 I can help= on that front, but it won't be until after I've finished getting k3s working and merged.
Ok. I will start with the simpler fixes for v2 and we will go back to that.

See mor= e specific comments below.

=C2=A0
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 file://balena-tmpfiles.conf \ +=C2=A0 =C2=A0 =C2=A0 =C2=A0"
+
+S =3D "${WORKDIR}/git"
+
+PV =3D "${BALENA_VERSION}+git${SRCREV}"
+
+SECURITY_CFLAGS =3D "${SECURITY_NOPIE_CFLAGS}"
+SECURITY_LDFLAGS =3D ""
+
+SYSTEMD_PACKAGES =3D "${PN}"
+SYSTEMD_SERVICE_${PN} =3D "balena-engine.service balena-engine.socket"
+GO_IMPORT =3D "import"
+USERADD_PACKAGES =3D "${PN}"
+GROUPADD_PARAM_${PN} =3D "-r balena-engine"
+
+DEPENDS_append_class-target =3D " systemd"
+RDEPENDS_${PN}_class-target =3D "curl util-linux iptables tini systemd bash"
+RRECOMMENDS_${PN} +=3D "kernel-module-nf-nat kernel-module-br-netfilter kernel-module-nf-conntrack-netlink kernel-module-xt-masquerade kernel-module-xt-addrtype"
+
+# oe-meta-go recipes try to build go-cross-native

oe-meta= -go shouldn't be relevant anymore .. neither should those _remove's.

=C2=A0
+DEPENDS_remove_class-native =3D "go-cross-native"
+DEPENDS_append_class-native =3D " go-native"
+
+INSANE_SKIP_${PN} +=3D "already-stripped"
+
+FILES_${PN} +=3D " \
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/lib/systemd/system/* \

/lib shouldn't be hardcoded.

+=C2=A0 =C2=A0 =C2=A0 =C2=A0/home/root \

neither should /home/root/

=C2=A0
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/boot/init \
+=C2=A0 =C2=A0 =C2=A0 =C2=A0/boot/storage-driver \
+=C2=A0 =C2=A0 =C2=A0 =C2=A0${localstatedir} \
+=C2=A0 =C2=A0 =C2=A0 =C2=A0"
+
+DOCKER_PKG=3D"github.com/docker/docker"
+
+# By default no extra LDFLAGS needed when compiling mobynit +MOBYNIT_EXTRA_LDFLAGS ??=3D ""
+
+do_configure[noexec] =3D "1"
+
+do_compile() {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0export PATH=3D${STAGING_BINDIR_NATIVE}/${HOST_SYS}:$PATH
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0export GOCACHE=3D"${B}/.cache"
+=C2=A0 =C2=A0 =C2=A0 =C2=A0export GOHOSTOS=3D"linux"
+=C2=A0 =C2=A0 =C2=A0 =C2=A0export GOOS=3D"linux"
+=C2=A0 =C2=A0 =C2=A0 =C2=A0case "${TARGET_ARCH}" in
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0x86_64= )
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0GOARCH=3Damd64
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0;;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0i586|i= 686)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0GOARCH=3D386
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0;;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0arm) +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 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 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0GOARCH=3D"${TARGET_ARCH}"
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0esac
+=C2=A0 =C2=A0 =C2=A0 =C2=A0export GOARCH

There a= re already classes that deal with the arch mapping, it doesn't belong in individual recipes.

+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0# Set GOPATH. See 'PACKAGERS.md'. = Don't rely on
+=C2=A0 =C2=A0 =C2=A0 =C2=A0# docker to download its dependenc= ies but rather
+=C2=A0 =C2=A0 =C2=A0 =C2=A0# use dependencies packaged indepe= ndently.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0cd ${S}/src/import
+=C2=A0 =C2=A0 =C2=A0 =C2=A0rm -rf .gopath
+=C2=A0 =C2=A0 =C2=A0 =C2=A0mkdir -p .gopath/src/"$(dirname "$= {DOCKER_PKG}")"
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf ../../../.. .gopath/src/"${= DOCKER_PKG}"
+=C2=A0 =C2=A0 =C2=A0 =C2=A0export GOPATH=3D"${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TAR= GET}/${prefix}/local/go"
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0export CGO_ENABLED=3D"1"
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0# Pass the needed cflags/ldflags s= o that cgo
+=C2=A0 =C2=A0 =C2=A0 =C2=A0# can find the needed headers file= s and libraries
+=C2=A0 =C2=A0 =C2=A0 =C2=A0export CGO_CFLAGS=3D"${CFLAGS} --sysroot=3D${STAGING_DIR_TARGET}"
+=C2=A0 =C2=A0 =C2=A0 =C2=A0export CGO_LDFLAGS=3D"${LDFLAGS}= =C2=A0 --sysroot=3D${STAGING_DIR_TARGET}"
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0export DOCKER_GITCOMMIT=3D"${SRCRE= V}"
+=C2=A0 =C2=A0 =C2=A0 =C2=A0export DOCKER_BUILDTAGS=3D"no_buil= dkit no_btrfs no_cri no_devmapper no_zfs exclude_disk_quota exclude_graphdriver_btrfs exclude_graphdriver_devicemapper exclude_graphdriver_zfs"

As we'v= e already solved in the other docker/moby recipes, we any setting of buildtags needs to be by variable, so it can be overriden=C2=A0by bbappends, etc.

=C2=A0
+=C2=A0 =C2=A0 =C2=A0 =C2=A0export DOCKER_LDFLAGS=3D"-s"
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0VERSION=3D${BALENA_VERSION} ./hack= /make.sh dynbinary-balena

And her= e we are with the repeated moby build infrastructure.

I am curious as to why mainline moby won't work for this.
I have no idea, but can look into that.

=C2=A0
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0# Compile mobynit
+=C2=A0 =C2=A0 =C2=A0 =C2=A0cd .gopath/src/"${DOCKER_PKG}"/cmd= /mobynit
+=C2=A0 =C2=A0 =C2=A0 =C2=A0go build -ldflags '-extldflags "-s= tatic ${MOBYNIT_EXTRA_LDFLAGS}"' .

This shouldn't be using 'go' directly, at the least, it should be using the variables as defined in the go classes.=C2=A0

But again, this is solving and duplicating all the fixes that we've had to do over time in the existing moby recipe. .. this is less than ideal. and anything that we haven't solved there, we should actually be fixing there.
I will drop the mobynit completely from this recipe.
This was actually also done lately in the meta-balena:
https://github.c= om/balena-os/meta-balena/commit/29844ed3bd936c581e20b72df133a2b6ed498512
=C2=A0
+=C2=A0 =C2=A0 =C2=A0 =C2=A0cd -
+}
+
+do_install() {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0mkdir -p ${D}/${bindir}
+=C2=A0 =C2=A0 =C2=A0 =C2=A0install -m 0755 ${S}/src/import/bundles/dynbinary-balena/balena-engine ${D}/${bindir}/balena-engine
+=C2=A0 =C2=A0 =C2=A0 =C2=A0# install -d ${D}/boot
+=C2=A0 =C2=A0 =C2=A0 =C2=A0# install -m 0755 ${S}/src/import/cmd/mobynit/mobynit ${D}/boot/init
+=C2=A0 =C2=A0 =C2=A0 =C2=A0# echo ${BALENA_STORAGE} > ${D}/boot/storage-driver
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir= }/balena
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir= }/balenad
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/balena-containerd
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/balena-containerd-shim
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/balena-containerd-ctr
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir= }/balena-runc
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir= }/balena-proxy
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/balena-engine-daemon
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/balena-engine-containerd
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/balena-engine-containerd-shim
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/balena-engine-containerd-ctr
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/balena-engine-runc
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf balena-engine ${D}/${bindir}/balena-engine-proxy

Outside of the branding, what's the difference between these binaries and when we build the upstream project variants ?
I think we only care about the balena-engine for the purpose of this layer, really.
From what I understand, the first ones are used in the balenaOS and I should
have dropped them in the initial recipe port.

=C2=A0
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0install -d ${D}${systemd_unitdir}/= system
+=C2=A0 =C2=A0 =C2=A0 =C2=A0install -m 0644 ${S}/src/import/contrib/init/systemd/balena-engine.socket ${D}/${systemd_unitdir}/system
+=C2=A0 =C2=A0 =C2=A0 =C2=A0install -m 0644 ${S}/src/import/contrib/init/systemd/balena-engine.service ${D}/${systemd_unitdir}/system

The ini= t system is variable, and should be checked before attempting to install services.

=C2=A0
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0install -d ${D}/home/root/.docker<= br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf .docker ${D}/home/root/.bal= ena
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf .docker ${D}/home/root/.bal= ena-engine

As mentioned above /home/room, shouldn't be hardcoded.

=C2=A0
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0install -d ${D}${localstatedir}/li= b/docker

Now we are polluting namespaces. A balena recipe making directories called "docker". This is the issue I had with k3s and CNI, and my concern about all the vendored versions we are getting in the container recipes.

=C2=A0
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf docker ${D}${localstatedir}= /lib/balena
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ln -sf docker ${D}${localstatedir}= /lib/balena-engine
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0install -d ${D}${sysconfdir}/tmpfi= les.d
+=C2=A0 =C2=A0 =C2=A0 =C2=A0install -m 0644 ${WORKDIR}/balena-= tmpfiles.conf ${D}${sysconfdir}/tmpfiles.d/
+}
+
+BBCLASSEXTEND =3D " native"

Where i= s this being used natively ?
I see no usecase for the purpose of meta-virt.
In case of balenaOS it was used to build the containers probably.
Will drop that.

Bruce
=C2=A0
--
2.25.1






--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II




--=20
Maciej Pijanowski
Embedded Firmware Team Leader
GPG: 9963C36AAC3B2B46
https://3mde=
b.com | @3mdeb_com
--------------9FBFCCA8362BF4BFABAD76DB--