summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Vacek <patrickvacek@gmail.com>2018-12-04 16:37:52 +0100
committerGitHub <noreply@github.com>2018-12-04 16:37:52 +0100
commit3d2c819b275f37f474f064702b592a792053dead (patch)
treefdeb4322c462ac9a85943d392a2fca9fae8b264e
parentdc878039e6059ac5835c4d11c1c561603c62e810 (diff)
parent27cbc9b97050f06d1478f7a2179a4dfd22272f5b (diff)
downloadmeta-updater-3d2c819b275f37f474f064702b592a792053dead.tar.gz
Merge pull request #445 from advancedtelematic/feat/rocko/hardware-id-etc
Feat/rocko/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.py12
-rw-r--r--recipes-sota/aktualizr/aktualizr-ca-implicit-prov-creds.bb6
-rwxr-xr-xrecipes-sota/aktualizr/aktualizr_git.bb10
8 files changed, 24 insertions, 19 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 2f74c1d..32630d7 100644
--- a/README.adoc
+++ b/README.adoc
@@ -84,6 +84,7 @@ Although we have used U-Boot so far, other boot loaders can be configured work w
84* `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. 84* `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.
85* `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). 85* `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).
86* `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. 86* `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.
87* `SOTA_HARDWARE_ID` - a custom hardware ID that will be written to the aktualizr config. Defaults to MACHINE if not set.
87 88
88== Usage 89== Usage
89 90
@@ -143,7 +144,6 @@ First, you can set `SOTA_CLIENT_PROV` to control which provisioning recipe is us
143 144
144Second, 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: 145Second, 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:
145 146
146* 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.
147* 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. 147* 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.
148* 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. 148* 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.
149 149
@@ -178,7 +178,7 @@ Please note that [target name, target version] pairs are expected to be unique i
178 178
179== QA with oe-selftest 179== QA with oe-selftest
180 180
181This layer relies on the test framework oe-selftest for quality assurance. Follow the steps below to run the tests: 181This 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:
182 182
1831. Append the line below to `conf/local.conf` to disable the warning about supported operating systems: 1831. Append the line below to `conf/local.conf` to disable the warning about supported operating systems:
184+ 184+
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 e7ff2c4..22ae123 100644
--- a/classes/image_types_ostree.bbclass
+++ b/classes/image_types_ostree.bbclass
@@ -226,7 +226,7 @@ IMAGE_CMD_garagesign () {
226 --length 0 \ 226 --length 0 \
227 --url "${GARAGE_TARGET_URL}" \ 227 --url "${GARAGE_TARGET_URL}" \
228 --sha256 ${ostree_target_hash} \ 228 --sha256 ${ostree_target_hash} \
229 --hardwareids ${MACHINE} 229 --hardwareids ${SOTA_HARDWARE_ID}
230 garage-sign targets sign --repo tufrepo \ 230 garage-sign targets sign --repo tufrepo \
231 --home-dir ${GARAGE_SIGN_REPO} \ 231 --home-dir ${GARAGE_SIGN_REPO} \
232 --key-name=targets 232 --key-name=targets
diff --git a/classes/sota.bbclass b/classes/sota.bbclass
index 657fbc2..246865b 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 3c17b8a..228b8a6 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.
@@ -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_NATIVE', 'libdir'], 'aktualizr-hsm-prov') 515 bb_vars_prov = get_bb_vars(['STAGING_DIR_NATIVE', 'libdir'], 'aktualizr-hsm-prov')
516 config = bb_vars_prov['STAGING_DIR_NATIVE'] + bb_vars_prov['libdir'] + '/sota/sota_hsm_prov.toml' 516 config = bb_vars_prov['STAGING_DIR_NATIVE'] + 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 9cc7c7a..ced8388 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"
@@ -71,6 +71,10 @@ do_install_append () {
71 install -m 0700 -d ${D}${libdir}/sota/conf.d 71 install -m 0700 -d ${D}${libdir}/sota/conf.d
72 install -m 0700 -d ${D}${sysconfdir}/sota/conf.d 72 install -m 0700 -d ${D}${sysconfdir}/sota/conf.d
73 73
74 if [ -n "${SOTA_HARDWARE_ID}" ]; then
75 echo "[provision]\nprimary_ecu_hardware_id = ${SOTA_HARDWARE_ID}\n" > ${D}${libdir}/sota/conf.d/40-hardware-id.toml
76 fi
77
74 if [ -n "${SOTA_SECONDARY_CONFIG_DIR}" ]; then 78 if [ -n "${SOTA_SECONDARY_CONFIG_DIR}" ]; then
75 if [ -d "${SOTA_SECONDARY_CONFIG_DIR}" ]; then 79 if [ -d "${SOTA_SECONDARY_CONFIG_DIR}" ]; then
76 install -m 0700 -d ${D}${sysconfdir}/sota/ecus 80 install -m 0700 -d ${D}${sysconfdir}/sota/ecus
@@ -107,12 +111,12 @@ FILES_${PN} = " \
107 " 111 "
108 112
109FILES_${PN}-examples = " \ 113FILES_${PN}-examples = " \
110 ${bindir}/hmi_stub \ 114 ${bindir}/hmi-stub \
111 " 115 "
112 116
113FILES_${PN}-host-tools = " \ 117FILES_${PN}-host-tools = " \
114 ${bindir}/aktualizr-repo \ 118 ${bindir}/aktualizr-repo \
115 ${bindir}/aktualizr_cert_provider \ 119 ${bindir}/aktualizr-cert-provider \
116 ${bindir}/garage-deploy \ 120 ${bindir}/garage-deploy \
117 ${bindir}/garage-push \ 121 ${bindir}/garage-push \
118 ${libdir}/sota/sota_autoprov.toml \ 122 ${libdir}/sota/sota_autoprov.toml \