diff options
| author | Patrick Vacek <patrickvacek@gmail.com> | 2019-08-20 16:19:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-20 16:19:18 +0200 |
| commit | 5e7ab2790cf4bfc6964254f0ccf696c1ad02b946 (patch) | |
| tree | 2d27fc4d09bb394b6a8775f36b824d3a2efae541 | |
| parent | 66a90135c7621d1337822bdee751e85ac0520e75 (diff) | |
| parent | 90eddc039a145e965b5d77e71e8132ec58a62da5 (diff) | |
| download | meta-updater-5e7ab2790cf4bfc6964254f0ccf696c1ad02b946.tar.gz | |
Merge pull request #581 from advancedtelematic/backport/thud-19-08-14
Backport/thud 19 08 14
| -rw-r--r-- | README.adoc | 36 | ||||
| -rw-r--r-- | classes/image_types_ostree.bbclass | 49 | ||||
| -rw-r--r-- | classes/image_types_ota.bbclass | 1 | ||||
| -rw-r--r-- | classes/sota.bbclass | 11 | ||||
| -rw-r--r-- | conf/local.conf.sample.append | 2 | ||||
| -rw-r--r-- | lib/oeqa/selftest/cases/testutils.py | 19 | ||||
| -rw-r--r-- | lib/oeqa/selftest/cases/updater_qemux86_64.py | 6 | ||||
| -rw-r--r-- | recipes-core/images/initramfs-ostree-image.bb | 3 | ||||
| -rw-r--r-- | recipes-sota/aktualizr/aktualizr-shared-prov-creds.bb | 19 | ||||
| -rw-r--r-- | recipes-sota/aktualizr/aktualizr_git.bb | 8 | ||||
| -rw-r--r-- | scripts/qemucommand.py | 20 |
11 files changed, 127 insertions, 47 deletions
diff --git a/README.adoc b/README.adoc index b047f91..dd07425 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 | |||
| 61 | 61 | ||
| 62 | * your OSTree repository, with the rootfs committed as an OSTree deployment, | 62 | * your OSTree repository, with the rootfs committed as an OSTree deployment, |
| 63 | * an `ota-ext4` bootstrap image, which is an OSTree physical sysroot as a burnable filesystem image, and optionally | 63 | * an `ota-ext4` bootstrap image, which is an OSTree physical sysroot as a burnable filesystem image, and optionally |
| 64 | * some machine-dependent live images (e.g. `.wic` for Raspberry Pi or `.porter-sdimg-ota` Renesas Porter board). | 64 | * some machine-dependent live images (e.g. `.wic` for Raspberry Pi or `.porter-sdimg-ota` for Renesas Porter board). |
| 65 | 65 | ||
| 66 | Although `aglsetup.sh` hooks provide reasonable defaults for SOTA-related variables, you may want to tune some of them. | 66 | Although `aglsetup.sh` hooks provide reasonable defaults for SOTA-related variables, you may want to tune some of them. |
| 67 | 67 | ||
| @@ -71,11 +71,18 @@ Ubuntu users that encounter an error due to missing `Python.h` should install `l | |||
| 71 | 71 | ||
| 72 | == Supported boards | 72 | == Supported boards |
| 73 | 73 | ||
| 74 | Currently supported platforms are | 74 | Currently supported platforms are: |
| 75 | 75 | ||
| 76 | * https://github.com/advancedtelematic/meta-updater-raspberrypi[Raspberry Pi3] | 76 | * https://github.com/advancedtelematic/meta-updater-raspberrypi[Raspberry Pi 2 and 3] |
| 77 | * https://github.com/advancedtelematic/meta-updater-minnowboard[Minnowboard] | 77 | * https://github.com/advancedtelematic/meta-updater-minnowboard[Intel Minnowboard] |
| 78 | * https://github.com/advancedtelematic/meta-updater-qemux86-64[Native QEMU emulation] | 78 | * https://github.com/advancedtelematic/meta-updater-qemux86-64[Native QEMU emulation] |
| 79 | * Renesas R-Car H3 and M3 | ||
| 80 | * https://github.com/advancedtelematic/meta-updater-ti/[TI BeagleBone Black] (rocko only, using TI SDK 05.03) | ||
| 81 | * https://github.com/advancedtelematic/meta-updater-ti/[TI AM65x industrial development kit] (rocko only, using TI SDK 05.03) | ||
| 82 | |||
| 83 | Additionally, there is community support for https://github.com/ricardosalveti/meta-updater-riscv[RISC-V] boards, in particular the Freedom U540. | ||
| 84 | |||
| 85 | We also historically supported the https://github.com/advancedtelematic/meta-updater-porter[Renesas Porter] board. | ||
| 79 | 86 | ||
| 80 | === Adding support for your board | 87 | === Adding support for your board |
| 81 | 88 | ||
| @@ -92,6 +99,7 @@ Your images will also need network connectivity to be able to reach an actual OT | |||
| 92 | 99 | ||
| 93 | == SOTA-related variables in local.conf | 100 | == SOTA-related variables in local.conf |
| 94 | 101 | ||
| 102 | * `OSTREE_BRANCHNAME` - OSTree branch name. Defaults to `${SOTA_HARDWARE_ID}`. Particularly useful for grouping similar images. | ||
| 95 | * `OSTREE_REPO` - path to your OSTree repository. Defaults to `$\{DEPLOY_DIR_IMAGE}/ostree_repo` | 103 | * `OSTREE_REPO` - path to your OSTree repository. Defaults to `$\{DEPLOY_DIR_IMAGE}/ostree_repo` |
| 96 | * `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". | 104 | * `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". |
| 97 | * `OSTREE_COMMIT_BODY` - Message attached to OSTree commit. Empty by default. | 105 | * `OSTREE_COMMIT_BODY` - Message attached to OSTree commit. Empty by default. |
| @@ -110,7 +118,7 @@ Your images will also need network connectivity to be able to reach an actual OT | |||
| 110 | * `SOTA_DT_OVERLAYS` - whitespace-separated list of used device tree overlays for FIT image. This list is OSTree-updateable as well. | 118 | * `SOTA_DT_OVERLAYS` - whitespace-separated list of used device tree overlays for FIT image. This list is OSTree-updateable as well. |
| 111 | * `SOTA_EXTRA_CONF_FRAGS` - extra https://lxr.missinglinkelectronics.com/uboot/doc/uImage.FIT/overlay-fdt-boot.txt[configuration fragments] for FIT image. | 119 | * `SOTA_EXTRA_CONF_FRAGS` - extra https://lxr.missinglinkelectronics.com/uboot/doc/uImage.FIT/overlay-fdt-boot.txt[configuration fragments] for FIT image. |
| 112 | * `RESOURCE_xxx_pn-aktualizr` - controls maximum resource usage of the aktualizr service, when `aktualizr-resource-control` is installed on the image. See <<aktualizr service resource control>> for details. | 120 | * `RESOURCE_xxx_pn-aktualizr` - controls maximum resource usage of the aktualizr service, when `aktualizr-resource-control` is installed on the image. See <<aktualizr service resource control>> for details. |
| 113 | * `SOTA_POLLING_SEC` - sets polling interval for aktualizr to check for updates if aktualizr-polling-sec is included in the image. | 121 | * `SOTA_POLLING_SEC` - sets polling interval for aktualizr to check for updates if aktualizr-polling-interval is included in the image. |
| 114 | 122 | ||
| 115 | == Usage | 123 | == Usage |
| 116 | 124 | ||
| @@ -191,7 +199,23 @@ RESOURCE_CPU_WEIGHT_pn-aktualizr = "50" | |||
| 191 | 199 | ||
| 192 | == Development configuration | 200 | == Development configuration |
| 193 | 201 | ||
| 194 | There are a few settings that can be controlled in `local.conf` to simplify the development process: | 202 | === Logging |
| 203 | |||
| 204 | 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`: | ||
| 205 | |||
| 206 | .... | ||
| 207 | IMAGE_INSTALL_append += " systemd-journald-persistent" | ||
| 208 | .... | ||
| 209 | |||
| 210 | It may also be helpful to run with debug logging enabled in aktualizr. To do so, add this to your `local.conf`: | ||
| 211 | |||
| 212 | .... | ||
| 213 | IMAGE_INSTALL_append += " aktualizr-log-debug" | ||
| 214 | .... | ||
| 215 | |||
| 216 | === Custom aktualizr versions | ||
| 217 | |||
| 218 | 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: | ||
| 195 | 219 | ||
| 196 | [options="header"] | 220 | [options="header"] |
| 197 | |====================== | 221 | |====================== |
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 56d4d76..2e8e8f5 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass | |||
| @@ -78,15 +78,15 @@ IMAGE_CMD_ostree () { | |||
| 78 | if [ "$(ls -A $dir)" ]; then | 78 | if [ "$(ls -A $dir)" ]; then |
| 79 | bbwarn "Data in /$dir directory is not preserved by OSTree. Consider moving it under /usr" | 79 | bbwarn "Data in /$dir directory is not preserved by OSTree. Consider moving it under /usr" |
| 80 | fi | 80 | fi |
| 81 | |||
| 82 | if [ -n "${SYSTEMD_USED}" ]; then | ||
| 83 | echo "d /var/rootdirs/${dir} 0755 root root -" >>${tmpfiles_conf} | ||
| 84 | else | ||
| 85 | echo "mkdir -p /var/rootdirs/${dir}; chown 755 /var/rootdirs/${dir}" >>${tmpfiles_conf} | ||
| 86 | fi | ||
| 87 | rm -rf ${dir} | 81 | rm -rf ${dir} |
| 88 | ln -sf var/rootdirs/${dir} ${dir} | ||
| 89 | fi | 82 | fi |
| 83 | |||
| 84 | if [ -n "${SYSTEMD_USED}" ]; then | ||
| 85 | echo "d /var/rootdirs/${dir} 0755 root root -" >>${tmpfiles_conf} | ||
| 86 | else | ||
| 87 | echo "mkdir -p /var/rootdirs/${dir}; chown 755 /var/rootdirs/${dir}" >>${tmpfiles_conf} | ||
| 88 | fi | ||
| 89 | ln -sf var/rootdirs/${dir} ${dir} | ||
| 90 | done | 90 | done |
| 91 | 91 | ||
| 92 | if [ -d root ] && [ ! -L root ]; then | 92 | if [ -d root ] && [ ! -L root ]; then |
| @@ -95,15 +95,40 @@ IMAGE_CMD_ostree () { | |||
| 95 | fi | 95 | fi |
| 96 | 96 | ||
| 97 | if [ -n "${SYSTEMD_USED}" ]; then | 97 | if [ -n "${SYSTEMD_USED}" ]; then |
| 98 | echo "d /var/roothome 0755 root root -" >>${tmpfiles_conf} | 98 | echo "d /var/roothome 0700 root root -" >>${tmpfiles_conf} |
| 99 | else | 99 | else |
| 100 | echo "mkdir -p /var/roothome; chown 755 /var/roothome" >>${tmpfiles_conf} | 100 | echo "mkdir -p /var/roothome; chown 700 /var/roothome" >>${tmpfiles_conf} |
| 101 | fi | 101 | fi |
| 102 | 102 | ||
| 103 | rm -rf root | 103 | rm -rf root |
| 104 | ln -sf var/roothome root | 104 | ln -sf var/roothome root |
| 105 | fi | 105 | fi |
| 106 | 106 | ||
| 107 | if [ -d usr/local ] && [ ! -L usr/local ]; then | ||
| 108 | if [ "$(ls -A usr/local)" ]; then | ||
| 109 | bbfatal "Data in /usr/local directory is not preserved by OSTree." | ||
| 110 | fi | ||
| 111 | rm -rf usr/local | ||
| 112 | fi | ||
| 113 | |||
| 114 | if [ -n "${SYSTEMD_USED}" ]; then | ||
| 115 | echo "d /var/usrlocal 0755 root root -" >>${tmpfiles_conf} | ||
| 116 | else | ||
| 117 | echo "mkdir -p /var/usrlocal; chown 755 /var/usrlocal" >>${tmpfiles_conf} | ||
| 118 | fi | ||
| 119 | |||
| 120 | dirs="bin etc games include lib man sbin share src" | ||
| 121 | |||
| 122 | for dir in ${dirs}; do | ||
| 123 | if [ -n "${SYSTEMD_USED}" ]; then | ||
| 124 | echo "d /var/usrlocal/${dir} 0755 root root -" >>${tmpfiles_conf} | ||
| 125 | else | ||
| 126 | echo "mkdir -p /var/usrlocal/${dir}; chown 755 /var/usrlocal/${dir}" >>${tmpfiles_conf} | ||
| 127 | fi | ||
| 128 | done | ||
| 129 | |||
| 130 | ln -sf ../var/usrlocal usr/local | ||
| 131 | |||
| 107 | if [ "${KERNEL_IMAGETYPE}" = "fitImage" ]; then | 132 | if [ "${KERNEL_IMAGETYPE}" = "fitImage" ]; then |
| 108 | # this is a hack for ostree not to override init= in kernel cmdline - | 133 | # this is a hack for ostree not to override init= in kernel cmdline - |
| 109 | # make it think that the initramfs is present (while it is in FIT image) | 134 | # make it think that the initramfs is present (while it is in FIT image) |
| @@ -229,6 +254,12 @@ IMAGE_CMD_garagesign () { | |||
| 229 | ${target_url} \ | 254 | ${target_url} \ |
| 230 | --sha256 ${ostree_target_hash} \ | 255 | --sha256 ${ostree_target_hash} \ |
| 231 | --hardwareids ${SOTA_HARDWARE_ID} | 256 | --hardwareids ${SOTA_HARDWARE_ID} |
| 257 | if [ -n "${GARAGE_CUSTOMIZE_TARGET}" ]; then | ||
| 258 | bbplain "Running command(${GARAGE_CUSTOMIZE_TARGET}) to customize target" | ||
| 259 | ${GARAGE_CUSTOMIZE_TARGET} \ | ||
| 260 | ${GARAGE_SIGN_REPO}/tufrepo/roles/unsigned/targets.json \ | ||
| 261 | ${GARAGE_TARGET_NAME}-${target_version} | ||
| 262 | fi | ||
| 232 | garage-sign targets sign --repo tufrepo \ | 263 | garage-sign targets sign --repo tufrepo \ |
| 233 | --home-dir ${GARAGE_SIGN_REPO} \ | 264 | --home-dir ${GARAGE_SIGN_REPO} \ |
| 234 | --key-name=targets | 265 | --key-name=targets |
diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index 12375ec..894919d 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass | |||
| @@ -45,6 +45,7 @@ do_image_ota[cleandirs] = "${OTA_SYSROOT}" | |||
| 45 | do_image_ota[depends] = "${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER') == 'grub' else ''} \ | 45 | do_image_ota[depends] = "${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER') == 'grub' else ''} \ |
| 46 | ${@'virtual/bootloader:do_deploy' if d.getVar('OSTREE_BOOTLOADER') == 'u-boot' else ''}" | 46 | ${@'virtual/bootloader:do_deploy' if d.getVar('OSTREE_BOOTLOADER') == 'u-boot' else ''}" |
| 47 | IMAGE_CMD_ota () { | 47 | IMAGE_CMD_ota () { |
| 48 | export OSTREE_BOOT_PARTITION=${OSTREE_BOOT_PARTITION} | ||
| 48 | ostree admin --sysroot=${OTA_SYSROOT} init-fs ${OTA_SYSROOT} | 49 | ostree admin --sysroot=${OTA_SYSROOT} init-fs ${OTA_SYSROOT} |
| 49 | ostree admin --sysroot=${OTA_SYSROOT} os-init ${OSTREE_OSNAME} | 50 | ostree admin --sysroot=${OTA_SYSROOT} os-init ${OSTREE_OSNAME} |
| 50 | mkdir -p ${OTA_SYSROOT}/boot/loader.0 | 51 | mkdir -p ${OTA_SYSROOT}/boot/loader.0 |
diff --git a/classes/sota.bbclass b/classes/sota.bbclass index bf27b6d..5506428 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass | |||
| @@ -38,11 +38,11 @@ EXTRA_IMAGEDEPENDS_append_sota = " parted-native mtools-native dosfstools-native | |||
| 38 | INITRAMFS_FSTYPES ?= "${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER') == 'u-boot', 'cpio.gz.u-boot', 'cpio.gz')}" | 38 | INITRAMFS_FSTYPES ?= "${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER') == 'u-boot', 'cpio.gz.u-boot', 'cpio.gz')}" |
| 39 | 39 | ||
| 40 | # Please redefine OSTREE_REPO in order to have a persistent OSTree repo | 40 | # Please redefine OSTREE_REPO in order to have a persistent OSTree repo |
| 41 | export OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" | 41 | OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" |
| 42 | export OSTREE_BRANCHNAME ?= "${SOTA_HARDWARE_ID}" | 42 | OSTREE_BRANCHNAME ?= "${SOTA_HARDWARE_ID}" |
| 43 | export OSTREE_OSNAME ?= "poky" | 43 | OSTREE_OSNAME ?= "poky" |
| 44 | export OSTREE_BOOTLOADER ??= 'u-boot' | 44 | OSTREE_BOOTLOADER ??= 'u-boot' |
| 45 | export OSTREE_BOOT_PARTITION ??= "/boot" | 45 | OSTREE_BOOT_PARTITION ??= "/boot" |
| 46 | 46 | ||
| 47 | INITRAMFS_IMAGE ?= "initramfs-ostree-image" | 47 | INITRAMFS_IMAGE ?= "initramfs-ostree-image" |
| 48 | 48 | ||
| @@ -51,6 +51,7 @@ GARAGE_SIGN_KEYNAME ?= "garage-key" | |||
| 51 | GARAGE_TARGET_NAME ?= "${OSTREE_BRANCHNAME}" | 51 | GARAGE_TARGET_NAME ?= "${OSTREE_BRANCHNAME}" |
| 52 | GARAGE_TARGET_VERSION ?= "" | 52 | GARAGE_TARGET_VERSION ?= "" |
| 53 | GARAGE_TARGET_URL ?= "" | 53 | GARAGE_TARGET_URL ?= "" |
| 54 | GARAGE_CUSTOMIZE_TARGET ?= "" | ||
| 54 | 55 | ||
| 55 | SOTA_MACHINE ??="none" | 56 | SOTA_MACHINE ??="none" |
| 56 | SOTA_MACHINE_rpi ?= "raspberrypi" | 57 | SOTA_MACHINE_rpi ?= "raspberrypi" |
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##" | |||
| 8 | DISTRO = "poky-sota-systemd" | 8 | DISTRO = "poky-sota-systemd" |
| 9 | 9 | ||
| 10 | # General SOTA setup | 10 | # General SOTA setup |
| 11 | #SOTA_CLIENT_PROV = "aktualizr-auto-prov" | 11 | #SOTA_CLIENT_PROV = "aktualizr-shared-prov" |
| 12 | #SOTA_PACKED_CREDENTIALS = "/path/to/credentials.zip" | 12 | #SOTA_PACKED_CREDENTIALS = "/path/to/credentials.zip" |
| 13 | 13 | ||
| 14 | # Uncomment this line to start an ssh server at boot automatically | 14 | # Uncomment this line to start an ssh server at boot automatically |
diff --git a/lib/oeqa/selftest/cases/testutils.py b/lib/oeqa/selftest/cases/testutils.py index 8d618a6..802d665 100644 --- a/lib/oeqa/selftest/cases/testutils.py +++ b/lib/oeqa/selftest/cases/testutils.py | |||
| @@ -119,20 +119,29 @@ def verifyNotProvisioned(testInst, machine): | |||
| 119 | 'Device already provisioned!? ' + stderr.decode() + stdout.decode()) | 119 | 'Device already provisioned!? ' + stderr.decode() + stdout.decode()) |
| 120 | 120 | ||
| 121 | 121 | ||
| 122 | def verifyProvisioned(testInst, machine): | 122 | def verifyProvisioned(testInst, machine, hwid=''): |
| 123 | # Verify that device HAS provisioned. | 123 | # Verify that device HAS provisioned. |
| 124 | # First loop while waiting for the device to boot. | ||
| 124 | ran_ok = False | 125 | ran_ok = False |
| 125 | for delay in [5, 5, 5, 5, 10, 10, 10, 10]: | 126 | for delay in [5, 5, 5, 5, 10, 10, 10, 10]: |
| 126 | stdout, stderr, retcode = testInst.qemu_command('aktualizr-info') | 127 | stdout, stderr, retcode = testInst.qemu_command('aktualizr-info') |
| 127 | if retcode == 0 and stderr == b'' and stdout.decode().find('Fetched metadata: yes') >= 0: | 128 | if retcode == 0 and stderr == b'': |
| 128 | ran_ok = True | 129 | ran_ok = True |
| 129 | break | 130 | break |
| 130 | sleep(delay) | 131 | sleep(delay) |
| 131 | testInst.assertTrue(ran_ok, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) | 132 | testInst.assertTrue(ran_ok, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) |
| 132 | 133 | # Then wait for aktualizr to provision. | |
| 134 | if stdout.decode().find('Fetched metadata: yes') < 0: | ||
| 135 | stdout, stderr, retcode = testInst.qemu_command('aktualizr-info --wait-until-provisioned') | ||
| 136 | testInst.assertFalse(retcode, 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) | ||
| 137 | testInst.assertEqual(stderr, b'', 'aktualizr-info failed: ' + stderr.decode() + stdout.decode()) | ||
| 133 | testInst.assertIn(b'Device ID: ', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) | 138 | testInst.assertIn(b'Device ID: ', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) |
| 134 | testInst.assertIn(b'Primary ecu hardware ID: ' + machine.encode(), stdout, | 139 | if hwid == '': |
| 135 | 'Provisioning failed: ' + stderr.decode() + stdout.decode()) | 140 | testInst.assertIn(b'Primary ecu hardware ID: ' + machine.encode(), stdout, |
| 141 | 'Provisioning failed: ' + stderr.decode() + stdout.decode()) | ||
| 142 | else: | ||
| 143 | testInst.assertIn(b'Primary ecu hardware ID: ' + hwid.encode(), stdout, | ||
| 144 | 'Provisioning failed: ' + stderr.decode() + stdout.decode()) | ||
| 136 | testInst.assertIn(b'Fetched metadata: yes', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) | 145 | testInst.assertIn(b'Fetched metadata: yes', stdout, 'Provisioning failed: ' + stderr.decode() + stdout.decode()) |
| 137 | p = re.compile(r'Device ID: ([a-z0-9-]*)\n') | 146 | p = re.compile(r'Device ID: ([a-z0-9-]*)\n') |
| 138 | m = p.search(stdout.decode()) | 147 | 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 2b4726c..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): | |||
| 85 | self.append_config('MACHINE = "qemux86-64"') | 85 | self.append_config('MACHINE = "qemux86-64"') |
| 86 | self.append_config('SOTA_CLIENT_PROV = " aktualizr-shared-prov "') | 86 | self.append_config('SOTA_CLIENT_PROV = " aktualizr-shared-prov "') |
| 87 | self.append_config('IMAGE_FSTYPES_remove = "ostreepush garagesign garagecheck"') | 87 | self.append_config('IMAGE_FSTYPES_remove = "ostreepush garagesign garagecheck"') |
| 88 | self.append_config('SOTA_HARDWARE_ID = "plain_reibekuchen_314"') | ||
| 88 | self.qemu, self.s = qemu_launch(machine='qemux86-64') | 89 | self.qemu, self.s = qemu_launch(machine='qemux86-64') |
| 89 | 90 | ||
| 90 | def tearDownLocal(self): | 91 | def tearDownLocal(self): |
| @@ -107,7 +108,8 @@ class SharedCredProvTests(OESelftestTestCase): | |||
| 107 | self.assertEqual(value, machine, | 108 | self.assertEqual(value, machine, |
| 108 | 'MACHINE does not match hostname: ' + machine + ', ' + value) | 109 | 'MACHINE does not match hostname: ' + machine + ', ' + value) |
| 109 | 110 | ||
| 110 | verifyProvisioned(self, machine) | 111 | hwid = get_bb_var('SOTA_HARDWARE_ID') |
| 112 | verifyProvisioned(self, machine, hwid) | ||
| 111 | 113 | ||
| 112 | 114 | ||
| 113 | class ManualControlTests(OESelftestTestCase): | 115 | class ManualControlTests(OESelftestTestCase): |
| @@ -358,7 +360,7 @@ class IpSecondaryTests(OESelftestTestCase): | |||
| 358 | self._test_ctx.append_config('SOTA_CLIENT_PROV = " aktualizr-shared-prov "') | 360 | self._test_ctx.append_config('SOTA_CLIENT_PROV = " aktualizr-shared-prov "') |
| 359 | 361 | ||
| 360 | def is_ecu_registered(self, ecu_id): | 362 | def is_ecu_registered(self, ecu_id): |
| 361 | max_number_of_tries = 40 | 363 | max_number_of_tries = 120 |
| 362 | try_counter = 0 | 364 | try_counter = 0 |
| 363 | 365 | ||
| 364 | # aktualizr-info is not always able to load ECU serials from DB | 366 | # aktualizr-info is not always able to load ECU serials from DB |
diff --git a/recipes-core/images/initramfs-ostree-image.bb b/recipes-core/images/initramfs-ostree-image.bb index e77499e..b21be1c 100644 --- a/recipes-core/images/initramfs-ostree-image.bb +++ b/recipes-core/images/initramfs-ostree-image.bb | |||
| @@ -15,6 +15,9 @@ LICENSE = "MIT" | |||
| 15 | 15 | ||
| 16 | IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}" | 16 | IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}" |
| 17 | 17 | ||
| 18 | # Avoid circular dependencies | ||
| 19 | EXTRA_IMAGEDEPENDS = "" | ||
| 20 | |||
| 18 | inherit core-image | 21 | inherit core-image |
| 19 | 22 | ||
| 20 | IMAGE_ROOTFS_SIZE = "8192" | 23 | IMAGE_ROOTFS_SIZE = "8192" |
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 | |||
| 14 | do_install() { | 14 | do_install() { |
| 15 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then | 15 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then |
| 16 | install -m 0700 -d ${D}${localstatedir}/sota | 16 | install -m 0700 -d ${D}${localstatedir}/sota |
| 17 | cp "${SOTA_PACKED_CREDENTIALS}" ${D}${localstatedir}/sota/sota_provisioning_credentials.zip | 17 | # root.json contains the root metadata for bootstrapping the Uptane metadata verification process. |
| 18 | # Device should not be able to push data to treehub | 18 | # autoprov.url has the URL to the device gateway on the server, which is where we send most of our requests. |
| 19 | zip -d ${D}${localstatedir}/sota/sota_provisioning_credentials.zip treehub.json | 19 | # autoprov_credentials.p12 contains the shared provisioning credentials. |
| 20 | # Device has no use for the API Gateway. Remove if present. See: | 20 | for var in root.json autoprov.url autoprov_credentials.p12; do |
| 21 | # https://github.com/advancedtelematic/ota-plus-server/pull/1913/ | 21 | if unzip -l "${SOTA_PACKED_CREDENTIALS}" $var > /dev/null; then |
| 22 | if unzip -l ${D}${localstatedir}/sota/sota_provisioning_credentials.zip api_gateway.url > /dev/null; then | 22 | unzip "${SOTA_PACKED_CREDENTIALS}" $var -d ${T} |
| 23 | zip -d ${D}${localstatedir}/sota/sota_provisioning_credentials.zip api_gateway.url | 23 | zip -mj -q ${D}${localstatedir}/sota/sota_provisioning_credentials.zip ${T}/$var |
| 24 | fi | 24 | else |
| 25 | bbwarn "$var is missing from credentials.zip" | ||
| 26 | fi | ||
| 27 | done | ||
| 25 | fi | 28 | fi |
| 26 | } | 29 | } |
| 27 | 30 | ||
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 5de341e..9adfce8 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 openssl-bi | |||
| 15 | PV = "1.0+git${SRCPV}" | 15 | PV = "1.0+git${SRCPV}" |
| 16 | PR = "7" | 16 | PR = "7" |
| 17 | 17 | ||
| 18 | GARAGE_SIGN_PV = "0.7.0-3-gf5ba640" | 18 | GARAGE_SIGN_PV = "0.7.0-19-g89ec974" |
| 19 | 19 | ||
| 20 | SRC_URI = " \ | 20 | SRC_URI = " \ |
| 21 | gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ | 21 | gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ |
| @@ -28,10 +28,10 @@ SRC_URI = " \ | |||
| 28 | " | 28 | " |
| 29 | 29 | ||
| 30 | # for garage-sign archive | 30 | # for garage-sign archive |
| 31 | SRC_URI[md5sum] = "e104ccd4f32e52571a5fc0e5042db050" | 31 | SRC_URI[md5sum] = "3ed27c1142860cd9b4a2594067312b8b" |
| 32 | SRC_URI[sha256sum] = "c590be1a57523bfe097af82279eda5c97cf40ae47fb27162cf33c469702c8a9b" | 32 | SRC_URI[sha256sum] = "e54eef3863118f373c3ebd9e2877f9de5bab4950ed157a15fb4f4ec575bc2ece" |
| 33 | 33 | ||
| 34 | SRCREV = "9c592cf9d8dfcd995d47753f2be7bd1a2b56c7da" | 34 | SRCREV = "03778511cc937d07bf53a8092f8b268e65f5d9a6" |
| 35 | BRANCH ?= "master" | 35 | BRANCH ?= "master" |
| 36 | 36 | ||
| 37 | S = "${WORKDIR}/git" | 37 | S = "${WORKDIR}/git" |
diff --git a/scripts/qemucommand.py b/scripts/qemucommand.py index 3045b45..a869d4d 100644 --- a/scripts/qemucommand.py +++ b/scripts/qemucommand.py | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | from os.path import exists, join, realpath, abspath | 1 | from os.path import exists, isdir, join, realpath, abspath |
| 2 | from os import listdir | 2 | from os import listdir |
| 3 | import random | 3 | import random |
| 4 | import socket | 4 | import socket |
| @@ -42,6 +42,8 @@ class QemuCommand(object): | |||
| 42 | if args.machine: | 42 | if args.machine: |
| 43 | self.machine = args.machine | 43 | self.machine = args.machine |
| 44 | else: | 44 | else: |
| 45 | if not isdir(args.dir): | ||
| 46 | raise ValueError("Directory %s does not exist, please specify a --machine or a valid images directory" % args.dir) | ||
| 45 | machines = listdir(args.dir) | 47 | machines = listdir(args.dir) |
| 46 | if len(machines) == 1: | 48 | if len(machines) == 1: |
| 47 | self.machine = machines[0] | 49 | self.machine = machines[0] |
| @@ -100,12 +102,8 @@ class QemuCommand(object): | |||
| 100 | cmdline += [ | 102 | cmdline += [ |
| 101 | "-serial", "tcp:127.0.0.1:%d,server,nowait" % self.serial_port, | 103 | "-serial", "tcp:127.0.0.1:%d,server,nowait" % self.serial_port, |
| 102 | "-m", self.mem, | 104 | "-m", self.mem, |
| 103 | "-usb", | ||
| 104 | "-object", "rng-random,id=rng0,filename=/dev/urandom", | 105 | "-object", "rng-random,id=rng0,filename=/dev/urandom", |
| 105 | "-device", "virtio-rng-pci,rng=rng0", | 106 | "-device", "virtio-rng-pci,rng=rng0", |
| 106 | "-device", "usb-tablet", | ||
| 107 | "-show-cursor", | ||
| 108 | "-vga", "std", | ||
| 109 | "-net", netuser, | 107 | "-net", netuser, |
| 110 | "-net", "nic,macaddr=%s" % self.mac_address | 108 | "-net", "nic,macaddr=%s" % self.mac_address |
| 111 | ] | 109 | ] |
| @@ -117,9 +115,17 @@ class QemuCommand(object): | |||
| 117 | '-device', 'e1000,netdev=vlan1,mac='+random_mac(), | 115 | '-device', 'e1000,netdev=vlan1,mac='+random_mac(), |
| 118 | ] | 116 | ] |
| 119 | if self.gui: | 117 | if self.gui: |
| 120 | cmdline += ["-serial", "stdio"] | 118 | cmdline += [ |
| 119 | "-usb", | ||
| 120 | "-device", "usb-tablet", | ||
| 121 | "-show-cursor", | ||
| 122 | "-vga", "std" | ||
| 123 | ] | ||
| 121 | else: | 124 | else: |
| 122 | cmdline.append('-nographic') | 125 | cmdline += [ |
| 126 | "-nographic", | ||
| 127 | "-monitor", "null", | ||
| 128 | ] | ||
| 123 | if self.kvm: | 129 | if self.kvm: |
| 124 | cmdline += ['-enable-kvm', '-cpu', 'host'] | 130 | cmdline += ['-enable-kvm', '-cpu', 'host'] |
| 125 | else: | 131 | else: |
