Skip to contentSkip to conversation

balena : New Package

PATCH New Refik Tuzaklı 2 participants 5 messages Jun 4, 2018 – Jun 5, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 balena : New Package

From: Refik Tuzakli <[email protected]>
Date: Mon, 4 Jun 2018 16:34:48 +0300

This patch adds balena; Moby-based Container Engine for Embedded, IoT, and Edge uses.

---

 ?package/Config.in????????? |? 1 +
 ?package/balena/Config.in?? | 16 +++++++++++
 ?package/balena/balena.hash |? 2 ++
 ?package/balena/balena.mk?? | 68 

++++++++++++++++++++++++++++++++++++++++++++++
?4 files changed, 87 insertions(+)
?create mode 100644 package/balena/Config.in
?create mode 100644 package/balena/balena.hash
?create mode 100644 package/balena/balena.mk

package/Config.in +1 -0
index 6a1606e..41e1986 100644
@@ -1983,6 +1983,7 @@ menu "System tools"
 ???? source "package/atop/Config.in"
 ???? source "package/attr/Config.in"
 ???? source "package/audit/Config.in"
+??? source "package/balena/Config.in"
 ???? source "package/bootutils/Config.in"
 ???? source "package/cgroupfs-mount/Config.in"
 ???? source "package/circus/Config.in"
package/balena/Config.in new file +16 -0
new file mode 100644
index 0000000..2904d2a
@@ -0,0 +1,16 @@
+config BR2_PACKAGE_BALENA
+??? bool "balena"
+??? depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
+??? depends on BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS
+??? depends on BR2_TOOLCHAIN_HAS_THREADS
+??? depends on BR2_INIT_SYSTEMD
+??? select BR2_PACKAGE_LVM2
+??? select BR2_PACKAGE_LVM2_STANDARD_INSTALL
+??? help
+??? ? Moby-based Container Engine for Embedded, IoT, and Edge uses
+
+??? ? https://github.com/resin-os/balena
+
+
+comment "balena needs systemd"
+??? depends on !BR2_INIT_SYSTEMD
package/balena/balena.hash new file +2 -0
new file mode 100644
index 0000000..9d40895
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256 ae07affea7f50d9754957d972c9957f42938998dffc48cc57fca37e0b187359a 

balena-17.06-resin.tar.gz

package/balena/balena.mk new file +27 -0
new file mode 100644
index 0000000..96f2497
@@ -0,0 +1,68 @@
+################################################################################
+#
+# balena
+#
+################################################################################
+
+BALENA_VERSION = 17.06-resin
+BALENA_COMMIT = 73136d1985f28a34705f537e90636cf208734048
+BALENA_SITE = $(call github,resin-os,balena,$(BALENA_VERSION))
+
+BALENA_LICENSE = Apache-2.0
+BALENA_LICENSE_FILES = LICENSE
+
+BALENA_DEPENDENCIES = host-go host-pkgconf systemd lvm2
+
+BALENA_GOPATH = "$(@D)/.gopath"
+
+BALENA_VERSION_DIR = 17.06.0-dev
+BALENA_BUILD_TARGETS = balena
+BALENA_INSTALL_BINS = $(TARGET_DIR)/usr/bin/$(target)
+
+
+BALENA_CONFIGURE_ENV = GOPATH=${BALENA_GOPATH} \
+??? $(TARGET_MAKE_ENV) \
+??? $(HOST_GO_TARGET_ENV) \
+??? DOCKER_GITCOMMIT=${BALENA_COMMIT} \
+??? DOCKER_BUILDTAGS='exclude_graphdriver_btrfs exclude_graphdirver_zfs 

