aboutsummaryrefslogtreecommitdiffstats
path: root/meta-sys940x/recipes-bsp/genmac/genmac.bb
diff options
context:
space:
mode:
authorDarren Hart <dvhart@linux.intel.com>2012-01-26 10:39:01 -0800
committerDarren Hart <dvhart@linux.intel.com>2012-02-03 09:25:18 -0800
commitc42364375acb28f0f23867e3a24c9ae25beced37 (patch)
tree5c5c7d1519d04076f11f89de51e70a1d69acbaa9 /meta-sys940x/recipes-bsp/genmac/genmac.bb
parent7b1d216a133d3df4597c336e3a6c3c941e69989a (diff)
downloadmeta-intel-c42364375acb28f0f23867e3a24c9ae25beced37.tar.gz
meta-intel-c42364375acb28f0f23867e3a24c9ae25beced37.tar.bz2
meta-intel-c42364375acb28f0f23867e3a24c9ae25beced37.zip
genmac: Replace RANDOM_MAC in network/interfaces with a randomly generated MAC
For machines that do not have a MAC in hardware and with drivers that don't generate a random one in the kernel, this init script will replace the string RANDOM_MAC in the network/interfaces file with one generated with "ranpwd -m". Care is taken to ensure multiple interfaces can use RANDOM_MAC and receive unique addresses. ranpwd generates MACs with the locally administered bit set and the multicast bit disabled. Signed-off-by: Darren Hart <dvhart@linux.intel.com> Signed-off-by: Joshua Lock <josh@linux.intel.com>
Diffstat (limited to 'meta-sys940x/recipes-bsp/genmac/genmac.bb')
-rw-r--r--meta-sys940x/recipes-bsp/genmac/genmac.bb30
1 files changed, 30 insertions, 0 deletions
diff --git a/meta-sys940x/recipes-bsp/genmac/genmac.bb b/meta-sys940x/recipes-bsp/genmac/genmac.bb
new file mode 100644
index 00000000..56849b46
--- /dev/null
+++ b/meta-sys940x/recipes-bsp/genmac/genmac.bb
@@ -0,0 +1,30 @@
+SUMMARY = "Provide a basic init script to generate a random MAC"
+DESCRIPTION = "Set the MAC from the config file."
+SECTION = "base"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"
+
+PR = "r0"
+
+inherit update-rc.d
+
+RDEPENDS_${PN} = "ranpwd"
+
+SRC_URI = "file://genmac"
+
+INITSCRIPT_NAME = "genmac"
+# Run as early as possible to ensure we are before the networking scripts
+INITSCRIPT_PARAMS = "start 39 S ."
+
+do_install() {
+ install -d ${D}${sysconfdir} \
+ ${D}${sysconfdir}/init.d
+ install -m 0755 ${WORKDIR}/${INITSCRIPT_NAME} ${D}${sysconfdir}/init.d
+ cat ${WORKDIR}/${INITSCRIPT_NAME} | \
+ sed -e 's,/etc,${sysconfdir},g' \
+ -e 's,/usr/sbin,${sbindir},g' \
+ -e 's,/var,${localstatedir},g' \
+ -e 's,/usr/bin,${bindir},g' \
+ -e 's,/usr,${prefix},g' > ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME}
+ chmod 755 ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME}
+}