MAC Address assignment to librerouter

Dear SAN,

  1. I have set 3 mac addresses in u-boot as per the attached image using a command line.

  2. As per the below link of OpenWrt I check the command to get the mac address
    Link :

. /lib/functions/
get_mac_binary /dev/mtd4 0x4

  1. I checked the “/etc/bat-hosts” file and it stores mac address list as per the attached image

Among the above cases, I found that the mac assignment to the device(eth0,wlan0) as per the 3rd case but not getting an idea from where this mac address got.

Can you please support us on how to assign the mac address to a device or provide us the steps which you are following till now.?

Thanks & Best Regards,
Nikunj Patel

  1. MAC addresses can be stored and then used in many ways in the board. The way that is currently implemented is using the ART partition of the SPI flash, they are at offsets:
  • eth0: 0x000000
  • eth1: 0x000006
  • wlan0: 0x00000C

You can check the partitions with: cat /proc/mtd you should see something like

    root@OpenWrt:/# cat /proc/mtd
    dev:    size   erasesize  name
    mtd0: 00040000 00010000 "u-boot"
    mtd1: 00010000 00010000 "u-boot-env"
    mtd2: 007d0000 00010000 "firmware"
    mtd3: 00160000 00010000 "kernel"
    mtd4: 00670000 00010000 "rootfs"
    mtd5: 00480000 00010000 "rootfs_data"
    mtd6: 007d0000 00010000 "fw2"
    mtd7: 00010000 00010000 "ART"

In this case mtd7 is the ART partition, where the qualcom calibration data for the wlan0 is stored and also the MAC addresses. The calibration data is at offset 0x1000 of the ART partition.
You should be able to configure the MAC addresses using ART tool (I don’t know how but there should be an option there). It also can be setup from linux writing to /dev/mtd7

Dear SAN,

Thanks for your quick reply.

We found the 8 partition on our board as below but in your last message you show the 7 parttiton. i flashed “lr-u-boot-v1.1.0.bin” and “librerouteros-1.3-r8118+1-8fa342b289-ar71xx-generic-librerouter-v1-squashfs-sysupgrade.bin” firmware on our board.

0;root@LiMe-e724d5: /root@LiMe-e724d5:/# cat /proc/mtd
dev: size erasesize name
mtd0: 00040000 00010000 “u-boot”
mtd1: 00010000 00010000 “u-boot-env”
mtd2: 007c0000 00010000 “firmware”
mtd3: 00160000 00010000 “kernel”
mtd4: 00660000 00010000 “rootfs”
mtd5: 002e0000 00010000 “rootfs_data”
mtd6: 007c0000 00010000 “fw2”
mtd7: 00020000 00010000 “res”
mtd8: 00010000 00010000 “ART”

Also we have some query so please help us to clear those.

  1. What happens for the first time when SPI FLASH is blank and it has only u-boot binary preloaded?
  2. What happens if calibration data are not available for wlan0? didn’t start the radio? or it will give below error

ath9k: probe of qca955x_wmac failed with error -5

  1. How do you load the calibration data on /mtd/ART partition? can you please share with us the steps /document/link which can help us with the fresh board?

  2. is there any method to check the calibration data are available on SPI flash of librerouter which we purchased from the dragino?

Thanks & Best Regards,
Nikunj Patel

Dear SAN,

Can you please update on above query?

Thanks & Best Regards,
Nikunj Patel

Yes I showed the output of an old version, it is correct that the ART is the partition 8.

You can use TFTP (or serial) to flash the firmware in the first partition. You should follow the instructions here README · librerouter · LibreRouter / u-boot · GitLab in short:

run `sudo ./tools/ eth0 path/to/openwrt-ar71xx-generic-librerouter-v1-squashfs-sysupgrade.bin`
and at the serial interface execute:
    ath> tftp 82000000 openwrt-ar71xx-generic-librerouter-v1-squashfs-sysupgrade.bin
    ath> erase 0x9f050000 +$filesize
    ath> cp.b 0x82000000 0x9f050000 $filesize
    ath> boot

Also you can directly pre flash the SPI with the u-boot and the firmware. You just need to use the correct offsets for the firmware (0x9f050000).

Yes, the driver needs the calibration data to load AFAIK so it gives error -5.

I don’t know how to do it. I think that it can be done using the ART utility. Anyway you can always read and write to the FLASH from the firmware using the mtd utility ([OpenWrt Wiki] MTD).

Yes, you can dump the ART partition to a file with cat /dev/mtd8 > /tmp/ART.partition

1 Like

Dear SAM,
We purchased the new 5G modules (QCA9882 PCI Module) due to unavailability of existing 5GHz PCI module. Currently we are facing the issue to storing the MAC address of those PCI module and it always gives “00:03:07:12:34:56” MAC so can you help us for this? how you stored the MAC address in exist 5Ghz PCI module?

Thanks & Best Regards,
Nikunj Patel

Dear All;

if anyone from the team can provide solution or hint for that?

Thanks & Best Regards;
Nikunj Patel

Hi! Sorry I don’t know how to help you. Each module may be different on how to store the MAC and then how the driver retrieves and applies the MAC. I suggest you to write to the openwrt forum for help as this is a “generic” openwrt support question.

Here you have more information [OpenWrt Wiki] Device Support: MAC address setup

And also this thread Atheros QCA9882 driver loading issue - #3 by n007 - For Developers - OpenWrt Forum