@@ -1,7 +1,6 @@
#!/usr/bin/env bash
set -e
DEVICE_TYPE="buildroot-x86_64"
-ARTIFACT_NAME="1.0"
parse_args() {
local o O opts
@@ -19,7 +18,8 @@ parse_args() {
DEVICE_TYPE="${2}"; shift 2
;;
(-a|--artifact-name)
- ARTIFACT_NAME="${2}"; shift 2
+ # Ignored to have same options as other scripts
+ shift 2
;;
(--)
shift; break
@@ -42,8 +42,7 @@ mender_fixup() {
main() {
parse_args "${@}"
mender_fixup
- echo "device_type=${DEVICE_TYPE}" > "${TARGET_DIR}/etc/mender/device_type"
- echo "artifact_name=${ARTIFACT_NAME}" > "${TARGET_DIR}/etc/mender/artifact_info"
+ echo "device_type=${DEVICE_TYPE}" > "${TARGET_DIR}/var/lib/mender/device_type"
}
main "${@}"
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
set -e
BOARD_DIR="$(realpath "$(dirname "$0")")"
+DATA_PART="${BINARIES_DIR}"/data-part
DATA_PART_SIZE="32M"
DEVICE_TYPE="buildroot-x86_64"
ARTIFACT_NAME="1.0"
@@ -33,6 +34,7 @@ parse_args() {
# Create the data partition
make_data_partition() {
"${HOST_DIR}/sbin/mkfs.ext4" \
+ -d "${DATA_PART}" \
-F \
-r 1 \
-N 0 \
@@ -41,6 +43,26 @@ make_data_partition() {
"${BINARIES_DIR}/data-part.ext4" "${DATA_PART_SIZE}"
}
+# Generate a mender bootstrap artifact.
+# See https://northerntech.atlassian.net/browse/MEN-2585
+generate_mender_bootstrap_artifact() {
+
+ rm -rf "${DATA_PART}"
+ mkdir -p "${DATA_PART}"
+ img_checksum=$(sha256sum "${BINARIES_DIR}"/rootfs.ext4 |awk '{print $1}')
+
+ "${HOST_DIR}"/bin/mender-artifact \
+ write bootstrap-artifact \
+ --compression lzma \
+ --artifact-name "${ARTIFACT_NAME}" \
+ --device-type "${DEVICE_TYPE}" \
+ --provides "rootfs-image.version:${ARTIFACT_NAME}" \
+ --provides "rootfs-image.checksum:${img_checksum}" \
+ --clears-provides "rootfs-image.*" \
+ --output-path "${DATA_PART}"/bootstrap.mender \
+ --version 3
+}
+
# Create a mender image.
generate_mender_image() {
echo "Creating ${BINARIES_DIR}/${DEVICE_TYPE}-${ARTIFACT_NAME}.mender"
@@ -60,6 +82,7 @@ generate_image() {
# Main function.
main() {
parse_args "${@}"
+ generate_mender_bootstrap_artifact
make_data_partition
generate_image
generate_mender_image
@@ -184,3 +184,18 @@ sed -r -i -e 's/(\.tar\.gz)$/-cargo2\1/' $(
Note that the hash _will_ have changed, so that needs to be updated
(manually) as well.
+
+[[migrating-mender]]
+=== Migrating to 2024.11
+
+Mender has changed in a few notable ways:
+
+* Now requires a special bootstrap artifact generated with the
+ host-mender-artifact packaged named bootstrap.mender, placed in
+ /var/lib/mender. See board/mender/x86_64/post-image-efi.sh for an
+ example of how to generate the bootstrap.mender file.
+
+* No longer supports the artifact_info file.
+
+* See https://docs.mender.io/release-information/release-notes-changelog/mender-client#mender-3-5-0-1
+ under features for more information.
deleted file mode 100644
@@ -1 +0,0 @@
-artifact_name=BUILDROOT_ARTIFACT
@@ -4,6 +4,7 @@
"RetryPollIntervalSeconds": 300,
"RootfsPartA": "/dev/mmcblk0p2",
"RootfsPartB": "/dev/mmcblk0p3",
+ "DeviceTypeFile": "/var/lib/mender/device_type",
"ServerCertificate": "/etc/mender/server.crt",
"ServerURL": "https://docker.mender.io",
"TenantToken": "dummy"
@@ -1,12 +1,12 @@
# Locally computed:
-sha256 8a149b11b990beb7620b372023eec28df63cee6a1aa4132e88ecef554f080f72 mender-3.4.0-go2.tar.gz
+sha256 35e369759b8d4f012153e538b5daf1e0cebe842205811e708332c5a092270ac5 mender-3.5.3-go2.tar.gz
# Vendor licenses
# Generated with sed '/^[A-Za-z0-9_]/s/^/sha256 /' LIC_FILES_CHKSUM.sha256
# Apache-2.0 license.
-sha256 1033348db7606a7e61b6484f293847cf8d7a35766efebb97e304d4bd5d7f3f6b LICENSE
-sha256 1033348db7606a7e61b6484f293847cf8d7a35766efebb97e304d4bd5d7f3f6b vendor/github.com/mendersoftware/mender-artifact/LICENSE
+sha256 d0f406b04e7901e6b4076bdf5fd20f9d7f04fc41681069fd8954413ac6295688 LICENSE
+sha256 52b2497ce07650b825015e80ca7a5d40c360c04c530234ca6d950b0f98bca23a vendor/github.com/mendersoftware/mender-artifact/LICENSE
sha256 73ba74dfaa520b49a401b5d21459a8523a146f3b7518a833eea5efa85130bf68 vendor/github.com/mendersoftware/openssl/LICENSE
sha256 cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 vendor/github.com/minio/sha256-simd/LICENSE
sha256 8f5d89b47d7a05a199b77b7e0f362dad391d451ebda4ef48ba11c50c071564c7 vendor/github.com/mendersoftware/progressbar/LICENSE
@@ -29,6 +29,8 @@ sha256 1b93a317849ee09d3d7e4f1d20c2b78ddb230b4becb12d7c224c927b9d470251 vendor
#
# MIT license.
sha256 6d2de1cde19c4d2bd8bcd9aaa1d581f4cfa3db9cf71896140330eaa2f2687685 vendor/github.com/klauspost/pgzip/LICENSE
+sha256 f69f157b0be75da373605dbc8bbf142e8924ee82d8f44f11bcaf351335bf98cf vendor/github.com/klauspost/compress/internal/snapref/LICENSE
+sha256 f566a9f97bacdaf00d9f21dd991e81dc11201c4e016c86b470799429a1c9a79c vendor/github.com/klauspost/compress/zstd/internal/xxhash/LICENSE.txt
sha256 5d966570d7a442d4e969892860a914e542c97f262c873baee8f0aa48e1f40212 vendor/github.com/klauspost/cpuid/v2/LICENSE
sha256 51a0c9ec7f8b7634181b8d4c03e5b5d204ac21d6e72f46c313973424664b2e6b vendor/github.com/sirupsen/logrus/LICENSE
sha256 f8e536c1c7b695810427095dc85f5f80d44ff7c10535e8a9486cf393e2599189 vendor/github.com/stretchr/testify/LICENSE
@@ -42,4 +44,4 @@ sha256 08eab1118c80885fa1fa6a6dd7303f65a379fcb3733e063d20d1bbc2c76e6fa1 vendor
sha256 310fe25c858a9515fc8c8d7d1f24a67c9496f84a91e0a0e41ea9975b1371e569 vendor/github.com/bmatsuo/lmdb-go/LICENSE.mdb.md
# sha256 of all the vendor licenses combined
-sha256 93d9db9b43097b174e362ac8f398aa9a37fcdde2974d0567b62bd6d1e0d22037 LIC_FILES_CHKSUM.sha256
+sha256 f6450978cef1c67078918fdebe21bbedf13a18a32537a071c755e2f2def3af16 LIC_FILES_CHKSUM.sha256
@@ -4,7 +4,7 @@
#
################################################################################
-MENDER_VERSION = 3.4.0
+MENDER_VERSION = 3.5.3
MENDER_SITE = $(call github,mendersoftware,mender,$(MENDER_VERSION))
MENDER_LICENSE = Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, MIT, OLDAP-2.8
MENDER_CPE_ID_VENDOR = northern.tech
@@ -29,6 +29,8 @@ MENDER_LICENSE_FILES = \
vendor/golang.org/x/term/LICENSE \
vendor/github.com/davecgh/go-spew/LICENSE \
vendor/github.com/klauspost/pgzip/LICENSE \
+ vendor/github.com/klauspost/compress/internal/snapref/LICENSE \
+ vendor/github.com/klauspost/compress/zstd/internal/xxhash/LICENSE.txt \
vendor/github.com/klauspost/cpuid/v2/LICENSE \
vendor/github.com/sirupsen/logrus/LICENSE \
vendor/github.com/stretchr/testify/LICENSE \
@@ -66,9 +68,6 @@ define MENDER_INSTALL_CONFIG_FILES
$(TARGET_DIR)/usr/share/mender/inventory/mender-inventory-$(f)
)
- $(INSTALL) -D -m 0755 $(MENDER_PKGDIR)/artifact_info \
- $(TARGET_DIR)/etc/mender/artifact_info
-
$(INSTALL) -D -m 0755 $(MENDER_PKGDIR)/device_type \
$(TARGET_DIR)/etc/mender/device_type
@@ -118,6 +118,10 @@ then you would typically create the Mender Artifact in a post image
script (BR2_ROOTFS_POST_IMAGE_SCRIPT). See the generate_mender_image
method in board/mender/x86_64/post-image-efi.sh for a working example.
+Additionally, mender requires a bootstrap.mender file which is also
+generated using the host-mender-artifact package. See the
+generate_mender_bootstrap_artifact method in
+board/mender/x86_64/post-image-efi.sh for an example
Configuring Mender with certificates
------------------------------------
@@ -7,9 +7,12 @@ class TestMenderInfra(infra.basetest.BRTest):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
BR2_PACKAGE_MENDER=y
+ BR2_PACKAGE_HOST_MENDER_ARTIFACT=y
BR2_TARGET_ROOTFS_CPIO=y
+ BR2_ROOTFS_POST_BUILD_SCRIPT="{}"
BR2_ROOTFS_OVERLAY="{}"
""".format(
+ infra.filepath("tests/package/test_mender/post-build.sh"),
# overlay to add a fake 'fw_printenv', used by Mender
infra.filepath("tests/package/test_mender/rootfs-overlay"))
new file mode 100755
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+set -e
+DEVICE_TYPE="buildroot-arm"
+ARTIFACT_NAME="RUNTIME_TEST_ARTIFACT_NAME"
+
+generate_mender_bootstrap_artifact() {
+ "${HOST_DIR}"/bin/mender-artifact \
+ write bootstrap-artifact \
+ --artifact-name "${ARTIFACT_NAME}" \
+ --device-type "${DEVICE_TYPE}" \
+ --provides "rootfs-image.version:${ARTIFACT_NAME}" \
+ --clears-provides "rootfs-image.*" \
+ --output-path "${TARGET_DIR}"/var/lib/mender/bootstrap.mender \
+ --version 3
+}
+
+function mender_fixup() {
+ rm -rf "${TARGET_DIR}"/var/lib/mender
+ mkdir -p "${TARGET_DIR}"/var/lib/mender
+ echo "device_type=${DEVICE_TYPE}" > "${TARGET_DIR}"/var/lib/mender/device_type
+
+}
+
+mender_fixup
+generate_mender_bootstrap_artifact
Updating directly to 4.x is too difficult and complex, as mender 4.x is a complete rewrite in C++, with several new dependencies and changes. As such, update to the last version that was written in Go, which is 3.5.3. The following changes are necessary: The artifact_info file is no longer supported. Instead, mender now expects a bootstrap.mender artifact created by mender-artifact /var/lib/mender. See the following for more information: https://northerntech.atlassian.net/browse/MEN-2585 https://northerntech.atlassian.net/browse/MEN-2583 https://docs.mender.io/release-information/release-notes-changelog/mender-client#mender-3-5-0-1 - Remove all instances of creating or copying an artifact_info file from board examples and package/mender. - Add a generate_mender_bootstrap_artifact method to board/mender/x86_64/post-image-efi.sh which creates a proper bootstrap.mender file and places it in the data partition. - Add a post-build.sh script to support/testing/tests/package/test_mender with the same generate_mender_bootstrap_artifact method with one change: As the rootfs.ext4 file is not yet created; we omit the optional --provides "rootfs-image.checksum:${img_checksum}" argument when generating the bootstrap.mender file. Mender expects the device_type file to exist in /var/lib/mender/device_type. This is further supported by the following line in tests/Dockerfile.daemon: `echo device_type=docker-client > /var/lib/mender/device_type` Add a migration section in docs/manual/migrating.adoc Update the package/mender/readme.txt to include a quick mention of the bootstrap.mender artifact change. License changes: New: vendor/github.com/klauspost/compress/internal/snapref/LICENSE vendor/github.com/klauspost/compress/zstd/internal/xxhash/LICENSE.txt Removed: vendor/github.com/klauspost/compress/internal/snapref/LICENSE vendor/github.com/klauspost/compress/zstd/internal/xxhash/LICENSE.txt Modified: LICENSE: Update year from 2022 to 2024 LIC_FILES_CHKSUM.sha256: Sum of all Licenses changed vendor/github.com/mendersoftware/mender-artifact/LICENSE - Update year from 2022 to 2023 Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com> --- board/mender/x86_64/post-build.sh | 7 +++--- board/mender/x86_64/post-image-efi.sh | 23 +++++++++++++++++ docs/manual/migrating.adoc | 15 +++++++++++ package/mender/artifact_info | 1 - package/mender/mender.conf | 1 + package/mender/mender.hash | 10 +++++--- package/mender/mender.mk | 7 +++--- package/mender/readme.txt | 4 +++ support/testing/tests/package/test_mender.py | 3 +++ .../tests/package/test_mender/post-build.sh | 25 +++++++++++++++++++ 10 files changed, 83 insertions(+), 13 deletions(-) delete mode 100644 package/mender/artifact_info create mode 100755 support/testing/tests/package/test_mender/post-build.sh