From efc6c221c0984c42dc840c54a4554d95c1c68ece Mon Sep 17 00:00:00 2001 From: Stefan Schmidt <stefan.schmidt@huawei.com> Date: Wed, 3 Mar 2021 16:39:25 +0100 Subject: [PATCH] systemd-conf: allow for runqemu and networkd compatibility When we started to use the networkd unit for wired in qemu we also broke the static IP configuration the runqemu script uses. The IP address, etc are given as kernel commandline options for the static setup. If we see this happening we can simply skip the networkd unit file for DHCP setup as we know a static IP config was provided. The key part of the imported unit file here is the KernelCommandLine=!ip line in the match section to skip the unit if IP is present in the commandline. Closes: https://git.ostc-eu.org/OSTC/OHOS/meta-ohos/-/issues/29 Signed-off-by: Stefan Schmidt <stefan.schmidt@huawei.com> --- .../recipes-core/systemd-conf/files/wired.network | 11 +++++++++++ .../recipes-core/systemd-conf/systemd-conf_%.bbappend | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 meta-ohos-core/recipes-core/systemd-conf/files/wired.network diff --git a/meta-ohos-core/recipes-core/systemd-conf/files/wired.network b/meta-ohos-core/recipes-core/systemd-conf/files/wired.network new file mode 100644 index 00000000..34c20fcb --- /dev/null +++ b/meta-ohos-core/recipes-core/systemd-conf/files/wired.network @@ -0,0 +1,11 @@ +[Match] +Name=en* eth* +KernelCommandLine=!nfsroot +KernelCommandLine=!ip + +[Network] +DHCP=yes + +[DHCP] +RouteMetric=10 +ClientIdentifier=mac diff --git a/meta-ohos-core/recipes-core/systemd-conf/systemd-conf_%.bbappend b/meta-ohos-core/recipes-core/systemd-conf/systemd-conf_%.bbappend index c8fa81fd..43ea50cb 100644 --- a/meta-ohos-core/recipes-core/systemd-conf/systemd-conf_%.bbappend +++ b/meta-ohos-core/recipes-core/systemd-conf/systemd-conf_%.bbappend @@ -1,3 +1,5 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + do_install_append_qemuall() { install -D -m0644 ${WORKDIR}/wired.network ${D}${systemd_unitdir}/network/80-wired.network } -- GitLab