Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding balena into buildroot #80

Closed
refiktuzakli opened this issue Jun 5, 2018 · 4 comments
Closed

Adding balena into buildroot #80

refiktuzakli opened this issue Jun 5, 2018 · 4 comments

Comments

@refiktuzakli
Copy link

Description

Hello

I am trying to add balena into buildroot. I consider balena_git.bb file from meta-resin as cross-compile procedure. I sent a patch in order to add balena I took some feed back from buildroot. I have some question and I need your help in some point.

Questions

  1. Why do we need some docker parameters as DOCKER_BUILDTAGS, DOCKER_GITCOMMIT, or directory as .gopath/src/github.com/docker/docker?
  2. build creates .gopath/src/github.com/docker/docker/cmd/mobynit/mobynit binary but we copy bundles/17.06.0-dev/dynbinary-balena/balena. what is the differences?

You can flow the e-mail from https://patchwork.ozlabs.org/patch/925039
if I am wrong at some point please warn

@agherzan
Copy link

agherzan commented Jun 5, 2018

Hi @refiktuzakli ,

DOCKER_GITCOMMIT provides information about the sources at runtime. See:
https://github.com/resin-os/balena/blob/b54f148fe1334735c1dc046643133c4708c501b0/hack/make.sh#L74
https://github.com/resin-os/balena/blob/df5d0f6fe7410472a0f8a4e1f45f991cf71d4def/hack/make/.go-autogen#L16
https://github.com/resin-os/balena/blob/df5d0f6fe7410472a0f8a4e1f45f991cf71d4def/dockerversion/useragent.go#L22

DOCKER_BUILDTAGS is used to strip the binary of things that were not tested/used. Basically, we deactivate the inclusion of some storage drivers.

I'm not sure what your question is about directory as .gopath/src/github.com/docker/docker.

We copy/install the mobynit tool too. https://github.com/resin-os/meta-resin/blob/master/meta-resin-common/recipes-containers/balena/balena_git.bb#L115 This tool is meant to be used when the root partition is a docker storage itself. So you can have a root file system as a docker image and use mobynit to mount that image and start an init system from it (for example systemd).

@refiktuzakli
Copy link
Author

I mean we create a link with .gopath/src/github.com/docker/docker, why this path related with docker why not .gopath/src/github.com/resin-os/balena because we download this from github/resion-os/balena!

Another question is that What if we build without "-ldflags '-extldflags "-static"'", which functionality do we loos? size of balena binary remain same but size of mobynit binary goes down about 1M. How can we use mobynit binary when it build without ldflags?

thanks

@robertgzr
Copy link
Contributor

  1. linking to .gopath/src/github.com/docker/docker is done since internally the code refers to all subpackages with the github.com/docker/docker prefix, not doing so would break the build

  2. those flags tell the Go compiler to build a static executable (which is actually trickier than just that: cmd/go: build: add -static flag golang/go#26492)

@paralin
Copy link

paralin commented Oct 19, 2020

The Go package infra was updated to use Go modules and now the .gopath tree is no longer necessary / created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants