meta-gsj: mac-address: Initialize MAC addresses
This commit is to assign MAC address to eth1, usb0_dev, usb0_host and
eth0 ports. The address of eth1 is read from EEPROM, while others are
obtained by adding one, two and three to eth1 respectively. We will
randomly generate address of eth1 once an error occurs.
The randomly-generated MAC address is of the form "00:1B:24:XX:XX:XX".
Signed-off-by: Hank Liou <Hank.Liou@quantatw.com>
Change-Id: I917258449ed83eb10b62b6001bf873eb8ba4ae0a
diff --git a/meta-gsj/recipes-gsj/mac-address/files/mac-address.service b/meta-gsj/recipes-gsj/mac-address/files/mac-address.service
new file mode 100644
index 0000000..e18d694
--- /dev/null
+++ b/meta-gsj/recipes-gsj/mac-address/files/mac-address.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Initialize MAC Address
+Before=usb_network.service network-pre.target
+Wants=network-pre.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/mac-address
+
+[Install]
+WantedBy=multi-user.target
\ No newline at end of file
diff --git a/meta-gsj/recipes-gsj/mac-address/mac-address.bb b/meta-gsj/recipes-gsj/mac-address/mac-address.bb
new file mode 100644
index 0000000..8d3fbf3
--- /dev/null
+++ b/meta-gsj/recipes-gsj/mac-address/mac-address.bb
@@ -0,0 +1,27 @@
+SRC_URI = "git://github.com/quanta-bmc/mac-address.git;protocol=git"
+SRCREV = "${AUTOREV}"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${QUANTABASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658"
+
+inherit autotools pkgconfig
+inherit systemd
+
+DEPENDS += "systemd"
+DEPENDS += "autoconf-archive-native"
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+SRC_URI_append = " file://mac-address.service"
+
+HASHSTYLE = "gnu"
+S = "${WORKDIR}/git"
+CXXFLAGS += "-std=c++17"
+
+do_install_append() {
+ install -d ${D}${systemd_unitdir}/system/
+ install -m 0644 ${WORKDIR}/mac-address.service \
+ ${D}${systemd_unitdir}/system
+}
+
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE_${PN} += "mac-address.service"
\ No newline at end of file