All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [[PATCH v2 00/14] various improvements to package/mender
@ 2018-08-20 13:09 Mirza Krak
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 01/14] package/mender: fix install path for identity and inventory scripts Mirza Krak
                   ` (13 more replies)
  0 siblings, 14 replies; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 13:09 UTC (permalink / raw)
  To: buildroot

This patch series brings some improvements to the Mender package. So
far the Mender client binary was compiled properly but it was lacking some
configuration files to function properly, which this series hope to adress.

The Mender client is only part one part of integrating Mender and the other
parts (in short) are (generic & board specific):

Generic:
- eMMC disk image with correct partition layout (A & B rootfs + data part)
    - But this is board specific in Buildroot?
- Mender artifact images (mender-artifact host tool)

Board specific:
- U-boot patches
    - bootcmd, altbootcmd, BOOTCOUNT_LIMIT, BOOTCOUNT_ENV
    - persistante storage of ENV
    - redundant ENV
- fw_printenv/fw_setenv configuration file

But above are not covered in this series and will be handled separately.

This series has been tested on a custom ATSAMA5D27 based board.

Previous revisions of this series can be found here:

    http://lists.busybox.net/pipermail/buildroot/2018-August/227822.html

Changes in v2:

- Split up patches in more logical changes and the order them accordingly
  - PATCH 1-5 - "Fixes" to make the mender client work, and work being defined
    as the mender.service will start without errors.
  - PATCH 6-12 - Clean-ups and improvements
  - PATCH 13-14 - RFC status

Mirza Krak (14):
  package/mender: fix install path for identity and inventory scripts
  package/mender: provide sane values in mender.conf
  package/mender: create directory structures required by the Mender
    client
  package/mender: create directory containing Mender state script
  package/mender: symlink /var/lib/mender -> /data/mender
  package/mender: select BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV
  package/mender: select BR2_PACKAGE_CA_CERTIFICATES
  package/mender: remove tenant.conf
  package/mender: use inventory and identity script from upstream source
  package/mender: update legal info
  package/mender: set version in go linker
  package/mender: use MENDER_PKGDIR to access local files
  package/mender: add BR2_PACKAGE_MENDER_ARTIFACT_NAME option
  package/mender: add BR2_PACKAGE_MENDER_DEVICE_TYPE option

 package/mender/Config.in                 | 27 ++++++++++++
 package/mender/mender-device-identity    | 52 -----------------------
 package/mender/mender-inventory-hostinfo | 21 ----------
 package/mender/mender-inventory-network  | 47 ---------------------
 package/mender/mender.conf               | 20 ++++-----
 package/mender/mender.hash               | 39 ++++++++++++++++++
 package/mender/mender.mk                 | 71 +++++++++++++++++++++++++++-----
 package/mender/mender.service            |  1 -
 package/mender/tenant.conf               |  0
 9 files changed, 134 insertions(+), 144 deletions(-)
 delete mode 100644 package/mender/mender-device-identity
 delete mode 100644 package/mender/mender-inventory-hostinfo
 delete mode 100644 package/mender/mender-inventory-network
 delete mode 100644 package/mender/tenant.conf

--
2.11.0

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 01/14] package/mender: fix install path for identity and inventory scripts
  2018-08-20 13:09 [Buildroot] [[PATCH v2 00/14] various improvements to package/mender Mirza Krak
@ 2018-08-20 13:09 ` Mirza Krak
  2018-08-20 14:51   ` Thomas Petazzoni
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 02/14] package/mender: provide sane values in mender.conf Mirza Krak
                   ` (12 subsequent siblings)
  13 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 13:09 UTC (permalink / raw)
  To: buildroot

These scripts are used to generate the device identity and to populate
the the device inventory. The Mender client will call these and at least
the mender-device-identity is required to be present at the correct
location. Inventory scripts are there as an example and not
actually required.

Example output from identity script:

    $ ./mender-device-identity
    mac=de:ad:ca:fe:00:01
    cpuid=1112233

Example output from inventory script:

    $ ./mender-inventory-network
    mac_br-fbfdad18c33c=02:42:7e:74:96:85
    network_interfaces=br-fbfdad18c33c
    ipv4_br-fbfdad18c33c=172.21.0.1/16
    mac_enp0s25=de:ad:be:ef:bb:05
    network_interfaces=enp0s25
    ipv4_enp0s25=123.22.0.197/16
    ipv4_enp0s25=10.20.20.105/16
    ipv6_enp0s25=fe80::2aad:beff:feef:bb05/64

Inventory and device identity data is presented on the Mender server
front-end.

Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
---
 package/mender/mender.mk | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/package/mender/mender.mk b/package/mender/mender.mk
index 695b5e7a91..deab0cb039 100644
--- a/package/mender/mender.mk
+++ b/package/mender/mender.mk
@@ -14,12 +14,13 @@ define MENDER_INSTALL_CONFIG_FILES
 		$(TARGET_DIR)/etc/mender/tenant.conf
 	$(INSTALL) -D -m 0644 package/mender/server.crt \
 		$(TARGET_DIR)/etc/mender/server.crt
+
 	$(INSTALL) -D -m 0755 package/mender/mender-device-identity \
-		$(TARGET_DIR)/var/share/mender/identity/mender-device-identity
+		$(TARGET_DIR)/usr/share/mender/identity/mender-device-identity
 	$(INSTALL) -D -m 0755 package/mender/mender-inventory-network \
-		$(TARGET_DIR)/var/share/mender/inventory/mender-inventory-network
+		$(TARGET_DIR)/usr/share/mender/inventory/mender-inventory-network
 	$(INSTALL) -D -m 0755 package/mender/mender-inventory-hostinfo \
-		$(TARGET_DIR)/var/share/mender/inventory/mender-inventory-hostinfo
+		$(TARGET_DIR)/usr/share/mender/inventory/mender-inventory-hostinfo
 endef
 
 MENDER_POST_INSTALL_TARGET_HOOKS += MENDER_INSTALL_CONFIG_FILES
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 02/14] package/mender: provide sane values in mender.conf
  2018-08-20 13:09 [Buildroot] [[PATCH v2 00/14] various improvements to package/mender Mirza Krak
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 01/14] package/mender: fix install path for identity and inventory scripts Mirza Krak
@ 2018-08-20 13:09 ` Mirza Krak
  2018-08-20 14:51   ` Thomas Petazzoni
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 03/14] package/mender: create directory structures required by the Mender client Mirza Krak
                   ` (11 subsequent siblings)
  13 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 13:09 UTC (permalink / raw)
  To: buildroot

The current values that are in mender.conf will actually
cause the Mender client to fail to start because of invalid
values.

Provide sane default values that at least allow the Mender client
to parse the configuration options and start running.

The values provided will actually work in a "Demo Environment",
see https://docs.mender.io/getting-started/create-a-test-environment.

Though an entry is required in /etc/hosts to resolve the URL to the
local IP address of the running demo server.

Example:

    echo "192.168.0.10 docker.mender.io s3.docker.mender.io" >> \
         /etc/hosts

Above is required because the demo certificate
(/etc/mender/server.crt) is created for https://docker.mender.io.

Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
---
 package/mender/mender.conf | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/package/mender/mender.conf b/package/mender/mender.conf
index a5c7c545c3..979f16aaf6 100644
--- a/package/mender/mender.conf
+++ b/package/mender/mender.conf
@@ -1,14 +1,10 @@
 {
-  "ClientProtocol": "http",
-  "HttpsClient": {
-    "Certificate": "",
-    "Key": ""
-  },
-  "RootfsPartA": "@MENDER_ROOTFS_PART_A@",
-  "RootfsPartB": "@MENDER_ROOTFS_PART_B@",
-  "UpdatePollIntervalSeconds": @MENDER_UPDATE_POLL_INTERVAL_SECONDS@,
-  "InventoryPollIntervalSeconds": @MENDER_INVENTORY_POLL_INTERVAL_SECONDS@,
-  "RetryPollIntervalSeconds": @MENDER_RETRY_POLL_INTERVAL_SECONDS@,
-  "ServerURL": "@MENDER_SERVER_URL@",
-  "ServerCertificate": "@MENDER_CERT_LOCATION@"
+  "InventoryPollIntervalSeconds": 1800,
+  "UpdatePollIntervalSeconds": 1800,
+  "RetryPollIntervalSeconds": 300,
+  "RootfsPartA": "mmcblk0p2",
+  "RootfsPartB": "mmcblk0p3",
+  "ServerCertificate": "/etc/mender/server.crt",
+  "ServerURL": "https://docker.mender.io",
+  "TenantToken": "dummy"
 }
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 03/14] package/mender: create directory structures required by the Mender client
  2018-08-20 13:09 [Buildroot] [[PATCH v2 00/14] various improvements to package/mender Mirza Krak
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 01/14] package/mender: fix install path for identity and inventory scripts Mirza Krak
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 02/14] package/mender: provide sane values in mender.conf Mirza Krak
@ 2018-08-20 13:09 ` Mirza Krak
  2018-08-20 13:15   ` Thomas Petazzoni
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 04/14] package/mender: create directory containing Mender state script Mirza Krak
                   ` (10 subsequent siblings)
  13 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 13:09 UTC (permalink / raw)
  To: buildroot

/uboot is a mount point for vfat boot partition.
/data is a mount point for the persistent data partition.

Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
---
 package/mender/mender.mk | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/mender/mender.mk b/package/mender/mender.mk
index deab0cb039..71f92ce048 100644
--- a/package/mender/mender.mk
+++ b/package/mender/mender.mk
@@ -8,6 +8,10 @@ MENDER_VERSION = 1.4.0
 MENDER_SITE = $(call github,mendersoftware,mender,$(MENDER_VERSION))
 
 define MENDER_INSTALL_CONFIG_FILES
