change mac address

Andres
Hi im trying to change my mini's mac address (because i found that if i
have two mini 2440 on the same network i have problems with the connection
)

until now i have try with this command lines:

ifconfig eth0 down
ifconfig eth0 hw ether 00:11:AA:BB:CC:DD

but i have this mistake:

ifconfig: siocsifhwaddr operation not supported, what can i do to solve
this problem?

i hope someone can help me

thanks!

strgezer
MAC addresses are hardwired into the media controller on an ethernet
device, usually in a eeprom.    they are made to be unique to the device,
and are immutable(cannot be changed). 

try changing the IP addresses instead.   the IP addresses are tied to the
mac address of the device, and they can be changed.

davef
But, don't the MAC addresses have to be different for the two mini2440s on
the same network?

Having the same problem!

Andres
yes i bought two mini2400 and they have the same mac and differents ip
address, if both of them are turn on i have problems when i try to access
to one of them

Help please !!

grodriguez
The DM9000 does not store a MAC address internally. In the mini2440, the
MAC address is typically stored on the onboard I2C EEPROM, and read by the
bootloader. Check the documentation of the bootloader, depending on what
you are using (vivi, u-boot, barebox).

Guillermo

strgezer
MAC addresses are programmed into the device by the manufacturer.  they are
tightly controlled so they are guaranteed to be unique per device. if you
have two devices with the same MAC then something is very, very wrong.   
IP addresses are mapped to the MAC address of a particular device and are
assigned by the user or by the network software, such as DHCP.    

ethernet MAC addresses are 6 bytes and usually look like this:

01:23:45:67:89:ab

the values between the colon are hexadecimal and are in the range 00:ff

IP addresses are four bytes, and are usually written like this:

192.168.0.1

the values between the dots are in decimal and range between 0 and 255.

hope this helps!

davef
> if you
> have two devices with the same MAC then something is very, very wrong. 

This topic has come many times in the past.  There seem to various
workarounds, most of which don't seem to be explained well enough for
others to replicate.

My understanding is that all mini2440s come with the MAC address of
08:08:11:18:12:27 because the manufacturer did not buy a block of MAC
addresses.  They used some obsolete Oscilloscope MAC address.

Looking forward to be corrected or advised how to actually change the MAC
address.

davef
grodriguez,

> Check the documentation of the bootloader, depending on what
> you are using (vivi, u-boot, barebox).

Even changing the MAC address in barebox and saveenv, on re-powering the
MAC address reverts to the original.

Is there some other way of changing the MAC address using barebox?

Thanks,
Dave

Screwface
If you look at the datasheet of DM9000, you will see that MAC address is
stored in an optional EEPROM which is not present on the mini. Instead, the
MAC address is hardcoded in the kernel. You can change it with your
bootloader (u-boot, for the others I don't know)

grodriguez
davef:

> Even changing the MAC address in barebox and saveenv, on re-powering the
MAC address reverts to the original.

What do you have in your Barebox's env/config ?

Guillermo

davef
Guillermo,

Originally, I had the line "ip=dhcp" commented out.  Then because of
another issue it was suggested to change that to "ip=none".

I see now that doing that also "skips kernel ip configuration".

Looks like I need to understand better the implications of changes to this
line!

**************
#!/bin/sh

machine=mini2440
user=

# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
ip=none

# or set your networking parameters here
eth0.ipaddr=192.168.1.230
eth0.netmask=255.255.2555.0
eth0.gateway=192.168.1.1
eth0.serverip=192.168.1.3
eth0.ethaddr=08:08:11:18:12:27

***************

Thank you.

Dave

grodriguez
Dave,

Actually ip=none should not have any effect on the MAC address.

I have just verified that if I change the MAC address in env/config, even
with ip=none, the DM9000 gets properly configured:

[...]
dm9000 Ethernet Driver, V1.31
eth0: dm9000e at c485e300,c4860304 IRQ 51 MAC: aa:bb:cc:dd:ee:ff (chip)
[...]

Doesn't this work for you?

Guillermo

grodriguez
@strgezer:

> MAC addresses are hardwired into the media controller on an ethernet
> device, usually in a eeprom.    they are made to be unique to the device,
> and are immutable(cannot be changed). 
[...]
> MAC addresses are programmed into the device by the manufacturer.  they
are
> tightly controlled so they are guaranteed to be unique per device. if you
> have two devices with the same MAC then something is very, very wrong.   

Normally MAC addresses are not hardwired on the Ethernet device itself
(this would require on-chip non-volatile storage, thus increasing cost),
but actually stored on some kind of onboard non-volatile memory (flash,
EEPROM, battery backed SRAM -- depends on the board). While it is true that
MAC addresses are not meant to be "configured" or changed by end users, in
most cases they are not "immutable" at all.

Also on dev boards like the mini2440 it is kind of normal that the MAC
address is not pre-programmed, so depending on how the bootloader is
configured you may very well end up with a "fallback" MAC address which may
be the same for all boards.

Guillermo

davef
> Doesn't this work for you?

Well, it didn't the first time I tried . . . using the Pengutronix distro,
just edit /env/config, CTRL D and saveenv and this time it works!

Would be nice to know why, however thank you for persisting.

With ip=none when I changed the ip address in /env/config that didn't work.
 I had to go into /etc/network/interfaces and change it there.

Now two mini2440s talk to each other using a cross-over cable.

Cheers,
Dave

grodriguez
Dave,

Yes, the MAC address and IP configuration are handled differently:

IP configuration:
This is passed by Barebox to the kernel via the kernel command line
(bootargs). If you pass ip=none to the Linux kernel, then it will skip IP
configuration at boot time, which then needs to be done after the boot
process completes (for example in a startup script that reads
/etc/network/interfaces)

MAC address:
If I understand correctly Barebox will configure the DM9000 registers with
the specified MAC address. Then, when Linux boots, the Linux DM9000 device
driver will use the MAC address that is already configured in the chip.

Guillermo

Andres
HI the solution that you found, does it only works on barebox?

 "I change the MAC address in env/config, even"

im using supervivi and i need to change that mac, for now im going to read
documentation about supervivi.

at least someone have already done it.

i wait for advices thanks!

davef
Guillermo,

Thank you for explaining the process in more detail.

When I said, "Would be nice to know why . . ." I was referring to the
frustration caused by not knowing what fixed a particular problem :)

