On Sat, Nov 26, 2011 at 01:20:01AM +0200, Roman Yeryomin wrote:
> On 25 November 2011 23:44, Luka Perkov <open...@lukaperkov.net> wrote:
> > On Fri, Nov 25, 2011 at 07:16:37PM +0200, Roman Yeryomin wrote:
> >> On 25 November 2011 13:20, Daniel Golle <dgo...@allnet.de> wrote:
> >> > Index: target/linux/ramips/base-files/lib/preinit/06_set_iface_mac
> >> > ===================================================================
> >> > --- target/linux/ramips/base-files/lib/preinit/06_set_iface_mac 
> >> > (revision 29328)
> >> > +++ target/linux/ramips/base-files/lib/preinit/06_set_iface_mac (working 
> >> > copy)
> >> > @@ -2,7 +2,7 @@
> >> >  # Copyright (C) 2011 OpenWrt.org
> >> >  #
> >> >
> >> > -nw718_set_mac() {
> >> > +extract_and_set_mac() {
> >> >        local part
> >> >        local mac
> >> >
> >> > @@ -10,13 +10,13 @@
> >> >
> >> >        . /etc/functions.sh
> >> >
> >> > -       part=$(find_mtd_part "factory")
> >> > +       part=$(find_mtd_part "$1")
> >> >        [ -z $part ] && return
> >> >
> >> > -       mac=$(dd bs=1 skip=4 count=6 if=$part 2>/dev/null | maccalc 
> >> > bin2mac)
> >> > +       mac=$(dd bs=1 skip=$2 count=6 if=$part 2>/dev/null | maccalc 
> >> > bin2mac)
> >> >        [ -z $mac ] && return
> >> >
> >> > -       mac=$(maccalc or "$mac" "02:00:00:00:00:00")
> >> > +       mac=$(maccalc or "$mac" "$3")
> >> >        ifconfig eth0 hw ether $mac 2>/dev/null
> >> >  }
> >> >
> >> > @@ -24,9 +24,12 @@
> >> >        . /lib/ramips.sh
> >> >
> >> >        case $(ramips_board_name) in
> >> >        bc2 | nw718)
> >> > -               nw718_set_mac
> >> > +               extract_and_set_mac "factory" 4 "02:00:00:00:00:00"
> >> >                ;;
> >> > +       hw550-3g)
> >> > +               extract_and_set_mac "factory" 40 "00:00:00:00:00:00"
> >> > +               ;;
> >> >        esac
> >> >  }
> >> >
> >> >
> >>
> >> Right.. this is what was already proposed at least 2 times before (by
> >> me and then, enhanced, by Alexander Gordeev) but never commited.
> >> There also are several pending patches for ramips platform (and
> >> affecting it) from me and others.
> >> Seems like OpenWrt needs more people with commit access to ramips target.
> >> I would be happy to help with that.
> >
> > Is in the target mac address writen in uboot environment partition?
> >
> 
> Well, it's there on all of my 5 different ramips routers.

I see that it's on uboot env now (missed find_mtd_part before). I think
that extract_and_set_mac should be moved elsewhere so all other targets
could use it then. If someone does not do it sooner I'll do it...

Luka

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to