+	$(INSTALL) -d -m 755 $(TARGET_DIR)/data/mender
+	$(INSTALL) -d -m 755 $(TARGET_DIR)/data/uboot
+	$(INSTALL) -d -m 755 $(TARGET_DIR)/uboot
+
 	$(INSTALL) -D -m 0644 package/mender/mender.conf \
 		$(TARGET_DIR)/etc/mender/mender.conf
 	$(INSTALL) -D -m 0644 package/mender/tenant.conf \
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 04/14] package/mender: create directory containing Mender state script
  2018-08-20 13:09 [Buildroot] [[PATCH v2 00/14] various improvements to package/mender Mirza Krak
                   ` (2 preceding siblings ...)
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 03/14] package/mender: create directory structures required by the Mender client Mirza Krak
@ 2018-08-20 13:09 ` Mirza Krak
  2018-08-20 14:51   ` Thomas Petazzoni
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 05/14] package/mender: symlink /var/lib/mender -> /data/mender Mirza Krak
                   ` (9 subsequent siblings)
  13 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 13:09 UTC (permalink / raw)
  To: buildroot

Mender state-scripts are essentially "hooks" that can be provided to
influence the update flow.

They should be placed inside /etc/mender/scripts and the directory must
contain a file containing the current state-script format version. It is
currently "2".

Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
---
 package/mender/mender.mk | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/package/mender/mender.mk b/package/mender/mender.mk
index 71f92ce048..acf50e0092 100644
--- a/package/mender/mender.mk
+++ b/package/mender/mender.mk
@@ -12,6 +12,9 @@ define MENDER_INSTALL_CONFIG_FILES
 	$(INSTALL) -d -m 755 $(TARGET_DIR)/data/uboot
 	$(INSTALL) -d -m 755 $(TARGET_DIR)/uboot
 
+	$(INSTALL) -d -m 755 $(TARGET_DIR)/etc/mender/scripts
+	echo -n "2" > $(TARGET_DIR)/etc/mender/scripts/version
+
 	$(INSTALL) -D -m 0644 package/mender/mender.conf \
 		$(TARGET_DIR)/etc/mender/mender.conf
 	$(INSTALL) -D -m 0644 package/mender/tenant.conf \
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 05/14] package/mender: symlink /var/lib/mender -> /data/mender
  2018-08-20 13:09 [Buildroot] [[PATCH v2 00/14] various improvements to package/mender Mirza Krak
                   ` (3 preceding siblings ...)
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 04/14] package/mender: create directory containing Mender state script Mirza Krak
@ 2018-08-20 13:09 ` Mirza Krak
  2018-08-20 18:36   ` Mirza Krak
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 06/14] package/mender: select BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV Mirza Krak
                   ` (8 subsequent siblings)
  13 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 13:09 UTC (permalink / raw)
  To: buildroot

The Mender client will use /var/lib/mender to access the persistent data
partition and expect the link to be in place.

By default it points to /data, but this can easily be overriden by
overriding the link in overlay_fs

Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
---
 package/mender/mender.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/mender/mender.mk b/package/mender/mender.mk
index acf50e0092..eb718ebc02 100644
--- a/package/mender/mender.mk
+++ b/package/mender/mender.mk
@@ -28,6 +28,8 @@ define MENDER_INSTALL_CONFIG_FILES
 		$(TARGET_DIR)/usr/share/mender/inventory/mender-inventory-network
 	$(INSTALL) -D -m 0755 package/mender/mender-inventory-hostinfo \
 		$(TARGET_DIR)/usr/share/mender/inventory/mender-inventory-hostinfo
+
+	ln -sf /data/mender $(TARGET_DIR)/var/lib/mender
 endef
 
 MENDER_POST_INSTALL_TARGET_HOOKS += MENDER_INSTALL_CONFIG_FILES
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 06/14] package/mender: select BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV
  2018-08-20 13:09 [Buildroot] [[PATCH v2 00/14] various improvements to package/mender Mirza Krak
                   ` (4 preceding siblings ...)
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 05/14] package/mender: symlink /var/lib/mender -> /data/mender Mirza Krak
@ 2018-08-20 13:09 ` Mirza Krak
  2018-08-20 14:52   ` Thomas Petazzoni
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 07/14] package/mender: select BR2_PACKAGE_CA_CERTIFICATES Mirza Krak
                   ` (7 subsequent siblings)
  13 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 13:09 UTC (permalink / raw)
  To: buildroot

The Mender client uses fw_printenv/fw_setenv to manipulate the U-boot
environment, e.g to change the boot candidate after a update has been
done.

Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
---

Changes in V2:
- Added #runtime to hint that this not a build dependency

 package/mender/Config.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/mender/Config.in b/package/mender/Config.in
index e461857486..aeb0b2694f 100644
--- a/package/mender/Config.in
+++ b/package/mender/Config.in
@@ -3,6 +3,8 @@ config BR2_PACKAGE_MENDER
 	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
 	depends on BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS
 	depends on BR2_TOOLCHAIN_HAS_THREADS
+	select BR2_PACKAGE_UBOOT_TOOLS # runtime
+	select BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV # runtime
 	help
 	  Mender is an open source over-the-air (OTA) software updater
 	  for embedded Linux devices. Mender comprises a client
--
2.11.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 07/14] package/mender: select BR2_PACKAGE_CA_CERTIFICATES
  2018-08-20 13:09 [Buildroot] [[PATCH v2 00/14] various improvements to package/mender Mirza Krak
                   ` (5 preceding siblings ...)
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 06/14] package/mender: select BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV Mirza Krak
@ 2018-08-20 13:09 ` Mirza Krak
  2018-08-20 14:54   ` Thomas Petazzoni
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 08/14] package/mender: remove tenant.conf Mirza Krak
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 13:09 UTC (permalink / raw)
  To: buildroot

Mender uses TLS to community with the management server,
and if CA signed certificates are used we must have
the ca-certificates package installed to be able to
verify these.

Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
---

Changes in V2:
- Added #runtime to hint that this not a build dependency

 package/mender/Config.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/mender/Config.in b/package/mender/Config.in
index aeb0b2694f..853a472ea1 100644
--- a/package/mender/Config.in
+++ b/package/mender/Config.in
@@ -5,6 +5,7 @@ config BR2_PACKAGE_MENDER
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	select BR2_PACKAGE_UBOOT_TOOLS # runtime
 	select BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV # runtime
+	select BR2_PACKAGE_CA_CERTIFICATES # runtime
 	help
 	  Mender is an open source over-the-air (OTA) software updater
 	  for embedded Linux devices. Mender comprises a client
--
2.11.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 08/14] package/mender: remove tenant.conf
  2018-08-20 13:09 [Buildroot] [[PATCH v2 00/14] various improvements to package/mender Mirza Krak
                   ` (6 preceding siblings ...)
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 07/14] package/mender: select BR2_PACKAGE_CA_CERTIFICATES Mirza Krak
@ 2018-08-20 13:09 ` Mirza Krak
  2018-08-20 15:15   ` Thomas Petazzoni
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 09/14] package/mender: use inventory and identity script from upstream source Mirza Krak
                   ` (5 subsequent siblings)
  13 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 13:09 UTC (permalink / raw)
  To: buildroot

Tenant Token is a configuration option that has to do with Hosted Mender,
where you you need to set this for the devices to connect to the
correct organization in a multi-tenant system.

The removal of tenant.conf usage (and /var/lib/mender/authtentoken)
was in Mender client version 1.2.0, where it was switched to be an mender.conf
option instead as the example above demonstrates. As the first version that was
integrated in Buildroot was 1.4.0, the inclusion of tenant.conf and the
creation of the symlink is not necessary.

Now it is specified as such in mender.conf:

Example:

/etc/mender/mender.conf
{
    TenantToken: "very long base64 encoded string"
}

Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
---

Changes in V2:

- New patch, split out from package/mender: update install of config files
    - Better description

 package/mender/mender.mk      | 3 +--
 package/mender/mender.service | 1 -
 package/mender/tenant.conf    | 0
 3 files changed, 1 insertion(+), 3 deletions(-)
 delete mode 100644 package/mender/tenant.conf

diff --git a/package/mender/mender.mk b/package/mender/mender.mk
index eb718ebc02..24122cafc5 100644
--- a/package/mender/mender.mk
+++ b/package/mender/mender.mk
@@ -17,8 +17,7 @@ define MENDER_INSTALL_CONFIG_FILES

 	$(INSTALL) -D -m 0644 package/mender/mender.conf \
 		$(TARGET_DIR)/etc/mender/mender.conf
-	$(INSTALL) -D -m 0644 package/mender/tenant.conf \
-		$(TARGET_DIR)/etc/mender/tenant.conf
+
 	$(INSTALL) -D -m 0644 package/mender/server.crt \
 		$(TARGET_DIR)/etc/mender/server.crt

diff --git a/package/mender/mender.service b/package/mender/mender.service
index ec77fbc46c..9ede55acb5 100644
--- a/package/mender/mender.service
+++ b/package/mender/mender.service
@@ -7,7 +7,6 @@ Type=idle
 User=root
 Group=root
 ExecStartPre=/bin/mkdir -p -m 0700 /data/mender
-ExecStartPre=/bin/ln -sf /etc/mender/tenant.conf /var/lib/mender/authtentoken
 ExecStart=/usr/bin/mender -daemon
 Restart=on-abort

diff --git a/package/mender/tenant.conf b/package/mender/tenant.conf
deleted file mode 100644
index e69de29bb2..0000000000
--
2.11.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 09/14] package/mender: use inventory and identity script from upstream source
  2018-08-20 13:09 [Buildroot] [[PATCH v2 00/14] various improvements to package/mender Mirza Krak
                   ` (7 preceding siblings ...)
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 08/14] package/mender: remove tenant.conf Mirza Krak
@ 2018-08-20 13:09 ` Mirza Krak
  2018-08-20 15:15   ` Thomas Petazzoni
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 10/14] package/mender: update legal info Mirza Krak
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 13:09 UTC (permalink / raw)
  To: buildroot

These files are part of Mender sources and no point in keeping duplicate
files locally.

Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
---

Changes in V2:
- New patch, split out from package/mender: update install of config files

 package/mender/mender-device-identity    | 52 --------------------------------
 package/mender/mender-inventory-hostinfo | 21 -------------
 package/mender/mender-inventory-network  | 47 -----------------------------
 package/mender/mender.mk                 | 10 +++---
 4 files changed, 5 insertions(+), 125 deletions(-)
 delete mode 100644 package/mender/mender-device-identity
 delete mode 100644 package/mender/mender-inventory-hostinfo
 delete mode 100644 package/mender/mender-inventory-network

