Hi ladies and gentleman xD
here comes an update to this issues and some questions
Analytics
okay well, I got the Wive-NG firmware compiled and working on my Asus RT-N12E B1 router. It works very well without the "LNA issue" (seems to be more an calibration issue with my current knowledge). I have filled the rt6352.c
from Wive-NG with DBGPRINT(RT_DEBUG_TRACE)
's and logged the RTMP_BBP_IO_WRITE8_BY_REG_ID()
with klogd
/syslogd
for many situations, such like $> wifi up/down
, connections, etc.
After that I realized that the LNA/calibration issue does not occur anymore on OpenWrt and seems to be fixed. I used the same OpenWrt squash image (sha1sum
verified) as before. Also the stock firmware (following "Stock") is working too as before. But curiously now, OpenWrt and Stock are using other MAC addresses for LAN/WAN/wifi adapters. So I got the idea that Wive-NG has flashed an (EEP-)ROM, which OpenWrt and Stock may are not doing. Next step I've done was to find out where the MAC addresses are located and found that there are located at the MTD block mtd2
, which is called factory
partition in OpenWrt https://github.com/openwrt/openwrt/blob/9ec5f5f230851ef9c980e99a43c3ddffca50a7fc/target/linux/ramips/dts/mt7620n_asus_rt-n12p.dts#L93
For tests, I erased the factory
partition and tried to boot all three firmwares. The result: Stock will be not full booting up anymore. OpenWrt is not getting up the wifi adapter anymore, as aspected as I read in the OpenWrt documentation https://openwrt.org/docs/techref/flash.layout#explanations (on Ralink: mtd4
-> mtd2
and art
-> factory
)
"mtd4 for the ART (Atheros Radio Test) - it contains calibration data for the wifi (EEPROM). If it is missing or corrupt, ath9k
(wireless driver) won't come up anymore."
Just the Wive-NG firmware is still fully working, by recovering the whole factory
partition. I could locate the raw BIN
data for it in the source as static C-array of the mt76x2+rt6352
driver in Wive-NG, called RT6352_EeBuffer[]
which will be set to pPRTMP_ADAPTER->chipCap.EEPROM_DEFAULT_BIN
in RT6352_Init()
https://gitlab.com/Ntemis/wive-ng-mt/-/blob/master/linux-3.4.x/drivers/net/wireless/ralink/mt76x2/chips/rt6352.c#L37
As you can see, you can locate the default MAC addresses (which will be patched be Wive-NG, but NOT by OpenWrt and Stock!) at offset RT6352_EeBuffer[4..9] = 00:0c:43:76:e8:72
for the primary MAC which is used for wifi. It's a Ralink Technology reserved MAC address. There are also 2 secondary MAC addresses at RT6352_EeBuffer[40..45]
and RT6352_EeBuffer[46..51]
.
The Wive-NG driver writes this raw BIN
data to an EEPROM pPRTMP_ADAPTER->EEPROMImage
during Set_LoadEepromBufferFromBin_Proc()
at https://gitlab.com/Ntemis/wive-ng-mt/-/blob/master/linux-3.4.x/drivers/net/wireless/ralink/mt76x2/common/eeprom.c#L464
These data seems to be used for calibrating the wifi of the MT7620, as you can see in mt76x2_cal_free_data_get()
at https://gitlab.com/Ntemis/wive-ng-mt/-/blob/master/linux-3.4.x/drivers/net/wireless/ralink/mt76x2/chips/mt76x2.c#L5048
Conclusion
With my current experience and knowledge I am really sure, that the Stock factory
partition was corrupted, from the OpenWrt point of view. The overwritten factory
partition is working well with all firmwares, I have tested: OpenWrt, Stock and Wive-NG itself. But I didn't backup the Stock factory
partition before I booted up Wive-NG, which enforces to overwrite it. Therefore, I can't reconstruct the issue and can not locate it in more detail. So it would be very helpful if anybody can provide a dump of a Stock factory/mtd2
partition.
Without it, I currently have no related issues anymore. But OpenWrt itself does not fix it. How could a fix working? The OpenWrt Documentation says, that OpenWrt won't bring up wifi adapters with corrupted factory
partitions. On the other hand it was a Stock partition, so it may be not broken and a bug in the OpenWrt driver.
If the OpenWrt wifi driver should fix the partition, then the next question is where the fix should be implemented? I think the calibration data are depending on the SoC MT7620N
and not on the wifi RT6352
itself. Also in the Wive-NG driver, the BIN
image is located in mt76x2/chips/rt6352.c
. The driver structure in OpenWrt seems not to be the same. On a short look to the OpenWrt driver structure, I think the BIN
data should be located in openwrt/mt76
sub-project. But currently the Ramips / mt7620n_asus_rt-n12p
is not using that driver and I would need some instructions/tutorial how make use of the mt76
driver in OpenWrt for the ramips / mt7620n_asus_rt-n12p
target.
Questions
- Can anyone provide a dump of the Stock
factory/mtd2
-partition from an Asus RT-N12E B1 for reconstructing the LNA/calibartion?
- Should corrupted
factory
partitions be fixed by the OpenWrt drivers?
- If yes: Where should the fix be implemented, which driver?
openwrt/mt76
is currently not loaded on Asus RT-N12E B1.
- Exist a tutorial which describes, how to make use of a new driver for a existing target machine?
Thanks for reading and hopefully some ideas,
Dirk =)