diff options
-rw-r--r-- | README.adoc | 34 | ||||
-rw-r--r-- | classes/image_types_ostree.bbclass | 55 | ||||
-rw-r--r-- | classes/image_types_ota.bbclass | 7 | ||||
-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, 128 insertions, 56 deletions
diff --git a/README.adoc b/README.adoc index 8711e86..8bded9a 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 `otaimg` bootstrap image, which is an OSTree physical sysroot as a burnable filesystem image, and optionally | 63 | * an `otaimg` 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,16 @@ 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 | We also historically supported the https://github.com/advancedtelematic/meta-updater-porter[Renesas Porter] board. | ||
79 | 84 | ||
80 | === Adding support for your board | 85 | === Adding support for your board |
81 | 86 | ||
@@ -92,6 +97,7 @@ Your images will also need network connectivity to be able to reach an actual OT | |||
92 | 97 | ||
93 | == SOTA-related variables in local.conf | 98 | == SOTA-related variables in local.conf |
94 | 99 | ||
100 | * `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` | 101 | * `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". | 102 | * `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_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. | 103 | * `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. |
@@ -106,7 +112,7 @@ Your images will also need network connectivity to be able to reach an actual OT | |||
106 | * `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. | 112 | * `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. |
107 | * `SOTA_HARDWARE_ID` - a custom hardware ID that will be written to the aktualizr config. Defaults to MACHINE if not set. | 113 | * `SOTA_HARDWARE_ID` - a custom hardware ID that will be written to the aktualizr config. Defaults to MACHINE if not set. |
108 | * `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. | 114 | * `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. |
109 | * `SOTA_POLLING_SEC` - sets polling interval for aktualizr to check for updates if aktualizr-polling-sec is included in the image. | 115 | * `SOTA_POLLING_SEC` - sets polling interval for aktualizr to check for updates if aktualizr-polling-interval is included in the image. |
110 | 116 | ||
111 | == Usage | 117 | == Usage |
112 | 118 | ||
@@ -187,7 +193,23 @@ RESOURCE_CPU_WEIGHT_pn-aktualizr = "50" | |||
187 | 193 | ||
188 | == Development configuration | 194 | == Development configuration |
189 | 195 | ||
190 | There are a few settings that can be controlled in `local.conf` to simplify the development process: | 196 | === Logging |
197 | |||
198 | 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`: | ||
199 | |||
200 | .... | ||
201 | IMAGE_INSTALL_append += " systemd-journald-persistent" | ||
202 | .... | ||
203 | |||
204 | It may also be helpful to run with debug logging enabled in aktualizr. To do so, add this to your `local.conf`: | ||
205 | |||
206 | .... | ||
207 | IMAGE_INSTALL_append += " aktualizr-log-debug" | ||
208 | .... | ||
209 | |||
210 | === Custom aktualizr versions | ||
211 | |||
212 | 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: | ||
191 | 213 | ||
192 | [options="header"] | 214 | [options="header"] |
193 | |====================== | 215 | |====================== |
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 134f5f5..edddf37 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass | |||
@@ -16,11 +16,11 @@ OSTREE_UPDATE_SUMMARY ??= "0" | |||
16 | SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'systemd', 'true', '')}" | 16 | SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'systemd', 'true', '')}" |
17 | 17 | ||
18 | IMAGE_CMD_ostree () { | 18 | IMAGE_CMD_ostree () { |
19 | if [ -z "$OSTREE_REPO" ]; then | 19 | if [ -z "${OSTREE_REPO}" ]; then |
20 | bbfatal "OSTREE_REPO should be set in your local.conf" | 20 | bbfatal "OSTREE_REPO should be set in your local.conf" |
21 | fi | 21 | fi |
22 | 22 | ||
23 | if [ -z "$OSTREE_BRANCHNAME" ]; then | 23 | if [ -z "${OSTREE_BRANCHNAME}" ]; then |
24 | bbfatal "OSTREE_BRANCHNAME should be set in your local.conf" | 24 | bbfatal "OSTREE_BRANCHNAME should be set in your local.conf" |
25 | fi | 25 | fi |
26 | 26 | ||
@@ -93,15 +93,15 @@ IMAGE_CMD_ostree () { | |||
93 | if [ "$(ls -A $dir)" ]; then | 93 | if [ "$(ls -A $dir)" ]; then |
94 | bbwarn "Data in /$dir directory is not preserved by OSTree. Consider moving it under /usr" | 94 | bbwarn "Data in /$dir directory is not preserved by OSTree. Consider moving it under /usr" |
95 | fi | 95 | fi |
96 | |||
97 | if [ -n "${SYSTEMD_USED}" ]; then | ||
98 | echo "d /var/rootdirs/${dir} 0755 root root -" >>${tmpfiles_conf} | ||
99 | else | ||
100 | echo "mkdir -p /var/rootdirs/${dir}; chown 755 /var/rootdirs/${dir}" >>${tmpfiles_conf} | ||
101 | fi | ||
102 | rm -rf ${dir} | 96 | rm -rf ${dir} |
103 | ln -sf var/rootdirs/${dir} ${dir} | ||
104 | fi | 97 | fi |
98 | |||
99 | if [ -n "${SYSTEMD_USED}" ]; then | ||
100 | echo "d /var/rootdirs/${dir} 0755 root root -" >>${tmpfiles_conf} | ||
101 | else | ||
102 | echo "mkdir -p /var/rootdirs/${dir}; chown 755 /var/rootdirs/${dir}" >>${tmpfiles_conf} | ||
103 | fi | ||
104 | ln -sf var/rootdirs/${dir} ${dir} | ||
105 | done | 105 | done |
106 | 106 | ||
107 | if [ -d root ] && [ ! -L root ]; then | 107 | if [ -d root ] && [ ! -L root ]; then |
@@ -110,20 +110,39 @@ IMAGE_CMD_ostree () { | |||
110 | fi | 110 | fi |
111 | 111 | ||
112 | if [ -n "${SYSTEMD_USED}" ]; then | 112 | if [ -n "${SYSTEMD_USED}" ]; then |
113 | echo "d /var/roothome 0755 root root -" >>${tmpfiles_conf} | 113 | echo "d /var/roothome 0700 root root -" >>${tmpfiles_conf} |
114 | else | 114 | else |
115 | echo "mkdir -p /var/roothome; chown 755 /var/roothome" >>${tmpfiles_conf} | 115 | echo "mkdir -p /var/roothome; chown 700 /var/roothome" >>${tmpfiles_conf} |
116 | fi | 116 | fi |
117 | 117 | ||
118 | rm -rf root | 118 | rm -rf root |
119 | ln -sf var/roothome root | 119 | ln -sf var/roothome root |
120 | fi | 120 | fi |
121 | 121 | ||
122 | # Creating boot directories is required for "ostree admin deploy" | 122 | if [ -d usr/local ] && [ ! -L usr/local ]; then |
123 | if [ "$(ls -A usr/local)" ]; then | ||
124 | bbfatal "Data in /usr/local directory is not preserved by OSTree." | ||
125 | fi | ||
126 | rm -rf usr/local | ||
127 | fi | ||
123 | 128 | ||
124 | mkdir -p boot/loader.0 | 129 | if [ -n "${SYSTEMD_USED}" ]; then |
125 | mkdir -p boot/loader.1 | 130 | echo "d /var/usrlocal 0755 root root -" >>${tmpfiles_conf} |
126 | ln -sf boot/loader.0 boot/loader | 131 | else |
132 | echo "mkdir -p /var/usrlocal; chown 755 /var/usrlocal" >>${tmpfiles_conf} | ||
133 | fi | ||
134 | |||
135 | dirs="bin etc games include lib man sbin share src" | ||
136 | |||
137 | for dir in ${dirs}; do | ||
138 | if [ -n "${SYSTEMD_USED}" ]; then | ||
139 | echo "d /var/usrlocal/${dir} 0755 root root -" >>${tmpfiles_conf} | ||
140 | else | ||
141 | echo "mkdir -p /var/usrlocal/${dir}; chown 755 /var/usrlocal/${dir}" >>${tmpfiles_conf} | ||
142 | fi | ||
143 | done | ||
144 | |||
145 | ln -sf ../var/usrlocal usr/local | ||
127 | 146 | ||
128 | checksum=`sha256sum ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} | cut -f 1 -d " "` | 147 | checksum=`sha256sum ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} | cut -f 1 -d " "` |
129 | 148 | ||
@@ -241,6 +260,12 @@ IMAGE_CMD_garagesign () { | |||
241 | ${target_url} \ | 260 | ${target_url} \ |
242 | --sha256 ${ostree_target_hash} \ | 261 | --sha256 ${ostree_target_hash} \ |
243 | --hardwareids ${SOTA_HARDWARE_ID} | 262 | --hardwareids ${SOTA_HARDWARE_ID} |
263 | if [ -n "${GARAGE_CUSTOMIZE_TARGET}" ]; then | ||
264 | bbplain "Running command(${GARAGE_CUSTOMIZE_TARGET}) to customize target" | ||
265 | ${GARAGE_CUSTOMIZE_TARGET} \ | ||
266 | ${GARAGE_SIGN_REPO}/tufrepo/roles/unsigned/targets.json \ | ||
267 | ${GARAGE_TARGET_NAME}-${target_version} | ||
268 | fi | ||
244 | garage-sign targets sign --repo tufrepo \ | 269 | garage-sign targets sign --repo tufrepo \ |
245 | --home-dir ${GARAGE_SIGN_REPO} \ | 270 | --home-dir ${GARAGE_SIGN_REPO} \ |
246 | --key-name=targets | 271 | --key-name=targets |
diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index 068d43e..cdc6479 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass | |||
@@ -48,18 +48,19 @@ IMAGE_CMD_otaimg () { | |||
48 | if ${@bb.utils.contains('IMAGE_FSTYPES', 'otaimg', 'false', 'true', d)}; then | 48 | if ${@bb.utils.contains('IMAGE_FSTYPES', 'otaimg', 'false', 'true', d)}; then |
49 | return | 49 | return |
50 | fi | 50 | fi |
51 | if [ -z "$OSTREE_REPO" ]; then | 51 | if [ -z "${OSTREE_REPO}" ]; then |
52 | bbfatal "OSTREE_REPO should be set in your local.conf" | 52 | bbfatal "OSTREE_REPO should be set in your local.conf" |
53 | fi | 53 | fi |
54 | 54 | ||
55 | if [ -z "$OSTREE_OSNAME" ]; then | 55 | if [ -z "${OSTREE_OSNAME}" ]; then |
56 | bbfatal "OSTREE_OSNAME should be set in your local.conf" | 56 | bbfatal "OSTREE_OSNAME should be set in your local.conf" |
57 | fi | 57 | fi |
58 | 58 | ||
59 | if [ -z "$OSTREE_BRANCHNAME" ]; then | 59 | if [ -z "${OSTREE_BRANCHNAME}" ]; then |
60 | bbfatal "OSTREE_BRANCHNAME should be set in your local.conf" | 60 | bbfatal "OSTREE_BRANCHNAME should be set in your local.conf" |
61 | fi | 61 | fi |
62 | 62 | ||
63 | export OSTREE_BOOT_PARTITION=${OSTREE_BOOT_PARTITION} | ||
63 | PHYS_SYSROOT=`mktemp -d ${WORKDIR}/ota-sysroot-XXXXX` | 64 | PHYS_SYSROOT=`mktemp -d ${WORKDIR}/ota-sysroot-XXXXX` |
64 | 65 | ||
65 | ostree admin --sysroot=${PHYS_SYSROOT} init-fs ${PHYS_SYSROOT} | 66 | ostree admin --sysroot=${PHYS_SYSROOT} init-fs ${PHYS_SYSROOT} |
diff --git a/classes/sota.bbclass b/classes/sota.bbclass index 013d6f9..ad78958 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass | |||
@@ -40,11 +40,11 @@ EXTRA_IMAGEDEPENDS_append_sota = " parted-native mtools-native dosfstools-native | |||
40 | OSTREE_INITRAMFS_FSTYPES ??= "${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot', 'ext4.gz.u-boot', 'ext4.gz')}" | 40 | OSTREE_INITRAMFS_FSTYPES ??= "${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot', 'ext4.gz.u-boot', 'ext4.gz')}" |
41 | 41 | ||
42 | # Please redefine OSTREE_REPO in order to have a persistent OSTree repo | 42 | # Please redefine OSTREE_REPO in order to have a persistent OSTree repo |
43 | export OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" | 43 | OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" |
44 | export OSTREE_BRANCHNAME ?= "${SOTA_HARDWARE_ID}" | 44 | OSTREE_BRANCHNAME ?= "${SOTA_HARDWARE_ID}" |
45 | export OSTREE_OSNAME ?= "poky" | 45 | OSTREE_OSNAME ?= "poky" |
46 | export OSTREE_BOOTLOADER ??= 'u-boot' | 46 | OSTREE_BOOTLOADER ??= 'u-boot' |
47 | export OSTREE_BOOT_PARTITION ??= "/boot" | 47 | OSTREE_BOOT_PARTITION ??= "/boot" |
48 | 48 | ||
49 | OSTREE_INITRAMFS_IMAGE ?= "initramfs-ostree-image" | 49 | OSTREE_INITRAMFS_IMAGE ?= "initramfs-ostree-image" |
50 | 50 | ||
@@ -53,6 +53,7 @@ GARAGE_SIGN_KEYNAME ?= "garage-key" | |||
53 | GARAGE_TARGET_NAME ?= "${OSTREE_BRANCHNAME}" | 53 | GARAGE_TARGET_NAME ?= "${OSTREE_BRANCHNAME}" |
54 | GARAGE_TARGET_VERSION ?= "" | 54 | GARAGE_TARGET_VERSION ?= "" |
55 | GARAGE_TARGET_URL ?= "" | 55 | GARAGE_TARGET_URL ?= "" |
56 | GARAGE_CUSTOMIZE_TARGET ?= "" | ||
56 | 57 | ||
57 | SOTA_MACHINE ??="none" | 58 | SOTA_MACHINE ??="none" |
58 | SOTA_MACHINE_rpi ?= "raspberrypi" | 59 | 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 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" | |||
15 | 15 | ||
16 | IMAGE_FSTYPES = "${OSTREE_INITRAMFS_FSTYPES}" | 16 | IMAGE_FSTYPES = "${OSTREE_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 31d7acb..d32fc30 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 | |||
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 8b7da2b..df6907c 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: |