summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Vacek <patrickvacek@gmail.com>2019-07-25 09:11:57 +0200
committerGitHub <noreply@github.com>2019-07-25 09:11:57 +0200
commit1d14d8b2b3437cfe35a37c30fa59b4bcf82324e1 (patch)
tree31aa1390f9f77f8d3d7841d8968e30f946b131e0
parent5400f79dd9974f099bcf9f04dbe04a9f38d9e361 (diff)
parentba5e43d0217d054e0b660906b858f050f2812ec5 (diff)
downloadmeta-updater-1d14d8b2b3437cfe35a37c30fa59b4bcf82324e1.tar.gz
Merge pull request #546 from advancedtelematic/Backport/sumo/secondaries-and-CI-improvement
Backport/sumo/secondaries and ci improvement
-rw-r--r--README.adoc30
-rw-r--r--conf/include/bblayers/sota_raspberrypi3.inc1
-rw-r--r--conf/local.conf.sample.append35
-rw-r--r--lib/oeqa/selftest/cases/updater_qemux86_64.py2
-rw-r--r--recipes-sota/aktualizr/aktualizr_git.bb14
-rw-r--r--recipes-support/python-canonicaljson/python-canonicaljson.bb18
-rw-r--r--recipes-support/python-frozendict/python-frozendict.bb12
-rw-r--r--recipes-support/python-petname/python-petname.bb16
-rw-r--r--recipes-support/systemd-journald-persistent/files/10-persistent-journal.conf3
-rw-r--r--recipes-support/systemd-journald-persistent/systemd-journald-persistent.bb20
-rw-r--r--recipes-test/demo-config/shared-conf.inc2
-rw-r--r--recipes-test/demo-network-config/files/26-multihomed-client.network9
-rw-r--r--recipes-test/demo-network-config/network-config.inc17
-rw-r--r--recipes-test/demo-network-config/primary-network-config.bb4
-rw-r--r--recipes-test/demo-network-config/secondary-network-config.bb3
-rw-r--r--recipes-test/demo-network-config/static-network-config.inc16
-rwxr-xr-xscripts/envsetup.sh5
17 files changed, 120 insertions, 87 deletions
diff --git a/README.adoc b/README.adoc
index 5c4e5bc..8711e86 100644
--- a/README.adoc
+++ b/README.adoc
@@ -19,6 +19,20 @@ toc::[]
19 19
20If you don't already have a Yocto project that you want to add OTA to, you can use the https://docs.atsgarage.com/quickstarts/raspberry-pi.html[HERE OTA Connect Quickstart] project to rapidly get up and running on a Raspberry Pi. It takes a standard https://www.yoctoproject.org/tools-resources/projects/poky[poky] distribution, and adds OTA and OSTree capabilities. 20If you don't already have a Yocto project that you want to add OTA to, you can use the https://docs.atsgarage.com/quickstarts/raspberry-pi.html[HERE OTA Connect Quickstart] project to rapidly get up and running on a Raspberry Pi. It takes a standard https://www.yoctoproject.org/tools-resources/projects/poky[poky] distribution, and adds OTA and OSTree capabilities.
21 21
22=== Dependencies
23
24In addition to the link:https://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html#required-packages-for-the-build-host[standard Yocto dependencies], meta-updater generally requires a few additional dependencies, depending on your use case and target platform. To install these additional packages on Debian/Ubuntu, run this:
25
26....
27sudo apt install cpu-checker default-jre parted
28....
29
30To build for https://github.com/advancedtelematic/meta-updater-minnowboard[Minnowboard] with GRUB, you will also need to install https://github.com/tianocore/tianocore.github.io/wiki/OVMF[TianoCore's ovmf] package on your host system. On Debian/Ubuntu, you can do so with this command:
31
32....
33sudo apt install ovmf
34....
35
22=== Adding meta-updater capabilities to your build 36=== Adding meta-updater capabilities to your build
23 37
24If you already have a Yocto-based project and you want to add atomic filesystem updates to it, you just need to do three things: 38If you already have a Yocto-based project and you want to add atomic filesystem updates to it, you just need to do three things:
@@ -72,7 +86,7 @@ If your board isn't supported yet, you can add board integration code yourself.
72 86
73You may take a look into https://github.com/advancedtelematic/meta-updater-minnowboard[Minnowboard] or https://github.com/advancedtelematic/meta-updater-raspberrypi[Raspberry Pi] integration layers for examples. 87You may take a look into https://github.com/advancedtelematic/meta-updater-minnowboard[Minnowboard] or https://github.com/advancedtelematic/meta-updater-raspberrypi[Raspberry Pi] integration layers for examples.
74 88
75Although we have used U-Boot so far, other boot loaders can be configured work with OSTree as well. 89Although we have focused on U-Boot and GRUB so far, other bootloaders can be configured to work with OSTree as well.
76 90
77Your images will also need network connectivity to be able to reach an actual OTA backend. Our 'poky-sota' distribution does not mandate or install a default network manager but our supported platforms use the `virtual/network-configuration` recipe, which can be used as a starting example. 91Your images will also need network connectivity to be able to reach an actual OTA backend. Our 'poky-sota' distribution does not mandate or install a default network manager but our supported platforms use the `virtual/network-configuration` recipe, which can be used as a starting example.
78 92
@@ -89,7 +103,7 @@ Your images will also need network connectivity to be able to reach an actual OT
89* `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. 103* `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.
90* `SOTA_CLIENT_PROV` - which provisioning method to use. Valid options are `aktualizr-shared-prov`, `aktualizr-device-prov`, and `aktualizr-device-prov-hsm`. For more information on these provisioning methods, see the https://docs.ota.here.com/client-config/client-provisioning-methods.html[OTA Connect documentation]. The default is `aktualizr-shared-prov`. This can also be set to an empty string to avoid using a provisioning recipe. 104* `SOTA_CLIENT_PROV` - which provisioning method to use. Valid options are `aktualizr-shared-prov`, `aktualizr-device-prov`, and `aktualizr-device-prov-hsm`. For more information on these provisioning methods, see the https://docs.ota.here.com/client-config/client-provisioning-methods.html[OTA Connect documentation]. The default is `aktualizr-shared-prov`. This can also be set to an empty string to avoid using a provisioning recipe.
91* `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). 105* `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).
92* `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. 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.
93* `SOTA_HARDWARE_ID` - a custom hardware ID that will be written to the aktualizr config. Defaults to MACHINE if not set. 107* `SOTA_HARDWARE_ID` - a custom hardware ID that will be written to the aktualizr config. Defaults to MACHINE if not set.
94* `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. 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.
95* `SOTA_POLLING_SEC` - sets polling interval for aktualizr to check for updates if aktualizr-polling-sec is included in the image. 109* `SOTA_POLLING_SEC` - sets polling interval for aktualizr to check for updates if aktualizr-polling-sec is included in the image.
@@ -216,11 +230,7 @@ IMAGE_INSTALL_append = " dropbear "
216 230
2173. Some tests require that `SOTA_PACKED_CREDENTIALS` is set in your `conf/local.conf`. See the <<sota-related-variables-in-localconf,SOTA-related variables in local.conf>> section. 2313. Some tests require that `SOTA_PACKED_CREDENTIALS` is set in your `conf/local.conf`. See the <<sota-related-variables-in-localconf,SOTA-related variables in local.conf>> section.
218 232
2194. To be able to build an image for the grub tests, you will need to install https://github.com/tianocore/tianocore.github.io/wiki/OVMF[TianoCore's ovmf] package on your host system. On Debian-like systems, you can do so with this command: 2334. To be able to build an image for the GRUB tests, you will need to install the ovmf package as described in the <<Dependencies,dependencies>>.
220+
221```
222sudo apt install ovmf
223```
224 234
2255. Run oe-selftest: 2355. Run oe-selftest:
226+ 236+
@@ -259,3 +269,9 @@ Provisioning procedure depends on your provisioning recipe, i.e. the value of `S
259** put URL to the server backend (together with protocol prefix and port number) at `/var/sota/gateway.url`. If you're using HERE OTA Connect, you can find the URL in the `autoprov.url` file in your credentials archive. 269** put URL to the server backend (together with protocol prefix and port number) at `/var/sota/gateway.url`. If you're using HERE OTA Connect, you can find the URL in the `autoprov.url` file in your credentials archive.
260** put root CA certificate (for the *server*, not for the *device*) at `/var/sota/import/root.crt`. 270** put root CA certificate (for the *server*, not for the *device*) at `/var/sota/import/root.crt`.
261** put client certificate and private key to slots 1 and 2 of the PKCS#11-compatible device. 271** put client certificate and private key to slots 1 and 2 of the PKCS#11-compatible device.
272
273== License
274
275This code is licensed under the link:COPYING.MIT[MIT license], a copy of which can be found in this repository. All code is copyright HERE Europe B.V., 2016-2019.
276
277We require that contributors accept the terms of Linux Foundation's link:https://developercertificate.org/[Developer Certificate of Origin]. Please see the https://github.com/advancedtelematic/aktualizr/blob/master/CONTRIBUTING.md[contribution instructions of aktualizr] for more information.
diff --git a/conf/include/bblayers/sota_raspberrypi3.inc b/conf/include/bblayers/sota_raspberrypi3.inc
index 03f8f44..42d5eb1 100644
--- a/conf/include/bblayers/sota_raspberrypi3.inc
+++ b/conf/include/bblayers/sota_raspberrypi3.inc
@@ -1,3 +1,4 @@
1BBLAYERS += "${METADIR}/meta-openembedded/meta-python" 1BBLAYERS += "${METADIR}/meta-openembedded/meta-python"
2BBLAYERS += "${METADIR}/meta-updater-raspberrypi" 2BBLAYERS += "${METADIR}/meta-updater-raspberrypi"
3BBLAYERS += "${METADIR}/meta-raspberrypi" 3BBLAYERS += "${METADIR}/meta-raspberrypi"
4BBLAYERS += "${METADIR}/meta-openembedded/meta-networking"
diff --git a/conf/local.conf.sample.append b/conf/local.conf.sample.append
new file mode 100644
index 0000000..4588ec3
--- /dev/null
+++ b/conf/local.conf.sample.append
@@ -0,0 +1,35 @@
1
2#
3# meta-updater configuration, see README.adoc and aktualizr's
4# documentation for more options and detailed documentation
5#
6
7MACHINE = "##MACHINE##"
8DISTRO = "poky-sota-systemd"
9
10# General SOTA setup
11#SOTA_CLIENT_PROV = "aktualizr-auto-prov"
12#SOTA_PACKED_CREDENTIALS = "/path/to/credentials.zip"
13
14# Uncomment this line to start an ssh server at boot automatically
15#IMAGE_FEATURES += "ssh-server-dropbear"
16
17# Uncomment this line to set the log level of aktualizr to 'debug' (from 'info'
18# by default)
19#IMAGE_INSTALL_append += " aktualizr-log-debug"
20
21# Store systemd logs in persistent storage
22#
23# It greatly helps diagnosing issues on testing devices but should be
24# carefully weighted against file system usage and flash device wear for
25# production systems. Please refer to systemd's docs for more details
26IMAGE_INSTALL_append += " systemd-journald-persistent"
27
28# Set resource limits for aktualizr service
29#
30# Uncomment these lines to change the default parameters.
31#
32#RESOURCE_CPU_WEIGHT_pn-aktualizr = "100"
33#RESOURCE_MEMORY_HIGH_pn-aktualizr = "100M"
34#RESOURCE_MEMORY_MAX_pn-aktualizr = "80%"
35IMAGE_INSTALL_append += " aktualizr-resource-control"
diff --git a/lib/oeqa/selftest/cases/updater_qemux86_64.py b/lib/oeqa/selftest/cases/updater_qemux86_64.py
index 80d135f..2b4726c 100644
--- a/lib/oeqa/selftest/cases/updater_qemux86_64.py
+++ b/lib/oeqa/selftest/cases/updater_qemux86_64.py
@@ -358,7 +358,7 @@ class IpSecondaryTests(OESelftestTestCase):
358 self._test_ctx.append_config('SOTA_CLIENT_PROV = " aktualizr-shared-prov "') 358 self._test_ctx.append_config('SOTA_CLIENT_PROV = " aktualizr-shared-prov "')
359 359
360 def is_ecu_registered(self, ecu_id): 360 def is_ecu_registered(self, ecu_id):
361 max_number_of_tries = 20 361 max_number_of_tries = 40
362 try_counter = 0 362 try_counter = 0
363 363
364 # aktualizr-info is not always able to load ECU serials from DB 364 # aktualizr-info is not always able to load ECU serials from DB
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index 28c51d9..ddc0de1 100644
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -6,7 +6,7 @@ LICENSE = "MPL-2.0"
6LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" 6LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3"
7 7
8DEPENDS = "boost curl openssl libarchive libsodium sqlite3 asn1c-native" 8DEPENDS = "boost curl openssl libarchive libsodium sqlite3 asn1c-native"
9DEPENDS_append = "${@bb.utils.contains('PTEST_ENABLED', '1', ' coreutils-native ostree-native aktualizr-native ', '', d)}" 9DEPENDS_append = "${@bb.utils.contains('PTEST_ENABLED', '1', ' coreutils-native net-tools-native ostree-native aktualizr-native ', '', d)}"
10RDEPENDS_${PN}_class-target = "aktualizr-configs lshw" 10RDEPENDS_${PN}_class-target = "aktualizr-configs lshw"
11RDEPENDS_${PN}-host-tools = "aktualizr aktualizr-repo aktualizr-cert-provider ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'garage-deploy garage-push', '', d)}" 11RDEPENDS_${PN}-host-tools = "aktualizr aktualizr-repo aktualizr-cert-provider ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'garage-deploy garage-push', '', d)}"
12 12
@@ -31,7 +31,7 @@ SRC_URI = " \
31SRC_URI[md5sum] = "e104ccd4f32e52571a5fc0e5042db050" 31SRC_URI[md5sum] = "e104ccd4f32e52571a5fc0e5042db050"
32SRC_URI[sha256sum] = "c590be1a57523bfe097af82279eda5c97cf40ae47fb27162cf33c469702c8a9b" 32SRC_URI[sha256sum] = "c590be1a57523bfe097af82279eda5c97cf40ae47fb27162cf33c469702c8a9b"
33 33
34SRCREV = "fce5854ff10e7efd52d69bbaf68dc2af990d5746" 34SRCREV = "9c592cf9d8dfcd995d47753f2be7bd1a2b56c7da"
35BRANCH ?= "master" 35BRANCH ?= "master"
36 36
37S = "${WORKDIR}/git" 37S = "${WORKDIR}/git"
@@ -106,16 +106,6 @@ do_install_append () {
106 printf "[provision]\nprimary_ecu_hardware_id = ${SOTA_HARDWARE_ID}\n" > ${D}${libdir}/sota/conf.d/40-hardware-id.toml 106 printf "[provision]\nprimary_ecu_hardware_id = ${SOTA_HARDWARE_ID}\n" > ${D}${libdir}/sota/conf.d/40-hardware-id.toml
107 fi 107 fi
108 108
109 if [ -n "${SOTA_SECONDARY_CONFIG_DIR}" ]; then
110 if [ -d "${SOTA_SECONDARY_CONFIG_DIR}" ]; then
111 install -m 0700 -d ${D}${sysconfdir}/sota/ecus
112 install -m 0644 "${SOTA_SECONDARY_CONFIG_DIR}"/* ${D}${sysconfdir}/sota/ecus/
113 printf "[uptane]\nsecondary_configs_dir = /etc/sota/ecus/\n" > ${D}${libdir}/sota/conf.d/30-secondary-configs-dir.toml
114 else
115 bbwarn "SOTA_SECONDARY_CONFIG_DIR is set to an invalid directory (${SOTA_SECONDARY_CONFIG_DIR})"
116 fi
117 fi
118
119 install -m 0755 -d ${D}${systemd_unitdir}/system 109 install -m 0755 -d ${D}${systemd_unitdir}/system
120 aktualizr_service=${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'serialcan', '${WORKDIR}/aktualizr-serialcan.service', '${WORKDIR}/aktualizr.service', d)} 110 aktualizr_service=${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'serialcan', '${WORKDIR}/aktualizr-serialcan.service', '${WORKDIR}/aktualizr.service', d)}
121 install -m 0644 ${aktualizr_service} ${D}${systemd_unitdir}/system/aktualizr.service 111 install -m 0644 ${aktualizr_service} ${D}${systemd_unitdir}/system/aktualizr.service
diff --git a/recipes-support/python-canonicaljson/python-canonicaljson.bb b/recipes-support/python-canonicaljson/python-canonicaljson.bb
deleted file mode 100644
index d8a0728..0000000
--- a/recipes-support/python-canonicaljson/python-canonicaljson.bb
+++ /dev/null
@@ -1,18 +0,0 @@
1DESCRIPTION = "python-canonicaljson recipe"
2
3LICENSE = "Apache-2.0"
4LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=2ee41112a44fe7014dce33e26468ba93"
5
6SRCREV = "92e2c06871cc275c2a8b8e3e899141a212aae0e8"
7SRC_URI = "git://github.com/matrix-org/python-canonicaljson.git"
8S = "${WORKDIR}/git"
9
10# Generate with:
11# git describe --tags | cut -b2-
12PV = "1.0.0"
13inherit setuptools
14
15RDEPENDS_${PN} = "\
16 python-simplejson \
17 python-frozendict \
18 "
diff --git a/recipes-support/python-frozendict/python-frozendict.bb b/recipes-support/python-frozendict/python-frozendict.bb
deleted file mode 100644
index 79fe5c8..0000000
--- a/recipes-support/python-frozendict/python-frozendict.bb
+++ /dev/null
@@ -1,12 +0,0 @@
1DESCRIPTION = "python-frozendict recipe"
2
3LICENSE = "BSD"
4LIC_FILES_CHKSUM = "file://${S}/LICENSE.txt;md5=f4da037a49c09b456fdbbc7a5bd36132"
5
6SRCREV = "c5d16bafcca7b72ff3e8f40d3a9081e4c9233f1b"
7SRC_URI = "git://github.com/slezica/python-frozendict.git"
8S = "${WORKDIR}/git"
9
10PV = "1.2"
11inherit setuptools
12
diff --git a/recipes-support/python-petname/python-petname.bb b/recipes-support/python-petname/python-petname.bb
deleted file mode 100644
index 9abd5d9..0000000
--- a/recipes-support/python-petname/python-petname.bb
+++ /dev/null
@@ -1,16 +0,0 @@
1DESCRIPTION = "python-petname recipe"
2
3LICENSE = "Apache-2.0"
4LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
5
6SRCREV = "d0b767cdb1567defb104f29c3fd022239a7f231e"
7SRC_URI = "git://github.com/dustinkirkland/python-petname.git"
8S = "${WORKDIR}/git"
9
10PV = "2.2"
11inherit setuptools
12RDEPENDS_${PN} = " python-setuptools \
13 python-argparse \
14 "
15
16FILES_${PN} = "${libdir} ${bindir}/petname"
diff --git a/recipes-support/systemd-journald-persistent/files/10-persistent-journal.conf b/recipes-support/systemd-journald-persistent/files/10-persistent-journal.conf
new file mode 100644
index 0000000..a56527c
--- /dev/null
+++ b/recipes-support/systemd-journald-persistent/files/10-persistent-journal.conf
@@ -0,0 +1,3 @@
1[Journal]
2Storage=persistent
3SystemMaxUse=64M
diff --git a/recipes-support/systemd-journald-persistent/systemd-journald-persistent.bb b/recipes-support/systemd-journald-persistent/systemd-journald-persistent.bb
new file mode 100644
index 0000000..1715fe1
--- /dev/null
+++ b/recipes-support/systemd-journald-persistent/systemd-journald-persistent.bb
@@ -0,0 +1,20 @@
1SUMMARY = "Configuration for systemd-journald"
2DESCRIPTION = "Provides configuration for systemd-journald, so that logs are \
3stored on persistent storage"
4LICENSE = "MPL-2.0"
5LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad"
6
7PACKAGE_ARCH = "${MACHINE_ARCH}"
8
9SRC_URI_append = " file://10-persistent-journal.conf"
10PR = "r1"
11
12S = "${WORKDIR}"
13
14FILES_${PN} = "${systemd_unitdir}/journald.conf.d/*"
15
16do_install() {
17 install -d ${D}/${systemd_unitdir}/journald.conf.d
18 install -m 0644 ${WORKDIR}/10-persistent-journal.conf ${D}/${systemd_unitdir}/journald.conf.d
19}
20
diff --git a/recipes-test/demo-config/shared-conf.inc b/recipes-test/demo-config/shared-conf.inc
index ce2bb44..c5ab598 100644
--- a/recipes-test/demo-config/shared-conf.inc
+++ b/recipes-test/demo-config/shared-conf.inc
@@ -2,4 +2,4 @@ SECONDARY_IP ?= "10.0.3.2"
2SECONDARY_PORT ?= "9050" 2SECONDARY_PORT ?= "9050"
3PRIMARY_IP ?= "10.0.3.1" 3PRIMARY_IP ?= "10.0.3.1"
4PRIMARY_PORT ?= "9040" 4PRIMARY_PORT ?= "9040"
5PRIMARY_WAIT_TIMEOUT ?= "120" 5PRIMARY_WAIT_TIMEOUT ?= "240"
diff --git a/recipes-test/demo-network-config/files/26-multihomed-client.network b/recipes-test/demo-network-config/files/26-multihomed-client.network
new file mode 100644
index 0000000..f1e6cc6
--- /dev/null
+++ b/recipes-test/demo-network-config/files/26-multihomed-client.network
@@ -0,0 +1,9 @@
1[Match]
2Name=@IFNAME@
3
4[Network]
5Description=Multihomed network. DHCP-assigned IP for Primary<->Backend. Statically assigned IP for Primary<->Secondary
6DHCP=yes
7
8[Address]
9Address=@ADDR@
diff --git a/recipes-test/demo-network-config/network-config.inc b/recipes-test/demo-network-config/network-config.inc
new file mode 100644
index 0000000..ed623d4
--- /dev/null
+++ b/recipes-test/demo-network-config/network-config.inc
@@ -0,0 +1,17 @@
1SRC_URI_append = "\
2 file://26-${CONF_TYPE}-client.network \
3 "
4
5SECONDARY_INTERFACE ?= "${@ 'eth0' if d.getVar('MACHINE') == 'raspberrypi3' else 'enp0s5'}"
6
7do_install_append() {
8 bbnote "Network configuration type to be applied: ${CONF_TYPE}"
9 install -d ${D}/usr/lib/systemd/network
10 install -m 0644 ${WORKDIR}/26-${CONF_TYPE}-client.network ${D}/usr/lib/systemd/network/
11 sed -i -e 's|@ADDR@|${IP_ADDR}|g' \
12 -e 's|@IFNAME@|${SECONDARY_INTERFACE}|g' \
13 ${D}/usr/lib/systemd/network/26-${CONF_TYPE}-client.network
14
15}
16
17# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/recipes-test/demo-network-config/primary-network-config.bb b/recipes-test/demo-network-config/primary-network-config.bb
index c7daa15..d840a95 100644
--- a/recipes-test/demo-network-config/primary-network-config.bb
+++ b/recipes-test/demo-network-config/primary-network-config.bb
@@ -18,8 +18,10 @@ do_install() {
18} 18}
19 19
20PRIMARY_IP ?= "10.0.3.1" 20PRIMARY_IP ?= "10.0.3.1"
21
21IP_ADDR = "${PRIMARY_IP}" 22IP_ADDR = "${PRIMARY_IP}"
23CONF_TYPE ?= "${@ 'multihomed' if d.getVar('MACHINE') == 'raspberrypi3' and d.getVar('RPI_WIFI_ENABLE') != '1' else 'static'}"
22 24
23require static-network-config.inc 25require network-config.inc
24 26
25# vim:set ts=4 sw=4 sts=4 expandtab: 27# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/recipes-test/demo-network-config/secondary-network-config.bb b/recipes-test/demo-network-config/secondary-network-config.bb
index c70d88a..b1d70f1 100644
--- a/recipes-test/demo-network-config/secondary-network-config.bb
+++ b/recipes-test/demo-network-config/secondary-network-config.bb
@@ -23,7 +23,8 @@ do_install() {
23 23
24SECONDARY_IP ?= "10.0.3.2" 24SECONDARY_IP ?= "10.0.3.2"
25IP_ADDR = "${SECONDARY_IP}" 25IP_ADDR = "${SECONDARY_IP}"
26CONF_TYPE = "static"
26 27
27require static-network-config.inc 28require network-config.inc
28 29
29# vim:set ts=4 sw=4 sts=4 expandtab: 30# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/recipes-test/demo-network-config/static-network-config.inc b/recipes-test/demo-network-config/static-network-config.inc
deleted file mode 100644
index e64675e..0000000
--- a/recipes-test/demo-network-config/static-network-config.inc
+++ /dev/null
@@ -1,16 +0,0 @@
1SRC_URI_append = "\
2 file://26-static-client.network \
3 "
4
5SECONDARY_INTERFACE ?= "enp0s5"
6
7do_install_append() {
8 install -d ${D}/usr/lib/systemd/network
9 install -m 0644 ${WORKDIR}/26-static-client.network ${D}/usr/lib/systemd/network/
10 sed -i -e 's|@ADDR@|${IP_ADDR}|g' \
11 -e 's|@IFNAME@|${SECONDARY_INTERFACE}|g' \
12 ${D}/usr/lib/systemd/network/26-static-client.network
13
14}
15
16# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/scripts/envsetup.sh b/scripts/envsetup.sh
index e912824..5827bc2 100755
--- a/scripts/envsetup.sh
+++ b/scripts/envsetup.sh
@@ -25,11 +25,12 @@ METADIR=${METADIR:-${SOURCEDIR}/../..}
25 25
26if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then 26if [[ ! -f "${BUILDDIR}/conf/local.conf" ]]; then
27 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" 27 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR"
28
28 echo "METADIR := \"\${@os.path.abspath('${METADIR}')}\"" >> conf/bblayers.conf 29 echo "METADIR := \"\${@os.path.abspath('${METADIR}')}\"" >> conf/bblayers.conf
29 cat "${METADIR}/meta-updater/conf/include/bblayers/sota.inc" >> conf/bblayers.conf 30 cat "${METADIR}/meta-updater/conf/include/bblayers/sota.inc" >> conf/bblayers.conf
30 cat "${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc" >> conf/bblayers.conf 31 cat "${METADIR}/meta-updater/conf/include/bblayers/sota_${MACHINE}.inc" >> conf/bblayers.conf
31 echo "MACHINE = \"${MACHINE}\"" >> conf/local.conf 32
32 echo "DISTRO = \"poky-sota-systemd\"" >> conf/local.conf 33 sed "s/##MACHINE##/$MACHINE/g" "${METADIR}/meta-updater/conf/local.conf.sample.append" >> conf/local.conf
33else 34else
34 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR" 35 source "$METADIR/poky/oe-init-build-env" "$BUILDDIR"
35fi 36fi