-1

I have configured one OpenWrt (lets call it child) to boot from sd card which has the firmware and software re-imaged from another OpenWrt (lets call it maker) as per following: http://labs.mediatek.com/forums/posts/list/3619.page#p7191.

Everything works fine except for the issue where wlan interface of child and maker are showing the same MAC address, the one of maker. Due to this I can connect to only one of them if they both are in AP mode.

I have tried giving 'macaddr' option in 'wifi-device', 'wifi-iface' but nothing works. I have also tried setting hardware address using command:

ifconfig ra0 hw ether 'XX:XX:XX:XX:XX:XX'

but this gives me error

ifconfig: SIOCSIFHWADDR: Operation not supported

I can see that the mac address is picked from

/sys/class/net/ra0/address

where ra0 is the interface name but its a read only file and is not there on sd card (atleast with the given path)

The mac address of the parent has to be on the sd card but can't find it using grep atleast.

So I would appreciate any help here, either in changing the address on sd card post imaging or override it in system startup.

Thanks

Shashank Singhal
  • 170
  • 1
  • 2
  • 9
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Internet of Things Stack Exchange](http://iot.stackexchange.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Jul 21 '18 at 15:19

2 Answers2

1

You can take a look on the calibration data in the "art" partition.If your MAC address is stored in it then you can change it.

root@OpenWrt:/# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 00030000 00010000 "u-boot"
mtd1: 00fc0000 00010000 "firmware"
mtd2: 00120000 00010000 "kernel"
mtd3: 00ea0000 00010000 "rootfs"
mtd4: 00c60000 00010000 "rootfs_data"
mtd5: 00010000 00010000 "art"

So my one is /dev/mtd5 . Now I will check the calibration data inside

cat /dev/mtd5 > art.img
hexdump art.img

My wifi MAC address is 04:F0:21:07:7C:EC .After running hexdump art.img it shows

0001000 0202 04f0 2107 7cec 0020 2020 0030 6530

I need to use a software application to modify art.img ,change "04f0 2107 7cec" to new MAC address

Then the final step is :copy the edited art.img to /dev/mtd5

 cat art.img > /dev/mtd5
Nam Pham
  • 316
  • 1
  • 6
  • Thanks Nam, your suggestion came useful. In my case the MAC was stored on /dev/mtd2 which linkit does not allow to change. However this value was correct in my case. The problem was with a cached copy which was also getting copied to the sd card. – Shashank Singhal Jul 03 '16 at 11:18
  • Glad I could help. Let me know if you encounter anymore problems. Cheers! – Nam Pham Jul 06 '16 at 09:32
  • 1
    The "art" partition is atheros specific. Many similar OpenWrt boards use the ar9331 etc, and in those cases that partition is indeed critical. However the board in the question uses a Mediatek SoC (of Ralink heritage) that does things differently. – Chris Stratton Jan 16 '17 at 21:14
1

Thanks for the help.

It seems that for mediatek linkit 7688, the MAC is stored in /dev/mtd2. Ideally this is a ROM partition and should not be affected on booting from SD card or raw flash.

But I found that upon boot it caches the same under /lib/firmware/mt7628.eeprom file which also gets copied on preparing sd card from a linkit.

So when I boot second linkit from sd card it considers the first linkit cache as its own /dev/mtd2 cache and thus the problem.

To solve this, after the sd card image is prepared, remove the file /mnt/upper/lib/firmware/mt7628.eeprom and make a symlink to /overlay-boot/upper/lib/firmware/mt7628.eeprom where /mnt is sd card mount location and overlay-boot is raw flash mount location

Shashank Singhal
  • 170
  • 1
  • 2
  • 9