summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Vacek <patrickvacek@gmail.com>2018-12-05 10:47:46 +0100
committerGitHub <noreply@github.com>2018-12-05 10:47:46 +0100
commit76b1f0c44affe5897e603c5c95c0553d4db26482 (patch)
tree5ee2a3fb5e015b753e722e799249677020ac6b56
parent244e716f3df772e85cfe927c144b932d281afcbc (diff)
parent59edeace82684572d00d44afe6e4c70d4a87c9ff (diff)
downloadmeta-updater-76b1f0c44affe5897e603c5c95c0553d4db26482.tar.gz
Merge pull request #444 from advancedtelematic/feat/sumo/hardware-id-etc
Feat/sumo/hardware id etc
-rw-r--r--CONTRIBUTING.adoc2
-rw-r--r--README.adoc4
-rw-r--r--classes/image_repo_manifest.bbclass4
-rw-r--r--classes/image_types_ostree.bbclass2
-rw-r--r--classes/sota.bbclass3
-rw-r--r--lib/oeqa/selftest/cases/updater.py18
-rw-r--r--recipes-sota/aktualizr/aktualizr-ca-implicit-prov-creds.bb6
-rwxr-xr-xrecipes-sota/aktualizr/aktualizr_git.bb10
8 files changed, 27 insertions, 22 deletions
diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.adoc
index f12b95d..4d9e8f6 100644
--- a/CONTRIBUTING.adoc
+++ b/CONTRIBUTING.adoc
@@ -17,7 +17,7 @@ If you are developing with meta-updater, it may be helpful to read the README an
17 17
18* OTA-enabled build succeeds for at least one platform, the resulting image boots, and an update can be installed. This check is absolutely necessary for every pull request unless it only touches documentation. 18* OTA-enabled build succeeds for at least one platform, the resulting image boots, and an update can be installed. This check is absolutely necessary for every pull request unless it only touches documentation.
19* If your change touches platform code (like `classes/sota_<platform>.bbclass`), please check building and updating on this particular platform. 19* If your change touches platform code (like `classes/sota_<platform>.bbclass`), please check building and updating on this particular platform.
20* oe-selftest succeeds. To test meta-updater, run `oe-selftest -r updater` from a build directory with `MACHINE` set to `qemux86-64`. 20* oe-selftest succeeds. To test meta-updater, run `oe-selftest -r updater` from a build directory with `MACHINE` set to `qemux86-64`. See the link:README.adoc#qa-with-oe-selftest[relevant section of the README] for more details.
21* Updates are forwards- and backwards-compatible. You should be able to update an OTA-enabled build before the change is applied to the version with change applied and vice versa. One should pay double attention to the compatibility when bootloader code is affected. 21* Updates are forwards- and backwards-compatible. You should be able to update an OTA-enabled build before the change is applied to the version with change applied and vice versa. One should pay double attention to the compatibility when bootloader code is affected.
22* The patch/branch should be based on the latest version of the target branch. This may mean that rebasing is necessary if other PRs are merged before yours is approved. 22* The patch/branch should be based on the latest version of the target branch. This may mean that rebasing is necessary if other PRs are merged before yours is approved.
23 23
diff --git a/README.adoc b/README.adoc
index ee88efa..6ca20d8 100644
--- a/README.adoc
+++ b/README.adoc
@@ -87,6 +87,7 @@ Although we have used U-Boot so far, other boot loaders can be configured work w
87* `SOTA_CLIENT_PROV` - which provisioning method to use. Valid options are https://github.com/advancedtelematic/aktualizr/blob/master/docs/automatic-provisioning.adoc[`aktualizr-auto-prov`], https://github.com/advancedtelematic/aktualizr/blob/master/docs/implicit-provisioning.adoc[`aktualizr-ca-implicit-prov`], and https://github.com/advancedtelematic/aktualizr/blob/master/docs/hsm-provisioning.adoc[`aktualizr-hsm-prov`]. The default is `aktualizr-auto-prov`. This can also be set to an empty string to avoid using a provisioning recipe. 87* `SOTA_CLIENT_PROV` - which provisioning method to use. Valid options are https://github.com/advancedtelematic/aktualizr/blob/master/docs/automatic-provisioning.adoc[`aktualizr-auto-prov`], https://github.com/advancedtelematic/aktualizr/blob/master/docs/implicit-provisioning.adoc[`aktualizr-ca-implicit-prov`], and https://github.com/advancedtelematic/aktualizr/blob/master/docs/hsm-provisioning.adoc[`aktualizr-hsm-prov`]. The default is `aktualizr-auto-prov`. This can also be set to an empty string to avoid using a provisioning recipe.
88* `SOTA_CLIENT_FEATURES` - extensions to aktualizr. The only valid options are `hsm` (to build with HSM support) and `secondary-network` (to set up a simulated 'in-vehicle' network with support for a primary node with a DHCP server and a secondary node with a DHCP client). 88* `SOTA_CLIENT_FEATURES` - extensions to aktualizr. The only valid options are `hsm` (to build with HSM support) and `secondary-network` (to set up a simulated 'in-vehicle' network with support for a primary node with a DHCP server and a secondary node with a DHCP client).
89* `SOTA_SECONDARY_CONFIG_DIR` - a directory containing JSON configuration files for virtual secondaries on the host. These will be installed into `/etc/sota/ecus` on the device and automatically provided to aktualizr. 89* `SOTA_SECONDARY_CONFIG_DIR` - a directory containing JSON configuration files for virtual secondaries on the host. These will be installed into `/etc/sota/ecus` on the device and automatically provided to aktualizr.
90* `SOTA_HARDWARE_ID` - a custom hardware ID that will be written to the aktualizr config. Defaults to MACHINE if not set.
90 91
91== Usage 92== Usage
92 93
@@ -146,7 +147,6 @@ First, you can set `SOTA_CLIENT_PROV` to control which provisioning recipe is us
146 147
147Second, you can write recipes to install additional config files with customized options. A few recipes already exist to address common needs and provide an example: 148Second, you can write recipes to install additional config files with customized options. A few recipes already exist to address common needs and provide an example:
148 149
149* link:recipes-sota/config/aktualizr-example-interface.bb[aktualizr-example-interface.bb] will configure aktualizr to connect to an example interface for a legacy flasher. This is intended to be used in conjunction with the `aktualizr-examples` package. See https://github.com/advancedtelematic/aktualizr/blob/master/docs/legacysecondary.adoc[legacysecondary.adoc] in the aktualizr repo for more information.
150* link:recipes-sota/config/aktualizr-disable-send-ip.bb[aktualizr-disable-send-ip.bb] disables the reporting of networking information to the server. This is enabled by default and supported by https://connect.ota.here.com/[HERE OTA Connect]. However, if you are using a different server that does not support this feature, you may want to disable it in aktualizr. 150* link:recipes-sota/config/aktualizr-disable-send-ip.bb[aktualizr-disable-send-ip.bb] disables the reporting of networking information to the server. This is enabled by default and supported by https://connect.ota.here.com/[HERE OTA Connect]. However, if you are using a different server that does not support this feature, you may want to disable it in aktualizr.
151* link:recipes-sota/config/aktualizr-log-debug.bb[aktualizr-log-debug.bb] sets the log level of aktualizr to 0 (trace). The default is 2 (info). This recipe is intended for development and debugging purposes. 151* link:recipes-sota/config/aktualizr-log-debug.bb[aktualizr-log-debug.bb] sets the log level of aktualizr to 0 (trace). The default is 2 (info). This recipe is intended for development and debugging purposes.
152 152
@@ -181,7 +181,7 @@ Please note that [target name, target version] pairs are expected to be unique i
181 181
182== QA with oe-selftest 182== QA with oe-selftest
183 183
184This layer relies on the test framework oe-selftest for quality assurance. Follow the steps below to run the tests: 184This layer relies on the test framework oe-selftest for quality assurance. Currently, you will need to run this in a build directory with `MACHINE` set to `qemux86-64`. Follow the steps below to run the tests:
185 185
1861. Append the line below to `conf/local.conf` to disable the warning about supported operating systems: 1861. Append the line below to `conf/local.conf` to disable the warning about supported operating systems:
187+ 187+
diff --git a/classes/image_repo_manifest.bbclass b/classes/image_repo_manifest.bbclass
index 467fd9a..c2e7056 100644
--- a/classes/image_repo_manifest.bbclass
+++ b/classes/image_repo_manifest.bbclass
@@ -12,7 +12,7 @@
12HOSTTOOLS_NONFATAL += " repo " 12HOSTTOOLS_NONFATAL += " repo "
13 13
14# Write build information to target filesystem 14# Write build information to target filesystem
15buildinfo () { 15buildinfo_manifest () {
16 if [ $(which repo) ]; then 16 if [ $(which repo) ]; then
17 repo manifest --revision-as-HEAD -o ${IMAGE_ROOTFS}${sysconfdir}/manifest.xml || bbwarn "Android repo tool failed to run; manifest not copied" 17 repo manifest --revision-as-HEAD -o ${IMAGE_ROOTFS}${sysconfdir}/manifest.xml || bbwarn "Android repo tool failed to run; manifest not copied"
18 else 18 else
@@ -20,4 +20,4 @@ buildinfo () {
20 fi 20 fi
21} 21}
22 22
23IMAGE_PREPROCESS_COMMAND += "buildinfo;" 23IMAGE_PREPROCESS_COMMAND += "buildinfo_manifest;"
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass
index 4bcfc9b..0acc786 100644
--- a/classes/image_types_ostree.bbclass
+++ b/classes/image_types_ostree.bbclass
@@ -235,7 +235,7 @@ IMAGE_CMD_garagesign () {
235 --length 0 \ 235 --length 0 \
236 --url "${GARAGE_TARGET_URL}" \ 236 --url "${GARAGE_TARGET_URL}" \
237 --sha256 ${ostree_target_hash} \ 237 --sha256 ${ostree_target_hash} \
238 --hardwareids ${MACHINE} 238 --hardwareids ${SOTA_HARDWARE_ID}
239 garage-sign targets sign --repo tufrepo \ 239 garage-sign targets sign --repo tufrepo \
240 --home-dir ${GARAGE_SIGN_REPO} \ 240 --home-dir ${GARAGE_SIGN_REPO} \
241 --key-name=targets 241 --key-name=targets
diff --git a/classes/sota.bbclass b/classes/sota.bbclass
index 06da674..1e149ea 100644
--- a/classes/sota.bbclass
+++ b/classes/sota.bbclass
@@ -10,6 +10,7 @@ HOSTTOOLS_NONFATAL += "java"
10SOTA_CLIENT ??= "aktualizr" 10SOTA_CLIENT ??= "aktualizr"
11SOTA_CLIENT_PROV ??= "aktualizr-auto-prov" 11SOTA_CLIENT_PROV ??= "aktualizr-auto-prov"
12SOTA_DEPLOY_CREDENTIALS ?= "1" 12SOTA_DEPLOY_CREDENTIALS ?= "1"
13SOTA_HARDWARE_ID ??= "${MACHINE}"
13 14
14IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV}" 15IMAGE_INSTALL_append_sota = " ostree os-release ${SOTA_CLIENT} ${SOTA_CLIENT_PROV}"
15IMAGE_CLASSES += " image_types_ostree image_types_ota" 16IMAGE_CLASSES += " image_types_ostree image_types_ota"
@@ -26,7 +27,7 @@ OSTREE_INITRAMFS_FSTYPES ??= "${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER', T
26 27
27# Please redefine OSTREE_REPO in order to have a persistent OSTree repo 28# Please redefine OSTREE_REPO in order to have a persistent OSTree repo
28OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" 29OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo"
29OSTREE_BRANCHNAME ?= "${MACHINE}" 30OSTREE_BRANCHNAME ?= "${SOTA_HARDWARE_ID}"
30OSTREE_OSNAME ?= "poky" 31OSTREE_OSNAME ?= "poky"
31OSTREE_INITRAMFS_IMAGE ?= "initramfs-ostree-image" 32OSTREE_INITRAMFS_IMAGE ?= "initramfs-ostree-image"
32OSTREE_BOOTLOADER ??= 'u-boot' 33OSTREE_BOOTLOADER ??= 'u-boot'
diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py
index 715a137..f2ec92a 100644
--- a/lib/oeqa/selftest/cases/updater.py
+++ b/lib/oeqa/selftest/cases/updater.py
@@ -103,7 +103,7 @@ class AktualizrToolsTests(OESelftestTestCase):
103 bitbake('aktualizr-native') 103 bitbake('aktualizr-native')
104 104
105 def test_cert_provider_help(self): 105 def test_cert_provider_help(self):
106 akt_native_run(self, 'aktualizr_cert_provider --help') 106 akt_native_run(self, 'aktualizr-cert-provider --help')
107 107
108 def test_cert_provider_local_output(self): 108 def test_cert_provider_local_output(self):
109 logger = logging.getLogger("selftest") 109 logger = logging.getLogger("selftest")
@@ -115,7 +115,7 @@ class AktualizrToolsTests(OESelftestTestCase):
115 bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-ca-implicit-prov') 115 bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-ca-implicit-prov')
116 config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_implicit_prov_ca.toml' 116 config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_implicit_prov_ca.toml'
117 117
118 akt_native_run(self, 'aktualizr_cert_provider -c {creds} -r -l {temp} -g {config}' 118 akt_native_run(self, 'aktualizr-cert-provider -c {creds} -r -l {temp} -g {config}'
119 .format(creds=creds, temp=temp_dir, config=config)) 119 .format(creds=creds, temp=temp_dir, config=config))
120 120
121 # Might be nice if these names weren't hardcoded. 121 # Might be nice if these names weren't hardcoded.
@@ -285,9 +285,9 @@ class RpiTests(OESelftestTestCase):
285 285
286 def test_rpi(self): 286 def test_rpi(self):
287 logger = logging.getLogger("selftest") 287 logger = logging.getLogger("selftest")
288 logger.info('Running bitbake to build rpi-basic-image') 288 logger.info('Running bitbake to build core-image-minimal')
289 self.append_config('SOTA_CLIENT_PROV = "aktualizr-auto-prov"') 289 self.append_config('SOTA_CLIENT_PROV = "aktualizr-auto-prov"')
290 bitbake('rpi-basic-image') 290 bitbake('core-image-minimal')
291 credentials = get_bb_var('SOTA_PACKED_CREDENTIALS') 291 credentials = get_bb_var('SOTA_PACKED_CREDENTIALS')
292 # Skip the test if the variable SOTA_PACKED_CREDENTIALS is not set. 292 # Skip the test if the variable SOTA_PACKED_CREDENTIALS is not set.
293 if credentials is None: 293 if credentials is None:
@@ -295,7 +295,7 @@ class RpiTests(OESelftestTestCase):
295 # Check if the file exists. 295 # Check if the file exists.
296 self.assertTrue(os.path.isfile(credentials), "File %s does not exist" % credentials) 296 self.assertTrue(os.path.isfile(credentials), "File %s does not exist" % credentials)
297 deploydir = get_bb_var('DEPLOY_DIR_IMAGE') 297 deploydir = get_bb_var('DEPLOY_DIR_IMAGE')
298 imagename = get_bb_var('IMAGE_LINK_NAME', 'rpi-basic-image') 298 imagename = get_bb_var('IMAGE_LINK_NAME', 'core-image-minimal')
299 # Check if the credentials are included in the output image. 299 # Check if the credentials are included in the output image.
300 result = runCmd('tar -jtvf %s/%s.tar.bz2 | grep sota_provisioning_credentials.zip' % 300 result = runCmd('tar -jtvf %s/%s.tar.bz2 | grep sota_provisioning_credentials.zip' %
301 (deploydir, imagename), ignore_status=True) 301 (deploydir, imagename), ignore_status=True)
@@ -424,14 +424,14 @@ class ImplProvTests(OESelftestTestCase):
424 self.assertIn(b'Fetched metadata: no', stdout, 424 self.assertIn(b'Fetched metadata: no', stdout,
425 'Device already provisioned!? ' + stderr.decode() + stdout.decode()) 425 'Device already provisioned!? ' + stderr.decode() + stdout.decode())
426 426
427 # Run cert_provider. 427 # Run aktualizr-cert-provider.
428 bb_vars = get_bb_vars(['SOTA_PACKED_CREDENTIALS'], 'aktualizr-native') 428 bb_vars = get_bb_vars(['SOTA_PACKED_CREDENTIALS'], 'aktualizr-native')
429 creds = bb_vars['SOTA_PACKED_CREDENTIALS'] 429 creds = bb_vars['SOTA_PACKED_CREDENTIALS']
430 bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-ca-implicit-prov') 430 bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-ca-implicit-prov')
431 config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_implicit_prov_ca.toml' 431 config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_implicit_prov_ca.toml'
432 432
433 print('Provisining at root@localhost:%d' % self.qemu.ssh_port) 433 print('Provisining at root@localhost:%d' % self.qemu.ssh_port)
434 akt_native_run(self, 'aktualizr_cert_provider -c {creds} -t root@localhost -p {port} -s -u -r -g {config}' 434 akt_native_run(self, 'aktualizr-cert-provider -c {creds} -t root@localhost -p {port} -s -u -r -g {config}'
435 .format(creds=creds, port=self.qemu.ssh_port, config=config)) 435 .format(creds=creds, port=self.qemu.ssh_port, config=config))
436 436
437 verifyProvisioned(self, machine) 437 verifyProvisioned(self, machine)
@@ -509,13 +509,13 @@ class HsmTests(OESelftestTestCase):
509 self.assertNotEqual(retcode, 0, 'softhsm2-tool succeeded before initialization: ' + 509 self.assertNotEqual(retcode, 0, 'softhsm2-tool succeeded before initialization: ' +
510 stdout.decode() + stderr.decode()) 510 stdout.decode() + stderr.decode())
511 511
512 # Run cert_provider. 512 # Run aktualizr-cert-provider.
513 bb_vars = get_bb_vars(['SOTA_PACKED_CREDENTIALS'], 'aktualizr-native') 513 bb_vars = get_bb_vars(['SOTA_PACKED_CREDENTIALS'], 'aktualizr-native')
514 creds = bb_vars['SOTA_PACKED_CREDENTIALS'] 514 creds = bb_vars['SOTA_PACKED_CREDENTIALS']
515 bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-hsm-prov') 515 bb_vars_prov = get_bb_vars(['STAGING_DIR_HOST', 'libdir'], 'aktualizr-hsm-prov')
516 config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_hsm_prov.toml' 516 config = bb_vars_prov['STAGING_DIR_HOST'] + bb_vars_prov['libdir'] + '/sota/sota_hsm_prov.toml'
517 517
518 akt_native_run(self, 'aktualizr_cert_provider -c {creds} -t root@localhost -p {port} -r -s -u -g {config}' 518 akt_native_run(self, 'aktualizr-cert-provider -c {creds} -t root@localhost -p {port} -r -s -u -g {config}'
519 .format(creds=creds, port=self.qemu.ssh_port, config=config)) 519 .format(creds=creds, port=self.qemu.ssh_port, config=config))
520 520
521 # Verify that HSM is able to initialize. 521 # Verify that HSM is able to initialize.
diff --git a/recipes-sota/aktualizr/aktualizr-ca-implicit-prov-creds.bb b/recipes-sota/aktualizr/aktualizr-ca-implicit-prov-creds.bb
index a729e6b..41af7c0 100644
--- a/recipes-sota/aktualizr/aktualizr-ca-implicit-prov-creds.bb
+++ b/recipes-sota/aktualizr/aktualizr-ca-implicit-prov-creds.bb
@@ -37,9 +37,9 @@ do_install() {
37 fi 37 fi
38 38
39 install -m 0700 -d ${D}${localstatedir}/sota 39 install -m 0700 -d ${D}${localstatedir}/sota
40 aktualizr_cert_provider --credentials ${SOTA_PACKED_CREDENTIALS} \ 40 aktualizr-cert-provider --credentials ${SOTA_PACKED_CREDENTIALS} \
41 --device-ca ${SOTA_CACERT_PATH} \ 41 --fleet-ca ${SOTA_CACERT_PATH} \
42 --device-ca-key ${SOTA_CAKEY_PATH} \ 42 --fleet-ca-key ${SOTA_CAKEY_PATH} \
43 --root-ca \ 43 --root-ca \
44 --server-url \ 44 --server-url \
45 --local ${D} \ 45 --local ${D} \
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index 14de9fa..d49f28c 100755
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -27,7 +27,7 @@ SRC_URI = " \
27 file://aktualizr-serialcan.service \ 27 file://aktualizr-serialcan.service \
28 " 28 "
29 29
30SRCREV = "4621a15779db38531fb386478232a9e8593e53f4" 30SRCREV = "d00d1a04cc2366d1a5f143b84b9f507f8bd32c44"
31BRANCH ?= "master" 31BRANCH ?= "master"
32 32
33S = "${WORKDIR}/git" 33S = "${WORKDIR}/git"
@@ -70,6 +70,10 @@ do_install_append () {
70 install -m 0700 -d ${D}${libdir}/sota/conf.d 70 install -m 0700 -d ${D}${libdir}/sota/conf.d
71 install -m 0700 -d ${D}${sysconfdir}/sota/conf.d 71 install -m 0700 -d ${D}${sysconfdir}/sota/conf.d
72 72
73 if [ -n "${SOTA_HARDWARE_ID}" ]; then
74 echo "[provision]\nprimary_ecu_hardware_id = ${SOTA_HARDWARE_ID}\n" > ${D}${libdir}/sota/conf.d/40-hardware-id.toml
75 fi
76
73 if [ -n "${SOTA_SECONDARY_CONFIG_DIR}" ]; then 77 if [ -n "${SOTA_SECONDARY_CONFIG_DIR}" ]; then
74 if [ -d "${SOTA_SECONDARY_CONFIG_DIR}" ]; then 78 if [ -d "${SOTA_SECONDARY_CONFIG_DIR}" ]; then
75 install -m 0700 -d ${D}${sysconfdir}/sota/ecus 79 install -m 0700 -d ${D}${sysconfdir}/sota/ecus
@@ -106,12 +110,12 @@ FILES_${PN} = " \
106 " 110 "
107 111
108FILES_${PN}-examples = " \ 112FILES_${PN}-examples = " \
109 ${bindir}/hmi_stub \ 113 ${bindir}/hmi-stub \
110 " 114 "
111 115
112FILES_${PN}-host-tools = " \ 116FILES_${PN}-host-tools = " \
113 ${bindir}/aktualizr-repo \ 117 ${bindir}/aktualizr-repo \
114 ${bindir}/aktualizr_cert_provider \ 118 ${bindir}/aktualizr-cert-provider \
115 ${bindir}/garage-deploy \ 119 ${bindir}/garage-deploy \
116 ${bindir}/garage-push \ 120 ${bindir}/garage-push \
117 ${libdir}/sota/sota_autoprov.toml \ 121 ${libdir}/sota/sota_autoprov.toml \