exclude_graphdriver_devicemapper'
+
+BALENA_MAKE_ENV = GOPATH=$(BALENA_GOPATH) \
+??? $(TARGET_MAKE_ENV) \
+??? $(HOST_GO_TARGET_ENV)
+
+BALENA_GLDFLAGS += -extldflags '-static'
+
+define BALENA_CONFIGURE_CMDS
+??? mkdir -p $(BALENA_GOPATH)/src/github.com/docker
+??? ln -fs $(@D) $(BALENA_GOPATH)/src/github.com/docker/docker +??? cd $(@D) && \
+??? ??? $(BALENA_CONFIGURE_ENV) \
+??? ??? bash ./hack/make.sh dynbinary-balena
+endef
+
+define BALENA_USERS
+??? - - balena -1 * - - - A Moby-based container engine for IoT +endef
+
+define BALENA_BUILD_CMDS
+??? $(foreach target,$(BALENA_BUILD_TARGETS), \
+??? ??? cd $(BALENA_GOPATH)/src/github.com/docker/docker/cmd/mobynit; \
+??? ??? $(BALENA_MAKE_ENV) \
+??? ??? $(HOST_DIR)/bin/go build -v\
+??? ??? ??? -ldflags "$(BALENA_GLDFLAGS)"
+??? )
+endef
+
+define BALENA_INSTALL_TARGET_CMDS
+??? $(foreach target,$(BALENA_BUILD_TARGETS), \
+??? ??? $(INSTALL) -D -m 0755 $(@D)/bundles/17.06.0-dev/dynbinary-balena/$(target) $(BALENA_INSTALL_BINS) +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balenad
+??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-containerd +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-containerd-shim +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-containerd-ctr +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-runc
+??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-proxy
+??? )
+endef
+
+$(eval $(golang-package))

Signature · 13 lines
1.9.1


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180604/7ff62b62/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: refik_tuzakli.vcf
Type: text/x-vcard
Size: 4 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180604/7ff62b62/attachment.vcf>
#1 lore raw

PATCH 1/1 balena : New Package

Hello Refik,

Thanks a lot for your contribution! I believe it's your first Buildroot contribution, so congratulations :-)

The first comment is that you should sent your patch using "git send-email". Because you didn't do that, your patch has been horribly rewrapped by your e-mail client, and it cannot be applied.

The second thing, less important, is that the [BALENA PATCH] subject prefix is not necessary, just [PATCH] is sufficient or more precisely [PATCHv2] for your next iteration.

The title should be:

balena: new package

which is almost the same as what you did, but without the space before :, and lower case.

Quoted 5 lines · Refik Tuzakl?
 ?package/Config.in????????? |? 1 +
 ?package/balena/Config.in?? | 16 +++++++++++
 ?package/balena/balena.hash |? 2 ++
 ?package/balena/balena.mk?? | 68 

++++++++++++++++++++++++++++++++++++++++++++++

Please add an entry in the DEVELOPERS file for this package.

Quoted 2 lines

+??? source "package/balena/Config.in"
???? source "package/bootutils/Config.in"

Indentation is wrong here, but maybe it's an artefact of not sending with git send-email.

Quoted 6 lines
package/balena/Config.in new file +0 -0
new file mode 100644
index 0000000..2904d2a

package/balena/Config.in line 8

Quoted 8 lines
package/balena/Config.in new file +8 -0
@@ -0,0 +1,16 @@
+config BR2_PACKAGE_BALENA
+??? bool "balena"
+??? depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
+??? depends on BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS
+??? depends on BR2_TOOLCHAIN_HAS_THREADS
+??? depends on BR2_INIT_SYSTEMD
+??? select BR2_PACKAGE_LVM2
+??? select BR2_PACKAGE_LVM2_STANDARD_INSTALL

You need to propagate the dependencies of lvm2 here:

depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_USE_MMU # needs fork()
depends on !BR2_STATIC_LIBS # It fails to build statically

package/balena/Config.in line 14

Quoted 6 lines
package/balena/Config.in new file +6 -0
+??? help
+??? ? Moby-based Container Engine for Embedded, IoT, and Edge uses
+
+??? ? https://github.com/resin-os/balena
+
+

Only one empty line here.

package/balena/Config.in line 16

Quoted 2 lines
package/balena/Config.in new file +2 -0
+comment "balena needs systemd"
+??? depends on !BR2_INIT_SYSTEMD

Also, please run check-package to make sure the indentation is correct.

package/balena/Config.in

Quoted 4 lines
package/balena/Config.in new file +4 -0
+BALENA_LICENSE = Apache-2.0
+BALENA_LICENSE_FILES = LICENSE
+
+BALENA_DEPENDENCIES = host-go host-pkgconf systemd lvm2

Drop the host-go dependency, it's not needed because you're using the golang-package infrastructure.

Quoted 1 line

+BALENA_GOPATH = "$(@D)/.gopath"

I believe this is not needed, it's taken care of by the golang-package infrastructure.

Quoted 1 line

