From f16037c36b9243a735cdc1345ebbc9287d7dec45 Mon Sep 17 00:00:00 2001 From: Hank Liou Date: Wed, 26 Jun 2019 14:00:20 +0800 Subject: 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". (From meta-quanta rev: b1c33ab8eb04ccf7ac77df58dca661a964cce293) Signed-off-by: Hank Liou Change-Id: I000f818058989af2fe1f9457e22b4568ce47a8d5 Signed-off-by: Brad Bishop --- .../mac-address/files/mac-address.service | 11 +++++++++ .../recipes-gsj/mac-address/mac-address.bb | 27 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 meta-quanta/meta-gsj/recipes-gsj/mac-address/files/mac-address.service create mode 100644 meta-quanta/meta-gsj/recipes-gsj/mac-address/mac-address.bb diff --git a/meta-quanta/meta-gsj/recipes-gsj/mac-address/files/mac-address.service b/meta-quanta/meta-gsj/recipes-gsj/mac-address/files/mac-address.service new file mode 100644 index 000000000..e18d69493 --- /dev/null +++ b/meta-quanta/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-quanta/meta-gsj/recipes-gsj/mac-address/mac-address.bb b/meta-quanta/meta-gsj/recipes-gsj/mac-address/mac-address.bb new file mode 100644 index 000000000..8d3fbf376 --- /dev/null +++ b/meta-quanta/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 -- cgit v1.2.3