From fe8e93af15a0698a7f20883a5b7fdcde7c10c5f5 Mon Sep 17 00:00:00 2001 From: Andy Doan Date: Tue, 16 Jul 2019 16:13:07 -0500 Subject: Allow customization of data in targets.json This allows a user to define their own script to be executed after a target has been added to the repository but not yet signed. Signed-off-by: Andy Doan (cherry picked from commit 086f225a581204f45c1c95cffc06c55d3f4eee30) --- classes/image_types_ostree.bbclass | 6 ++++++ classes/sota.bbclass | 1 + 2 files changed, 7 insertions(+) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 134f5f5..79147cf 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -241,6 +241,12 @@ IMAGE_CMD_garagesign () { ${target_url} \ --sha256 ${ostree_target_hash} \ --hardwareids ${SOTA_HARDWARE_ID} + if [ -n "${GARAGE_CUSTOMIZE_TARGET}" ]; then + bbplain "Running command(${GARAGE_CUSTOMIZE_TARGET}) to customize target" + ${GARAGE_CUSTOMIZE_TARGET} \ + ${GARAGE_SIGN_REPO}/tufrepo/roles/unsigned/targets.json \ + ${GARAGE_TARGET_NAME}-${target_version} + fi garage-sign targets sign --repo tufrepo \ --home-dir ${GARAGE_SIGN_REPO} \ --key-name=targets diff --git a/classes/sota.bbclass b/classes/sota.bbclass index 4465e6c..61d27ad 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass @@ -53,6 +53,7 @@ GARAGE_SIGN_KEYNAME ?= "garage-key" GARAGE_TARGET_NAME ?= "${OSTREE_BRANCHNAME}" GARAGE_TARGET_VERSION ?= "" GARAGE_TARGET_URL ?= "" +GARAGE_CUSTOMIZE_TARGET ?= "" SOTA_MACHINE ??="none" SOTA_MACHINE_rpi ?= "raspberrypi" -- cgit v1.2.3-54-g00ecf From 7c7aec62e844e79e862cb9ac49ca9f73c5931629 Mon Sep 17 00:00:00 2001 From: Ricardo Salveti Date: Fri, 18 May 2018 17:47:11 -0300 Subject: image_types_ostree: no need to create boot/loader folders when creating ostree repo The boot/loader folders are only required at the deploy stage, which is already created by image_types_ota.bbclass. Signed-off-by: Ricardo Salveti (cherry-picked from commit 54f9b8e2ecb4ef0027da026368edc33bbc08eed4) --- classes/image_types_ostree.bbclass | 6 ------ 1 file changed, 6 deletions(-) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 79147cf..ca97fdb 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -119,12 +119,6 @@ IMAGE_CMD_ostree () { ln -sf var/roothome root fi - # Creating boot directories is required for "ostree admin deploy" - - mkdir -p boot/loader.0 - mkdir -p boot/loader.1 - ln -sf boot/loader.0 boot/loader - checksum=`sha256sum ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} | cut -f 1 -d " "` cp ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} boot/vmlinuz-${checksum} -- cgit v1.2.3-54-g00ecf From 0b592956d0ac9784a7435d94ed9c06aaecc03ed3 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 19 Jul 2019 21:48:44 +0200 Subject: image_types_ostree: add top level directories unconditionally The Filesystem Hierarchy Standard defines several top-level directory to be writeable. Add those even in the absence of files installed by OpenEmbedded so a user might actually use them. Signed-off-by: Stefan Agner (cherry-picked from commit 986526193a8f2f08ccdc77d71bb7d7f5e86185f0) --- classes/image_types_ostree.bbclass | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index ca97fdb..b7104d7 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -93,15 +93,15 @@ IMAGE_CMD_ostree () { if [ "$(ls -A $dir)" ]; then bbwarn "Data in /$dir directory is not preserved by OSTree. Consider moving it under /usr" fi - - if [ -n "${SYSTEMD_USED}" ]; then - echo "d /var/rootdirs/${dir} 0755 root root -" >>${tmpfiles_conf} - else - echo "mkdir -p /var/rootdirs/${dir}; chown 755 /var/rootdirs/${dir}" >>${tmpfiles_conf} - fi rm -rf ${dir} - ln -sf var/rootdirs/${dir} ${dir} fi + + if [ -n "${SYSTEMD_USED}" ]; then + echo "d /var/rootdirs/${dir} 0755 root root -" >>${tmpfiles_conf} + else + echo "mkdir -p /var/rootdirs/${dir}; chown 755 /var/rootdirs/${dir}" >>${tmpfiles_conf} + fi + ln -sf var/rootdirs/${dir} ${dir} done if [ -d root ] && [ ! -L root ]; then -- cgit v1.2.3-54-g00ecf From 75625f1203d9a387b028884111cad8738c455065 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 19 Jul 2019 21:55:15 +0200 Subject: image_types_ostree: make root directory only readable by root Make the root home directory only accessible by root. Use 700 as commonly used for the root home directory. Signed-off-by: Stefan Agner (cherry-picked from commit c170b6344b13ea075aff4091c846623b9b6f9a97) --- classes/image_types_ostree.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index b7104d7..d644f53 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -110,9 +110,9 @@ IMAGE_CMD_ostree () { fi if [ -n "${SYSTEMD_USED}" ]; then - echo "d /var/roothome 0755 root root -" >>${tmpfiles_conf} + echo "d /var/roothome 0700 root root -" >>${tmpfiles_conf} else - echo "mkdir -p /var/roothome; chown 755 /var/roothome" >>${tmpfiles_conf} + echo "mkdir -p /var/roothome; chown 700 /var/roothome" >>${tmpfiles_conf} fi rm -rf root -- cgit v1.2.3-54-g00ecf From 4f6bd2518d030cf94f48885dbdeceb483b05384a Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 19 Jul 2019 22:11:50 +0200 Subject: image_types_ostree: add /usr/local support Add /usr/local support as outlined in OSTree documentation. This makes sure that a writeable and persistent /usr/local directory is available. See also: https://ostree.readthedocs.io/en/latest/manual/adapting-existing/ Signed-off-by: Stefan Agner (cherry-picked from commit bc6c9f098442a2c0bf4a7a40ba50c9ee5fe40cc1) --- classes/image_types_ostree.bbclass | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index d644f53..3300a3d 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -119,6 +119,31 @@ IMAGE_CMD_ostree () { ln -sf var/roothome root fi + if [ -d usr/local ] && [ ! -L usr/local ]; then + if [ "$(ls -A usr/local)" ]; then + bbfatal "Data in /usr/local directory is not preserved by OSTree." + fi + rm -rf usr/local + fi + + if [ -n "${SYSTEMD_USED}" ]; then + echo "d /var/usrlocal 0755 root root -" >>${tmpfiles_conf} + else + echo "mkdir -p /var/usrlocal; chown 755 /var/usrlocal" >>${tmpfiles_conf} + fi + + dirs="bin etc games include lib man sbin share src" + + for dir in ${dirs}; do + if [ -n "${SYSTEMD_USED}" ]; then + echo "d /var/usrlocal/${dir} 0755 root root -" >>${tmpfiles_conf} + else + echo "mkdir -p /var/usrlocal/${dir}; chown 755 /var/usrlocal/${dir}" >>${tmpfiles_conf} + fi + done + + ln -sf ../var/usrlocal usr/local + checksum=`sha256sum ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} | cut -f 1 -d " "` cp ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} boot/vmlinuz-${checksum} -- cgit v1.2.3-54-g00ecf From 3cbe8167169d9c03d18314aa0ba50eddb40777de Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Wed, 24 Jul 2019 13:34:33 +0200 Subject: Longer timeout for primary/secondary oe-selftest Signed-off-by: Laurent Bonnans (cherry-picked from commit 383144042a1354a0d1e6d042e77bdb0faaba9ed2) --- lib/oeqa/selftest/cases/updater_qemux86_64.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/oeqa/selftest/cases/updater_qemux86_64.py b/lib/oeqa/selftest/cases/updater_qemux86_64.py index 2b4726c..c65d6e9 100644 --- a/lib/oeqa/selftest/cases/updater_qemux86_64.py +++ b/lib/oeqa/selftest/cases/updater_qemux86_64.py @@ -358,7 +358,7 @@ class IpSecondaryTests(OESelftestTestCase): self._test_ctx.append_config('SOTA_CLIENT_PROV = " aktualizr-shared-prov "') def is_ecu_registered(self, ecu_id): - max_number_of_tries = 40 + max_number_of_tries = 120 try_counter = 0 # aktualizr-info is not always able to load ECU serials from DB -- cgit v1.2.3-54-g00ecf From ced70b413839998ae1ac378e36741a8f76a59665 Mon Sep 17 00:00:00 2001 From: Zee314159 <252806294@qq.com> Date: Wed, 24 Jul 2019 09:32:24 +0200 Subject: oe-selftests: wait until provisioned * fixed bugs * Removed unnecessary code and added comments * Checked stderr and stdout Signed-off-by: Zee314159 <252806294@qq.com> (cherry-picked and squashed from PR #562) --- lib/oeqa/selftest/cases/testutils.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/oeqa/selftest/cases/testutils.py b/lib/oeqa/selftest/cases/testutils.py index 8d618a6..28087ca 100644 --- a/lib/oeqa/selftest/cases/testutils.py +++ b/lib/oeqa/selftest/cases/testutils.py @@ -121,15 +121,21 @@ def verifyNotProvisioned(testInst, machine): def verifyProvisioned(testInst, machine): # Verify that device HAS provisioned. + # First loop while waiting for the device to boot. ran_ok = False for delay in [5, 5, 5, 5, 10, 10, 10, 10]: stdout, stderr, retcode = testInst.qemu_command('aktualizr-info') - if retcode == 0 and stderr == b'' and stdout.decode().find('Fetched metadata: yes') >= 0: + if retcode == 0 and stderr == b'': ran_ok = True break sleep(delay) testInst.assertTrue(ran_ok, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) + # Then wait for aktualizr to provision. + if stdout.decode().find('Fetched metadata: yes') < 0: + stdout, stderr, retcode = testInst.qemu_command('aktualizr-info --wait-until-provisioned') + testInst.assertFalse(retcode, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) + testInst.assertEqual(stderr, b'', 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) testInst.assertIn(b'Device ID: ', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) testInst.assertIn(b'Primary ecu hardware ID: ' + machine.encode(), stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) -- cgit v1.2.3-54-g00ecf From 2cbffc73c8531e1cd32529567ec1270f5d13d39d Mon Sep 17 00:00:00 2001 From: Ricardo Salveti Date: Wed, 24 Jul 2019 18:46:45 -0300 Subject: initramfs-ostree-image: unset EXTRA_IMAGEDEPENDS to avoid extra dependencies It is common for machine configurations to set EXTRA_IMAGEDEPENDS, which can end up causing circular dependencies when building the initramfs image (they are usually only required for the actual rootfs image). Signed-off-by: Ricardo Salveti (cherry-picked from commit e556e32c8449fc324481d0d74682f5e04a191477) --- recipes-core/images/initramfs-ostree-image.bb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes-core/images/initramfs-ostree-image.bb b/recipes-core/images/initramfs-ostree-image.bb index b2d9e27..26a70d3 100644 --- a/recipes-core/images/initramfs-ostree-image.bb +++ b/recipes-core/images/initramfs-ostree-image.bb @@ -15,6 +15,9 @@ LICENSE = "MIT" IMAGE_FSTYPES = "${OSTREE_INITRAMFS_FSTYPES}" +# Avoid circular dependencies +EXTRA_IMAGEDEPENDS = "" + inherit core-image IMAGE_ROOTFS_SIZE = "8192" -- cgit v1.2.3-54-g00ecf From 406f9579adb98a010958f35311e495701c30dd49 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Tue, 23 Jul 2019 17:29:28 +0200 Subject: README: update list of supported boards. Renesas isn't actually new, but the TI support is. Signed-off-by: Patrick Vacek (cherry-picked from commit 3f248a6fc304365954f621c5fa8720dbf209f329) --- README.adoc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/README.adoc b/README.adoc index 8711e86..c121af7 100644 --- a/README.adoc +++ b/README.adoc @@ -61,7 +61,7 @@ and get as a result an `ostree_repo` folder in your images directory (`tmp/deplo * your OSTree repository, with the rootfs committed as an OSTree deployment, * an `otaimg` bootstrap image, which is an OSTree physical sysroot as a burnable filesystem image, and optionally -* some machine-dependent live images (e.g. `.wic` for Raspberry Pi or `.porter-sdimg-ota` Renesas Porter board). +* some machine-dependent live images (e.g. `.wic` for Raspberry Pi or `.porter-sdimg-ota` for Renesas Porter board). Although `aglsetup.sh` hooks provide reasonable defaults for SOTA-related variables, you may want to tune some of them. @@ -71,11 +71,16 @@ Ubuntu users that encounter an error due to missing `Python.h` should install `l == Supported boards -Currently supported platforms are +Currently supported platforms are: -* https://github.com/advancedtelematic/meta-updater-raspberrypi[Raspberry Pi3] -* https://github.com/advancedtelematic/meta-updater-minnowboard[Minnowboard] +* https://github.com/advancedtelematic/meta-updater-raspberrypi[Raspberry Pi 2 and 3] +* https://github.com/advancedtelematic/meta-updater-minnowboard[Intel Minnowboard] * https://github.com/advancedtelematic/meta-updater-qemux86-64[Native QEMU emulation] +* Renesas R-Car H3 and M3 +* https://github.com/advancedtelematic/meta-updater-ti/[TI BeagleBone Black] (rocko only, using TI SDK 05.03) +* https://github.com/advancedtelematic/meta-updater-ti/[TI AM65x industrial development kit] (rocko only, using TI SDK 05.03) + +We also historically supported the https://github.com/advancedtelematic/meta-updater-porter[Renesas Porter] board. === Adding support for your board -- cgit v1.2.3-54-g00ecf From 60faee946d234db0a015f4f7be159a90052c0e48 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Tue, 23 Jul 2019 17:30:15 +0200 Subject: README: describe OSTREE_BRANCHNAME. Not sure how that one got away for so long! It's one of the most commonly used, after all. Signed-off-by: Patrick Vacek (cherry-picked from commit 5593f8500385fdd8532828b539ed5e2dc75bad2c) --- README.adoc | 1 + 1 file changed, 1 insertion(+) diff --git a/README.adoc b/README.adoc index c121af7..aa182b2 100644 --- a/README.adoc +++ b/README.adoc @@ -97,6 +97,7 @@ Your images will also need network connectivity to be able to reach an actual OT == SOTA-related variables in local.conf +* `OSTREE_BRANCHNAME` - OSTree branch name. Defaults to `${SOTA_HARDWARE_ID}`. Particularly useful for grouping similar images. * `OSTREE_REPO` - path to your OSTree repository. Defaults to `$\{DEPLOY_DIR_IMAGE}/ostree_repo` * `OSTREE_OSNAME` - OS deployment name on your target device. For more information about deployments and osnames see the https://ostree.readthedocs.io/en/latest/manual/deployment/[OSTree documentation]. Defaults to "poky". * `OSTREE_INITRAMFS_IMAGE` - initramfs/initrd image that is used as a proxy while booting into OSTree deployment. Do not change this setting unless you are sure that your initramfs can serve as such a proxy. -- cgit v1.2.3-54-g00ecf From b446fa5a41dccb743ced09d6e62871757b245114 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Tue, 23 Jul 2019 17:30:49 +0200 Subject: README: add recommendations for logging. Signed-off-by: Patrick Vacek (cherry-picked from commit f693e967b7c7fb97d07375b076e11dbf2ffd799a) --- README.adoc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index aa182b2..9c125bf 100644 --- a/README.adoc +++ b/README.adoc @@ -193,7 +193,23 @@ RESOURCE_CPU_WEIGHT_pn-aktualizr = "50" == Development configuration -There are a few settings that can be controlled in `local.conf` to simplify the development process: +=== Logging + +To troubleshoot problems that you might encounter during development, we recommend that you enable persistent `systemd` logging. This setting is enabled by default for newly configured environments (see link:conf/local.conf.sample.append[]). To enable it manually, put this to your `local.conf`: + +.... +IMAGE_INSTALL_append += " systemd-journald-persistent" +.... + +It may also be helpful to run with debug logging enabled in aktualizr. To do so, add this to your `local.conf`: + +.... +IMAGE_INSTALL_append += " aktualizr-log-debug" +.... + +=== Custom aktualizr versions + +You can override the version of aktualizr included in your image. This requires that the version you wish to run is pushed to the https://github.com/advancedtelematic/aktualizr[aktualizr github repo]. You can then use these settings in your `local.conf` to simplify the development process: [options="header"] |====================== -- cgit v1.2.3-54-g00ecf From 427d416070941fb7bafa4722d63c0610edfb9439 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Thu, 25 Jul 2019 17:23:48 +0200 Subject: local.conf.sample: fix provisioning naming. Missed that somehow when we did the renaming. Signed-off-by: Patrick Vacek (cherry-picked from commit 4216c0aca0d22c6810ea8de45d1efd61102b4d5f) --- conf/local.conf.sample.append | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/local.conf.sample.append b/conf/local.conf.sample.append index 4588ec3..fc565f8 100644 --- a/conf/local.conf.sample.append +++ b/conf/local.conf.sample.append @@ -8,7 +8,7 @@ MACHINE = "##MACHINE##" DISTRO = "poky-sota-systemd" # General SOTA setup -#SOTA_CLIENT_PROV = "aktualizr-auto-prov" +#SOTA_CLIENT_PROV = "aktualizr-shared-prov" #SOTA_PACKED_CREDENTIALS = "/path/to/credentials.zip" # Uncomment this line to start an ssh server at boot automatically -- cgit v1.2.3-54-g00ecf From b38c79944790de3ae8410c1a59d82464c9a1a63b Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Tue, 30 Jul 2019 10:53:34 +0200 Subject: README: fix type in recipe name. Signed-off-by: Patrick Vacek Suggested-by: Montgomery, Greg (cherry-picked from commit 924a190936f24eb9978e66c8a9e44c2d5873f2a4) --- README.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.adoc b/README.adoc index 9c125bf..8bded9a 100644 --- a/README.adoc +++ b/README.adoc @@ -112,7 +112,7 @@ Your images will also need network connectivity to be able to reach an actual OT * `SOTA_SECONDARY_CONFIG` - a file containing JSON configuration for secondaries. It will be installed into `/etc/sota/ecus` on the device and automatically provided to aktualizr. See link:https://github.com/advancedtelematic/aktualizr/blob/master/docs/posix-secondaries-bitbaking.adoc[here] for more details. * `SOTA_HARDWARE_ID` - a custom hardware ID that will be written to the aktualizr config. Defaults to MACHINE if not set. * `RESOURCE_xxx_pn-aktualizr` - controls maximum resource usage of the aktualizr service, when `aktualizr-resource-control` is installed on the image. See <> for details. -* `SOTA_POLLING_SEC` - sets polling interval for aktualizr to check for updates if aktualizr-polling-sec is included in the image. +* `SOTA_POLLING_SEC` - sets polling interval for aktualizr to check for updates if aktualizr-polling-interval is included in the image. == Usage -- cgit v1.2.3-54-g00ecf From 6237c1807c64f1b3fc72ef79336dd392078f4432 Mon Sep 17 00:00:00 2001 From: Zee314159 <252806294@qq.com> Date: Fri, 26 Jul 2019 08:53:36 +0200 Subject: Dont patch credentials Unzip files in tmp directory, updated comments Fixed a zip bug Grouped elements with warnings With a fancier loop Signed-off-by: Zee314159 <252806294@qq.com> (cherry-picked from commit 672fcc51d92522c8e2de794ef561e8dd281f7f20) --- recipes-sota/aktualizr/aktualizr-shared-prov-creds.bb | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/recipes-sota/aktualizr/aktualizr-shared-prov-creds.bb b/recipes-sota/aktualizr/aktualizr-shared-prov-creds.bb index dbb5fde..2701c07 100644 --- a/recipes-sota/aktualizr/aktualizr-shared-prov-creds.bb +++ b/recipes-sota/aktualizr/aktualizr-shared-prov-creds.bb @@ -14,14 +14,17 @@ require credentials.inc do_install() { if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then install -m 0700 -d ${D}${localstatedir}/sota - cp "${SOTA_PACKED_CREDENTIALS}" ${D}${localstatedir}/sota/sota_provisioning_credentials.zip - # Device should not be able to push data to treehub - zip -d ${D}${localstatedir}/sota/sota_provisioning_credentials.zip treehub.json - # Device has no use for the API Gateway. Remove if present. See: - # https://github.com/advancedtelematic/ota-plus-server/pull/1913/ - if unzip -l ${D}${localstatedir}/sota/sota_provisioning_credentials.zip api_gateway.url > /dev/null; then - zip -d ${D}${localstatedir}/sota/sota_provisioning_credentials.zip api_gateway.url - fi + # root.json contains the root metadata for bootstrapping the Uptane metadata verification process. + # autoprov.url has the URL to the device gateway on the server, which is where we send most of our requests. + # autoprov_credentials.p12 contains the shared provisioning credentials. + for var in root.json autoprov.url autoprov_credentials.p12; do + if unzip -l "${SOTA_PACKED_CREDENTIALS}" $var > /dev/null; then + unzip "${SOTA_PACKED_CREDENTIALS}" $var -d ${T} + zip -mj -q ${D}${localstatedir}/sota/sota_provisioning_credentials.zip ${T}/$var + else + bbwarn "$var is missing from credentials.zip" + fi + done fi } -- cgit v1.2.3-54-g00ecf From 8a461f1eb7f7333b0c30faaa74226ff2d4de4d09 Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Wed, 31 Jul 2019 17:54:40 +0200 Subject: More helpful error message when running qemu Signed-off-by: Laurent Bonnans (cherry-picked from commit 36f311912372be3150633b4da0f344c70e456d55) --- scripts/qemucommand.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/qemucommand.py b/scripts/qemucommand.py index 8b7da2b..daf2dd1 100644 --- a/scripts/qemucommand.py +++ b/scripts/qemucommand.py @@ -1,4 +1,4 @@ -from os.path import exists, join, realpath, abspath +from os.path import exists, isdir, join, realpath, abspath from os import listdir import random import socket @@ -42,6 +42,8 @@ class QemuCommand(object): if args.machine: self.machine = args.machine else: + if not isdir(args.dir): + raise ValueError("Directory %s does not exist, please specify a --machine or a valid images directory" % args.dir) machines = listdir(args.dir) if len(machines) == 1: self.machine = machines[0] -- cgit v1.2.3-54-g00ecf From b71882853174f93a7c4fe0a94921102cbc842e7e Mon Sep 17 00:00:00 2001 From: Zee314159 <252806294@qq.com> Date: Wed, 31 Jul 2019 16:01:01 +0200 Subject: Test for setting hwid Fixed bug taking device ID for hardware ID Signed-off-by: Zee314159 <252806294@qq.com> (cherry-picked from commit a2fc4db9ca899db957bb5feb8bc15b6526b1b23e) --- lib/oeqa/selftest/cases/testutils.py | 15 +++++++++------ lib/oeqa/selftest/cases/updater_qemux86_64.py | 4 +++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/oeqa/selftest/cases/testutils.py b/lib/oeqa/selftest/cases/testutils.py index 28087ca..802d665 100644 --- a/lib/oeqa/selftest/cases/testutils.py +++ b/lib/oeqa/selftest/cases/testutils.py @@ -119,7 +119,7 @@ def verifyNotProvisioned(testInst, machine): 'Device already provisioned!? ' + stderr.decode() + stdout.decode()) -def verifyProvisioned(testInst, machine): +def verifyProvisioned(testInst, machine, hwid=''): # Verify that device HAS provisioned. # First loop while waiting for the device to boot. ran_ok = False @@ -133,12 +133,15 @@ def verifyProvisioned(testInst, machine): # Then wait for aktualizr to provision. if stdout.decode().find('Fetched metadata: yes') < 0: stdout, stderr, retcode = testInst.qemu_command('aktualizr-info --wait-until-provisioned') - - testInst.assertFalse(retcode, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) - testInst.assertEqual(stderr, b'', 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) + testInst.assertFalse(retcode, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) + testInst.assertEqual(stderr, b'', 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) testInst.assertIn(b'Device ID: ', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) - testInst.assertIn(b'Primary ecu hardware ID: ' + machine.encode(), stdout, - 'Provisioning failed: ' + stderr.decode() + stdout.decode()) + if hwid == '': + testInst.assertIn(b'Primary ecu hardware ID: ' + machine.encode(), stdout, + 'Provisioning failed: ' + stderr.decode() + stdout.decode()) + else: + testInst.assertIn(b'Primary ecu hardware ID: ' + hwid.encode(), stdout, + 'Provisioning failed: ' + stderr.decode() + stdout.decode()) testInst.assertIn(b'Fetched metadata: yes', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) p = re.compile(r'Device ID: ([a-z0-9-]*)\n') m = p.search(stdout.decode()) diff --git a/lib/oeqa/selftest/cases/updater_qemux86_64.py b/lib/oeqa/selftest/cases/updater_qemux86_64.py index c65d6e9..24abcff 100644 --- a/lib/oeqa/selftest/cases/updater_qemux86_64.py +++ b/lib/oeqa/selftest/cases/updater_qemux86_64.py @@ -85,6 +85,7 @@ class SharedCredProvTests(OESelftestTestCase): self.append_config('MACHINE = "qemux86-64"') self.append_config('SOTA_CLIENT_PROV = " aktualizr-shared-prov "') self.append_config('IMAGE_FSTYPES_remove = "ostreepush garagesign garagecheck"') + self.append_config('SOTA_HARDWARE_ID = "plain_reibekuchen_314"') self.qemu, self.s = qemu_launch(machine='qemux86-64') def tearDownLocal(self): @@ -107,7 +108,8 @@ class SharedCredProvTests(OESelftestTestCase): self.assertEqual(value, machine, 'MACHINE does not match hostname: ' + machine + ', ' + value) - verifyProvisioned(self, machine) + hwid = get_bb_var('SOTA_HARDWARE_ID') + verifyProvisioned(self, machine, hwid) class ManualControlTests(OESelftestTestCase): -- cgit v1.2.3-54-g00ecf From ad7c8f60007d89cb9b4500c5af7070a388a9647c Mon Sep 17 00:00:00 2001 From: Eugene Smirnov Date: Tue, 6 Aug 2019 12:31:36 +0200 Subject: qemucommand.py: redirect qemu monitor to null chardev By default qemu monitor gets attached to stdio, and that interferes with the test output. We also don't need vga options in nographic mode. Signed-off-by: Eugene Smirnov (cherry-picked from commit c6ad1d288b8f930bbc3fa6de9e102209e3304c66) --- scripts/qemucommand.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/qemucommand.py b/scripts/qemucommand.py index daf2dd1..df6907c 100644 --- a/scripts/qemucommand.py +++ b/scripts/qemucommand.py @@ -102,12 +102,8 @@ class QemuCommand(object): cmdline += [ "-serial", "tcp:127.0.0.1:%d,server,nowait" % self.serial_port, "-m", self.mem, - "-usb", "-object", "rng-random,id=rng0,filename=/dev/urandom", "-device", "virtio-rng-pci,rng=rng0", - "-device", "usb-tablet", - "-show-cursor", - "-vga", "std", "-net", netuser, "-net", "nic,macaddr=%s" % self.mac_address ] @@ -119,9 +115,17 @@ class QemuCommand(object): '-device', 'e1000,netdev=vlan1,mac='+random_mac(), ] if self.gui: - cmdline += ["-serial", "stdio"] + cmdline += [ + "-usb", + "-device", "usb-tablet", + "-show-cursor", + "-vga", "std" + ] else: - cmdline.append('-nographic') + cmdline += [ + "-nographic", + "-monitor", "null", + ] if self.kvm: cmdline += ['-enable-kvm', '-cpu', 'host'] else: -- cgit v1.2.3-54-g00ecf From edff609356bee7fd8e03764e00da9e58c60c5ba9 Mon Sep 17 00:00:00 2001 From: Patrick Vacek Date: Tue, 25 Jun 2019 16:00:44 +0200 Subject: Bump aktualizr and garage-sign versions to the latest. Both include support for mutual TLS in the garage tools. Signed-off-by: Patrick Vacek (cherry-picked from commit 8fa3a60d39476903745cb80f6130bb8c412e0694) --- recipes-sota/aktualizr/aktualizr_git.bb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index ddc0de1..8d1decd 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -15,7 +15,7 @@ RDEPENDS_${PN}-ptest += "bash cmake curl python3-misc python3-modules sqlite3 va PV = "1.0+git${SRCPV}" PR = "7" -GARAGE_SIGN_PV = "0.7.0-3-gf5ba640" +GARAGE_SIGN_PV = "0.7.0-19-g89ec974" SRC_URI = " \ gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ @@ -28,10 +28,10 @@ SRC_URI = " \ " # for garage-sign archive -SRC_URI[md5sum] = "e104ccd4f32e52571a5fc0e5042db050" -SRC_URI[sha256sum] = "c590be1a57523bfe097af82279eda5c97cf40ae47fb27162cf33c469702c8a9b" +SRC_URI[md5sum] = "3ed27c1142860cd9b4a2594067312b8b" +SRC_URI[sha256sum] = "e54eef3863118f373c3ebd9e2877f9de5bab4950ed157a15fb4f4ec575bc2ece" -SRCREV = "9c592cf9d8dfcd995d47753f2be7bd1a2b56c7da" +SRCREV = "03778511cc937d07bf53a8092f8b268e65f5d9a6" BRANCH ?= "master" S = "${WORKDIR}/git" -- cgit v1.2.3-54-g00ecf From d2a57a9bfc8b3939addf92d14d9178f6f9ebb434 Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Thu, 15 Aug 2019 12:23:57 +0200 Subject: Do not export anything in sota.bbclass A simple variable definition will be enough and doing an export there completely kills caching. Cherry-picked from master with additional fix to use yocto variables instead of bash ones (not present anymore). Signed-off-by: Laurent Bonnans --- classes/image_types_ostree.bbclass | 4 ++-- classes/image_types_ota.bbclass | 6 +++--- classes/sota.bbclass | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 3300a3d..edddf37 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -16,11 +16,11 @@ OSTREE_UPDATE_SUMMARY ??= "0" SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'systemd', 'true', '')}" IMAGE_CMD_ostree () { - if [ -z "$OSTREE_REPO" ]; then + if [ -z "${OSTREE_REPO}" ]; then bbfatal "OSTREE_REPO should be set in your local.conf" fi - if [ -z "$OSTREE_BRANCHNAME" ]; then + if [ -z "${OSTREE_BRANCHNAME}" ]; then bbfatal "OSTREE_BRANCHNAME should be set in your local.conf" fi diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index b14d2bb..6d0676b 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass @@ -48,15 +48,15 @@ IMAGE_CMD_otaimg () { if ${@bb.utils.contains('IMAGE_FSTYPES', 'otaimg', 'false', 'true', d)}; then return fi - if [ -z "$OSTREE_REPO" ]; then + if [ -z "${OSTREE_REPO}" ]; then bbfatal "OSTREE_REPO should be set in your local.conf" fi - if [ -z "$OSTREE_OSNAME" ]; then + if [ -z "${OSTREE_OSNAME}" ]; then bbfatal "OSTREE_OSNAME should be set in your local.conf" fi - if [ -z "$OSTREE_BRANCHNAME" ]; then + if [ -z "${OSTREE_BRANCHNAME}" ]; then bbfatal "OSTREE_BRANCHNAME should be set in your local.conf" fi diff --git a/classes/sota.bbclass b/classes/sota.bbclass index 61d27ad..85401d5 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass @@ -40,11 +40,11 @@ EXTRA_IMAGEDEPENDS_append_sota = " parted-native mtools-native dosfstools-native OSTREE_INITRAMFS_FSTYPES ??= "${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot', 'ext4.gz.u-boot', 'ext4.gz')}" # Please redefine OSTREE_REPO in order to have a persistent OSTree repo -export OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" -export OSTREE_BRANCHNAME ?= "${SOTA_HARDWARE_ID}" -export OSTREE_OSNAME ?= "poky" -export OSTREE_BOOTLOADER ??= 'u-boot' -export OSTREE_BOOT_PARTITION ??= "/boot" +OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" +OSTREE_BRANCHNAME ?= "${SOTA_HARDWARE_ID}" +OSTREE_OSNAME ?= "poky" +OSTREE_BOOTLOADER ??= 'u-boot' +OSTREE_BOOT_PARTITION ??= "/boot" OSTREE_INITRAMFS_IMAGE ?= "initramfs-ostree-image" -- cgit v1.2.3-54-g00ecf From 285591672866e37781f6049a05b88b1921394372 Mon Sep 17 00:00:00 2001 From: Laurent Bonnans Date: Fri, 16 Aug 2019 17:51:56 +0200 Subject: Expose OSTREE_BOOT_PARTITION in do_image_ota Used by ostree-grub-generator Signed-off-by: Laurent Bonnans --- classes/image_types_ota.bbclass | 1 + 1 file changed, 1 insertion(+) diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index 6d0676b..9f4bd40 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass @@ -60,6 +60,7 @@ IMAGE_CMD_otaimg () { bbfatal "OSTREE_BRANCHNAME should be set in your local.conf" fi + export OSTREE_BOOT_PARTITION=${OSTREE_BOOT_PARTITION} PHYS_SYSROOT=`mktemp -d ${WORKDIR}/ota-sysroot-XXXXX` ostree admin --sysroot=${PHYS_SYSROOT} init-fs ${PHYS_SYSROOT} -- cgit v1.2.3-54-g00ecf