+BALENA_VERSION_DIR = 17.06.0-dev

Ditto, should not be needed.

Quoted 1 line

+BALENA_BUILD_TARGETS = balena

This one is OK.

Quoted 1 line

+BALENA_INSTALL_BINS = $(TARGET_DIR)/usr/bin/$(target)

This one doesn't make sense because $(target) is empty. Instead list the binaries to be installed.

Quoted 6 lines

+BALENA_CONFIGURE_ENV = GOPATH=${BALENA_GOPATH} \
+??? $(TARGET_MAKE_ENV) \
+??? $(HOST_GO_TARGET_ENV) \
+??? DOCKER_GITCOMMIT=${BALENA_COMMIT} \
+??? DOCKER_BUILDTAGS='exclude_graphdriver_btrfs exclude_graphdirver_zfs exclude_graphdriver_devicemapper'

None of that should be needed with the golang-package infrastructure. Look at the docker-engine package for an example.

package/balena/Config.in

Quoted 4 lines
package/balena/Config.in new file +4 -0
+
+BALENA_MAKE_ENV = GOPATH=$(BALENA_GOPATH) \
+??? $(TARGET_MAKE_ENV) \
+??? $(HOST_GO_TARGET_ENV)

Same.

package/balena/Config.in

Quoted 2 lines
package/balena/Config.in new file +2 -0
+
+BALENA_GLDFLAGS += -extldflags '-static'

Same.

package/balena/Config.in

Quoted 4 lines
package/balena/Config.in new file +4 -0
+
+define BALENA_CONFIGURE_CMDS
+??? mkdir -p $(BALENA_GOPATH)/src/github.com/docker
+??? ln -fs $(@D) $(BALENA_GOPATH)/src/github.com/docker/docker

Not needed with the golang-package infrastructure.

Quoted 3 lines

+??? cd $(@D) && \
+??? ??? $(BALENA_CONFIGURE_ENV) \
+??? ??? bash ./hack/make.sh dynbinary-balena

Do this in a POST_CONFIGURE_HOOKS.

package/balena/Config.in

Quoted 8 lines
package/balena/Config.in new file +8 -0
+define BALENA_BUILD_CMDS
+??? $(foreach target,$(BALENA_BUILD_TARGETS), \
+??? ??? cd $(BALENA_GOPATH)/src/github.com/docker/docker/cmd/mobynit; \
+??? ??? $(BALENA_MAKE_ENV) \
+??? ??? $(HOST_DIR)/bin/go build -v\
+??? ??? ??? -ldflags "$(BALENA_GLDFLAGS)"
+??? )
+endef

Not needed, it should be done by the golang-package infrastructure.

Quoted 4 lines
package/balena/Config.in new file +4 -0
+
+define BALENA_INSTALL_TARGET_CMDS
+??? $(foreach target,$(BALENA_BUILD_TARGETS), \
+??? ??? $(INSTALL) -D -m 0755 
Quoted 8 lines

$(@D)/bundles/17.06.0-dev/dynbinary-balena/$(target) $(BALENA_INSTALL_BINS) +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balenad
+??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-containerd +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-containerd-shim +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-containerd-ctr +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-runc
+??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-proxy
+??? )

Same.

Basically, I have the feeling that you created this package as a generic-package originally, and then quickly converted it to golang-package. But the golang-package infrastructure greatly simplifies Go packages, so you should really leverage the features of the golang-package infrastructure.

Could you rework this package to use golang-package more effectively ?

Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 balena : New Package

Hello Thomas,

Thanks for feedback.

Quoted 8 lines · Thomas Petazzoni

Hello Refik,

Thanks a lot for your contribution! I believe it's your first Buildroot contribution, so congratulations :-)

The first comment is that you should sent your patch using "git send-email". Because you didn't do that, your patch has been horribly rewrapped by your e-mail client, and it cannot be applied.

I tried to send this patch via git send-email but I have problem with my ssl certificate as below;

STARTTLS failed! SSL connect attempt failed with unknown error error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed at /usr/lib/git-core/git-send-email line 1241.

When I solve problem, I will use this tool instead of sending via direct e-mail.

Quoted 11 lines

The second thing, less important, is that the [BALENA PATCH] subject prefix is not necessary, just [PATCH] is sufficient or more precisely [PATCHv2] for your next iteration.

The title should be:

balena: new package

