Skip to content

Commit

Permalink
aktualizr: Fix virtual secondary support.
Browse files Browse the repository at this point in the history
Use /etc/sota/ecus as using /var/sota/ecus was conflicting with the
provisioning recipes that also use /var/sota. Not totally ideal, but the
best compromise I could find.

Signed-off-by: Patrick Vacek <patrickvacek@gmail.com>
  • Loading branch information
pattivacek committed Nov 13, 2018
1 parent 94b473a commit f05f7e5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 17 deletions.
3 changes: 1 addition & 2 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ Although we have used U-Boot so far, other boot loaders can be configured work w
* `SOTA_DEPLOY_CREDENTIALS` - when set to '1' (default value), deploys credentials to the built image. Override it in `local.conf` to built a generic image that can be provisioned manually after the build.
* `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.
* `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).
* `SOTA_SECONDARY_ECUS` - a list of paths separated by spaces of JSON configuration files for virtual secondaries on the host. These will be installed into `/var/sota/ecus` on the device.
* `SOTA_VIRTUAL_SECONDARIES` - a list of paths separated by spaces of JSON configuration files for virtual secondaries installed on the device. If `SOTA_SECONDARY_ECUS` is used to install them, then you can expect them to be installed in `/var/sota/ecus`.
* `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.

== Usage

Expand Down
5 changes: 0 additions & 5 deletions classes/image_types_ostree.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@ IMAGE_CMD_ostree () {
ln -sf var/roothome root
fi

if [ -n "${SOTA_SECONDARY_ECUS}" ]; then
mkdir -p var/sota/ecus
cp ${SOTA_SECONDARY_ECUS} var/sota/ecus
fi

checksum=`sha256sum ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} | cut -f 1 -d " "`

cp ${DEPLOY_DIR_IMAGE}/${OSTREE_KERNEL} boot/vmlinuz-${checksum}
Expand Down
3 changes: 0 additions & 3 deletions recipes-sota/aktualizr/aktualizr-auto-prov.bb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ do_install() {
fi

install -m 0700 -d ${D}${libdir}/sota/conf.d
install -m 0700 -d ${D}${localstatedir}/sota
aktualizr_toml=${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'secondary-network', 'sota_autoprov_primary.toml', 'sota_autoprov.toml', d)}

install -m 0644 ${STAGING_DIR_NATIVE}${libdir}/sota/${aktualizr_toml} \
Expand All @@ -40,8 +39,6 @@ do_install() {
FILES_${PN} = " \
${libdir}/sota/conf.d \
${libdir}/sota/conf.d/20-${aktualizr_toml} \
${localstatedir}/sota \
${localstatedir}/sota/sota_provisioning_credentials.zip \
"

# vim:set ts=4 sw=4 sts=4 expandtab:
7 changes: 7 additions & 0 deletions recipes-sota/aktualizr/aktualizr_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ do_install_append () {
install -m 0644 ${WORKDIR}/aktualizr-secondary.service ${D}${systemd_unitdir}/system/aktualizr-secondary.service
install -m 0700 -d ${D}${libdir}/sota/conf.d
install -m 0700 -d ${D}${sysconfdir}/sota/conf.d

if [ -n "${SOTA_SECONDARY_CONFIG_DIR}" ] && [ -e "${SOTA_SECONDARY_CONFIG_DIR}" ]; then
install -m 0700 -d ${D}${sysconfdir}/sota/ecus
install -m 0644 "${SOTA_SECONDARY_CONFIG_DIR}"/* ${D}${sysconfdir}/sota/ecus/
fi

}

do_install_append_class-target () {
Expand All @@ -91,6 +97,7 @@ FILES_${PN} = " \
${systemd_unitdir}/system/aktualizr.service \
${libdir}/sota/conf.d \
${sysconfdir}/sota/conf.d \
${sysconfdir}/sota/ecus/* \
"

FILES_${PN}-examples = " \
Expand Down
11 changes: 4 additions & 7 deletions recipes-sota/aktualizr/environment.inc
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
export SOTA_VIRTUAL_SECONDARIES

do_install_append() {
for sec in ${SOTA_VIRTUAL_SECONDARIES}; do
AKTUALIZR_PARAMETERS_VIRTUALSECS="${AKTUALIZR_PARAMETERS_VIRTUALSECS} --secondary-config $sec"
done

echo "AKTUALIZR_CMDLINE_PARAMETERS=${AKTUALIZR_PARAMETERS_VIRTUALSECS}" > ${D}${libdir}/sota/sota.env
if [ -n "${SOTA_SECONDARY_CONFIG_DIR}" ]; then
AKTUALIZR_CMDLINE_PARAMETERS="${AKTUALIZR_CMDLINE_PARAMETERS} --secondary-configs-dir /etc/sota/ecus"
fi
echo "AKTUALIZR_CMDLINE_PARAMETERS=${AKTUALIZR_CMDLINE_PARAMETERS}" > ${D}${libdir}/sota/sota.env
}

FILES_${PN}_append = " ${libdir}/sota/sota.env"

0 comments on commit f05f7e5

Please sign in to comment.