[OE-core] [PATCH v2 1/1] systemd-conf: configure wired network with dhcp

Khem Raj raj.khem at gmail.com
Tue May 21 17:37:04 UTC 2019


just copy paste from meta-yoe, that has been long working.

On Tue, May 21, 2019 at 2:23 AM <kai.kang at windriver.com> wrote:
>
> From: Kai Kang <kai.kang at windriver.com>
>
> Add a configure file for systemd.networkd to configure wired network
> interfaces with dhcp. It works with common network interfaces such eth0
> and eno1.
>
> Refer to
> https://github.com/YoeDistro/meta-yoe/tree/master/recipes-core/systemd
>
> [YOCTO #13057]
>
> Signed-off-by: Kai Kang <kai.kang at windriver.com>
> ---
>  meta/recipes-core/systemd/systemd-conf/dhcp.network | 9 +++++++++
>  meta/recipes-core/systemd/systemd-conf_242.bb       | 5 +++++
>  2 files changed, 14 insertions(+)
>  create mode 100644 meta/recipes-core/systemd/systemd-conf/dhcp.network
>
> diff --git a/meta/recipes-core/systemd/systemd-conf/dhcp.network b/meta/recipes-core/systemd/systemd-conf/dhcp.network
> new file mode 100644
> index 0000000000..253aee9382
> --- /dev/null
> +++ b/meta/recipes-core/systemd/systemd-conf/dhcp.network
> @@ -0,0 +1,9 @@
> +[Match]
> +Name=en* eth*

I think this is better put
Name=en*
Name=eth*

> +
> +[Network]
> +DHCP=yes
> +
> +[DHCP]
> +RouteMetric=10
> +ClientIdentifier=mac
> diff --git a/meta/recipes-core/systemd/systemd-conf_242.bb b/meta/recipes-core/systemd/systemd-conf_242.bb
> index 96beea53a7..105ee3ceed 100644
> --- a/meta/recipes-core/systemd/systemd-conf_242.bb
> +++ b/meta/recipes-core/systemd/systemd-conf_242.bb
> @@ -10,12 +10,16 @@ SRC_URI = "\
>      file://logind.conf \
>      file://system.conf \
>      file://system.conf-qemuall \
> +    file://dhcp.network \

better to call it wired or something

>  "
>
>  do_install() {
>         install -D -m0644 ${WORKDIR}/journald.conf ${D}${systemd_unitdir}/journald.conf.d/00-${PN}.conf
>         install -D -m0644 ${WORKDIR}/logind.conf ${D}${systemd_unitdir}/logind.conf.d/00-${PN}.conf
>         install -D -m0644 ${WORKDIR}/system.conf ${D}${systemd_unitdir}/system.conf.d/00-${PN}.conf
> +       if ${@bb.utils.contains('OVERRIDES', 'qemuall', 'false', 'true', d)}; then
> +               install -D -m0644 ${WORKDIR}/dhcp.network ${D}${systemd_unitdir}/network/80-dhcp.network
> +       fi
>  }
>
>  # Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52
> @@ -29,4 +33,5 @@ FILES_${PN} = "\
>      ${systemd_unitdir}/journald.conf.d/ \
>      ${systemd_unitdir}/logind.conf.d/ \
>      ${systemd_unitdir}/system.conf.d/ \
> +    ${systemd_unitdir}/network/ \
>  "
> --
> 2.20.0
>


More information about the Openembedded-core mailing list