diff --git a/meta-digi-del/recipes-core/netbase/netbase-5.0/ifup b/meta-digi-del/recipes-core/netbase/netbase-5.0/ifup new file mode 100644 index 000000000..892e63f17 --- /dev/null +++ b/meta-digi-del/recipes-core/netbase/netbase-5.0/ifup @@ -0,0 +1,48 @@ +#!/bin/sh -l +#=============================================================================== +# +# ifup +# +# Copyright (C) 2013 by Digi International Inc. +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 as published by +# the Free Software Foundation. +# +# +# !Description: Set network interfaces MAC addresses. +# +#=============================================================================== + +set -e + +# loopback methods are directly handled by ifup +[ "${METHOD}" = "loopback" ] && exit 0 + +# Do nothing if interface does not exist +[ ! -h /sys/class/net/${IFACE} ] && exit 0 + +if [ -h /sys/class/net/eth0 ]; then + driver="$(readlink -f -n /sys/class/net/eth0 | sed 's,\/,\n,g' | awk '/fec/ {print}')" + case ${driver} in + fec.*) + macaddr=`cat /proc/cmdline | sed 's,\s,\n,g' | awk '/ethaddr1/ {print}' | sed 's,ethaddr1=,,g'` + ;; + sms.*) + macaddr=`cat /proc/cmdline | sed 's,\s,\n,g' | awk '/ethaddr3/ {print}' | sed 's,ethaddr3=,,g'` + ;; + esac + if [ "${macaddr}" ]; then + /sbin/ifconfig eth0 hw ether ${macaddr} + fi +fi + +if [ -h /sys/class/net/eth1 ]; then + macaddr=`cat /proc/cmdline | sed 's,\s,\n,g' | awk '/ethaddr3/ {print}' | sed 's,ethaddr3=,,g'` + if [ "${macaddr}" ]; then + /sbin/ifconfig eth1 hw ether ${macaddr} + fi +fi + +exit 0 diff --git a/meta-digi-del/recipes-core/netbase/netbase-5.0/interfaces b/meta-digi-del/recipes-core/netbase/netbase-5.0/interfaces index 2d3b12bcc..b4720e4da 100644 --- a/meta-digi-del/recipes-core/netbase/netbase-5.0/interfaces +++ b/meta-digi-del/recipes-core/netbase/netbase-5.0/interfaces @@ -1,32 +1,3 @@ # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) -# The loopback interface -auto lo -iface lo inet loopback - -# Wireless interfaces -auto wlan0 -iface wlan0 inet dhcp - wireless_mode managed - wireless_essid any - wpa-driver wext - wpa-conf /etc/wpa_supplicant.conf - -iface atml0 inet dhcp - -# Wired or wireless interfaces -auto eth0 -iface eth0 inet dhcp -iface eth1 inet dhcp - -# Ethernet/RNDIS gadget (g_ether) -# ... or on host side, usbnet and random hwaddr -iface usb0 inet static - address 192.168.7.2 - netmask 255.255.255.0 - network 192.168.7.0 - gateway 192.168.7.1 - -# Bluetooth networking -iface bnep0 inet dhcp - +# Dummy file - will be autogenerated in target. diff --git a/meta-digi-del/recipes-core/netbase/netbase_5.0.bbappend b/meta-digi-del/recipes-core/netbase/netbase_5.0.bbappend index 332a21f91..c5c0280c6 100644 --- a/meta-digi-del/recipes-core/netbase/netbase_5.0.bbappend +++ b/meta-digi-del/recipes-core/netbase/netbase_5.0.bbappend @@ -1,3 +1,79 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:" PR_append = "+${DISTRO}.r0" + +DEPENDS="virtual/kernel" + +SRC_URI += "file://ifup" + +do_install_append(){ + install -m 0755 ${WORKDIR}/ifup ${D}${sysconfdir}/network/if-up.d +} + +pkg_postinst_${PN} () { +#!/bin/sh +cat << EOF > $D${sysconfdir}/network/interfaces +EOF + +cat $D/boot/config* | /bin/grep CONFIG_BLK_DEV_LOOP=y +if [ $? -eq 0 ]; then +cat << EOF >> $D${sysconfdir}/network/interfaces +# The loopback interface +auto lo +iface lo inet loopback +EOF +fi + +cat $D/boot/config* | /bin/grep CONFIG_FEC=y +if [ $? -eq 0 ]; then +# Primary wired interface +cat << EOF >> $D${sysconfdir}/network/interfaces +auto eth0 +# Use for dhcp +# iface eth0 inet dhcp +iface eth0 inet static + address 192.168.42.30 + netmask 255.255.255.0 + network 192.168.42.0 + gateway 192.168.42.1 + +EOF +fi + +# Secondary wired interface +cat $D/boot/config* | /bin/grep CONFIG_SMSC911X=y +if [ $? -eq 0 ]; then +cat << EOF >> $D${sysconfdir}/network/interfaces +auto eth1 +# Use for dhcp +# iface eth1 inet dhcp +iface eth1 inet static + address 192.168.44.30 + netmask 255.255.255.0 + network 192.168.44.0 + gateway 192.168.44.1 + +EOF +fi + +# Wireless interface +cat $D/boot/config* | /bin/grep CONFIG_WIRELESS=y +if [ $? -eq 0 ]; then +cat << EOF >> $D${sysconfdir}/network/interfaces +auto wlan0 +# Use for dhcp +# iface wlan0 inet dhcp +iface wlan0 inet static + address 192.168.43.30 + netmask 255.255.255.0 + network 192.168.43.0 + wireless_mode managed + wireless_essid any + wpa-driver wext + wpa-conf /etc/wpa_supplicant.conf + +EOF +fi +} + +CONFFILES_${PN} = "${sysconfdir}/hosts"