which is almost the same as what you did, but without the space before :, and lower case.

OK

Quoted 8 lines · Refik Tuzakl?
Quoted 5 lines
  ?package/Config.in????????? |? 1 +
  ?package/balena/Config.in?? | 16 +++++++++++
  ?package/balena/balena.hash |? 2 ++
  ?package/balena/balena.mk?? | 68

++++++++++++++++++++++++++++++++++++++++++++++

Please add an entry in the DEVELOPERS file for this package.

OK

Quoted 5 lines
Quoted 3 lines

+??? source "package/balena/Config.in"
???? source "package/bootutils/Config.in"

Indentation is wrong here, but maybe it's an artefact of not sending with git send-email.

At my local patch file, I can not see this typo but I will take care of it.

Quoted 17 lines
Quoted 7 lines
package/balena/Config.in new file +0 -0
new file mode 100644
index 0000000..2904d2a

package/balena/Config.in line 8

Quoted 8 lines
package/balena/Config.in new file +8 -0
@@ -0,0 +1,16 @@
+config BR2_PACKAGE_BALENA
+??? bool "balena"
+??? depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
+??? depends on BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS
+??? depends on BR2_TOOLCHAIN_HAS_THREADS
+??? depends on BR2_INIT_SYSTEMD
+??? select BR2_PACKAGE_LVM2
+??? select BR2_PACKAGE_LVM2_STANDARD_INSTALL

You need to propagate the dependencies of lvm2 here:

Quoted 3 lines

depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_USE_MMU # needs fork()
depends on !BR2_STATIC_LIBS # It fails to build statically

OK

Quoted 8 lines

package/balena/Config.in line 14

Quoted 7 lines
package/balena/Config.in new file +6 -0
+??? help
+??? ? Moby-based Container Engine for Embedded, IoT, and Edge uses
+
+??? ? https://github.com/resin-os/balena
+
+

Only one empty line here.

OK

Quoted 4 lines

package/balena/Config.in line 16

Quoted 3 lines
package/balena/Config.in new file +2 -0
+comment "balena needs systemd"
+??? depends on !BR2_INIT_SYSTEMD

Also, please run check-package to make sure the indentation is correct.

OK

Quoted 7 lines

package/balena/Config.in

Quoted 5 lines
package/balena/Config.in new file +4 -0
+BALENA_LICENSE = Apache-2.0
+BALENA_LICENSE_FILES = LICENSE
+
+BALENA_DEPENDENCIES = host-go host-pkgconf systemd lvm2

Drop the host-go dependency, it's not needed because you're using the golang-package infrastructure.

OK

Quoted 4 lines
Quoted 2 lines

+BALENA_GOPATH = "$(@D)/.gopath"

I believe this is not needed, it's taken care of by the golang-package infrastructure.

OK

Quoted 3 lines
Quoted 2 lines

+BALENA_VERSION_DIR = 17.06.0-dev

Ditto, should not be needed.

OK

Quoted 7 lines
Quoted 2 lines

+BALENA_BUILD_TARGETS = balena

This one is OK.

Quoted 1 line

+BALENA_INSTALL_BINS = $(TARGET_DIR)/usr/bin/$(target)

This one doesn't make sense because $(target) is empty. Instead list the binaries to be installed.

OK

Quoted 9 lines
Quoted 7 lines

+BALENA_CONFIGURE_ENV = GOPATH=${BALENA_GOPATH} \
+??? $(TARGET_MAKE_ENV) \
+??? $(HOST_GO_TARGET_ENV) \
+??? DOCKER_GITCOMMIT=${BALENA_COMMIT} \
+??? DOCKER_BUILDTAGS='exclude_graphdriver_btrfs exclude_graphdirver_zfs exclude_graphdriver_devicemapper'

None of that should be needed with the golang-package infrastructure. Look at the docker-engine package for an example.

I thought so but when I remove one of them, it crashes while configuring. Even it is balena package, it needs some docker parameters.

Quoted 11 lines

package/balena/Config.in

Quoted 5 lines
package/balena/Config.in new file +4 -0
+
+BALENA_MAKE_ENV = GOPATH=$(BALENA_GOPATH) \
+??? $(TARGET_MAKE_ENV) \
+??? $(HOST_GO_TARGET_ENV)

Same.

package/balena/Config.in

