aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhang Nguyen <khang.nguyen.xw@renesas.com>2019-07-03 14:20:21 +0700
committerKhang Nguyen <khang.nguyen.xw@renesas.com>2019-07-10 14:10:16 +0700
commit4f0ba4d9bc8e63380ffce5513586b66d25c61334 (patch)
treeacec2bdf237d0e8d531948cbe53dcf7d9871e00d
parentb7c2822cc75574dfbf5c64d6357a91269d9cc748 (diff)
rcar-gen3: systemd: Set static IP
This adds eth0.network to set a static IP for eth0 via STATIC_IP variable in local.conf, the dynamic IP will be used if this variable is empty. E.g.: STATIC_IP = "192.168.10.100" Change-Id: I41667af48d4bc76463a8a8be847a5c008b28fd14 Signed-off-by: Khang Nguyen <khang.nguyen.xw@renesas.com>
-rw-r--r--meta-rcar-gen3/recipes-core/systemd/files/eth0.network5
-rw-r--r--meta-rcar-gen3/recipes-core/systemd/systemd_%.bbappend16
2 files changed, 19 insertions, 2 deletions
diff --git a/meta-rcar-gen3/recipes-core/systemd/files/eth0.network b/meta-rcar-gen3/recipes-core/systemd/files/eth0.network
new file mode 100644
index 0000000..db2aff1
--- /dev/null
+++ b/meta-rcar-gen3/recipes-core/systemd/files/eth0.network
@@ -0,0 +1,5 @@
+[Match]
+Name=eth0
+
+[Network]
+Address=@IP@
diff --git a/meta-rcar-gen3/recipes-core/systemd/systemd_%.bbappend b/meta-rcar-gen3/recipes-core/systemd/systemd_%.bbappend
index 99f8e7c..19194ef 100644
--- a/meta-rcar-gen3/recipes-core/systemd/systemd_%.bbappend
+++ b/meta-rcar-gen3/recipes-core/systemd/systemd_%.bbappend
@@ -1,11 +1,23 @@
require include/gles-control.inc
-PACKAGECONFIG_remove = "timesyncd"
+FILESEXTRAPATHS_prepend_rcar-gen3 := "${THISDIR}/files:"
+
+SRC_URI_append_rcar-gen3 = " \
+ file://eth0.network \
+"
+
+PACKAGECONFIG_remove_rcar-gen3 = "timesyncd"
# Avoid pushing opened device fds into PID1 by logind when restarting
-do_install_append () {
+do_install_append_rcar-gen3 () {
if [ "X${USE_GLES}" = "X1" ]; then
sed -e 's/FileDescriptorStoreMax=512/FileDescriptorStoreMax=0/' \
-i ${D}/lib/systemd/system/systemd-logind.service
fi
+
+ # Set static IP
+ if [ ! -z "${STATIC_IP}" ]; then
+ install -m 0644 ${WORKDIR}/eth0.network ${D}${sysconfdir}/systemd/network/
+ sed "s/@IP@/${STATIC_IP}/g" -i ${D}${sysconfdir}/systemd/network/eth0.network
+ fi
}