diff --git a/package/mender/mender-device-identity b/package/mender/mender-device-identity
deleted file mode 100644
index d87f843357..0000000000
--- a/package/mender/mender-device-identity
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/sh
-
-# Example script called by Mender agent to collect device identity data. The
-# script needs to be located at
-# $(datadir)/mender/identity/mender-device-identity path for the agent to find
-# it. The script shall exit with non-0 status on errors. In this case the agent
-# will discard any output the script may have produced.
-#
-# The script shall output identity data in <key>=<value> format, one
-# entry per line. Example
-#
-# $ ./mender-device-identity
-# mac=de:ad:ca:fe:00:01
-# cpuid=1112233
-#
-# The example script collects the MAC address of a network interface with the
-# type ARPHRD_ETHER and it will pick the interface with the lowest ifindex
-# number if there are multiple interfaces with that type. The identity data is
-# output in the following format:
-#
-# mac=00:01:02:03:04:05
-#
-
-set -ue
-
-SCN=/sys/class/net
-min=65535
-arphrd_ether=1
-ifdev=
-
-# find iface with lowest ifindex, skip non ARPHRD_ETHER types (lo, sit ...)
-for dev in $SCN/*; do
-    iftype=$(cat $dev/type)
-    if [ $iftype -ne $arphrd_ether ]; then
-        continue
-    fi
-
-    idx=$(cat $dev/ifindex)
-    if [ $idx -lt $min ]; then
-        min=$idx
-        ifdev=$dev
-    fi
-done
-
-if [ -z "$ifdev" ]; then
-    echo "no suitable interfaces found" >&2
-    exit 1
-else
-    echo "using interface $ifdev" >&2
-    # grab MAC address
-    echo "mac=$(cat $ifdev/address)"
-fi
diff --git a/package/mender/mender-inventory-hostinfo b/package/mender/mender-inventory-hostinfo
deleted file mode 100644
index cf508fdf88..0000000000
--- a/package/mender/mender-inventory-hostinfo
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-#
-# The example script collects information about current host
-#
-
-set -ue
-
-LC_ALL=C
-export LC_ALL
-
-grep 'model name' /proc/cpuinfo | uniq | awk -F': ' '
-     // { printf("cpu_model=%s\n", $2);}
-'
-echo "kernel=$(cat /proc/version)"
-
-cat /proc/meminfo | awk '
-/MemTotal/ {printf("mem_total_kB=%d\n", $2)}
-'
-
-echo "hostname=$(cat /etc/hostname)"
-
diff --git a/package/mender/mender-inventory-network b/package/mender/mender-inventory-network
deleted file mode 100644
index b017c4ea14..0000000000
--- a/package/mender/mender-inventory-network
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-#
-# Example script called by Mender agent to collect inventory data for a
-# particular devce. The script needs to be located in $(datadir)/mender and its
-# name shall start with `mender-inventory-` prefix. The script shall exit with
-# non-0 status on errors. In this case the agent will discard any output the
-# script may have produced.
-#
-# The script shall output inventory data in <key>=<value> format, one entry per
-# line. Entries appearing multiple times will be joined in a list under the same
-# key.
-#
-# $ ./mender-inventory-network
-# mac_br-fbfdad18c33c=02:42:7e:74:96:85
-# network_interfaces=br-fbfdad18c33c
-# ipv4_br-fbfdad18c33c=172.21.0.1/16
-# mac_enp0s25=de:ad:be:ef:bb:05
-# network_interfaces=enp0s25
-# ipv4_enp0s25=123.22.0.197/16
-# ipv4_enp0s25=10.20.20.105/16
-# ipv6_enp0s25=fe80::2aad:beff:feef:bb05/64
-#
-#
-# The example script collects the list of network interfaces, as well as
-# ethernet and IP addresses of each of the interfaces.
-#
-
-set -ue
-
-SCN=/sys/class/net
-min=65535
-ifdev=
-
-# find iface with lowest ifindex, except loopback
-for devpath in $SCN/*; do
-    dev=$(basename $devpath)
-    if [ $dev = "lo" ]; then
-        continue
-    fi
-    echo "mac_$dev=$(cat $devpath/address)"
-    echo "network_interfaces=$dev"
-
-    ip addr show dev $dev | awk -v dev=$dev '
-       /inet / { printf("ipv4_%s=%s\n", dev, $2) }
-       /inet6 / {printf("ipv6_%s=%s\n", dev, $2) }
-    '
-done
diff --git a/package/mender/mender.mk b/package/mender/mender.mk
index 24122cafc5..1f54862077 100644
--- a/package/mender/mender.mk
+++ b/package/mender/mender.mk
@@ -21,12 +21,12 @@ define MENDER_INSTALL_CONFIG_FILES
 	$(INSTALL) -D -m 0644 package/mender/server.crt \
 		$(TARGET_DIR)/etc/mender/server.crt

-	$(INSTALL) -D -m 0755 package/mender/mender-device-identity \
+	$(INSTALL) -D -m 0755 $(@D)/support/mender-device-identity \
 		$(TARGET_DIR)/usr/share/mender/identity/mender-device-identity
-	$(INSTALL) -D -m 0755 package/mender/mender-inventory-network \
-		$(TARGET_DIR)/usr/share/mender/inventory/mender-inventory-network
-	$(INSTALL) -D -m 0755 package/mender/mender-inventory-hostinfo \
-		$(TARGET_DIR)/usr/share/mender/inventory/mender-inventory-hostinfo
+	$(foreach f,hostinfo network, \
+		$(INSTALL) -D -m 0755 $(@D)/support/mender-inventory-$(f) \
+			$(TARGET_DIR)/usr/share/mender/inventory/mender-inventory-$(f)
+	)

 	ln -sf /data/mender $(TARGET_DIR)/var/lib/mender
 endef
--
2.11.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 10/14] package/mender: update legal info
  2018-08-20 13:09 [Buildroot] [[PATCH v2 00/14] various improvements to package/mender Mirza Krak
                   ` (8 preceding siblings ...)
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 09/14] package/mender: use inventory and identity script from upstream source Mirza Krak
@ 2018-08-20 13:09 ` Mirza Krak
  2018-08-20 15:15   ` Thomas Petazzoni
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 11/14] package/mender: set version in go linker Mirza Krak
                   ` (3 subsequent siblings)
  13 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 13:09 UTC (permalink / raw)
  To: buildroot

Also added license checksums in mender.hash

Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
---

Changes in V2:

- Added all vendor licenses to mender.hash and MENDER_LICENSE_FILES

 package/mender/mender.hash | 39 +++++++++++++++++++++++++++++++++++++++
 package/mender/mender.mk   | 25 +++++++++++++++++++++++++
 2 files changed, 64 insertions(+)

diff --git a/package/mender/mender.hash b/package/mender/mender.hash
index 30a04fad7a..8faa740e3b 100644
--- a/package/mender/mender.hash
+++ b/package/mender/mender.hash
@@ -1,2 +1,41 @@
 # Locally computed:
 sha256 267fa73ad472b034248ee298593b5c52ea0b105fd73c91febb3587280c61bee2 mender-1.4.0.tar.gz
+
+# Apache-2.0 license, locally computed
+sha256 ceb1b36ff073bd13d9806d4615b931707768ca9023805620acc32dd1cfc2f680 LICENSE
+
+# Vendor licenses
+# Generated with sed '/^[A-Za-z0-9_]/s/^/sha256  /' LIC_FILES_CHKSUM.sha256
+
+# Apache-2.0 license.
+sha256 ceb1b36ff073bd13d9806d4615b931707768ca9023805620acc32dd1cfc2f680  vendor/github.com/mendersoftware/mendertesting/LICENSE
+sha256 3591f687e2d6f49c83b1ec69577e8110afbde80be5ec81791bd86d2838ccd3de  vendor/github.com/mendersoftware/log/LICENSE
+sha256 bbb303820971c294a9a8e5eba5affcf1379036e877ea61c11cbf9400b2949483  vendor/github.com/mendersoftware/log/COPYING
+sha256 3591f687e2d6f49c83b1ec69577e8110afbde80be5ec81791bd86d2838ccd3de  vendor/github.com/mendersoftware/scopestack/LICENSE
+sha256 bbb303820971c294a9a8e5eba5affcf1379036e877ea61c11cbf9400b2949483  vendor/github.com/mendersoftware/scopestack/COPYING
+sha256 b40930bbcf80744c86c46a12bc9da056641d722716c378f5659b9e555ef833e1  vendor/github.com/mendersoftware/mender-artifact/LICENSE
+
+# BSD 2 Clause license.
+sha256 8d427fd87bc9579ea368fde3d49f9ca22eac857f91a9dec7e3004bdfab7dee86  vendor/github.com/pkg/errors/LICENSE
+
+# BSD 3 Clause license.
+sha256 2eb550be6801c1ea434feba53bf6d12e7c71c90253e0a9de4a4f46cf88b56477  vendor/github.com/pmezard/go-difflib/LICENSE
+sha256 2d36597f7117c38b006835ae7f537487207d8ec407aa9d9980794b2030cbc067  vendor/golang.org/x/sys/LICENSE
+sha256 2d36597f7117c38b006835ae7f537487207d8ec407aa9d9980794b2030cbc067  vendor/golang.org/x/net/LICENSE
+sha256 0634b008cee55ca01f0888d2f5aba2d34e66c3f52c31a4e16a5d5d33d0c2a03e  vendor/github.com/bmatsuo/lmdb-go/LICENSE.md
+
+# ISC license.
+sha256  3525392c6db3b804af76980b2c560ee9ec1abdadd907d76a26091df7c78f3a25  vendor/github.com/davecgh/go-spew/LICENSE
+
+# MIT license.
+sha256 51a0c9ec7f8b7634181b8d4c03e5b5d204ac21d6e72f46c313973424664b2e6b  vendor/github.com/Sirupsen/logrus/LICENSE
+sha256 402f39eed8a1851385d0703999aa9f23d067c2ea3e15c63c074e389cbf8f8f8f  vendor/github.com/stretchr/testify/LICENSE
+sha256 402f39eed8a1851385d0703999aa9f23d067c2ea3e15c63c074e389cbf8f8f8f  vendor/github.com/stretchr/testify/LICENCE.txt
+sha256 fde7d610b9b95fc5a6304055c4dae951025b630aaa42a24e95ebf76675ae832c  vendor/github.com/stretchr/objx/LICENSE.md
+sha256 ffa15bdce332058a03a1d923910864fb6e58bf6df66a0e3914284725b327183e  vendor/github.com/ungerik/go-sysfs/LICENSE
+
+# OpenLDAP Public License
+sha256 310fe25c858a9515fc8c8d7d1f24a67c9496f84a91e0a0e41ea9975b1371e569  vendor/github.com/bmatsuo/lmdb-go/LICENSE.mdb.md
+
+# sha256 of all the vendor licenses combined
+sha256 54d6f54a2815cc2e3cef4f7dde5a3aae20f09b2cde394d8d3f1dce5d8a79d738 LIC_FILES_CHKSUM.sha256
diff --git a/package/mender/mender.mk b/package/mender/mender.mk
index 1f54862077..fafb0d923a 100644
--- a/package/mender/mender.mk
+++ b/package/mender/mender.mk
@@ -6,6 +6,31 @@

 MENDER_VERSION = 1.4.0
 MENDER_SITE = $(call github,mendersoftware,mender,$(MENDER_VERSION))
+MENDER_LICENSE = Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, MIT, OLDAP-2.8
+
+# Vendor license paths generated with:
+#    awk '{print $2}' LIC_FILES_CHKSUM.sha256 | grep vendor
+MENDER_LICENSE_FILES = \
+	LICENSE \
+	LIC_FILES_CHKSUM.sha256 \
+	vendor/github.com/mendersoftware/mendertesting/LICENSE \
+	vendor/github.com/mendersoftware/log/LICENSE \
+	vendor/github.com/mendersoftware/log/COPYING \
+	vendor/github.com/mendersoftware/scopestack/LICENSE \
+	vendor/github.com/mendersoftware/scopestack/COPYING \
+	vendor/github.com/mendersoftware/mender-artifact/LICENSE \
+	vendor/github.com/pkg/errors/LICENSE \
+	vendor/github.com/pmezard/go-difflib/LICENSE \
+	vendor/golang.org/x/sys/LICENSE \
+	vendor/golang.org/x/net/LICENSE \
+	vendor/github.com/bmatsuo/lmdb-go/LICENSE.md \
+	vendor/github.com/davecgh/go-spew/LICENSE \
+	vendor/github.com/Sirupsen/logrus/LICENSE \
+	vendor/github.com/stretchr/testify/LICENSE \
+	vendor/github.com/stretchr/testify/LICENCE.txt \
+	vendor/github.com/stretchr/objx/LICENSE.md \
+	vendor/github.com/ungerik/go-sysfs/LICENSE \
+	vendor/github.com/bmatsuo/lmdb-go/LICENSE.mdb.md

 define MENDER_INSTALL_CONFIG_FILES
 	$(INSTALL) -d -m 755 $(TARGET_DIR)/data/mender
--
2.11.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 11/14] package/mender: set version in go linker
  2018-08-20 13:09 [Buildroot] [[PATCH v2 00/14] various improvements to package/mender Mirza Krak
                   ` (9 preceding siblings ...)
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 10/14] package/mender: update legal info Mirza Krak
@ 2018-08-20 13:09 ` Mirza Krak
  2018-08-20 15:15   ` Thomas Petazzoni
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 12/14] package/mender: use MENDER_PKGDIR to access local files Mirza Krak
                   ` (2 subsequent siblings)
  13 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 13:09 UTC (permalink / raw)
  To: buildroot

This is used when calling the mender client with the
-version option and it says "unknown" if not set in
linker.

Now it displays the following:

    # mender -version
    1.4.0
    runtime: go1.10.2

Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
---

Changes in V2:
- None

 package/mender/mender.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/package/mender/mender.mk b/package/mender/mender.mk
index fafb0d923a..7e6f18f523 100644
--- a/package/mender/mender.mk
+++ b/package/mender/mender.mk
@@ -32,6 +32,8 @@ MENDER_LICENSE_FILES = \
 	vendor/github.com/ungerik/go-sysfs/LICENSE \
 	vendor/github.com/bmatsuo/lmdb-go/LICENSE.mdb.md

+MENDER_LDFLAGS = -X main.Version=$(MENDER_VERSION)
+
 define MENDER_INSTALL_CONFIG_FILES
 	$(INSTALL) -d -m 755 $(TARGET_DIR)/data/mender
 	$(INSTALL) -d -m 755 $(TARGET_DIR)/data/uboot
--
2.11.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 12/14] package/mender: use MENDER_PKGDIR to access local files
  2018-08-20 13:09 [Buildroot] [[PATCH v2 00/14] various improvements to package/mender Mirza Krak
                   ` (10 preceding siblings ...)
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 11/14] package/mender: set version in go linker Mirza Krak
@ 2018-08-20 13:09 ` Mirza Krak
  2018-10-21 14:09   ` Thomas Petazzoni
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 13/14] package/mender: add BR2_PACKAGE_MENDER_ARTIFACT_NAME option Mirza Krak
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 14/14] package/mender: add BR2_PACKAGE_MENDER_DEVICE_TYPE option Mirza Krak
  13 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 13:09 UTC (permalink / raw)
  To: buildroot

Utilize the predefined variable MENDER_PKGDIR which points to the
directory containing mender.mk and Config.in, along with the local
files.

One benefit is also that it works when BR2_EXTERNAL is used, which
makes it easier to "backport" this to an older external tree.

Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
---

Changes in V2:
- New patch, reported by eager user :)

 package/mender/mender.mk | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/package/mender/mender.mk b/package/mender/mender.mk
index 7e6f18f523..a4b9c6ee85 100644
--- a/package/mender/mender.mk
+++ b/package/mender/mender.mk
@@ -42,10 +42,9 @@ define MENDER_INSTALL_CONFIG_FILES
 	$(INSTALL) -d -m 755 $(TARGET_DIR)/etc/mender/scripts
 	echo -n "2" > $(TARGET_DIR)/etc/mender/scripts/version

-	$(INSTALL) -D -m 0644 package/mender/mender.conf \
+	$(INSTALL) -D -m 0644 $(MENDER_PKGDIR)/mender.conf \
 		$(TARGET_DIR)/etc/mender/mender.conf
-
-	$(INSTALL) -D -m 0644 package/mender/server.crt \
+	$(INSTALL) -D -m 0644 $(MENDER_PKGDIR)/server.crt \
 		$(TARGET_DIR)/etc/mender/server.crt

 	$(INSTALL) -D -m 0755 $(@D)/support/mender-device-identity \
@@ -61,7 +60,7 @@ endef
 MENDER_POST_INSTALL_TARGET_HOOKS += MENDER_INSTALL_CONFIG_FILES

 define MENDER_INSTALL_INIT_SYSTEMD
-	$(INSTALL) -D -m 0644 package/mender/mender.service \
+	$(INSTALL) -D -m 0644 $(MENDER_PKGDIR)/mender.service \
 		$(TARGET_DIR)/usr/lib/systemd/system/mender.service
 	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
 	ln -fs ../../../../usr/lib/systemd/system/mender.service \
--
2.11.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 13/14] package/mender: add BR2_PACKAGE_MENDER_ARTIFACT_NAME option
  2018-08-20 13:09 [Buildroot] [[PATCH v2 00/14] various improvements to package/mender Mirza Krak
                   ` (11 preceding siblings ...)
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 12/14] package/mender: use MENDER_PKGDIR to access local files Mirza Krak
@ 2018-08-20 13:09 ` Mirza Krak
  2018-10-21 14:40   ` Arnout Vandecappelle
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 14/14] package/mender: add BR2_PACKAGE_MENDER_DEVICE_TYPE option Mirza Krak
  13 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 13:09 UTC (permalink / raw)
  To: buildroot

ARTIFACT_NAME is used to set a unique string of the built artifact/image
and this will be reported to the Mender managment server as "current
software running".

The Mender managment server will skip updating device if the
ARTIFACT_NAME is the same on the target device as in the Mender artifact
and hence this name must be unique for every release.

Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
---
 package/mender/Config.in | 13 +++++++++++++
 package/mender/mender.mk |  7 +++++++
 2 files changed, 20 insertions(+)

diff --git a/package/mender/Config.in b/package/mender/Config.in
index 853a472ea1..8a6359c906 100644
--- a/package/mender/Config.in
+++ b/package/mender/Config.in
@@ -14,6 +14,19 @@ config BR2_PACKAGE_MENDER
 
 	  https://github.com/mendersoftware/mender
 
+if BR2_PACKAGE_MENDER
+
+config BR2_PACKAGE_MENDER_ARTIFACT_NAME
+	string "Mender artifact name"
+	help
+	  The name of the image or update that will be built. This is
+	  what the device will report that it is running, and different
+	  updates must have different names.
+
+	  Will be stored in /etc/mender/artifact_info
+
+endif
+
 comment "mender needs a toolchain w/ threads"
 	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
 	depends on BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS
diff --git a/package/mender/mender.mk b/package/mender/mender.mk
index a4b9c6ee85..0d4df3a763 100644
--- a/package/mender/mender.mk
+++ b/package/mender/mender.mk
@@ -34,6 +34,10 @@ MENDER_LICENSE_FILES = \
 
 MENDER_LDFLAGS = -X main.Version=$(MENDER_VERSION)
 
+ifeq ($(call qstrip,$(BR2_PACKAGE_MENDER_ARTIFACT_NAME)),)
+$(error Mender device type not set. Check your BR2_PACKAGE_MENDER_ARTIFACT_NAME setting)
+endif
+
 define MENDER_INSTALL_CONFIG_FILES
 	$(INSTALL) -d -m 755 $(TARGET_DIR)/data/mender
 	$(INSTALL) -d -m 755 $(TARGET_DIR)/data/uboot
@@ -55,6 +59,9 @@ define MENDER_INSTALL_CONFIG_FILES
 	)
 
 	ln -sf /data/mender $(TARGET_DIR)/var/lib/mender
+
+	echo "artifact_name=$(call qstrip,$(BR2_PACKAGE_MENDER_ARTIFACT_NAME))" > \
+		$(TARGET_DIR)/etc/mender/artifact_info
 endef
 
 MENDER_POST_INSTALL_TARGET_HOOKS += MENDER_INSTALL_CONFIG_FILES
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 14/14] package/mender: add BR2_PACKAGE_MENDER_DEVICE_TYPE option
  2018-08-20 13:09 [Buildroot] [[PATCH v2 00/14] various improvements to package/mender Mirza Krak
                   ` (12 preceding siblings ...)
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 13/14] package/mender: add BR2_PACKAGE_MENDER_ARTIFACT_NAME option Mirza Krak
@ 2018-08-20 13:09 ` Mirza Krak
  13 siblings, 0 replies; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 13:09 UTC (permalink / raw)
  To: buildroot

MENDER_DEVICE_TYPE is used to verify compatibility of Mender artifacts
against devices and it will also be reported to the Mender management
server from the device for the server to be able to verify this.

Device type can not change once a device has been provisioned with the
initial software and this is why it is stored on the persistent data
partition which is preserved across updates.

Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
---
 package/mender/Config.in | 11 +++++++++++
 package/mender/mender.mk |  7 +++++++
 2 files changed, 18 insertions(+)

diff --git a/package/mender/Config.in b/package/mender/Config.in
index 8a6359c906..c9987adc36 100644
--- a/package/mender/Config.in
+++ b/package/mender/Config.in
@@ -25,6 +25,17 @@ config BR2_PACKAGE_MENDER_ARTIFACT_NAME
 
 	  Will be stored in /etc/mender/artifact_info
 
+config BR2_PACKAGE_MENDER_DEVICE_TYPE
+	string "Mender device type"
+	help
+	  A string that defines the type of device which will be used
+	  to check compatibility of update artifacts. Once a device is
+	  flashed with this, it will not change, even if the device is
+	  updated using Mender.
+
+	  Will be stored in /data/mender/device_type. Note that /data
+	  is a mount point for the persistent data partition.
+
 endif
 
 comment "mender needs a toolchain w/ threads"
diff --git a/package/mender/mender.mk b/package/mender/mender.mk
index 0d4df3a763..89965f4c85 100644
--- a/package/mender/mender.mk
+++ b/package/mender/mender.mk
@@ -38,6 +38,10 @@ ifeq ($(call qstrip,$(BR2_PACKAGE_MENDER_ARTIFACT_NAME)),)
 $(error Mender device type not set. Check your BR2_PACKAGE_MENDER_ARTIFACT_NAME setting)
 endif
 
+ifeq ($(call qstrip,$(BR2_PACKAGE_MENDER_DEVICE_TYPE)),)
+$(error Mender device type not set. Check your BR2_PACKAGE_MENDER_DEVICE_TYPE setting)
+endif
+
 define MENDER_INSTALL_CONFIG_FILES
 	$(INSTALL) -d -m 755 $(TARGET_DIR)/data/mender
 	$(INSTALL) -d -m 755 $(TARGET_DIR)/data/uboot
@@ -62,6 +66,9 @@ define MENDER_INSTALL_CONFIG_FILES
 
 	echo "artifact_name=$(call qstrip,$(BR2_PACKAGE_MENDER_ARTIFACT_NAME))" > \
 		$(TARGET_DIR)/etc/mender/artifact_info
+
+	echo "device_type=$(call qstrip,$(BR2_PACKAGE_MENDER_DEVICE_TYPE))" > \
+		$(TARGET_DIR)/data/mender/device_type
 endef
 
 MENDER_POST_INSTALL_TARGET_HOOKS += MENDER_INSTALL_CONFIG_FILES
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 03/14] package/mender: create directory structures required by the Mender client
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 03/14] package/mender: create directory structures required by the Mender client Mirza Krak
@ 2018-08-20 13:15   ` Thomas Petazzoni
  2018-08-20 13:35     ` Mirza Krak
  0 siblings, 1 reply; 37+ messages in thread
From: Thomas Petazzoni @ 2018-08-20 13:15 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 20 Aug 2018 15:09:03 +0200, Mirza Krak wrote:
> /uboot is a mount point for vfat boot partition.
> /data is a mount point for the persistent data partition.
> 
> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
> ---
>  package/mender/mender.mk | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/package/mender/mender.mk b/package/mender/mender.mk
> index deab0cb039..71f92ce048 100644
> --- a/package/mender/mender.mk
> +++ b/package/mender/mender.mk
> @@ -8,6 +8,10 @@ MENDER_VERSION = 1.4.0
>  MENDER_SITE = $(call github,mendersoftware,mender,$(MENDER_VERSION))
>  
>  define MENDER_INSTALL_CONFIG_FILES
> +	$(INSTALL) -d -m 755 $(TARGET_DIR)/data/mender
> +	$(INSTALL) -d -m 755 $(TARGET_DIR)/data/uboot
> +	$(INSTALL) -d -m 755 $(TARGET_DIR)/uboot

I am sorry, but despite the explanations, I still don't understand why
these *must* be /data and /uboot. Is Mender *enforcing* those locations
exactly ?

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 03/14] package/mender: create directory structures required by the Mender client
  2018-08-20 13:15   ` Thomas Petazzoni
@ 2018-08-20 13:35     ` Mirza Krak
  2018-08-20 13:43       ` Mirza Krak
  0 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 13:35 UTC (permalink / raw)
  To: buildroot

On Mon, Aug 20, 2018 at 3:15 PM, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
> Hello,
>
> On Mon, 20 Aug 2018 15:09:03 +0200, Mirza Krak wrote:
>> /uboot is a mount point for vfat boot partition.
>> /data is a mount point for the persistent data partition.
>>
>> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
>> ---
>>  package/mender/mender.mk | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/package/mender/mender.mk b/package/mender/mender.mk
>> index deab0cb039..71f92ce048 100644
>> --- a/package/mender/mender.mk
>> +++ b/package/mender/mender.mk
>> @@ -8,6 +8,10 @@ MENDER_VERSION = 1.4.0
>>  MENDER_SITE = $(call github,mendersoftware,mender,$(MENDER_VERSION))
>>
>>  define MENDER_INSTALL_CONFIG_FILES
>> +     $(INSTALL) -d -m 755 $(TARGET_DIR)/data/mender
>> +     $(INSTALL) -d -m 755 $(TARGET_DIR)/data/uboot
>> +     $(INSTALL) -d -m 755 $(TARGET_DIR)/uboot
>
> I am sorry, but despite the explanations, I still don't understand why
> these *must* be /data and /uboot. Is Mender *enforcing* those locations
> exactly ?

/uboot, not really enforced, just aligned to other systems that
integrate Mender. I could actually drop this.

/data is not really enforced but the symlink /var/lib/mender must
point to a valid location (normally it points to /data), because once
the Mender daemon starts it will generate some initial files at that
location and the service would fail if non-existent.

List of files that are generated on "first start-up"

-rw-------    1 root     root        2.4K Jan 28  2018 mender-agent.pem
-rw-------    1 root     root        8.0K Jan 28  2018 mender-store
-rw-------    1 root     root        8.0K Jan 28  2018 mender-store-lock

Thank you.

-- 
Mirza Krak | Embedded Solutions Architect | https://mender.io

 Northern.tech AS | @northerntechHQ

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 03/14] package/mender: create directory structures required by the Mender client
  2018-08-20 13:35     ` Mirza Krak
@ 2018-08-20 13:43       ` Mirza Krak
  2018-08-20 14:31         ` Mirza Krak
  0 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 13:43 UTC (permalink / raw)
  To: buildroot

On Mon, Aug 20, 2018 at 3:35 PM, Mirza Krak <mirza.krak@northern.tech> wrote:
> On Mon, Aug 20, 2018 at 3:15 PM, Thomas Petazzoni
> <thomas.petazzoni@bootlin.com> wrote:
>> Hello,
>>
>> On Mon, 20 Aug 2018 15:09:03 +0200, Mirza Krak wrote:
>>> /uboot is a mount point for vfat boot partition.
>>> /data is a mount point for the persistent data partition.
>>>
>>> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
>>> ---
>>>  package/mender/mender.mk | 4 ++++
>>>  1 file changed, 4 insertions(+)
>>>
>>> diff --git a/package/mender/mender.mk b/package/mender/mender.mk
>>> index deab0cb039..71f92ce048 100644
>>> --- a/package/mender/mender.mk
>>> +++ b/package/mender/mender.mk
>>> @@ -8,6 +8,10 @@ MENDER_VERSION = 1.4.0
>>>  MENDER_SITE = $(call github,mendersoftware,mender,$(MENDER_VERSION))
>>>
>>>  define MENDER_INSTALL_CONFIG_FILES
>>> +     $(INSTALL) -d -m 755 $(TARGET_DIR)/data/mender
>>> +     $(INSTALL) -d -m 755 $(TARGET_DIR)/data/uboot
>>> +     $(INSTALL) -d -m 755 $(TARGET_DIR)/uboot
>>
>> I am sorry, but despite the explanations, I still don't understand why
>> these *must* be /data and /uboot. Is Mender *enforcing* those locations
>> exactly ?
>
> /uboot, not really enforced, just aligned to other systems that
> integrate Mender. I could actually drop this.
>
> /data is not really enforced but the symlink /var/lib/mender must
> point to a valid location (normally it points to /data), because once
> the Mender daemon starts it will generate some initial files at that
> location and the service would fail if non-existent.

Actually I can drop the /data creation from mender.mk as well, as the
mender.service will run:

    ExecStartPre=/bin/mkdir -p -m 0700 /data/mender

So yeah a bit enforced.

-- 
Mirza Krak | Embedded Solutions Architect | https://mender.io

 Northern.tech AS | @northerntechHQ

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 03/14] package/mender: create directory structures required by the Mender client
  2018-08-20 13:43       ` Mirza Krak
@ 2018-08-20 14:31         ` Mirza Krak
  2018-10-21 14:27           ` Arnout Vandecappelle
  0 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 14:31 UTC (permalink / raw)
  To: buildroot

On Mon, Aug 20, 2018 at 3:43 PM, Mirza Krak <mirza.krak@northern.tech> wrote:
> On Mon, Aug 20, 2018 at 3:35 PM, Mirza Krak <mirza.krak@northern.tech> wrote:
>> On Mon, Aug 20, 2018 at 3:15 PM, Thomas Petazzoni
>> <thomas.petazzoni@bootlin.com> wrote:
>>> Hello,
>>>
>>> On Mon, 20 Aug 2018 15:09:03 +0200, Mirza Krak wrote:
>>>> /uboot is a mount point for vfat boot partition.
>>>> /data is a mount point for the persistent data partition.
>>>>
>>>> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
>>>> ---
>>>>  package/mender/mender.mk | 4 ++++
>>>>  1 file changed, 4 insertions(+)
>>>>
>>>> diff --git a/package/mender/mender.mk b/package/mender/mender.mk
>>>> index deab0cb039..71f92ce048 100644
>>>> --- a/package/mender/mender.mk
>>>> +++ b/package/mender/mender.mk
>>>> @@ -8,6 +8,10 @@ MENDER_VERSION = 1.4.0
>>>>  MENDER_SITE = $(call github,mendersoftware,mender,$(MENDER_VERSION))
>>>>
>>>>  define MENDER_INSTALL_CONFIG_FILES
>>>> +     $(INSTALL) -d -m 755 $(TARGET_DIR)/data/mender
>>>> +     $(INSTALL) -d -m 755 $(TARGET_DIR)/data/uboot
>>>> +     $(INSTALL) -d -m 755 $(TARGET_DIR)/uboot
>>>
>>> I am sorry, but despite the explanations, I still don't understand why
>>> these *must* be /data and /uboot. Is Mender *enforcing* those locations
>>> exactly ?
>>
>> /uboot, not really enforced, just aligned to other systems that
>> integrate Mender. I could actually drop this.
>>
>> /data is not really enforced but the symlink /var/lib/mender must
>> point to a valid location (normally it points to /data), because once
>> the Mender daemon starts it will generate some initial files at that
>> location and the service would fail if non-existent.
>
> Actually I can drop the /data creation from mender.mk as well, as the
> mender.service will run:
>
>     ExecStartPre=/bin/mkdir -p -m 0700 /data/mender
>
> So yeah a bit enforced.

But what I wanted tot say is that we can probably drop this patch.

-- 
Mirza Krak | Embedded Solutions Architect | https://mender.io

 Northern.tech AS | @northerntechHQ

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 01/14] package/mender: fix install path for identity and inventory scripts
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 01/14] package/mender: fix install path for identity and inventory scripts Mirza Krak
@ 2018-08-20 14:51   ` Thomas Petazzoni
  0 siblings, 0 replies; 37+ messages in thread
From: Thomas Petazzoni @ 2018-08-20 14:51 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 20 Aug 2018 15:09:01 +0200, Mirza Krak wrote:
> These scripts are used to generate the device identity and to populate
> the the device inventory. The Mender client will call these and at least
> the mender-device-identity is required to be present at the correct
> location. Inventory scripts are there as an example and not
> actually required.
> 
> Example output from identity script:
> 
>     $ ./mender-device-identity
>     mac=de:ad:ca:fe:00:01
>     cpuid=1112233
> 
> Example output from inventory script:
> 
>     $ ./mender-inventory-network
>     mac_br-fbfdad18c33c=02:42:7e:74:96:85
>     network_interfaces=br-fbfdad18c33c
>     ipv4_br-fbfdad18c33c=172.21.0.1/16
>     mac_enp0s25=de:ad:be:ef:bb:05
>     network_interfaces=enp0s25
>     ipv4_enp0s25=123.22.0.197/16
>     ipv4_enp0s25=10.20.20.105/16
>     ipv6_enp0s25=fe80::2aad:beff:feef:bb05/64
> 
> Inventory and device identity data is presented on the Mender server
> front-end.
> 
> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
> ---
>  package/mender/mender.mk | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 02/14] package/mender: provide sane values in mender.conf
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 02/14] package/mender: provide sane values in mender.conf Mirza Krak
@ 2018-08-20 14:51   ` Thomas Petazzoni
  0 siblings, 0 replies; 37+ messages in thread
From: Thomas Petazzoni @ 2018-08-20 14:51 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 20 Aug 2018 15:09:02 +0200, Mirza Krak wrote:
> The current values that are in mender.conf will actually
> cause the Mender client to fail to start because of invalid
> values.
> 
> Provide sane default values that at least allow the Mender client
> to parse the configuration options and start running.
> 
> The values provided will actually work in a "Demo Environment",
> see https://docs.mender.io/getting-started/create-a-test-environment.
> 
> Though an entry is required in /etc/hosts to resolve the URL to the
> local IP address of the running demo server.
> 
> Example:
> 
>     echo "192.168.0.10 docker.mender.io s3.docker.mender.io" >> \
>          /etc/hosts
> 
> Above is required because the demo certificate
> (/etc/mender/server.crt) is created for https://docker.mender.io.
> 
> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
> ---
>  package/mender/mender.conf | 20 ++++++++------------
>  1 file changed, 8 insertions(+), 12 deletions(-)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 04/14] package/mender: create directory containing Mender state script
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 04/14] package/mender: create directory containing Mender state script Mirza Krak
@ 2018-08-20 14:51   ` Thomas Petazzoni
  0 siblings, 0 replies; 37+ messages in thread
From: Thomas Petazzoni @ 2018-08-20 14:51 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 20 Aug 2018 15:09:04 +0200, Mirza Krak wrote:
> Mender state-scripts are essentially "hooks" that can be provided to
> influence the update flow.
> 
> They should be placed inside /etc/mender/scripts and the directory must
> contain a file containing the current state-script format version. It is
> currently "2".
> 
> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
> ---
>  package/mender/mender.mk | 3 +++
>  1 file changed, 3 insertions(+)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 06/14] package/mender: select BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 06/14] package/mender: select BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV Mirza Krak
@ 2018-08-20 14:52   ` Thomas Petazzoni
  0 siblings, 0 replies; 37+ messages in thread
From: Thomas Petazzoni @ 2018-08-20 14:52 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 20 Aug 2018 15:09:06 +0200, Mirza Krak wrote:
> The Mender client uses fw_printenv/fw_setenv to manipulate the U-boot
> environment, e.g to change the boot candidate after a update has been
> done.
> 
> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
> ---

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 07/14] package/mender: select BR2_PACKAGE_CA_CERTIFICATES
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 07/14] package/mender: select BR2_PACKAGE_CA_CERTIFICATES Mirza Krak
@ 2018-08-20 14:54   ` Thomas Petazzoni
  2018-08-20 18:33     ` Mirza Krak
  0 siblings, 1 reply; 37+ messages in thread
From: Thomas Petazzoni @ 2018-08-20 14:54 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 20 Aug 2018 15:09:07 +0200, Mirza Krak wrote:
> Mender uses TLS to community with the management server,
> and if CA signed certificates are used we must have
> the ca-certificates package installed to be able to
> verify these.
> 
> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>

I am not sure we want to make this a mandatory dependency. If people
are using a management server that provides a CA signed certificate,
then they should add the ca-certificates package to their build.

Perhaps this belongs more to a note in the Config.in help text. Or
maybe even Mender deserves a package/mender/readme.txt, which a bit like
boot/grub2/readme.txt, would give more details about Mender's
integration in Buildroot.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 08/14] package/mender: remove tenant.conf
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 08/14] package/mender: remove tenant.conf Mirza Krak
@ 2018-08-20 15:15   ` Thomas Petazzoni
  0 siblings, 0 replies; 37+ messages in thread
From: Thomas Petazzoni @ 2018-08-20 15:15 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 20 Aug 2018 15:09:08 +0200, Mirza Krak wrote:
> Tenant Token is a configuration option that has to do with Hosted Mender,
> where you you need to set this for the devices to connect to the
> correct organization in a multi-tenant system.
> 
> The removal of tenant.conf usage (and /var/lib/mender/authtentoken)
> was in Mender client version 1.2.0, where it was switched to be an mender.conf
> option instead as the example above demonstrates. As the first version that was
> integrated in Buildroot was 1.4.0, the inclusion of tenant.conf and the
> creation of the symlink is not necessary.
> 
> Now it is specified as such in mender.conf:
> 
> Example:
> 
> /etc/mender/mender.conf
> {
>     TenantToken: "very long base64 encoded string"
> }
> 
> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
> ---

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 09/14] package/mender: use inventory and identity script from upstream source
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 09/14] package/mender: use inventory and identity script from upstream source Mirza Krak
@ 2018-08-20 15:15   ` Thomas Petazzoni
  0 siblings, 0 replies; 37+ messages in thread
From: Thomas Petazzoni @ 2018-08-20 15:15 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 20 Aug 2018 15:09:09 +0200, Mirza Krak wrote:
> These files are part of Mender sources and no point in keeping duplicate
> files locally.
> 
> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
> ---

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 10/14] package/mender: update legal info
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 10/14] package/mender: update legal info Mirza Krak
@ 2018-08-20 15:15   ` Thomas Petazzoni
  0 siblings, 0 replies; 37+ messages in thread
From: Thomas Petazzoni @ 2018-08-20 15:15 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 20 Aug 2018 15:09:10 +0200, Mirza Krak wrote:
> Also added license checksums in mender.hash
> 
> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
> ---

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 11/14] package/mender: set version in go linker
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 11/14] package/mender: set version in go linker Mirza Krak
@ 2018-08-20 15:15   ` Thomas Petazzoni
  0 siblings, 0 replies; 37+ messages in thread
From: Thomas Petazzoni @ 2018-08-20 15:15 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 20 Aug 2018 15:09:11 +0200, Mirza Krak wrote:
> This is used when calling the mender client with the
> -version option and it says "unknown" if not set in
> linker.
> 
> Now it displays the following:
> 
>     # mender -version
>     1.4.0
>     runtime: go1.10.2
> 
> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
> ---

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 07/14] package/mender: select BR2_PACKAGE_CA_CERTIFICATES
  2018-08-20 14:54   ` Thomas Petazzoni
@ 2018-08-20 18:33     ` Mirza Krak
  2018-10-21 14:37       ` Arnout Vandecappelle
  0 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 18:33 UTC (permalink / raw)
  To: buildroot

On Mon, Aug 20, 2018 at 4:54 PM, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
> Hello,
>
> On Mon, 20 Aug 2018 15:09:07 +0200, Mirza Krak wrote:
>> Mender uses TLS to community with the management server,
>> and if CA signed certificates are used we must have
>> the ca-certificates package installed to be able to
>> verify these.
>>
>> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
>
> I am not sure we want to make this a mandatory dependency. If people
> are using a management server that provides a CA signed certificate,
> then they should add the ca-certificates package to their build.
>
> Perhaps this belongs more to a note in the Config.in help text. Or
> maybe even Mender deserves a package/mender/readme.txt, which a bit like
> boot/grub2/readme.txt, would give more details about Mender's
> integration in Buildroot.

Makes sense.

Thanks for the hint on creating a readme.txt. Will make so sure to do that.

-- 
Mirza Krak | Embedded Solutions Architect | https://mender.io

 Northern.tech AS | @northerntechHQ

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 05/14] package/mender: symlink /var/lib/mender -> /data/mender
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 05/14] package/mender: symlink /var/lib/mender -> /data/mender Mirza Krak
@ 2018-08-20 18:36   ` Mirza Krak
  2018-08-20 20:04     ` Thomas Petazzoni
  0 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 18:36 UTC (permalink / raw)
  To: buildroot

On Mon, Aug 20, 2018 at 3:09 PM, Mirza Krak <mirza.krak@northern.tech> wrote:
> The Mender client will use /var/lib/mender to access the persistent data
> partition and expect the link to be in place.
>
> By default it points to /data, but this can easily be overriden by
> overriding the link in overlay_fs
>
> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
> ---
>  package/mender/mender.mk | 2 ++
>  1 file changed, 2 insertions(+)

Thanks Thomas for picking up my other patches.

Wondering if this one was missed or some other reason not to apply it?

-- 
Mirza Krak | Embedded Solutions Architect | https://mender.io

 Northern.tech AS | @northerntechHQ

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 05/14] package/mender: symlink /var/lib/mender -> /data/mender
  2018-08-20 18:36   ` Mirza Krak
@ 2018-08-20 20:04     ` Thomas Petazzoni
  2018-08-20 20:33       ` Mirza Krak
  0 siblings, 1 reply; 37+ messages in thread
From: Thomas Petazzoni @ 2018-08-20 20:04 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 20 Aug 2018 20:36:22 +0200, Mirza Krak wrote:
> On Mon, Aug 20, 2018 at 3:09 PM, Mirza Krak <mirza.krak@northern.tech> wrote:
> > The Mender client will use /var/lib/mender to access the persistent data
> > partition and expect the link to be in place.
> >
> > By default it points to /data, but this can easily be overriden by
> > overriding the link in overlay_fs
> >
> > Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
> > ---
> >  package/mender/mender.mk | 2 ++
> >  1 file changed, 2 insertions(+)  
> 
> Thanks Thomas for picking up my other patches.
> 
> Wondering if this one was missed or some other reason not to apply it?

This one also relies on the assumption that /data is the persistent
partition, which is the part I'm still not sure how to handle. So I've
so far merged the things that I agree with, and that are OK for master.

The rest is either stuff that needs more discussion (persistent
partition related stuff) or that isn't material for master because it
doesn't fix any problem.

BTW, could you send a patch adding yourself as a developer for the
mender package in the DEVELOPERS file ?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 05/14] package/mender: symlink /var/lib/mender -> /data/mender
  2018-08-20 20:04     ` Thomas Petazzoni
@ 2018-08-20 20:33       ` Mirza Krak
  2018-10-21 14:36         ` Arnout Vandecappelle
  0 siblings, 1 reply; 37+ messages in thread
From: Mirza Krak @ 2018-08-20 20:33 UTC (permalink / raw)
  To: buildroot

On Mon, Aug 20, 2018 at 10:04 PM, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> wrote:
> Hello,
>
> On Mon, 20 Aug 2018 20:36:22 +0200, Mirza Krak wrote:
>> On Mon, Aug 20, 2018 at 3:09 PM, Mirza Krak <mirza.krak@northern.tech> wrote:
>> > The Mender client will use /var/lib/mender to access the persistent data
>> > partition and expect the link to be in place.
>> >
>> > By default it points to /data, but this can easily be overriden by
>> > overriding the link in overlay_fs
>> >
>> > Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
>> > ---
>> >  package/mender/mender.mk | 2 ++
>> >  1 file changed, 2 insertions(+)
>>
>> Thanks Thomas for picking up my other patches.
>>
>> Wondering if this one was missed or some other reason not to apply it?
>
> This one also relies on the assumption that /data is the persistent
> partition, which is the part I'm still not sure how to handle. So I've
> so far merged the things that I agree with, and that are OK for master.

Sorry I probably mislead you regarding this.

The Mender client will use the /var/lib/mender path, that is pretty
much hard-coded. The fact that it was a link to /data is simply to
provide a "valid" path, because the mender.service will create the
directory structure on start-up. The reason it is a link is because
you can change it to point to where ever your persistent storage is.

So we either have to have a "mkdir -p /var/lib/mender" in mender.mk or
use the link that this patch provides.

Sorry once again for not making this clear.

>
> The rest is either stuff that needs more discussion (persistent
> partition related stuff) or that isn't material for master because it
> doesn't fix any problem.
>
> BTW, could you send a patch adding yourself as a developer for the
> mender package in the DEVELOPERS file ?

Will do.

-- 
Mirza Krak | Embedded Solutions Architect | https://mender.io

 Northern.tech AS | @northerntechHQ

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 12/14] package/mender: use MENDER_PKGDIR to access local files
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 12/14] package/mender: use MENDER_PKGDIR to access local files Mirza Krak
@ 2018-10-21 14:09   ` Thomas Petazzoni
  0 siblings, 0 replies; 37+ messages in thread
From: Thomas Petazzoni @ 2018-10-21 14:09 UTC (permalink / raw)
  To: buildroot

Hello,

On Mon, 20 Aug 2018 15:09:12 +0200, Mirza Krak wrote:
> Utilize the predefined variable MENDER_PKGDIR which points to the
> directory containing mender.mk and Config.in, along with the local
> files.
> 
> One benefit is also that it works when BR2_EXTERNAL is used, which
> makes it easier to "backport" this to an older external tree.
> 
> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
> ---

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 03/14] package/mender: create directory structures required by the Mender client
  2018-08-20 14:31         ` Mirza Krak
@ 2018-10-21 14:27           ` Arnout Vandecappelle
  0 siblings, 0 replies; 37+ messages in thread
From: Arnout Vandecappelle @ 2018-10-21 14:27 UTC (permalink / raw)
  To: buildroot



On 20/08/2018 15:31, Mirza Krak wrote:
> On Mon, Aug 20, 2018 at 3:43 PM, Mirza Krak <mirza.krak@northern.tech> wrote:
>> On Mon, Aug 20, 2018 at 3:35 PM, Mirza Krak <mirza.krak@northern.tech> wrote:
>>> On Mon, Aug 20, 2018 at 3:15 PM, Thomas Petazzoni
>>> <thomas.petazzoni@bootlin.com> wrote:
>>>> Hello,
>>>>
>>>> On Mon, 20 Aug 2018 15:09:03 +0200, Mirza Krak wrote:
>>>>> /uboot is a mount point for vfat boot partition.
>>>>> /data is a mount point for the persistent data partition.
>>>>>
>>>>> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
>>>>> ---
>>>>>  package/mender/mender.mk | 4 ++++
>>>>>  1 file changed, 4 insertions(+)
>>>>>
>>>>> diff --git a/package/mender/mender.mk b/package/mender/mender.mk
>>>>> index deab0cb039..71f92ce048 100644
>>>>> --- a/package/mender/mender.mk
>>>>> +++ b/package/mender/mender.mk
>>>>> @@ -8,6 +8,10 @@ MENDER_VERSION = 1.4.0
>>>>>  MENDER_SITE = $(call github,mendersoftware,mender,$(MENDER_VERSION))
>>>>>
>>>>>  define MENDER_INSTALL_CONFIG_FILES
>>>>> +     $(INSTALL) -d -m 755 $(TARGET_DIR)/data/mender
>>>>> +     $(INSTALL) -d -m 755 $(TARGET_DIR)/data/uboot
>>>>> +     $(INSTALL) -d -m 755 $(TARGET_DIR)/uboot
>>>>
>>>> I am sorry, but despite the explanations, I still don't understand why
>>>> these *must* be /data and /uboot. Is Mender *enforcing* those locations
>>>> exactly ?
>>>
>>> /uboot, not really enforced, just aligned to other systems that
>>> integrate Mender. I could actually drop this.
>>>
>>> /data is not really enforced but the symlink /var/lib/mender must
>>> point to a valid location (normally it points to /data), because once
>>> the Mender daemon starts it will generate some initial files at that
>>> location and the service would fail if non-existent.
>>
>> Actually I can drop the /data creation from mender.mk as well, as the
>> mender.service will run:
>>
>>     ExecStartPre=/bin/mkdir -p -m 0700 /data/mender
>>
>> So yeah a bit enforced.
> 
> But what I wanted tot say is that we can probably drop this patch.

 As you suggested, I've marked the patch as Rejected in patchwork.

 Regards,
 Arnout

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 05/14] package/mender: symlink /var/lib/mender -> /data/mender
  2018-08-20 20:33       ` Mirza Krak
@ 2018-10-21 14:36         ` Arnout Vandecappelle
  0 siblings, 0 replies; 37+ messages in thread
From: Arnout Vandecappelle @ 2018-10-21 14:36 UTC (permalink / raw)
  To: buildroot



On 20/08/2018 21:33, Mirza Krak wrote:
> On Mon, Aug 20, 2018 at 10:04 PM, Thomas Petazzoni
> <thomas.petazzoni@bootlin.com> wrote:
>> Hello,
>>
>> On Mon, 20 Aug 2018 20:36:22 +0200, Mirza Krak wrote:
>>> On Mon, Aug 20, 2018 at 3:09 PM, Mirza Krak <mirza.krak@northern.tech> wrote:
>>>> The Mender client will use /var/lib/mender to access the persistent data
>>>> partition and expect the link to be in place.
>>>>
>>>> By default it points to /data, but this can easily be overriden by
>>>> overriding the link in overlay_fs
>>>>
>>>> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
>>>> ---
>>>>  package/mender/mender.mk | 2 ++
>>>>  1 file changed, 2 insertions(+)
>>>
>>> Thanks Thomas for picking up my other patches.
>>>
>>> Wondering if this one was missed or some other reason not to apply it?
>>
>> This one also relies on the assumption that /data is the persistent
>> partition, which is the part I'm still not sure how to handle. So I've
>> so far merged the things that I agree with, and that are OK for master.
> 
> Sorry I probably mislead you regarding this.
> 
> The Mender client will use the /var/lib/mender path, that is pretty
> much hard-coded. The fact that it was a link to /data is simply to
> provide a "valid" path, because the mender.service will create the
> directory structure on start-up. The reason it is a link is because
> you can change it to point to where ever your persistent storage is.
> 
> So we either have to have a "mkdir -p /var/lib/mender" in mender.mk or
> use the link that this patch provides.

 I think we should take a similar approach as for dropbear.

 Since mender hardcodes /var/lib/mender, that is what we should use within
Buildroot as well. So the service file should use that path.

 However, that means that we have to create that path, and do it in a writable
location.

 So the proposal is the following:

- install a symlink /var/lib/mender -> /var/run/mender

- in the service file, check if /var/lib/mender is a symlink to /var/run/mender.
If it is, try to remove it and replace it with an actual directory (that covers
the case when /var/lib is mounted as a read-write partition); if it isn't, do an
mkdir -p of the location pointed to by that symlink AND print a warning that
this is a bad idea. If /var/lib/mender doesn't exist or is a symlink to
somewhere else, create the directory.

 Do you feel up to that? :-)

 I've marked the patch as Changes Requested in patchwork.

 Regards,
 Arnout

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 07/14] package/mender: select BR2_PACKAGE_CA_CERTIFICATES
  2018-08-20 18:33     ` Mirza Krak
@ 2018-10-21 14:37       ` Arnout Vandecappelle
  0 siblings, 0 replies; 37+ messages in thread
From: Arnout Vandecappelle @ 2018-10-21 14:37 UTC (permalink / raw)
  To: buildroot



On 20/08/2018 19:33, Mirza Krak wrote:
> On Mon, Aug 20, 2018 at 4:54 PM, Thomas Petazzoni
> <thomas.petazzoni@bootlin.com> wrote:
>> Hello,
>>
>> On Mon, 20 Aug 2018 15:09:07 +0200, Mirza Krak wrote:
>>> Mender uses TLS to community with the management server,
>>> and if CA signed certificates are used we must have
>>> the ca-certificates package installed to be able to
>>> verify these.
>>>
>>> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
>>
>> I am not sure we want to make this a mandatory dependency. If people
>> are using a management server that provides a CA signed certificate,
>> then they should add the ca-certificates package to their build.
>>
>> Perhaps this belongs more to a note in the Config.in help text. Or
>> maybe even Mender deserves a package/mender/readme.txt, which a bit like
>> boot/grub2/readme.txt, would give more details about Mender's
>> integration in Buildroot.
> 
> Makes sense.
> 
> Thanks for the hint on creating a readme.txt. Will make so sure to do that.
> 

 Assuming you're going to create this readme.txt, I've marked this patch as
Changes Requested.

 Regards,
 Arnout

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [Buildroot] [[PATCH v2 13/14] package/mender: add BR2_PACKAGE_MENDER_ARTIFACT_NAME option
  2018-08-20 13:09 ` [Buildroot] [[PATCH v2 13/14] package/mender: add BR2_PACKAGE_MENDER_ARTIFACT_NAME option Mirza Krak
@ 2018-10-21 14:40   ` Arnout Vandecappelle
  0 siblings, 0 replies; 37+ messages in thread
From: Arnout Vandecappelle @ 2018-10-21 14:40 UTC (permalink / raw)
  To: buildroot



On 20/08/2018 14:09, Mirza Krak wrote:
> ARTIFACT_NAME is used to set a unique string of the built artifact/image
> and this will be reported to the Mender managment server as "current
> software running".
> 
> The Mender managment server will skip updating device if the
> ARTIFACT_NAME is the same on the target device as in the Mender artifact
> and hence this name must be unique for every release.

 When a package needs some configuration, we don't usually add configure options
for it, but instead assume the user will create the necessary configuration
files in an overlay.

 In particular in this case, you probably want to generate it with a script that
looks at a git tag or something like that.

 This would be something good to document in the readme.txt that you were going
to write.

 If you want to deliver an out-of-the-box experience, you could create files
with some default values (which would normally get overwritten in the overlay).
But I'm not even sure we really want that.

 So I've marked this patch and the following one as Rejected.

 Regards,
 Arnout

> 
> Signed-off-by: Mirza Krak <mirza.krak@northern.tech>
> ---
>  package/mender/Config.in | 13 +++++++++++++
>  package/mender/mender.mk |  7 +++++++
>  2 files changed, 20 insertions(+)
> 
> diff --git a/package/mender/Config.in b/package/mender/Config.in
> index 853a472ea1..8a6359c906 100644
> --- a/package/mender/Config.in
> +++ b/package/mender/Config.in
> @@ -14,6 +14,19 @@ config BR2_PACKAGE_MENDER
>  
>  	  https://github.com/mendersoftware/mender
>  
> +if BR2_PACKAGE_MENDER
> +
> +config BR2_PACKAGE_MENDER_ARTIFACT_NAME
> +	string "Mender artifact name"
> +	help
> +	  The name of the image or update that will be built. This is
> +	  what the device will report that it is running, and different
> +	  updates must have different names.
> +
> +	  Will be stored in /etc/mender/artifact_info
> +
> +endif
> +
>  comment "mender needs a toolchain w/ threads"
>  	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
>  	depends on BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS
> diff --git a/package/mender/mender.mk b/package/mender/mender.mk
> index a4b9c6ee85..0d4df3a763 100644
> --- a/package/mender/mender.mk
> +++ b/package/mender/mender.mk
> @@ -34,6 +34,10 @@ MENDER_LICENSE_FILES = \
>  
>  MENDER_LDFLAGS = -X main.Version=$(MENDER_VERSION)
>  
> +ifeq ($(call qstrip,$(BR2_PACKAGE_MENDER_ARTIFACT_NAME)),)
> +$(error Mender device type not set. Check your BR2_PACKAGE_MENDER_ARTIFACT_NAME setting)
> +endif
> +
>  define MENDER_INSTALL_CONFIG_FILES
>  	$(INSTALL) -d -m 755 $(TARGET_DIR)/data/mender
>  	$(INSTALL) -d -m 755 $(TARGET_DIR)/data/uboot
> @@ -55,6 +59,9 @@ define MENDER_INSTALL_CONFIG_FILES
>  	)
>  
>  	ln -sf /data/mender $(TARGET_DIR)/var/lib/mender
> +
> +	echo "artifact_name=$(call qstrip,$(BR2_PACKAGE_MENDER_ARTIFACT_NAME))" > \
> +		$(TARGET_DIR)/etc/mender/artifact_info
>  endef
>  
>  MENDER_POST_INSTALL_TARGET_HOOKS += MENDER_INSTALL_CONFIG_FILES
> 

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2018-10-21 14:40 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-20 13:09 [Buildroot] [[PATCH v2 00/14] various improvements to package/mender Mirza Krak
2018-08-20 13:09 ` [Buildroot] [[PATCH v2 01/14] package/mender: fix install path for identity and inventory scripts Mirza Krak
2018-08-20 14:51   ` Thomas Petazzoni
2018-08-20 13:09 ` [Buildroot] [[PATCH v2 02/14] package/mender: provide sane values in mender.conf Mirza Krak
2018-08-20 14:51   ` Thomas Petazzoni
2018-08-20 13:09 ` [Buildroot] [[PATCH v2 03/14] package/mender: create directory structures required by the Mender client Mirza Krak
2018-08-20 13:15   ` Thomas Petazzoni
2018-08-20 13:35     ` Mirza Krak
2018-08-20 13:43       ` Mirza Krak
2018-08-20 14:31         ` Mirza Krak
2018-10-21 14:27           ` Arnout Vandecappelle
2018-08-20 13:09 ` [Buildroot] [[PATCH v2 04/14] package/mender: create directory containing Mender state script Mirza Krak
2018-08-20 14:51   ` Thomas Petazzoni
2018-08-20 13:09 ` [Buildroot] [[PATCH v2 05/14] package/mender: symlink /var/lib/mender -> /data/mender Mirza Krak
2018-08-20 18:36   ` Mirza Krak
2018-08-20 20:04     ` Thomas Petazzoni
2018-08-20 20:33       ` Mirza Krak
2018-10-21 14:36         ` Arnout Vandecappelle
2018-08-20 13:09 ` [Buildroot] [[PATCH v2 06/14] package/mender: select BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV Mirza Krak
2018-08-20 14:52   ` Thomas Petazzoni
2018-08-20 13:09 ` [Buildroot] [[PATCH v2 07/14] package/mender: select BR2_PACKAGE_CA_CERTIFICATES Mirza Krak
2018-08-20 14:54   ` Thomas Petazzoni
2018-08-20 18:33     ` Mirza Krak
2018-10-21 14:37       ` Arnout Vandecappelle
2018-08-20 13:09 ` [Buildroot] [[PATCH v2 08/14] package/mender: remove tenant.conf Mirza Krak
2018-08-20 15:15   ` Thomas Petazzoni
2018-08-20 13:09 ` [Buildroot] [[PATCH v2 09/14] package/mender: use inventory and identity script from upstream source Mirza Krak
2018-08-20 15:15   ` Thomas Petazzoni
2018-08-20 13:09 ` [Buildroot] [[PATCH v2 10/14] package/mender: update legal info Mirza Krak
2018-08-20 15:15   ` Thomas Petazzoni
2018-08-20 13:09 ` [Buildroot] [[PATCH v2 11/14] package/mender: set version in go linker Mirza Krak
2018-08-20 15:15   ` Thomas Petazzoni
2018-08-20 13:09 ` [Buildroot] [[PATCH v2 12/14] package/mender: use MENDER_PKGDIR to access local files Mirza Krak
2018-10-21 14:09   ` Thomas Petazzoni
2018-08-20 13:09 ` [Buildroot] [[PATCH v2 13/14] package/mender: add BR2_PACKAGE_MENDER_ARTIFACT_NAME option Mirza Krak
2018-10-21 14:40   ` Arnout Vandecappelle
2018-08-20 13:09 ` [Buildroot] [[PATCH v2 14/14] package/mender: add BR2_PACKAGE_MENDER_DEVICE_TYPE option Mirza Krak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.