Quoted 2 lines
package/balena/Config.in new file +2 -0
+
+BALENA_GLDFLAGS += -extldflags '-static'

Same.

Quoted 5 lines

package/balena/Config.in

Quoted 4 lines
package/balena/Config.in new file +4 -0
+
+define BALENA_CONFIGURE_CMDS
+??? mkdir -p $(BALENA_GOPATH)/src/github.com/docker
+??? ln -fs $(@D) $(BALENA_GOPATH)/src/github.com/docker/docker

Not needed with the golang-package infrastructure.

golang-package does ;

mkdir -p $(@D)/_gopath/src/github.com/resin-os/ ln -sf $(@D) $(@D)/_gopath/src/github.com/resin-os/balena

but balena needs ;
mkdir -p $(@D)/.gopath/src/github.com/docker ln -fs $(@D) $(@D)/.gopath/src/github.com/docker/docker

I think this caused by package itself. I am not a developer of balena, I can ask this issue to balena developers

Quoted 5 lines
Quoted 4 lines

+??? cd $(@D) && \
+??? ??? $(BALENA_CONFIGURE_ENV) \
+??? ??? bash ./hack/make.sh dynbinary-balena

Do this in a POST_CONFIGURE_HOOKS.

OK

Quoted 10 lines

package/balena/Config.in

Quoted 9 lines
package/balena/Config.in new file +8 -0
+define BALENA_BUILD_CMDS
+??? $(foreach target,$(BALENA_BUILD_TARGETS), \
+??? ??? cd $(BALENA_GOPATH)/src/github.com/docker/docker/cmd/mobynit; \
+??? ??? $(BALENA_MAKE_ENV) \
+??? ??? $(HOST_DIR)/bin/go build -v\
+??? ??? ??? -ldflags "$(BALENA_GLDFLAGS)"
+??? )
+endef

Not needed, it should be done by the golang-package infrastructure.

build directory is

$(BALENA_GOPATH)/src/github.com/docker/docker/cmd/mobynit

I guess buildroot looks $(BALENA_GOPATH)/src/github.com/resin-io/balena/cmd/balena Am I right?

Quoted 14 lines
Quoted 5 lines
package/balena/Config.in new file +4 -0
+
+define BALENA_INSTALL_TARGET_CMDS
+??? $(foreach target,$(BALENA_BUILD_TARGETS), \
+??? ??? $(INSTALL) -D -m 0755
Quoted 8 lines

$(@D)/bundles/17.06.0-dev/dynbinary-balena/$(target) $(BALENA_INSTALL_BINS) +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balenad
+??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-containerd +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-containerd-shim +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-containerd-ctr +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-runc
+??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-proxy
+??? )

Same.

build step creates

$(BALENA_GOPATH)/src/github.com/docker/docker/cmd/mobynit/mobynit

but we need

$(@D)/bundles/17.06.0-dev/dynbinary-balena/balena

Quoted 7 lines

Basically, I have the feeling that you created this package as a generic-package originally, and then quickly converted it to golang-package. But the golang-package infrastructure greatly simplifies Go packages, so you should really leverage the features of the golang-package infrastructure.

Quoted 5 lines

Could you rework this package to use golang-package more effectively ?

Thanks a lot!

Thomas

I check docker-engine before converting to golang package. Also I took balena_git.bb file on meta-resin as a reference for cross-compile procedure from Yocto Projects. If I can I want to rework on this package with your help.

Cheers,

Refik Tuzakl?
Embedded Software Engineer
IT and Simulation Group

Savronik A.?.

Organize Sanayi B?lgesi

20. Cadde No: 19 26110

Eski?ehir Turkey

Tel?? : (+90 222) 236 1590

Faks: (+90 222) 236 1589

www.savronik.com.tr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180605/f9c9d606/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: refik_tuzakli.vcf
Type: text/x-vcard
Size: 4 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180605/f9c9d606/attachment.vcf>

#3 lore raw

PATCH 1/1 balena : New Package

Hello,

Quoted 9 lines · Refik Tuzakl?

I tried to send this patch via git send-email but I have problem with my ssl certificate as below;

STARTTLS failed! SSL connect attempt failed with unknown error error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed at /usr/lib/git-core/git-send-email line 1241.

When I solve problem, I will use this tool instead of sending via direct e-mail.

You can probably tell git to not verify too much the SSL certificate, but obviously that's a bit disabling the whole point of SSL in the first place :-)