Andres,

http://groups.google.com/group/mini2440/browse_thread/thread/9d458655b9f...

and there are about 10 pages of hits on this site.

Good luck

Andres
hi i have been looking for where supervivi store the mac and i found the
file on

vivi/drivers/cs8900.c

the function its this:

void cs8900_get_enetaddr (uchar *addr)
{
    int i;
    /* verify chip id */
    if (get_reg_init_bus(PP_ChipID) != 0x630e)
  return;
    eth_reset();    
    if ((get_reg(PP_SelfST) & (PP_SelfSTAT_EEPROM | PP_SelfSTAT_EEPROM_OK))
== 
        (PP_SelfSTAT_EEPROM|PP_SelfSTAT_EEPROM_OK)) {
  /* Load the MAC from EEPROM */      
  for (i=0; i<6/2; i++) {
      unsigned int Addr;
      Addr = get_reg(PP_IA+i*2);
      addr[i*2] = Addr & 0xFF;
      addr[i*2+1] = Addr >> 8;
  }
    }    
}


how ever im not very good on c language so any help could be useful for me,
im going to study what do i have to change and how super vivi works firts.

i think that im step on where i have to work

Thanks for the help

Andres
hi i try to change the mac address from u-boot, i fail on that but here are
the steps i did, may be someone find some mistake or giveme some ideas.

my mini2440 has already install supervivi and qtopia (normal installation )

after that i enter to bios (to this menu)

##### FriendlyARM BIOS for 2440 #####
[x] bon part 0 320k 2368k
[v] Download vivi 
[k] Download linux kernel 
[y] Download root_yaffs image 
[c] Download root_cramfs image 
[a] Absolute User Application
[n] Download Nboot 
[e] Download Eboot 
[i] Download WinCE NK.nb0 
[w] Download WinCE NK.bin 
[d] Download & Run 
[f] Format the nand flash 
[p] Partition for Linux 
[b] Boot the system 
[s] Set the boot parameters 
[t] Print the TOC struct of wince 
[u] Backup NAND Flash to HOST through USB(upload) 
[r] Restore NAND Flash from HOST through USB 
[q] Goto shell of vivi 

Enter your selection: q

then:

load ram 0x31000000 242332 u

and after that i upload teh file uboot.128 bin

go 0x31000000

and after that i am on the uboot menu

then i enter this comand line

 MINI2440 # set ethaddr 08:00:2f:00:00:02

#i saved my configuration:

 MINI2440 # saveenv


after that i reboot my mini2440, but when i checked my mac (ifconfig) i
found that i didnt change anything.

i hope that someone can help me, thanks!

Jatuporn
MAC address setting was stored inside the file "/etc/eth0-setting",
the settings will use to set the eth0 device during boot by script
"/etc/init.d/ifconfig-eth0" (called from "/etc/init.d/rcS").

you just edit the MAC address value inside the file, that's all.

Andres
thanks for the idea but it doesnt work, i modified that file and change the
line:

ifconfig eth0 hw ether $mac

for this

ifconfig eth0 hw ether 00:00:11:33:AA:BB

But it continues with the same mistake:

siocsifhwaddr operation not supported

Andres
hi read all the eeprom but i didtn find the mac address, then where i can
change it?

help my boot system its supervivi

Andres
Hi finally i found the solution, i have to modified the driver cs8900 on
drivers/net

and after that compile my kernel again

i hope this can be useful for someone else

THanks for the help

Blueled1
Although solved, did you try this without the :'s?


su
ifconfig eth0 down
ifconfig eth0 hw ether 0011AABBCCDD