various improvements to package/mender
cover various improvements to package/mender
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.
This also includes an update to the package legal-info.
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 seperatily.
This series has been tested on a custom ATSAMA5D27 based board.
Mirza Krak (8):
package/mender: update legal info
package/mender: update install of config files package/mender: add dep on BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV package/mender: add BR2_PACKAGE_MENDER_ARTIFACT_NAME option package/mender: add BR2_PACKAGE_MENDER_DEVICE_TYPE option package/mender: populate the mender.conf template package/mender: select BR2_PACKAGE_CA_CERTIFICATES package/mender: set version in go linker
package/mender/Config.in | 95 ++++++++++++++++++++++++ package/mender/mender-device-identity | 52 ------------- package/mender/mender-inventory-hostinfo | 21 ------ package/mender/mender-inventory-network | 47 ------------ package/mender/mender.conf | 14 ++-- package/mender/mender.hash | 4 + package/mender/mender.mk | 52 ++++++++++--- package/mender/mender.service | 1 - package/mender/tenant.conf | 0 9 files changed, 146 insertions(+), 140 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.18.0
PATCH 1/8 package/mender: update legal info
And also added license checksums in mender.hash
--- package/mender/mender.hash | 4 ++++ package/mender/mender.mk | 2 ++ 2 files changed, 6 insertions(+)
package/mender/mender.hash +4 -0
@@ -1,2 +1,6 @@ # Locally computed: sha256 267fa73ad472b034248ee298593b5c52ea0b105fd73c91febb3587280c61bee2 mender-1.4.0.tar.gz + +# License, locally computed +sha256 ceb1b36ff073bd13d9806d4615b931707768ca9023805620acc32dd1cfc2f680 LICENSE +sha256 54d6f54a2815cc2e3cef4f7dde5a3aae20f09b2cde394d8d3f1dce5d8a79d738 LIC_FILES_CHKSUM.sha256
package/mender/mender.mk +2 -0
@@ -6,6 +6,8 @@ MENDER_VERSION = 1.4.0 MENDER_SITE = $(call github,mendersoftware,mender,$(MENDER_VERSION)) +MENDER_LICENSE = Apache-2.0 & BSD-2-Clause & BSD-3-Clause & MIT & OLDAP-2.8 +MENDER_LICENSE_FILES = LICENSE LIC_FILES_CHKSUM.sha256 define MENDER_INSTALL_CONFIG_FILES $(INSTALL) -D -m 0644 package/mender/mender.conf \
Signature · 1 line
2.18.0
PATCH 1/8 package/mender: update legal info
Hi Mirza,
Quoted 23 lines · Mirza Krak
And also added license checksums in mender.hash
Signed-off-by Mirza Krak <[email protected]>--- package/mender/mender.hash | 4 ++++ package/mender/mender.mk | 2 ++ 2 files changed, 6 insertions(+)package/mender/mender.hash +4
-0@@ -1,2 +1,6 @@ # Locally computed: sha256 267fa73ad472b034248ee298593b5c52ea0b105fd73c91febb3587280c61bee2 mender-1.4.0.tar.gz + +# License, locally computed +sha256 ceb1b36ff073bd13d9806d4615b931707768ca9023805620acc32dd1cfc2f680 LICENSE +sha256 54d6f54a2815cc2e3cef4f7dde5a3aae20f09b2cde394d8d3f1dce5d8a79d738 LIC_FILES_CHKSUM.sha256> diff --git a/package/mender/mender.mk b/package/mender/mender.mkindex
695b5e7a91..0dad93be28100644
package/mender/mender.mk line 9
Quoted 4 lines
package/mender/mender.mk +1
-0@@ -6,6 +6,8 @@ MENDER_VERSION = 1.4.0 MENDER_SITE = $(call github,mendersoftware,mender,$(MENDER_VERSION)) +MENDER_LICENSE = Apache-2.0 & BSD-2-Clause & BSD-3-Clause & MIT & OLDAP-2.8
Although & is probably the proper delimiter to use for AND in SPDX format, we
currently use ", " everywhere, so please stick to that.
package/mender/mender.mk line 10
Quoted 1 line
package/mender/mender.mk +1
-0+MENDER_LICENSE_FILES = LICENSE LIC_FILES_CHKSUM.sha256
Instead of LIC_FILES_CHKSUM.sha256, we should actually include all the files
mentioned in there in our license list. Well, actually, we can optimize it a little bit because there are some identical files.
Alternatively, you could include all of them, and for the .hash file you can
just prepend 'sha256 ' to every line of LIC_FILES_CHKSUM.sha256 and append it to the .hash file, with the comment
# From LIC_FILES_CHKSUM.sha256
On second thought, actually it is a good idea to include
LIC_FILES_CHKSUM.sha256 as well, to detect when a new subpackage with a new license is added.
Regards,
Arnout
Quoted 4 lines
package/mender/mender.mk +0
-0define MENDER_INSTALL_CONFIG_FILES $(INSTALL) -D -m 0644 package/mender/mender.conf \
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 1/8 package/mender: update legal info
Quoted 1 line · Arnout Vandecappelle
Hi Mirza,
Hi Arnout,
Quoted 26 lines · Mirza Krak
Quoted 24 lines
And also added license checksums in mender.hash
Signed-off-by Mirza Krak <[email protected]>--- package/mender/mender.hash | 4 ++++ package/mender/mender.mk | 2 ++ 2 files changed, 6 insertions(+)package/mender/mender.hash +4
-0@@ -1,2 +1,6 @@ # Locally computed: sha256 267fa73ad472b034248ee298593b5c52ea0b105fd73c91febb3587280c61bee2 mender-1.4.0.tar.gz + +# License, locally computed +sha256 ceb1b36ff073bd13d9806d4615b931707768ca9023805620acc32dd1cfc2f680 LICENSE +sha256 54d6f54a2815cc2e3cef4f7dde5a3aae20f09b2cde394d8d3f1dce5d8a79d738 LIC_FILES_CHKSUM.sha256> diff --git a/package/mender/mender.mk b/package/mender/mender.mkindex
695b5e7a91..0dad93be28100644package/mender/mender.mk +0
-0@@ -6,6 +6,8 @@
Quoted 6 lines
package/mender/mender.mk line 9
Quoted 3 lines
package/mender/mender.mk +1
-0MENDER_VERSION = 1.4.0 MENDER_SITE = $(call github,mendersoftware,mender,$(MENDER_VERSION)) +MENDER_LICENSE = Apache-2.0 & BSD-2-Clause & BSD-3-Clause & MIT & OLDAP-2.8Although & is probably the proper delimiter to use for AND in SPDX format, we
currently use ", " everywhere, so please stick to that.
Got it, thanks.
Quoted 10 lines
package/mender/mender.mk line 10
Quoted 1 line
package/mender/mender.mk +1
-0+MENDER_LICENSE_FILES = LICENSE LIC_FILES_CHKSUM.sha256Instead of LIC_FILES_CHKSUM.sha256, we should actually include all the files
mentioned in there in our license list. Well, actually, we can optimize it a little bit because there are some identical files.Alternatively, you could include all of them, and for the .hash file you can
just prepend 'sha256 ' to every line of LIC_FILES_CHKSUM.sha256 and append it to the .hash file, with the comment
Quoted 6 lines
# From LIC_FILES_CHKSUM.sha256
On second thought, actually it is a good idea to include
LIC_FILES_CHKSUM.sha256 as well, to detect when a new subpackage with a new license is added.
I would really like to keep this as-is to avoid a heavy maintenance burden. This file is maintained in the upstream package and would rather not duplicate the work by extracting the information from LIC_FILES_CHKSUM.sha256 to put it in mender.hash.
The checksum check of LIC_FILES_CHKSUM.sha256 will handle the sanity check of the LICENSE files, and all the licenses that are in LIC_FILES_CHKSUM.sha256 are already mentioned in the mender.mk file:
MENDER_LICENSE = Apache-2.0, BSD-2-Clause, BSD-3-Clause, MIT, OLDAP-2.8
This should cover it. Or are there any big drawbacks with this approach that I am not seeing?
Signature · 3 lines
Mirza Krak | Embedded Solutions Architect | https://mender.io Northern.tech AS | @northerntechHQ
PATCH 1/8 package/mender: update legal info
Quoted 7 lines · Mirza Krak
Quoted 1 line · Arnout Vandecappelle
Hi Mirza,
Hi Arnout,
Quoted 2 lines · Mirza Krak
[snip]
Quoted 22 lines
Quoted 10 lines
Quoted 1 line
+MENDER_LICENSE_FILES = LICENSE LIC_FILES_CHKSUM.sha256
Instead of LIC_FILES_CHKSUM.sha256, we should actually include all the files
mentioned in there in our license list. Well, actually, we can optimize it a little bit because there are some identical files.Alternatively, you could include all of them, and for the .hash file you can
just prepend 'sha256 ' to every line of LIC_FILES_CHKSUM.sha256 and append it to the .hash file, with the commentQuoted 6 lines
# From LIC_FILES_CHKSUM.sha256
On second thought, actually it is a good idea to include
LIC_FILES_CHKSUM.sha256 as well, to detect when a new subpackage with a new license is added.I would really like to keep this as-is to avoid a heavy maintenance burden. This file is maintained in the upstream package and would rather not duplicate the work by extracting the information from LIC_FILES_CHKSUM.sha256 to put it in mender.hash.
Quoted 8 lines
The checksum check of LIC_FILES_CHKSUM.sha256 will handle the sanity check of the LICENSE files, and all the licenses that are in LIC_FILES_CHKSUM.sha256 are already mentioned in the mender.mk file:
MENDER_LICENSE = Apache-2.0, BSD-2-Clause, BSD-3-Clause, MIT, OLDAP-2.8This should cover it. Or are there any big drawbacks with this approach that I am not seeing?
Well, we really want to collect the license text for all applicable licenses.
So you should include at least one file for each license mentioned in MENDER_LICENSE. Since the checksums are already available, I thought the easiest would be to create part of the hash file from the existing file. Like:
# Generated with sed '/^[A-Za-z0-9_]/s/^/sha256 /' LIC_FILES_CHKSUM.sha256 # Apache-2.0 license.
sha256 ceb1b36ff073bd13d9806d4615b931707768ca9023805620acc32dd1cfc2f680 LICENSE
...
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 1/8 package/mender: update legal info
Quoted 43 lines · Arnout Vandecappelle
Quoted 7 lines · Mirza Krak
Quoted 1 line · Arnout Vandecappelle
Hi Mirza,
Hi Arnout,
Quoted 2 lines · Mirza Krak
[snip]
Quoted 22 lines
Quoted 10 lines
Quoted 1 line
+MENDER_LICENSE_FILES = LICENSE LIC_FILES_CHKSUM.sha256
Instead of LIC_FILES_CHKSUM.sha256, we should actually include all the files
mentioned in there in our license list. Well, actually, we can optimize it a little bit because there are some identical files.Alternatively, you could include all of them, and for the .hash file you can
just prepend 'sha256 ' to every line of LIC_FILES_CHKSUM.sha256 and append it to the .hash file, with the commentQuoted 6 lines
# From LIC_FILES_CHKSUM.sha256
On second thought, actually it is a good idea to include
LIC_FILES_CHKSUM.sha256 as well, to detect when a new subpackage with a new license is added.I would really like to keep this as-is to avoid a heavy maintenance burden. This file is maintained in the upstream package and would rather not duplicate the work by extracting the information from LIC_FILES_CHKSUM.sha256 to put it in mender.hash.
Quoted 8 lines
The checksum check of LIC_FILES_CHKSUM.sha256 will handle the sanity check of the LICENSE files, and all the licenses that are in LIC_FILES_CHKSUM.sha256 are already mentioned in the mender.mk file:
MENDER_LICENSE = Apache-2.0, BSD-2-Clause, BSD-3-Clause, MIT, OLDAP-2.8This should cover it. Or are there any big drawbacks with this approach that I am not seeing?
Quoted 8 lines
Well, we really want to collect the license text for all applicable licenses.
So you should include at least one file for each license mentioned inMENDER_LICENSE. Since the checksums are already available, I thought the easiest would be to create part of the hash file from the existing file. Like:# Generated with sed '/^[A-Za-z0-9_]/s/^/sha256 /' LIC_FILES_CHKSUM.sha256 # Apache-2.0 license.
sha256ceb1b36ff073bd13d9806d4615b931707768ca9023805620acc32dd1cfc2f680LICENSE
Got it, and thanks for providing the "sed magic" :).
Signature · 3 lines
Mirza Krak | Embedded Solutions Architect | https://mender.io Northern.tech AS | @northerntechHQ
PATCH 1/8 package/mender: update legal info
In reply to Arnout VandecappelleQuoted 43 lines · Arnout Vandecappelle
Quoted 7 lines · Mirza Krak
Quoted 1 line · Arnout Vandecappelle
Hi Mirza,
Hi Arnout,
Quoted 2 lines · Mirza Krak
[snip]
Quoted 22 lines
Quoted 10 lines
Quoted 1 line
+MENDER_LICENSE_FILES = LICENSE LIC_FILES_CHKSUM.sha256
Instead of LIC_FILES_CHKSUM.sha256, we should actually include all the files
mentioned in there in our license list. Well, actually, we can optimize it a little bit because there are some identical files.Alternatively, you could include all of them, and for the .hash file you can
just prepend 'sha256 ' to every line of LIC_FILES_CHKSUM.sha256 and append it to the .hash file, with the commentQuoted 6 lines
# From LIC_FILES_CHKSUM.sha256
On second thought, actually it is a good idea to include
LIC_FILES_CHKSUM.sha256 as well, to detect when a new subpackage with a new license is added.I would really like to keep this as-is to avoid a heavy maintenance burden. This file is maintained in the upstream package and would rather not duplicate the work by extracting the information from LIC_FILES_CHKSUM.sha256 to put it in mender.hash.
Quoted 8 lines
The checksum check of LIC_FILES_CHKSUM.sha256 will handle the sanity check of the LICENSE files, and all the licenses that are in LIC_FILES_CHKSUM.sha256 are already mentioned in the mender.mk file:
MENDER_LICENSE = Apache-2.0, BSD-2-Clause, BSD-3-Clause, MIT, OLDAP-2.8This should cover it. Or are there any big drawbacks with this approach that I am not seeing?
Quoted 8 lines
Well, we really want to collect the license text for all applicable licenses.
So you should include at least one file for each license mentioned inMENDER_LICENSE. Since the checksums are already available, I thought the easiest would be to create part of the hash file from the existing file. Like:# Generated with sed '/^[A-Za-z0-9_]/s/^/sha256 /' LIC_FILES_CHKSUM.sha256 # Apache-2.0 license.
sha256ceb1b36ff073bd13d9806d4615b931707768ca9023805620acc32dd1cfc2f680LICENSE
Hmm, though I having some issues with trying to accommodate this.
Adding the following line to mender.hash:
# BSD 2 Clause license.
sha256 8d427fd87bc9579ea368fde3d49f9ca22eac857f91a9dec7e3004bdfab7dee86
vendor/github.com/pkg/errors/LICENSE
Does not do anything, when I run:
$ make mender-legal-info
Quoted 1 line
Quoted 1 line
Quoted 1 line
mender 1.4.0 Collecting legal info
LICENSE: OK (sha256:
ceb1b36ff073bd13d9806d4615b931707768ca9023805620acc32dd1cfc2f680)
LIC_FILES_CHKSUM.sha256: OK (sha256:54d6f54a2815cc2e3cef4f7dde5a3aae20f09b2cde394d8d3f1dce5d8a79d738)
Inspecting other *.hash files in Buildroot, no one seems to reference files that are outside of the "root source". Or should I specify the path differently?
Signature · 3 lines
Mirza Krak | Embedded Solutions Architect | https://mender.io Northern.tech AS | @northerntechHQ
PATCH 1/8 package/mender: update legal info
Hi Mirza,
Quoted 58 lines · Mirza Krak
Quoted 36 lines · Arnout Vandecappelle
Quoted 2 lines · Mirza Krak
Quoted 1 line · Arnout Vandecappelle
On 15-08-18 01:13, Mirza Krak wrote:
[snip]
Quoted 22 lines
Quoted 10 lines
Quoted 1 line
+MENDER_LICENSE_FILES = LICENSE LIC_FILES_CHKSUM.sha256
Instead of LIC_FILES_CHKSUM.sha256, we should actually include all the files
mentioned in there in our license list. Well, actually, we can optimize it a little bit because there are some identical files.Alternatively, you could include all of them, and for the .hash file you can
just prepend 'sha256 ' to every line of LIC_FILES_CHKSUM.sha256 and append it to the .hash file, with the commentQuoted 6 lines
# From LIC_FILES_CHKSUM.sha256
On second thought, actually it is a good idea to include
LIC_FILES_CHKSUM.sha256 as well, to detect when a new subpackage with a new license is added.I would really like to keep this as-is to avoid a heavy maintenance burden. This file is maintained in the upstream package and would rather not duplicate the work by extracting the information from LIC_FILES_CHKSUM.sha256 to put it in mender.hash.
Quoted 8 lines
The checksum check of LIC_FILES_CHKSUM.sha256 will handle the sanity check of the LICENSE files, and all the licenses that are in LIC_FILES_CHKSUM.sha256 are already mentioned in the mender.mk file:
MENDER_LICENSE = Apache-2.0, BSD-2-Clause, BSD-3-Clause, MIT, OLDAP-2.8This should cover it. Or are there any big drawbacks with this approach that I am not seeing?
Quoted 8 lines
Well, we really want to collect the license text for all applicable licenses.
So you should include at least one file for each license mentioned inMENDER_LICENSE. Since the checksums are already available, I thought the easiest would be to create part of the hash file from the existing file. Like:# Generated with sed '/^[A-Za-z0-9_]/s/^/sha256 /' LIC_FILES_CHKSUM.sha256 # Apache-2.0 license.
sha256ceb1b36ff073bd13d9806d4615b931707768ca9023805620acc32dd1cfc2f680LICENSEHmm, though I having some issues with trying to accommodate this.
Adding the following line to mender.hash:
# BSD 2 Clause license.
sha2568d427fd87bc9579ea368fde3d49f9ca22eac857f91a9dec7e3004bdfab7dee86
vendor/github.com/pkg/errors/LICENSEDoes not do anything, when I run:
$ make mender-legal-infoQuoted 1 line
Quoted 1 line
Quoted 1 line
mender 1.4.0 Collecting legal info
Quoted 8 lines
LICENSE: OK (sha256: ceb1b36ff073bd13d9806d4615b931707768ca9023805620acc32dd1cfc2f680) LIC_FILES_CHKSUM.sha256: OK (sha256:
54d6f54a2815cc2e3cef4f7dde5a3aae20f09b2cde394d8d3f1dce5d8a79d738)Inspecting other *.hash files in Buildroot, no one seems to reference files that are outside of the "root source". Or should I specify the path differently?
There are a number of packages with license files in subdirectories. For example:
make alsa-lib-legal-info
...
Quoted 1 line
Quoted 1 line
Quoted 1 line
alsa-lib 1.1.6 Collecting legal info
COPYING: OK (sha256: 32434afcc8666ba060e111d715bfdb6c2d5dd8a35fa4d3ab8ad67d8f850d2f2b) aserver/COPYING: OK (sha256: bfe16cf823bcff261fc6a062c07ee96660e3c39678f42f39a788a68dbc234ced)
baruch
Signature · 3 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -PATCH 1/8 package/mender: update legal info
Quoted 2 lines · Baruch Siach
Hi Mirza,
< snip >
Quoted 22 lines
Quoted 13 lines
Hmm, though I having some issues with trying to accommodate this.
Adding the following line to mender.hash:
# BSD 2 Clause license.
sha2568d427fd87bc9579ea368fde3d49f9ca22eac857f91a9dec7e3004bdfab7dee86
vendor/github.com/pkg/errors/LICENSEDoes not do anything, when I run:
$ make mender-legal-infoQuoted 1 line
Quoted 1 line
Quoted 1 line
mender 1.4.0 Collecting legal info
Quoted 8 lines
LICENSE: OK (sha256: ceb1b36ff073bd13d9806d4615b931707768ca9023805620acc32dd1cfc2f680) LIC_FILES_CHKSUM.sha256: OK (sha256:
54d6f54a2815cc2e3cef4f7dde5a3aae20f09b2cde394d8d3f1dce5d8a79d738)Inspecting other *.hash files in Buildroot, no one seems to reference files that are outside of the "root source". Or should I specify the path differently?
Quoted 8 lines
There are a number of packages with license files in subdirectories. For example:
make alsa-lib-legal-info
...Quoted 1 line
Quoted 1 line
Quoted 1 line
alsa-lib 1.1.6 Collecting legal info
COPYING: OK (sha256:
32434afcc8666ba060e111d715bfdb6c2d5dd8a35fa4d3ab8ad67d8f850d2f2b) aserver/COPYING: OK (sha256:bfe16cf823bcff261fc6a062c07ee96660e3c39678f42f39a788a68dbc234ced)
Of course.
I missed adding the files to LICENSE_FILES. Doh!
Signature · 3 lines
Mirza Krak | Embedded Solutions Architect | https://mender.io Northern.tech AS | @northerntechHQ
PATCH 2/8 package/mender: update install of config files
In reply to Mirza KrakSummary of changes:
- identity and inventory scripts are part of Mender source repo, hence remove the local files and install from source directory.
- tenant.conf is not used by Mender, remove it
These are required to run Mender in managed mode (daemon).
- Create /data and /uboot directories.
- Symlink /var/lib/mender to /data
- Added /etc/mender/script/version file
--- package/mender/mender-device-identity | 52 ------------------------ package/mender/mender-inventory-hostinfo | 21 ---------- package/mender/mender-inventory-network | 47 --------------------- package/mender/mender.mk | 22 ++++++---- package/mender/mender.service | 1 - package/mender/tenant.conf | 0 6 files changed, 14 insertions(+), 129 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
package/mender/mender-device-identity deleted +0 -52
@@ -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
package/mender/mender-inventory-hostinfo deleted +0 -21
@@ -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)" -
package/mender/mender-inventory-network deleted +0 -47
47 lines not on this page · raw message
package/mender/mender.mk +14 -8
@@ -10,18 +10,24 @@ MENDER_LICENSE = Apache-2.0 & BSD-2-Clause & BSD-3-Clause & MIT & OLDAP-2.8 MENDER_LICENSE_FILES = LICENSE LIC_FILES_CHKSUM.sha256 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 755 $(TARGET_DIR)/usr/share/mender/inventory + + $(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 \ - $(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 - $(INSTALL) -D -m 0755 package/mender/mender-inventory-network \ - $(TARGET_DIR)/var/share/mender/inventory/mender-inventory-network - $(INSTALL) -D -m 0755 package/mender/mender-inventory-hostinfo \ - $(TARGET_DIR)/var/share/mender/inventory/mender-inventory-hostinfo + $(INSTALL) -D -m 0755 $(@D)/support/mender-device-identity \ + $(TARGET_DIR)/usr/share/mender/identity/mender-device-identity + $(INSTALL) -D -m 0755 $(@D)/support/mender-inventory-* \ + $(TARGET_DIR)/usr/share/mender/inventory + + ln -sf /data/mender $(TARGET_DIR)/var/lib/mender endef MENDER_POST_INSTALL_TARGET_HOOKS += MENDER_INSTALL_CONFIG_FILES
package/mender/mender.service +0 -1
@@ -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
package/mender/tenant.conf deleted +0 -0
Signature · 1 line
2.18.0
PATCH 2/8 package/mender: update install of config files
Hello,
Quoted 7 lines · Mirza Krak
Summary of changes:
- identity and inventory scripts are part of Mender source repo, hence remove the local files and install from source directory.
- tenant.conf is not used by Mender, remove it
Quoted 7 lines
These are required to run Mender in managed mode (daemon).
- Create /data and /uboot directories.
- Symlink/var/lib/menderto /data
- Added/etc/mender/script/versionfileSigned-off-by Mirza Krak <[email protected]>
There are too many changes in one commit here, please do these changes one step at a time.
Do you know why tenant.conf was added in the current Mender packaging ? Was it an old configuration file from previous Mender versions ?
package/mender/mender.mk MENDER_LICENSE = Apache-2.0 & BSD-2-Clause & BSD-3-Clause & MIT & OLDAP-2.8 · line 16
Quoted 5 lines
define
MENDER_INSTALL_CONFIG_FILESpackage/mender/mender.mk +4
-0+ $(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 755 $(TARGET_DIR)/usr/share/mender/inventory
Could you give a bit of background about these ?
Quoted 7 lines
package/mender/mender.mk +3
-2+ $(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 \ - $(TARGET_DIR)/etc/mender/tenant.conf
package/mender/mender.mk MENDER_LICENSE = Apache-2.0 & BSD-2-Clause & BSD-3-Clause & MIT & OLDAP-2.8 · line 26
Quoted 10 lines
package/mender/mender.mk +2
-6$(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 - $(INSTALL) -D -m 0755 package/mender/mender-inventory-network \ - $(TARGET_DIR)/var/share/mender/inventory/mender-inventory-network - $(INSTALL) -D -m 0755 package/mender/mender-inventory-hostinfo \ - $(TARGET_DIR)/var/share/mender/inventory/mender-inventory-hostinfo + $(INSTALL) -D -m 0755 $(@D)/support/mender-device-identity \ + $(TARGET_DIR)/usr/share/mender/identity/mender-device-identity
The installation path has changed from /var/share, to /usr/share. Why ?
package/mender/mender.mk MENDER_LICENSE = Apache-2.0 & BSD-2-Clause & BSD-3-Clause & MIT & OLDAP-2.8 · line 28
Quoted 2 lines
package/mender/mender.mk +2
-0+ $(INSTALL) -D -m 0755 $(@D)/support/mender-inventory-* \ + $(TARGET_DIR)/usr/share/mender/inventory
A $(INSTALL) -D invocation should have a full destination path, so:
$(foreach f,hostinfo network, \ $(INSTALL) -D -m 0755 $(@D)/support/mender-inventory-$(f) \ $(TARGET_DIR)/usr/share/mender/inventory/mender-inventory-$(f) )
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 2/8 package/mender: update install of config files
Quoted 12 lines · Thomas Petazzoni
Hello,
Quoted 9 lines · Mirza Krak
Summary of changes:
- identity and inventory scripts are part of Mender source repo, hence remove the local files and install from source directory.
- tenant.conf is not used by Mender, remove it
These are required to run Mender in managed mode (daemon).
Quoted 8 lines
Quoted 5 lines
- Create /data and /uboot directories.
- Symlink/var/lib/menderto /data
- Added/etc/mender/script/versionfileSigned-off-by Mirza Krak <[email protected]>There are too many changes in one commit here, please do these changes one step at a time.
Sure.
Quoted 3 lines
Do you know why tenant.conf was added in the current Mender packaging ? Was it an old configuration file from previous Mender versions ?
This was something that we did deploy in our Yocto recipes (which might have been source of inspiration for the package in Buildroot), but it was never actually used for anything. There is an option in mender.conf for this, TenantToken.
Quoted 7 lines
package/mender/mender.mk MENDER_LICENSE = Apache-2.0 & BSD-2-Clause & BSD-3-Clause & MIT & OLDAP-2.8 · line 16
Quoted 5 lines
define
MENDER_INSTALL_CONFIG_FILESpackage/mender/mender.mk +4
-0+ $(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 755 $(TARGET_DIR)/usr/share/mender/inventoryCould you give a bit of background about these ?
Will do.
Quoted 19 lines
Quoted 8 lines
package/mender/mender.mk +3
-2+ $(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 \ - $(TARGET_DIR)/etc/mender/tenant.confpackage/mender/mender.mk MENDER_LICENSE = Apache-2.0 & BSD-2-Clause & BSD-3-Clause & MIT & OLDAP-2.8 · line 26
Quoted 10 lines
package/mender/mender.mk +2
-6$(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 - $(INSTALL) -D -m 0755 package/mender/mender-inventory-network \ - $(TARGET_DIR)/var/share/mender/inventory/mender-inventory-network - $(INSTALL) -D -m 0755 package/mender/mender-inventory-hostinfo \ - $(TARGET_DIR)/var/share/mender/inventory/mender-inventory-hostinfo + $(INSTALL) -D -m 0755 $(@D)/support/mender-device-identity \ + $(TARGET_DIR)/usr/share/mender/identity/mender-device-identity
Quoted 1 line
The installation path has changed from
/var/share, to/usr/share. Why ?
/var/share was incorrect, it has always been /usr/share.
Quoted 4 lines
package/mender/mender.mk MENDER_LICENSE = Apache-2.0 & BSD-2-Clause & BSD-3-Clause & MIT & OLDAP-2.8 · line 28
Quoted 3 lines
package/mender/mender.mk +2
-0+ $(INSTALL) -D -m 0755 $(@D)/support/mender-inventory-* \ + $(TARGET_DIR)/usr/share/mender/inventory
Quoted 8 lines
A $(INSTALL) -D invocation should have a full destination path, so:
$(foreach f,hostinfo network, \ $(INSTALL) -D -m 0755 $(@D)/support/mender-inventory-$(f) \ $(TARGET_DIR)/usr/share/mender/inventory/mender-inventory-$(f) )Thanks!
Ok, thanks.
Signature · 3 lines
Mirza Krak | Embedded Solutions Architect | https://mender.io Northern.tech AS | @northerntechHQ
PATCH 2/8 package/mender: update install of config files
Hello,
Quoted 7 lines · Mirza Krak
Quoted 2 lines
Do you know why tenant.conf was added in the current Mender packaging ? Was it an old configuration file from previous Mender versions ?
This was something that we did deploy in our Yocto recipes (which might have been source of inspiration for the package in Buildroot), but it was never actually used for anything. There is an option in mender.conf for this, TenantToken.
Which is set to ?
tenant.conf was the target of a symlink, created in the systemd unit file:
/bin/ln -sf /etc/mender/tenant.conf /var/lib/mender/authtentoken
How does it work now ?
Quoted 3 lines
Quoted 1 line
The installation path has changed from
/var/share, to/usr/share. Why ?
/var/sharewas incorrect, it has always been/usr/share.
So in its current state, the mender package in Buildroot doesn't work ? I'm trying to figure out if this is a bug, or just a preference. If it's a bug, we need to fix it in the master branch, and perhaps backport it to our LTS release.
In your next iteration of the patches, could you please clearly separate the bug fixes as separate patches. They should come first in the series, before the improvements/cleanups.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 2/8 package/mender: update install of config files
Quoted 12 lines · Thomas Petazzoni
Hello,
Quoted 7 lines · Mirza Krak
Quoted 2 lines
Do you know why tenant.conf was added in the current Mender packaging ? Was it an old configuration file from previous Mender versions ?
This was something that we did deploy in our Yocto recipes (which might have been source of inspiration for the package in Buildroot), but it was never actually used for anything. There is an option in mender.conf for this, TenantToken.
Quoted 8 lines
Which is set to ?
tenant.conf was the target of a symlink, created in the systemd unit file:
/bin/ln-sf/etc/mender/tenant.conf/var/lib/mender/authtentokenHow does it work now ?
Example:
/etc/mender/mender.conf
{
TenantToken: "very long base64 encoded string"
}
This 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.
I also looked up some details, the removal of tenant.conf usage (and /var/lib/mender/authtentoken) was in 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 was not necessary.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
The installation path has changed from
/var/share, to/usr/share. Why ?
/var/sharewas incorrect, it has always been/usr/share.So in its current state, the mender package in Buildroot doesn't work ?
We need to define works. If we define works as that the mender.service is started successfully and the daemon is running, currently this does not work. And the path change from /var/share -> /usr/share is one of the fixes. The other one is a "sane" mender.conf file, currently there are only "template" values in the file installed that are not replaced with actually working values.
For Mender to actually be able to perform updates (works) it requires integration with U-boot and a specific partition layout, as it is A & B update solution. Will go in more detail on this in the other thread, with similar questions.
Quoted 7 lines
I'm trying to figure out if this is a bug, or just a preference. If it's a bug, we need to fix it in the master branch, and perhaps backport it to our LTS release.
In your next iteration of the patches, could you please clearly separate the bug fixes as separate patches. They should come first in the series, before the improvements/cleanups.
Yes, I can do that.
Signature · 3 lines
Mirza Krak | Embedded Solutions Architect | https://mender.io Northern.tech AS | @northerntechHQ
PATCH 2/8 package/mender: update install of config files
Hello,
Quoted 34 lines · Mirza Krak
Quoted 12 lines · Thomas Petazzoni
Hello,
Quoted 7 lines · Mirza Krak
Quoted 2 lines
Do you know why tenant.conf was added in the current Mender packaging ? Was it an old configuration file from previous Mender versions ?
This was something that we did deploy in our Yocto recipes (which might have been source of inspiration for the package in Buildroot), but it was never actually used for anything. There is an option in mender.conf for this, TenantToken.
Quoted 8 lines
Which is set to ?
tenant.conf was the target of a symlink, created in the systemd unit file:
/bin/ln-sf/etc/mender/tenant.conf/var/lib/mender/authtentokenHow does it work now ?
Example:
/etc/mender/mender.conf
{
TenantToken: "very long base64 encoded string"
}This 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.
Quoted 6 lines
I also looked up some details, the removal of tenant.conf usage (and
/var/lib/mender/authtentoken) was in 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 was not necessary.
OK, thanks a lot for this research. Please make this a separate patch from the rest, with this very good explanation as the commit log.
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
The installation path has changed from
/var/share, to/usr/share. Why ?
/var/sharewas incorrect, it has always been/usr/share.So in its current state, the mender package in Buildroot doesn't work ?
We need to define works. If we define works as that the mender.service is started successfully and the daemon is running, currently this does not work. And the path change from
/var/share->/usr/shareis one of the fixes.
OK, so we want this as a separate patch as well, so that we can apply it to master and backport to our LTS branch.
Quoted 3 lines
The other one is a "sane" mender.conf file, currently there are only "template" values in the file installed that are not replaced with actually working values.
It is kind of expected that the mender.conf provided in Buildroot is a template and needs to be replaced. I don't think it is really possible to provide an out-of-the-box working solution for update systems. As you explain below, it requires integration with the bootloader, a specific organization of the partitions, etc.
Quoted 4 lines
For Mender to actually be able to perform updates (works) it requires integration with U-boot and a specific partition layout, as it is A & B update solution. Will go in more detail on this in the other thread, with similar questions.
OK, thanks!
Quoted 5 lines
Quoted 3 lines
In your next iteration of the patches, could you please clearly separate the bug fixes as separate patches. They should come first in the series, before the improvements/cleanups.
Yes, I can do that.
Thanks a lot!
I have to say I'm really pleased to have people with deep knowledge of Mender taking care of its Buildroot packaging. This will definitely help in making Mender more usable in the context of Buildroot.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 3/8 package/mender: add dep on BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV
In reply to Mirza KrakThe 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.
--- package/mender/Config.in | 2 ++ 1 file changed, 2 insertions(+)
package/mender/Config.in +2 -0
@@ -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 + depends on BR2_PACKAGE_UBOOT_TOOLS + depends on BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV help Mender is an open source over-the-air (OTA) software updater for embedded Linux devices. Mender comprises a client
Signature · 1 line
2.18.0
PATCH 3/8 package/mender: add dep on BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV
Hi Mirza,
Quoted 14 lines · Mirza Krak
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 <[email protected]>--- package/mender/Config.in | 2 ++ 1 file changed, 2 insertions(+)package/mender/Config.in +0
-0
package/mender/Config.in config BR2_PACKAGE_MENDER · line 7
Quoted 5 lines
package/mender/Config.in +2
-0@@ -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 + depends on BR2_PACKAGE_UBOOT_TOOLS + depends on BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV
For non-obvious dependencies like these we prefer 'select'. Also, since this is a run-time only dependency, there should be a comment saying that. So:
select BR2_PACKAGE_UBOOT_TOOLS # runtime select BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV # runtime
baruch
Quoted 3 lines
package/mender/Config.in +0
-0help Mender is an open source over-the-air (OTA) software updater for embedded Linux devices. Mender comprises a client
Signature · 3 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -PATCH 3/8 package/mender: add dep on BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV
Quoted 1 line · Baruch Siach
Hi Mirza,
Hi Baruch,
Quoted 26 lines
Quoted 14 lines · Mirza Krak
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 <[email protected]>--- package/mender/Config.in | 2 ++ 1 file changed, 2 insertions(+)package/mender/Config.in +0
-0package/mender/Config.in config BR2_PACKAGE_MENDER · line 7
Quoted 5 lines
package/mender/Config.in +2
-0@@ -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 + depends on BR2_PACKAGE_UBOOT_TOOLS + depends on BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENVFor non-obvious dependencies like these we prefer 'select'. Also, since this is a run-time only dependency, there should be a comment saying that. So:
Quoted 2 lines
select
BR2_PACKAGE_UBOOT_TOOLS# runtime selectBR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV# runtime
Acknowledged.
Signature · 3 lines
Mirza Krak | Embedded Solutions Architect | https://mender.io Northern.tech AS | @northerntechHQ
PATCH 4/8 package/mender: add BR2_PACKAGE_MENDER_ARTIFACT_NAME option
In reply to Mirza KrakARTIFACT_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.
--- package/mender/Config.in | 13 +++++++++++++ package/mender/mender.mk | 7 +++++++ 2 files changed, 20 insertions(+)
package/mender/Config.in +13 -0
@@ -13,6 +13,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
package/mender/mender.mk +7 -0
@@ -9,6 +9,10 @@ MENDER_SITE = $(call github,mendersoftware,mender,$(MENDER_VERSION)) MENDER_LICENSE = Apache-2.0 & BSD-2-Clause & BSD-3-Clause & MIT & OLDAP-2.8 MENDER_LICENSE_FILES = LICENSE LIC_FILES_CHKSUM.sha256 +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
@@ -28,6 +32,9 @@ define MENDER_INSTALL_CONFIG_FILES $(TARGET_DIR)/usr/share/mender/inventory 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
Signature · 1 line
2.18.0
PATCH 4/8 package/mender: add BR2_PACKAGE_MENDER_ARTIFACT_NAME option
Hi Mirza,
Quoted 19 lines · Mirza Krak
ARTIFACT_NAMEis 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_NAMEis 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 <[email protected]>--- package/mender/Config.in | 13 +++++++++++++ package/mender/mender.mk | 7 +++++++ 2 files changed, 20 insertions(+)package/mender/Config.in +0
-0
package/mender/Config.in config BR2_PACKAGE_MENDER · line 19
Quoted 7 lines
package/mender/Config.in +4
-0@@ -13,6 +13,19 @@ config BR2_PACKAGE_MENDER https://github.com/mendersoftware/mender +if BR2_PACKAGE_MENDER + +config BR2_PACKAGE_MENDER_ARTIFACT_NAME + string "Mender artifact name"
You should have a default value here. Otherwise ...
Quoted 17 lines
package/mender/Config.in +9
-0+ 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_SUPPORTSpackage/mender/mender.mk +0
-0
package/mender/mender.mk MENDER_SITE = $(call github,mendersoftware,mender,$(MENDER_VERSION)) · line 13
Quoted 5 lines
package/mender/mender.mk +2
-0@@ -9,6 +9,10 @@ MENDER_SITE = $(call github,mendersoftware,mender,$(MENDER_VERSION)) MENDER_LICENSE = Apache-2.0 & BSD-2-Clause & BSD-3-Clause & MIT & OLDAP-2.8 MENDER_LICENSE_FILES = LICENSE LIC_FILES_CHKSUM.sha256 +ifeq ($(call qstrip,$(BR2_PACKAGE_MENDER_ARTIFACT_NAME)),) +$(error Mender device type not set. Check your BR2_PACKAGE_MENDER_ARTIFACT_NAME setting)
... this error will trigger by default. This will hit the autobuilders badly.
Same goes for the next patch.
baruch
Quoted 15 lines
package/mender/mender.mk +5
-0+endif + define MENDER_INSTALL_CONFIG_FILES $(INSTALL) -d -m 755 $(TARGET_DIR)/data/mender $(INSTALL) -d -m 755 $(TARGET_DIR)/data/uboot@@ -28,6 +32,9 @@ define MENDER_INSTALL_CONFIG_FILES $(TARGET_DIR)/usr/share/mender/inventory 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
Signature · 3 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -PATCH 4/8 package/mender: add BR2_PACKAGE_MENDER_ARTIFACT_NAME option
Quoted 52 lines · Baruch Siach
Hi Mirza,
Quoted 19 lines · Mirza Krak
ARTIFACT_NAMEis 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_NAMEis 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 <[email protected]>--- package/mender/Config.in | 13 +++++++++++++ package/mender/mender.mk | 7 +++++++ 2 files changed, 20 insertions(+)package/mender/Config.in +0
-0package/mender/Config.in config BR2_PACKAGE_MENDER · line 19
Quoted 7 lines
package/mender/Config.in +4
-0@@ -13,6 +13,19 @@ config BR2_PACKAGE_MENDER https://github.com/mendersoftware/mender +if BR2_PACKAGE_MENDER + +config BR2_PACKAGE_MENDER_ARTIFACT_NAME + string "Mender artifact name"You should have a default value here. Otherwise ...
Quoted 20 lines
package/mender/Config.in +9
-0+ 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_SUPPORTSpackage/mender/mender.mk +0
-0@@ -9,6 +9,10 @@ MENDER_SITE = $(call github,mendersoftware,mender,$(MENDER_VERSION)) MENDER_LICENSE = Apache-2.0 & BSD-2-Clause & BSD-3-Clause & MIT & OLDAP-2.8 MENDER_LICENSE_FILES = LICENSE LIC_FILES_CHKSUM.sha256
Quoted 7 lines
package/mender/mender.mk MENDER_SITE = $(call github,mendersoftware,mender,$(MENDER_VERSION)) · line 13
Quoted 2 lines
package/mender/mender.mk +2
-0+ifeq ($(call qstrip,$(BR2_PACKAGE_MENDER_ARTIFACT_NAME)),) +$(error Mender device type not set. Check your BR2_PACKAGE_MENDER_ARTIFACT_NAME setting)... this error will trigger by default. This will hit the autobuilders badly.
Same goes for the next patch.
Got it.
Thank you for reviewing.
Signature · 3 lines
Mirza Krak | Embedded Solutions Architect | https://mender.io Northern.tech AS | @northerntechHQ
PATCH 4/8 package/mender: add BR2_PACKAGE_MENDER_ARTIFACT_NAME option
In reply to Mirza KrakHello,
package/mender/Config.in config BR2_PACKAGE_MENDER · line 27
Quoted 12 lines · Mirza Krak
package/mender/Config.in +12
-0+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
I am wondering if we really need a new option for that, or if you shouldn't just let the user add /etc/mender/artifact_info to its root filesystem overlay.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 4/8 package/mender: add BR2_PACKAGE_MENDER_ARTIFACT_NAME option
Quoted 4 lines · Thomas Petazzoni
Hello,
On Wed, 15 Aug 2018 01:13:33 +0200, Mirza Krak wrote:
Quoted 16 lines
package/mender/Config.in config BR2_PACKAGE_MENDER · line 27
Quoted 12 lines
package/mender/Config.in +12
-0+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 + +endifI am wondering if we really need a new option for that, or if you shouldn't just let the user add
/etc/mender/artifact_infoto its root filesystem overlay.
This file is required to be present for the Mender client to start in daemon mode, but I could just create a file with "dummy" content without the option to satisfy that behavior and let users override with file-system overlay if that is the preferred to minimize number of options.
Though there is a reason why this was an option and it was to be able to share this information with the mender-artifact tool, I do not know if that is actually possible with how I did this. To provide some more context, somewhere I have the intention of calling the mender-artifact (host tool) tool with the following arguments:
#Create Mender artifact
mender-artifact write rootfs-image \
--update ${output_dir}/rootfs.ext4 \
--output-path ${mender_artifact} \
--artifact-name ${artifact_name} \
--device-type ${device_type}I have not yet figured out where to put above but I am getting there :). Mender artifacts are basically the ext4 image + some meta-data (checksum, signature, file-size etc)
Target image and Mender artifact share information (device_type and artifact_info/artifact_name) to be able to do sanity checks later on when updates are applied. This was my intention of keeping artifact_name as an option to be able to share it. But I gladly accept suggestions on how to best solve this.
Signature · 3 lines
Mirza Krak | Embedded Solutions Architect | https://mender.io Northern.tech AS | @northerntechHQ
PATCH 5/8 package/mender: add BR2_PACKAGE_MENDER_DEVICE_TYPE option
In reply to Mirza KrakMENDER_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.
--- package/mender/Config.in | 10 ++++++++++ package/mender/mender.mk | 7 +++++++ 2 files changed, 17 insertions(+)
package/mender/Config.in +10 -0
@@ -24,6 +24,16 @@ 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"
package/mender/mender.mk +7 -0
@@ -13,6 +13,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
@@ -35,6 +39,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
Signature · 1 line
2.18.0
PATCH 5/8 package/mender: add BR2_PACKAGE_MENDER_DEVICE_TYPE option
Hello,
package/mender/Config.in config BR2_PACKAGE_MENDER_ARTIFACT_NAME · line 35
Quoted 9 lines · Mirza Krak
package/mender/Config.in +9
-0+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.
I am a bit confused with "Note that /data is a mount point for the persistent data partition". If /data is a different partition than the root filesystem one, then what is the point of
having /data/mender/device_type in the root filesystem ? It will be hidden by whatever partition gets mounted in /data.
(Side note: please make sure to run check-package on your changes, the Config.in help text lines look a bit too long.)
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 5/8 package/mender: add BR2_PACKAGE_MENDER_DEVICE_TYPE option
Quoted 4 lines · Thomas Petazzoni
Hello,
On Wed, 15 Aug 2018 01:13:34 +0200, Mirza Krak wrote:
Quoted 15 lines
package/mender/Config.in config BR2_PACKAGE_MENDER_ARTIFACT_NAME · line 35
Quoted 9 lines
package/mender/Config.in +9
-0+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.I am a bit confused with "Note that /data is a mount point for the persistent data partition". If /data is a different partition than the root filesystem one, then what is the point of
having /data/mender/device_type in the root filesystem ? It will be hidden by whatever partition gets mounted in /data.
Understand the confusion, my intention was to convert the /data directory on target image to an ext4 image in a post build step and that is why I put these files there. Or is there a better way of "staging" files for post build steps?
Quoted 3 lines
(Side note: please make sure to run check-package on your changes, the Config.in help text lines look a bit too long.)
Will do.
Signature · 3 lines
Mirza Krak | Embedded Solutions Architect | https://mender.io Northern.tech AS | @northerntechHQ
PATCH 5/8 package/mender: add BR2_PACKAGE_MENDER_DEVICE_TYPE option
Hello,
Quoted 8 lines · Mirza Krak
Quoted 5 lines
I am a bit confused with "Note that /data is a mount point for the persistent data partition". If /data is a different partition than the root filesystem one, then what is the point of
having /data/mender/device_type in the root filesystem ? It will be hidden by whatever partition gets mounted in /data.Understand the confusion, my intention was to convert the /data directory on target image to an ext4 image in a post build step
Why do you want to do this ?
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 5/8 package/mender: add BR2_PACKAGE_MENDER_DEVICE_TYPE option
Quoted 10 lines · Thomas Petazzoni
Hello,
Quoted 6 lines · Mirza Krak
Quoted 5 lines
I am a bit confused with "Note that /data is a mount point for the persistent data partition". If /data is a different partition than the root filesystem one, then what is the point of
having /data/mender/device_type in the root filesystem ? It will be hidden by whatever partition gets mounted in /data.
Quoted 4 lines
Quoted 2 lines
Understand the confusion, my intention was to convert the /data directory on target image to an ext4 image in a post build step
Why do you want to do this ?
In the end I would like to create a "disk image" with _all_ the content, and the data part must be populated at build time, as it works at the moment.
Pseudo image:
image sdcard.img {
hdimage {
}
partition u-boot {
partition-type = 0xC
bootable = "true"
image = "boot.vfat"
}
partition rootfsA {
partition-type = 0x83
image = "rootfs.ext4"
size = 512M
}
partition rootfsB {
partition-type = 0x83
image = "rootfs.ext4"
size = 512M
}
partition data {
partition-type = 0x83
image = "data.ext4"
size = 512M
}
}Signature · 3 lines
Mirza Krak | Embedded Solutions Architect | https://mender.io Northern.tech AS | @northerntechHQ
PATCH 5/8 package/mender: add BR2_PACKAGE_MENDER_DEVICE_TYPE option
Hello,
Quoted 37 lines · Mirza Krak
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
I am a bit confused with "Note that /data is a mount point for the persistent data partition". If /data is a different partition than the root filesystem one, then what is the point of
having /data/mender/device_type in the root filesystem ? It will be hidden by whatever partition gets mounted in /data.Understand the confusion, my intention was to convert the /data directory on target image to an ext4 image in a post build step
Why do you want to do this ?
In the end I would like to create a "disk image" with _all_ the content, and the data part must be populated at build time, as it works at the moment.
Pseudo image:
image sdcard.img { hdimage { } partition u-boot { partition-type = 0xC bootable = "true" image = "boot.vfat" } partition rootfsA { partition-type = 0x83 image = "rootfs.ext4" size = 512M } partition rootfsB { partition-type = 0x83 image = "rootfs.ext4" size = 512M
Quoted 8 lines
}
partition data {
partition-type = 0x83
image = "data.ext4"
size = 512M
}
}I don't think we should enforce anything like that in the Mender package. Buildroot's policy is to not have much policy on how the system should be structured/organized. Maybe people won't need any data partition because the system is completely state-less ? Maybe they need two data partitions ? Maybe having it in /data is not what they want.
So, the mender package should not make any assumption like this. And I still don't get why the device_type file should be in this data partition :-)
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 5/8 package/mender: add BR2_PACKAGE_MENDER_DEVICE_TYPE option
Quoted 1 line · Thomas Petazzoni
Hello,
Hello,
< snip >
Quoted 5 lines
I don't think we should enforce anything like that in the Mender package. Buildroot's policy is to not have much policy on how the system should be structured/organized. Maybe people won't need any data partition because the system is completely state-less ? Maybe they need two data partitions ? Maybe having it in /data is not what they want.
I highly appropriate you taking time to review this.
It is time for me to provide a bit more context :), I know all the internals so I assume that other people know this as well :).
Mender is an end-to-end open-source update solution. This has some implications and "enforcement". Other update solutions such as swupdate or RAUC are generic update solutions and highly configurable = no enforcement/policies. They do not really do anything specific unless you apply some kind of configuration to them.
Mender is highly optimized to do A & B style updates really well and that is it (for now), and is coupled with an management server for OTA updates (optional as it is able to do stand-alone updates). Being highly optimized for a specific use-case/style of updates also has some (not many but still) "enforcement's" otherwise you lose some of the benefits of being a "highly optimized" solution. I understand that not everything can exist in the upstream Buildroot repository and some things shall come in via file-system overlays and external patches but I am trying to get in as much as possible to minimize the "external" stuff and appreciate your feedback on where to draw the line.
This examples is based on updates on block based devices (eMMC/SD)
Mender _requires_ that the following partitions:
- rootfs A
- rootfs B
- data (persistent)
So "data" is not optional. You can have as many extra partitions as you would like but above is minimum if Mender is to be used. You can adjust where to mount the persistent data partition easily trough file-system overlay, but "normally" it is /data. Things that are stored on "data" part are not touched by updates and you only update rootfs A and rootfs B.
Things stored on the "data" part by the Mender client:
- update progress logs / error logs on the persistent data part to be able to provide failed updates to the server.
- authentication data provided by the server once the device is boot-strapped.
- device_type (explanation coming soon :))
- fw_env.config ()
device_type and fw_env.config must be populated during build-time, the other stuff will be dynamically created by the Mender client once it connects to a server etc.
My intention with installing it to /data in mender.mk is to have it in place, even though it is in the wrong location. This can be later extracted in a "post build" stage and converted to an ext4 image and embedded in to an disk image as a separate partition. If am violating Buildroot policies with this, I will back-off :).
Quoted 4 lines
So, the mender package should not make any assumption like this. And I still don't get why the
device_typefile should be in this data partition :-)
The device_type file normally contains a string like:
device_type=raspberrypi3
or
device_type=beaglebone
The content of this file is reported to the Mender service as a "compatibility" string, so that you can only install artifacts that are targeting "raspberrypi3" on devices that actually are reporting that they are a "raspberrypi3" device. And the reason for this to be on the "data" part is that this value can not change once set.
The same applies for the fw_env.config file, which is an important part for Mender to work it is put on "data" part to not be affected by updates. There is a symlink in rootfs, /etc/fw_env.config -> /data/uboot/fw_env.config
Sorry for the long email, but hopefully this brings some insights.
Signature · 3 lines
Mirza Krak | Embedded Solutions Architect | https://mender.io Northern.tech AS | @northerntechHQ
PATCH 6/8 package/mender: populate the mender.conf template
In reply to Mirza KrakOptions are provided for the Mender configuration and the default values should work together with a Mender demo environment.
https://docs.mender.io//getting-started/create-a-test-environment
--- package/mender/Config.in | 69 ++++++++++++++++++++++++++++++++++++++ package/mender/mender.conf | 14 +++----- package/mender/mender.mk | 12 +++++-- 3 files changed, 84 insertions(+), 11 deletions(-)
package/mender/Config.in +69 -0
@@ -34,6 +34,75 @@ config BR2_PACKAGE_MENDER_DEVICE_TYPE Will be stored in /data/mender/device_type. Note that /data is a mount point for the persistent data partition. +config BR2_PACKAGE_MENDER_INVENTORY_POLL_INTERVAL_SEC + int "Inventory poll interval" + default 1800 + help + An integer that sets the number of seconds to wait between each inventory + poll to the Mender server. + + https://docs.mender.io/client-configuration/configuration-file/polling-intervals + +config BR2_PACKAGE_MENDER_UPDATE_POLL_INTERVAL_SEC + int "Update poll interval" + default 1800 + help + An integer that sets the number of seconds to wait between each check for + a new update. Note that the client may occasionally check more often if + there has been recent activity on the device + + https://docs.mender.io/client-configuration/configuration-file/polling-intervals + +config BR2_PACKAGE_MENDER_RETRY_POLL_INTERVAL_SEC + int "Retry poll interval" + default 300 + help + An integer that sets the number of seconds to wait between each attempt + to download an update file. Note that the client may attempt more often + initially to enable rapid upgrades, but will gradually fall back to this + value if the server is busy. + + https://docs.mender.io/client-configuration/configuration-file/polling-intervals + +config BR2_PACKAGE_MENDER_SERVER_URL + string "Server URL" + default "https://docker.mender.io" + help + The server URL which is used as the basis for API requests. This should + be set to the server that runs the Mender server services. It should + include the whole URL, including https:// and a trailing slash. + + The default points to the Mender demo server setup, + https://docs.mender.io/1.5/getting-started/create-a-test-environment + +config BR2_PACKAGE_MENDER_TENANT_TOKEN + string "Hosted Mender tenant token" + default "dummy" + help + A token which identifies which tenant a device belongs to. This is only + relevant if using Hosted Mender. + +config BR2_PACKAGE_MENDER_SERVER_CRT + string "Public certificate of the Mender server" + default "/etc/mender/server.crt" + help + The location of the public certificate of the server, if any. If this + certificate is missing, or the one presented by the server doesn't match + the one specified in this setting, the server certificate will be + validated using standard certificate trust chains + +config BR2_PACKAGE_MENDER_ROOTFS_PART_A + string "Root filesystem A device" + default "mmcblk0p2" + help + The Linux device that contains root filesystem A. + +config BR2_PACKAGE_MENDER_ROOTFS_PART_B + string "Root filesystem B device" + default "mmcblk0p3" + help + The Linux device that contains root filesystem B. + endif comment "mender needs a toolchain w/ threads"
package/mender/mender.conf +5 -9
@@ -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@, + "UpdatePollIntervalSeconds": @MENDER_UPDATE_POLL_INTERVAL_SECONDS@, "RetryPollIntervalSeconds": @MENDER_RETRY_POLL_INTERVAL_SECONDS@, + "RootfsPartA": "@MENDER_ROOTFS_PART_A@", + "RootfsPartB": "@MENDER_ROOTFS_PART_B@", + "ServerCertificate": "@MENDER_CERT_LOCATION@", "ServerURL": "@MENDER_SERVER_URL@", - "ServerCertificate": "@MENDER_CERT_LOCATION@" + "TenantToken": "@MENDER_TENANT_TOKEN@" }
package/mender/mender.mk +10 -2
@@ -26,8 +26,6 @@ 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 \ - $(TARGET_DIR)/etc/mender/mender.conf $(INSTALL) -D -m 0644 package/mender/server.crt \ $(TARGET_DIR)/etc/mender/server.crt $(INSTALL) -D -m 0755 $(@D)/support/mender-device-identity \
@@ -42,6 +40,16 @@ define MENDER_INSTALL_CONFIG_FILES echo "device_type=$(call qstrip,$(BR2_PACKAGE_MENDER_DEVICE_TYPE))" > \ $(TARGET_DIR)/data/mender/device_type + + sed -e 's#@MENDER_ROOTFS_PART_A@#$(call qstrip,$(BR2_PACKAGE_MENDER_ROOTFS_PART_A))#g' \ + -e 's#@MENDER_ROOTFS_PART_B@#$(call qstrip,$(BR2_PACKAGE_MENDER_ROOTFS_PART_B))#g' \ + -e 's/@MENDER_UPDATE_POLL_INTERVAL_SECONDS@/$(call qstrip,$(BR2_PACKAGE_MENDER_UPDATE_POLL_INTERVAL_SEC))/' \ + -e 's/@MENDER_INVENTORY_POLL_INTERVAL_SECONDS@/$(call qstrip,$(BR2_PACKAGE_MENDER_INVENTORY_POLL_INTERVAL_SEC))/' \ + -e 's/@MENDER_RETRY_POLL_INTERVAL_SECONDS@/$(call qstrip,$(BR2_PACKAGE_MENDER_RETRY_POLL_INTERVAL_SEC))/' \ + -e 's#@MENDER_SERVER_URL@#$(call qstrip,$(BR2_PACKAGE_MENDER_SERVER_URL))#g' \ + -e 's#@MENDER_CERT_LOCATION@#$(call qstrip,$(BR2_PACKAGE_MENDER_SERVER_CRT))#g' \ + -e 's/@MENDER_TENANT_TOKEN@/$(call qstrip,$(BR2_PACKAGE_MENDER_TENANT_TOKEN))/' \ + package/mender/mender.conf > $(TARGET_DIR)/etc/mender/mender.conf endef MENDER_POST_INSTALL_TARGET_HOOKS += MENDER_INSTALL_CONFIG_FILES
Signature · 1 line
2.18.0
PATCH 6/8 package/mender: populate the mender.conf template
Hello,
Quoted 7 lines · Mirza Krak
Options are provided for the Mender configuration and the default values should work together with a Mender demo environment.
https://docs.mender.io//getting-started/create-a-test-environment
Signed-off-by Mirza Krak <[email protected]>
I'm sorry, but no. We are not going to add gazillions of options to each and every package to be able to configure the zillions of possible knobs that can be configured. We are not going to add options to create virtual hosts in Apache or Lighttpd, we are not going to add options to enable/disable each and every cipher in OpenSSH, etc.
The point of Buildroot is to provide a reasonable default mender.conf, and let user override it with their own configuration file as part of a root filesystem overlay.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 6/8 package/mender: populate the mender.conf template
Quoted 17 lines · Thomas Petazzoni
Hello,
Quoted 7 lines · Mirza Krak
Options are provided for the Mender configuration and the default values should work together with a Mender demo environment.
https://docs.mender.io//getting-started/create-a-test-environment
Signed-off-by Mirza Krak <[email protected]>I'm sorry, but no. We are not going to add gazillions of options to each and every package to be able to configure the zillions of possible knobs that can be configured. We are not going to add options to create virtual hosts in Apache or Lighttpd, we are not going to add options to enable/disable each and every cipher in OpenSSH, etc.
Quoted 3 lines
The point of Buildroot is to provide a reasonable default mender.conf, and let user override it with their own configuration file as part of a root filesystem overlay.
Got it.
Signature · 3 lines
Mirza Krak | Embedded Solutions Architect | https://mender.io Northern.tech AS | @northerntechHQ
PATCH 7/8 package/mender: select BR2_PACKAGE_CA_CERTIFICATES
In reply to Mirza KrakMender 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.
--- package/mender/Config.in | 1 + 1 file changed, 1 insertion(+)
package/mender/Config.in +1 -0
@@ -5,6 +5,7 @@ config BR2_PACKAGE_MENDER depends on BR2_TOOLCHAIN_HAS_THREADS depends on BR2_PACKAGE_UBOOT_TOOLS depends on BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV + select BR2_PACKAGE_CA_CERTIFICATES help Mender is an open source over-the-air (OTA) software updater for embedded Linux devices. Mender comprises a client
Signature · 1 line
2.18.0
PATCH 7/8 package/mender: select BR2_PACKAGE_CA_CERTIFICATES
Hello,
Quoted 15 lines · Mirza Krak
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 <[email protected]>--- package/mender/Config.in | 1 + 1 file changed, 1 insertion(+)package/mender/Config.in +0
-0
package/mender/Config.in config BR2_PACKAGE_MENDER · line 8
Quoted 4 lines
package/mender/Config.in +1
-0@@ -5,6 +5,7 @@ config BR2_PACKAGE_MENDER depends on BR2_TOOLCHAIN_HAS_THREADS depends on BR2_PACKAGE_UBOOT_TOOLS depends on BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV + select BR2_PACKAGE_CA_CERTIFICATES
Please add "# runtime" at the end of this line, to clarify that we don't have a build dependency on this.
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 7/8 package/mender: select BR2_PACKAGE_CA_CERTIFICATES
Quoted 13 lines · Thomas Petazzoni
Hello,
Quoted 10 lines · Mirza Krak
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 <[email protected]>--- package/mender/Config.in | 1 + 1 file changed, 1 insertion(+)
Quoted 12 lines
package/mender/Config.in config BR2_PACKAGE_MENDER · line 8
Quoted 9 lines
package/mender/Config.in +1
-0@@ -5,6 +5,7 @@ config BR2_PACKAGE_MENDER depends on BR2_TOOLCHAIN_HAS_THREADS depends on BR2_PACKAGE_UBOOT_TOOLS depends on BR2_PACKAGE_UBOOT_TOOLS_FWPRINTENV + select BR2_PACKAGE_CA_CERTIFICATESPlease add "# runtime" at the end of this line, to clarify that we don't have a build dependency on this.
Got it, thanks
Signature · 3 lines
Mirza Krak | Embedded Solutions Architect | https://mender.io Northern.tech AS | @northerntechHQ
PATCH 8/8 package/mender: set version in go linker
In reply to Mirza KrakThis 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--- package/mender/mender.mk | 2 ++ 1 file changed, 2 insertions(+)
package/mender/mender.mk +2 -0
@@ -17,6 +17,8 @@ ifeq ($(call qstrip,$(BR2_PACKAGE_MENDER_DEVICE_TYPE)),) $(error Mender device type not set. Check your BR2_PACKAGE_MENDER_DEVICE_TYPE setting) endif +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
Signature · 1 line
2.18.0
PATCH 8/8 package/mender: set version in go linker
Hello,
Quoted 20 lines · Mirza Krak
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.2Signed-off-by Mirza Krak <[email protected]>--- package/mender/mender.mk | 2 ++ 1 file changed, 2 insertions(+)package/mender/mender.mk +0
-0
package/mender/mender.mk ifeq ($(call qstrip,$(BR2_PACKAGE_MENDER_DEVICE_TYPE)),) · line 20
Quoted 4 lines
package/mender/mender.mk +1
-0@@ -17,6 +17,8 @@ ifeq ($(call qstrip,$(BR2_PACKAGE_MENDER_DEVICE_TYPE)),) $(error Mender device type not set. Check your BR2_PACKAGE_MENDER_DEVICE_TYPE setting) endif +MENDER_LDFLAGS = -X main.Version=$(MENDER_VERSION)
Is this main.Version property something specific to Mender, or something that is common to Go packaging in general ? I'm just trying to figure out if it should be in mender.mk like you did, or in pkg-golang.mk.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 8/8 package/mender: set version in go linker
Quoted 26 lines · Thomas Petazzoni
Hello,
Quoted 23 lines · Mirza Krak
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.2Signed-off-by Mirza Krak <[email protected]>--- package/mender/mender.mk | 2 ++ 1 file changed, 2 insertions(+)package/mender/mender.mk +0
-0@@ -17,6 +17,8 @@ ifeq ($(call qstrip,$(BR2_PACKAGE_MENDER_DEVICE_TYPE)),) $(error Mender device type not set. Check your BR2_PACKAGE_MENDER_DEVICE_TYPE setting) endif
Quoted 6 lines
package/mender/mender.mk ifeq ($(call qstrip,$(BR2_PACKAGE_MENDER_DEVICE_TYPE)),) · line 20
Quoted 1 line
package/mender/mender.mk +1
-0+MENDER_LDFLAGS = -X main.Version=$(MENDER_VERSION)Is this main.Version property something specific to Mender, or something that is common to Go packaging in general ? I'm just trying to figure out if it should be in mender.mk like you did, or in pkg-golang.mk.
I would not know the answer to this as my experience is somewhat limited when it comes to golang. But if we take a look at docker-containerd.mk, it does this:
DOCKER_CONTAINERD_LDFLAGS = \
-Xgithub.com/docker/containerd.GitCommit=$(DOCKER_CONTAINERD_VERSION)
Maybe above an argument against putting it in pkg-golank.mk?
Marcin, maybe you know? Or someone else on the list.
Signature · 3 lines
Mirza Krak | Embedded Solutions Architect | https://mender.io Northern.tech AS | @northerntechHQ
PATCH 8/8 package/mender: set version in go linker
Hello,
Quoted 9 lines · Mirza Krak
I would not know the answer to this as my experience is somewhat limited when it comes to golang. But if we take a look at docker-containerd.mk, it does this:
DOCKER_CONTAINERD_LDFLAGS = \ -Xgithub.com/docker/containerd.GitCommit=$(DOCKER_CONTAINERD_VERSION)
Maybe above an argument against putting it in pkg-golank.mk?
Indeed, every package seems to use its own custom property, so your patch looks good. Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com