Quoted 10 lines
Quoted 8 lines
Quoted 6 lines

+BALENA_CONFIGURE_ENV = GOPATH=${BALENA_GOPATH} \
+??? $(TARGET_MAKE_ENV) \
+??? $(HOST_GO_TARGET_ENV) \
+??? DOCKER_GITCOMMIT=${BALENA_COMMIT} \
+??? DOCKER_BUILDTAGS='exclude_graphdriver_btrfs exclude_graphdirver_zfs exclude_graphdriver_devicemapper'

None of that should be needed with the golang-package infrastructure. Look at the docker-engine package for an example.

I thought so but when I remove one of them, it crashes while configuring. Even it is balena package, it needs some docker parameters.

You can still pass build tags, see how the docker-engine package is doing this:

ifeq ($(BR2_PACKAGE_DOCKER_ENGINE_DRIVER_VFS),y)
DOCKER_ENGINE_DEPENDENCIES += gvfs
else
DOCKER_ENGINE_TAGS += exclude_graphdriver_vfs
endif

Quoted 9 lines
Quoted 4 lines
Quoted 3 lines

+define BALENA_CONFIGURE_CMDS
+??? mkdir -p $(BALENA_GOPATH)/src/github.com/docker +??? ln -fs $(@D) $(BALENA_GOPATH)/src/github.com/docker/docker

Not needed with the golang-package infrastructure.

golang-package does ;

mkdir -p $(@D)/_gopath/src/github.com/resin-os/ ln -sf $(@D) $(@D)/_gopath/src/github.com/resin-os/balena

Quoted 6 lines

but balena needs ;
mkdir -p $(@D)/.gopath/src/github.com/docker ln -fs $(@D) $(@D)/.gopath/src/github.com/docker/docker

I think this caused by package itself. I am not a developer of balena, I can ask this issue to balena developers

Then, set:

BALENA_SRC_SUBDIR = github.com/docker/docker

Quoted 9 lines
Quoted 9 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+define BALENA_BUILD_CMDS
+??? $(foreach target,$(BALENA_BUILD_TARGETS), \
+??? ??? cd $(BALENA_GOPATH)/src/github.com/docker/docker/cmd/mobynit; \
+??? ??? $(BALENA_MAKE_ENV) \
+??? ??? $(HOST_DIR)/bin/go build -v\
+??? ??? ??? -ldflags "$(BALENA_GLDFLAGS)"
+??? )
+endef  

Not needed, it should be done by the golang-package infrastructure.

Quoted 6 lines

build directory is

$(BALENA_GOPATH)/src/github.com/docker/docker/cmd/mobynit

I guess buildroot looks $(BALENA_GOPATH)/src/github.com/resin-io/balena/cmd/balena Am I right?

Depends on BALENA_SRC_SUBDIR, see above.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

+define BALENA_INSTALL_TARGET_CMDS
+??? $(foreach target,$(BALENA_BUILD_TARGETS), \
+??? ??? $(INSTALL) -D -m 0755 $(@D)/bundles/17.06.0-dev/dynbinary-balena/$(target) $(BALENA_INSTALL_BINS) +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balenad
+??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-containerd +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-containerd-shim +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-containerd-ctr +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-runc
+??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-proxy
+??? )

Quoted 8 lines
Quoted 1 line

Same.

build step creates

$(BALENA_GOPATH)/src/github.com/docker/docker/cmd/mobynit/mobynit

but we need

$(@D)/bundles/17.06.0-dev/dynbinary-balena/balena

Meh, this installation location looks weird. Angelo, do you have any idea here ?

Refik, in the mean time, you can make a new submission keeping the INSTALL_TARGET_CMDS you had. I'll try to have a look once you make this new submission.

Thanks!

Thomas Petazzoni

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

PATCH 1/1 balena : New Package

In reply to Thomas Petazzoni

Hello Thomas,

Thanks for feedback.

Quoted 8 lines · Thomas Petazzoni

Hello Refik,

Thanks a lot for your contribution! I believe it's your first Buildroot contribution, so congratulations :-)

The first comment is that you should sent your patch using "git send-email". Because you didn't do that, your patch has been horribly rewrapped by your e-mail client, and it cannot be applied.

I tried to send this patch via git send-email but I have problem with my ssl certificate as below;

