[OE-core] [PATCH 1/1] systemd-conf: configure wired network with dhcp
Kang Kai
Kai.Kang at windriver.com
Tue May 21 05:03:44 UTC 2019
On 2019/5/21 上午10:54, Kang Kai wrote:
> On 2019/5/21 上午2:05, Khem Raj wrote:
>>
>>
>> On 5/20/19 2:46 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.
>>>
>>> [YOCTO #13057]
>>>
>>> Signed-off-by: Kai Kang <kai.kang at windriver.com>
>>> ---
>>> meta/recipes-core/systemd/systemd-conf/dhcp.network | 5 +++++
>>> meta/recipes-core/systemd/systemd-conf_242.bb | 3 +++
>>> 2 files changed, 8 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..81f36ebaa5
>>> --- /dev/null
>>> +++ b/meta/recipes-core/systemd/systemd-conf/dhcp.network
>>> @@ -0,0 +1,5 @@
>>> +[Match]
>>> +Name=en* eth*
>>> +
>>> +[Network]
>>> +DHCP=yes
>>> diff --git a/meta/recipes-core/systemd/systemd-conf_242.bb
>>> b/meta/recipes-core/systemd/systemd-conf_242.bb
>>> index 96beea53a7..094f03e195 100644
>>> --- a/meta/recipes-core/systemd/systemd-conf_242.bb
>>> +++ b/meta/recipes-core/systemd/systemd-conf_242.bb
>>> @@ -10,12 +10,14 @@ SRC_URI = "\
>>> file://logind.conf \
>>> file://system.conf \
>>> file://system.conf-qemuall \
>>> + file://dhcp.network \
>>> "
>>> 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
>>> + install -D -m0644 ${WORKDIR}/dhcp.network
>>> ${D}${systemd_unitdir}/network/80-dhcp.network
>>> }
>>> # Based on change from YP bug 8141, OE commit
>>> 5196d7bacaef1076c361adaa2867be31759c1b52
>>> @@ -29,4 +31,5 @@ FILES_${PN} = "\
>>> ${systemd_unitdir}/journald.conf.d/ \
>>> ${systemd_unitdir}/logind.conf.d/ \
>>> ${systemd_unitdir}/system.conf.d/ \
>>> + ${systemd_unitdir}/network/ \
>>> "
>>>
>>
>> Please look into
>>
>> https://github.com/YoeDistro/meta-yoe/tree/master/recipes-core/systemd
>>
>> this also means we need to enable networkd and resolved for this to work
>>
>
> I checked the repo you post,
>
> 1) package config 'networkd' and 'resolved' have been involved in
> default package config in systemd_242.bb
>
> 2) I suspect wireless.network is not necessary. Unlike wired network,
> we can't predict the ap name and connect it automatically.
>
> 3) the configure file doesn't work with qemu tap mode. I'll update
> with it.
>
> 4) Do the configure of section [DHCP] in wired.network necessary?
>
> [DHCP]
> RouteMetric=10
> ClientIdentifier=mac
>
Ignore 4). I have checked the commit message and know why.
Regards,
Kai
>
> Thanks.
>
>
--
Kai Kang
More information about the Openembedded-core
mailing list