diff options
author | Patrick Vacek <patrickvacek@gmail.com> | 2019-06-20 15:27:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-20 15:27:06 +0200 |
commit | 59777c8f37a8ae588d695f0974e00df01608363a (patch) | |
tree | bc1a06637008e9430c42164916bcedb0294809a5 | |
parent | 2e2fb57021d79b7fdd0fe416080c690a7d50591a (diff) | |
parent | fcf3daa7d63bf9a9948bafb2cc0472dc7d08d401 (diff) | |
download | meta-updater-59777c8f37a8ae588d695f0974e00df01608363a.tar.gz |
Merge pull request #530 from advancedtelematic/feat/OTA-2294/preconfigured-secondaries-on-RPi
OTA-2541: Primary and Secondary network configuration in case of RPi
6 files changed, 32 insertions, 18 deletions
diff --git a/conf/include/bblayers/sota_raspberrypi3.inc b/conf/include/bblayers/sota_raspberrypi3.inc index ea420ba..7e320af 100644 --- a/conf/include/bblayers/sota_raspberrypi3.inc +++ b/conf/include/bblayers/sota_raspberrypi3.inc | |||
@@ -1,2 +1,3 @@ | |||
1 | BBLAYERS += "${METADIR}/meta-updater-raspberrypi" | 1 | BBLAYERS += "${METADIR}/meta-updater-raspberrypi" |
2 | BBLAYERS += "${METADIR}/meta-raspberrypi" | 2 | BBLAYERS += "${METADIR}/meta-raspberrypi" |
3 | BBLAYERS += "${METADIR}/meta-openembedded/meta-networking" | ||
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] | ||
2 | Name=@IFNAME@ | ||
3 | |||
4 | [Network] | ||
5 | Description=Multihomed network. DHCP-assigned IP for Primary<->Backend. Statically assigned IP for Primary<->Secondary | ||
6 | DHCP=yes | ||
7 | |||
8 | [Address] | ||
9 | Address=@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 @@ | |||
1 | SRC_URI_append = "\ | ||
2 | file://26-${CONF_TYPE}-client.network \ | ||
3 | " | ||
4 | |||
5 | SECONDARY_INTERFACE ?= "${@ 'eth0' if d.getVar('MACHINE') == 'raspberrypi3' else 'enp0s5'}" | ||
6 | |||
7 | do_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 | ||
20 | PRIMARY_IP ?= "10.0.3.1" | 20 | PRIMARY_IP ?= "10.0.3.1" |
21 | |||
21 | IP_ADDR = "${PRIMARY_IP}" | 22 | IP_ADDR = "${PRIMARY_IP}" |
23 | CONF_TYPE ?= "${@ 'multihomed' if d.getVar('MACHINE') == 'raspberrypi3' and d.getVar('RPI_WIFI_ENABLE') != '1' else 'static'}" | ||
22 | 24 | ||
23 | require static-network-config.inc | 25 | require 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 | ||
24 | SECONDARY_IP ?= "10.0.3.2" | 24 | SECONDARY_IP ?= "10.0.3.2" |
25 | IP_ADDR = "${SECONDARY_IP}" | 25 | IP_ADDR = "${SECONDARY_IP}" |
26 | CONF_TYPE = "static" | ||
26 | 27 | ||
27 | require static-network-config.inc | 28 | require 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 @@ | |||
1 | SRC_URI_append = "\ | ||
2 | file://26-static-client.network \ | ||
3 | " | ||
4 | |||
5 | SECONDARY_INTERFACE ?= "enp0s5" | ||
6 | |||
7 | do_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: | ||