STARTTLS failed! SSL connect attempt failed with unknown error error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed at /usr/lib/git-core/git-send-email line 1241.

When I solve problem, I will use this tool instead of sending via direct e-mail.

Quoted 11 lines

The second thing, less important, is that the [BALENA PATCH] subject prefix is not necessary, just [PATCH] is sufficient or more precisely [PATCHv2] for your next iteration.

The title should be:

balena: new package

which is almost the same as what you did, but without the space before :, and lower case.

OK

Quoted 8 lines · Refik Tuzakl?
Quoted 5 lines
  ?package/Config.in????????? |? 1 +
  ?package/balena/Config.in?? | 16 +++++++++++
  ?package/balena/balena.hash |? 2 ++
  ?package/balena/balena.mk?? | 68

++++++++++++++++++++++++++++++++++++++++++++++

Please add an entry in the DEVELOPERS file for this package.

OK

Quoted 5 lines
Quoted 3 lines

+??? source "package/balena/Config.in"
???? source "package/bootutils/Config.in"

Indentation is wrong here, but maybe it's an artefact of not sending with git send-email.

At my local patch file, I can not see this typo but I will take care of it.

Quoted 17 lines
Quoted 7 lines
package/balena/Config.in new file +0 -0
new file mode 100644
index 0000000..2904d2a

package/balena/Config.in line 8

Quoted 8 lines
package/balena/Config.in new file +8 -0
@@ -0,0 +1,16 @@
+config BR2_PACKAGE_BALENA
+??? bool "balena"
+??? depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
+??? depends on BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS
+??? depends on BR2_TOOLCHAIN_HAS_THREADS
+??? depends on BR2_INIT_SYSTEMD
+??? select BR2_PACKAGE_LVM2
+??? select BR2_PACKAGE_LVM2_STANDARD_INSTALL

You need to propagate the dependencies of lvm2 here:

Quoted 3 lines

depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_USE_MMU # needs fork()
depends on !BR2_STATIC_LIBS # It fails to build statically

OK

Quoted 8 lines

package/balena/Config.in line 14

Quoted 7 lines
package/balena/Config.in new file +6 -0
+??? help
+??? ? Moby-based Container Engine for Embedded, IoT, and Edge uses
+
+??? ? https://github.com/resin-os/balena
+
+

Only one empty line here.

OK

Quoted 4 lines

package/balena/Config.in line 16

Quoted 3 lines
package/balena/Config.in new file +2 -0
+comment "balena needs systemd"
+??? depends on !BR2_INIT_SYSTEMD

Also, please run check-package to make sure the indentation is correct.

OK

Quoted 7 lines

package/balena/Config.in

Quoted 5 lines
package/balena/Config.in new file +4 -0
+BALENA_LICENSE = Apache-2.0
+BALENA_LICENSE_FILES = LICENSE
+
+BALENA_DEPENDENCIES = host-go host-pkgconf systemd lvm2

Drop the host-go dependency, it's not needed because you're using the golang-package infrastructure.

OK

Quoted 4 lines
Quoted 2 lines

+BALENA_GOPATH = "$(@D)/.gopath"

I believe this is not needed, it's taken care of by the golang-package infrastructure.

OK

Quoted 3 lines
Quoted 2 lines

+BALENA_VERSION_DIR = 17.06.0-dev

Ditto, should not be needed.

OK

Quoted 7 lines
Quoted 2 lines

+BALENA_BUILD_TARGETS = balena

This one is OK.

Quoted 1 line

+BALENA_INSTALL_BINS = $(TARGET_DIR)/usr/bin/$(target)

This one doesn't make sense because $(target) is empty. Instead list the binaries to be installed.

OK

Quoted 9 lines
Quoted 7 lines

+BALENA_CONFIGURE_ENV = GOPATH=${BALENA_GOPATH} \
+??? $(TARGET_MAKE_ENV) \
+??? $(HOST_GO_TARGET_ENV) \
+??? DOCKER_GITCOMMIT=${BALENA_COMMIT} \
+??? DOCKER_BUILDTAGS='exclude_graphdriver_btrfs exclude_graphdirver_zfs exclude_graphdriver_devicemapper'

None of that should be needed with the golang-package infrastructure. Look at the docker-engine package for an example.

I thought so but when I remove one of them, it crashes while configuring. Even it is balena package, it needs some docker parameters.

