[U-Boot-Users] Problem in Passing MAC address from u-boot to linux after reading it from eeprom

Vijay g.vijaychakravarthy at gdatech.co.in
Tue Nov 8 16:17:21 CET 2005


Hello All,

I am working on u-boot-1.1.2  and working on MPC8540 based board.I have one issue regarding reading MAC address from EEPROM and passing the same to Linux. I added little bit of code in common/main.c to read mac address from eeprom as follows.

 printf("\n Reading EEPROM for MAC addresses");
 if(i2c_read(0x50, 0, 1, macbuf, 12) != 0) 
   puts ("Error reading EEPROM chip for MAC address.\n");
 udelay(100);
 sprintf(macaddr1,"%02X:%02X:%02X:%02X:%02X:%02X\n",macbuf[0],macbuf[1],macbuf[2],macbuf[3],macbuf[4],macbuf[5]);
 sprintf(macaddr2,"%02X:%02X:%02X:%02X:%02X:%02X\n",macbuf[6],macbuf[7],macbuf[8],macbuf[9],macbuf[10],macbuf[11]);
 
 printf("\n%s",macaddr1);
 printf("%s",macaddr2);
 eth_set_enetaddr(0,macaddr1);
 eth_set_enetaddr(1,macaddr2);

and added code in common/cmd_nvedit.c to update the same board info structure to be passed to the linux.
else
 {
   int i;
   extern unsigned char macbuf[]; 
    for (i=0; i<6; ++i) {
   bd->bi_enetaddr[i] = macbuf[i];
  
  }
  for (i=6; i<12; ++i) {
     bd->bi_enet1addr[i-6] = macbuf[i];
  }


The problem being, the linux is getting the MAC address that was read from eeprom if I download linux and ramdisk to RAM using tftp and bootm by giving ram addresses. Linux is not getting the Mac addresses if I bootm by giving  flash addresses of  linux and ramdisk that are present in flash.

Thanks in advance.

Regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20051108/b12804ee/attachment.htm 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: BitDefender.txt
Url: http://lists.denx.de/pipermail/u-boot/attachments/20051108/b12804ee/attachment.txt 


More information about the U-Boot mailing list