From 5b594414cbb1aba3513d8ff5d0f0d3b3bd4c2818 Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Wed, 15 May 2013 12:30:06 +0300 Subject: init-ifupdown: use fixed MAC address Since beagleboard does not have fixed MAC address, use interfaces config to set it. This will use the MAC address from the first boot (which is random) in subsequent restarts. Change-Id: I2ea5e92b2b29f7aad7b40a7fb14ba8ca8d4fbe7a Reviewed-by: Kalle Viironen --- recipes/init-ifupdown/init-ifupdown/fixed_mac_address | 7 +++++++ recipes/init-ifupdown/init-ifupdown/interfaces | 3 ++- recipes/init-ifupdown/init-ifupdown_1.0.bbappend | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 recipes/init-ifupdown/init-ifupdown/fixed_mac_address diff --git a/recipes/init-ifupdown/init-ifupdown/fixed_mac_address b/recipes/init-ifupdown/init-ifupdown/fixed_mac_address new file mode 100755 index 0000000..020257e --- /dev/null +++ b/recipes/init-ifupdown/init-ifupdown/fixed_mac_address @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ ! -e /etc/network/interfaces.fixed ]; then + HWADDRESS=$(cat /sys/class/net/eth0/address) + sed -i -e 's,^#\(.*\)00:00:00:00:00:00,\1'$HWADDRESS',' /etc/network/interfaces + touch /etc/network/interfaces.fixed +fi diff --git a/recipes/init-ifupdown/init-ifupdown/interfaces b/recipes/init-ifupdown/init-ifupdown/interfaces index 02960ab..e315b94 100644 --- a/recipes/init-ifupdown/init-ifupdown/interfaces +++ b/recipes/init-ifupdown/init-ifupdown/interfaces @@ -16,7 +16,8 @@ iface atml0 inet dhcp # Wired or wireless interfaces auto eth0 iface eth0 inet dhcp -hostname `/bin/hostname` + hostname `/bin/hostname` +# hwaddress ether 00:00:00:00:00:00 iface eth1 inet dhcp # Ethernet/RNDIS gadget (g_ether) diff --git a/recipes/init-ifupdown/init-ifupdown_1.0.bbappend b/recipes/init-ifupdown/init-ifupdown_1.0.bbappend index 6d4804d..c2ed1b8 100644 --- a/recipes/init-ifupdown/init-ifupdown_1.0.bbappend +++ b/recipes/init-ifupdown/init-ifupdown_1.0.bbappend @@ -1,2 +1,8 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +SRC_URI += "file://fixed_mac_address" + +do_install_append() { + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/fixed_mac_address ${D}${sysconfdir}/network/if-pre-up.d/ +} -- cgit v1.2.3-54-g00ecf