Quoted 11 lines

package/balena/Config.in

Quoted 5 lines
package/balena/Config.in new file +4 -0
+
+BALENA_MAKE_ENV = GOPATH=$(BALENA_GOPATH) \
+??? $(TARGET_MAKE_ENV) \
+??? $(HOST_GO_TARGET_ENV)

Same.

package/balena/Config.in

Quoted 2 lines
package/balena/Config.in new file +2 -0
+
+BALENA_GLDFLAGS += -extldflags '-static'

Same.

Quoted 5 lines

package/balena/Config.in

Quoted 4 lines
package/balena/Config.in new file +4 -0
+
+define BALENA_CONFIGURE_CMDS
+??? mkdir -p $(BALENA_GOPATH)/src/github.com/docker
+??? ln -fs $(@D) $(BALENA_GOPATH)/src/github.com/docker/docker

Not needed with the golang-package infrastructure.

golang-package does ;

mkdir -p $(@D)/_gopath/src/github.com/resin-os/ ln -sf $(@D) $(@D)/_gopath/src/github.com/resin-os/balena

but balena needs ;
mkdir -p $(@D)/.gopath/src/github.com/docker ln -fs $(@D) $(@D)/.gopath/src/github.com/docker/docker

I think this caused by package itself. I am not a developer of balena, I can ask this issue to balena developers

Quoted 5 lines
Quoted 4 lines

+??? cd $(@D) && \
+??? ??? $(BALENA_CONFIGURE_ENV) \
+??? ??? bash ./hack/make.sh dynbinary-balena

Do this in a POST_CONFIGURE_HOOKS.

OK

Quoted 10 lines

package/balena/Config.in

Quoted 9 lines
package/balena/Config.in new file +8 -0
+define BALENA_BUILD_CMDS
+??? $(foreach target,$(BALENA_BUILD_TARGETS), \
+??? ??? cd $(BALENA_GOPATH)/src/github.com/docker/docker/cmd/mobynit; \
+??? ??? $(BALENA_MAKE_ENV) \
+??? ??? $(HOST_DIR)/bin/go build -v\
+??? ??? ??? -ldflags "$(BALENA_GLDFLAGS)"
+??? )
+endef

Not needed, it should be done by the golang-package infrastructure.

build directory is

$(BALENA_GOPATH)/src/github.com/docker/docker/cmd/mobynit

I guess buildroot looks $(BALENA_GOPATH)/src/github.com/resin-io/balena/cmd/balena Am I right?

Quoted 14 lines
Quoted 5 lines
package/balena/Config.in new file +4 -0
+
+define BALENA_INSTALL_TARGET_CMDS
+??? $(foreach target,$(BALENA_BUILD_TARGETS), \
+??? ??? $(INSTALL) -D -m 0755
Quoted 8 lines

$(@D)/bundles/17.06.0-dev/dynbinary-balena/$(target) $(BALENA_INSTALL_BINS) +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balenad
+??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-containerd +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-containerd-shim +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-containerd-ctr +??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-runc
+??? ??? ln -sf balena $(TARGET_DIR)/usr/bin/balena-proxy
+??? )

Same.

build step creates

$(BALENA_GOPATH)/src/github.com/docker/docker/cmd/mobynit/mobynit

but we need

$(@D)/bundles/17.06.0-dev/dynbinary-balena/balena

Quoted 7 lines

Basically, I have the feeling that you created this package as a generic-package originally, and then quickly converted it to golang-package. But the golang-package infrastructure greatly simplifies Go packages, so you should really leverage the features of the golang-package infrastructure.

Quoted 5 lines

Could you rework this package to use golang-package more effectively ?

Thanks a lot!

Thomas

I check docker-engine before converting to golang package. Also I took balena_git.bb file on meta-resin as a reference for cross-compile procedure from Yocto Projects. If I can I want to rework on this package with your help.

Cheers,

Refik Tuzakl?
Embedded Software Engineer
IT and Simulation Group

Savronik A.?.

Organize Sanayi B?lgesi

20. Cadde No: 19 26110

Eski?ehir Turkey

Tel?? : (+90 222) 236 1590

Faks: (+90 222) 236 1589

www.savronik.com.tr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180605/76614371/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: refik_tuzakli.vcf
Type: text/x-vcard
Size: 4 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180605/76614371/attachment.vcf>