[OE-core] [PATCH 1/1] systemd: add network config while networkd supported

Hongxu Jia hongxu.jia at windriver.com
Mon Nov 3 07:37:55 UTC 2014


While networkd supported, we add network config which starts
dhcp by default.

And the customers could edit it according their own requirements.
(dhcp or static ip...)

It refers:
https://wiki.archlinux.org/index.php/systemd-networkd

Signed-off-by: Hongxu Jia <hongxu.jia at windriver.com>
---
 meta/recipes-core/systemd/systemd/oe-core.network | 8 ++++++++
 meta/recipes-core/systemd/systemd_216.bb          | 6 ++++++
 2 files changed, 14 insertions(+)
 create mode 100644 meta/recipes-core/systemd/systemd/oe-core.network

diff --git a/meta/recipes-core/systemd/systemd/oe-core.network b/meta/recipes-core/systemd/systemd/oe-core.network
new file mode 100644
index 0000000..fcaefc2
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd/oe-core.network
@@ -0,0 +1,8 @@
+[Match]
+Name=eth*
+
+[Network]
+DHCP=v4
+
+[DHCPv4]
+UseHostname=false
diff --git a/meta/recipes-core/systemd/systemd_216.bb b/meta/recipes-core/systemd/systemd_216.bb
index 6d3e47f..dae1cb8 100644
--- a/meta/recipes-core/systemd/systemd_216.bb
+++ b/meta/recipes-core/systemd/systemd_216.bb
@@ -37,6 +37,7 @@ SRC_URI = "git://anongit.freedesktop.org/systemd/systemd;branch=master;protocol=
            file://00-create-volatile.conf \
            file://init \
            file://run-ptest \
+           file://oe-core.network \
            ${@bb.utils.contains('PACKAGECONFIG', 'resolved', '', 'file://0001-tmpfiles.d-etc.conf-disable-resolv.conf-symlink.patch', d)} \
           "
 
@@ -137,6 +138,11 @@ do_install() {
         # Delete journal README, as log can be symlinked inside volatile.
         rm -f ${D}/${localstatedir}/log/README
 
+	# While networkd enabled, it start dhcp by default
+	if ${@bb.utils.contains('PACKAGECONFIG','networkd','true','false',d)}; then
+		install -m 0755 ${WORKDIR}/oe-core.network ${D}${sysconfdir}/systemd/network
+	fi
+
 	# Create symlinks for systemd-update-utmp-runlevel.service
 	install -d ${D}${systemd_unitdir}/system/graphical.target.wants
 	install -d ${D}${systemd_unitdir}/system/multi-user.target.wants
-- 
1.9.1




More information about the Openembedded-core mailing list