[LEDE-DEV] ar71xx: Need advice on parsing specific board config data on TP-Link TL-WR942N

Sergey Studzinski serguzhg at gmail.com
Mon Feb 20 15:00:23 PST 2017


I'm currently working on LEDE port for TP-Link TL-WR942N v1 N450 router.
Hardware is mostly like Archer C59 QCA9561 platform but no 5GHz ac
radio and two USB2.0 ports.
Most work is already done against 17.01-rc2 and there is working
factory and sysupgrade images.
Special thanks to Henryk Heisig and Felix Fietkau for their work!
Pecularities are found with MAC and some other specific board config
data which are not stored on first
mtd0(u-boot) partition like on Archers but right after rootfs
partition in a slightly different format (ASCII instead
of binary). Due this router starts with random MACs now.

There is factory partition table:
-----
root at LEDE:~# strings /dev/mtd5
partition fs-uboot base 0x00000 size 0x20000
partition os-image base 0x20000 size 0x150000
partition file-system base 0x170000 size 0xcd0000
partition default-mac base 0xe40000 size 0x00200
partition pin base 0xe40200 size 0x00200
partition product-info base 0xe40400 size 0x0fc00
partition partition-table base 0xe50000 size 0x10000
partition soft-version base 0xe60000 size 0x10000
partition support-list base 0xe70000 size 0x10000
partition profile base 0xe80000 size 0x10000
partition default-config base 0xe90000 size 0x10000
partition user-config base 0xea0000 size 0x40000
partition qos-db base 0xee0000 size 0x40000
partition certificate base 0xf20000 size 0x10000
partition usb-config base 0xfb0000 size 0x10000
partition log base 0xfc0000 size 0x20000
partition radio-bk base 0xfe0000 size 0x10000
partition radio base 0xff0000 size 0x10000
-----
Currently on the LEDE port three partitions (defalt-mac, pin,
product-info) are united in one 64K
partition. Content is like:
-----
root at LEDE:~# hexdump -C /dev/mtd4
00000000  00 00 00 16 00 00 00 00  4d 41 43 3a 38 34 2d 31  |........MAC:84-1|
00000010  36 2d 12 34 2d 56 78 2d  9a bc 2d de f0 0a ff ff  |6-F9-12-34-56...|
00000020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000200  00 00 00 09 00 00 00 00  35 38 36 33 33 37 32 34  |........58633724|
00000210  0a 00 ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000220  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00000400  00 00 00 96 00 00 00 00  76 65 6e 64 6f 72 5f 6e  |........vendor_n|
00000410  61 6d 65 3a 54 50 2d 4c  49 4e 4b 0a 76 65 6e 64  |ame:TP-LINK.vend|
00000420  6f 72 5f 75 72 6c 3a 77  77 77 2e 74 70 2d 6c 69  |or_url:www.tp-li|
00000430  6e 6b 2e 63 6f 6d 0a 70  72 6f 64 75 63 74 5f 6e  |nk.com.product_n|
00000440  61 6d 65 3a 54 4c 2d 57  52 39 34 32 4e 0a 6c 61  |ame:TL-WR942N.la|
00000450  6e 67 75 61 67 65 3a 55  4e 0a 70 72 6f 64 75 63  |nguage:UN.produc|
00000460  74 5f 76 65 72 3a 31 2e  30 2e 30 0a 70 72 6f 64  |t_ver:1.0.0.prod|
00000470  75 63 74 5f 69 64 3a 30  39 34 32 30 30 30 31 0a  |uct_id:09420001.|
00000480  73 70 65 63 69 61 6c 5f  69 64 3a 35 32 35 35 30  |special_id:52550|
00000490  30 30 30 0a 63 6f 75 6e  74 72 79 3a 52 55 00 ff  |000.country:RU..|
000004a0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
*
00010000
-----

Is there already special parser for this data somewhere in LEDE tree
or should we write new one?
Or can we move this data on the second mtd0 sector on the first boot
and have it mostly like and
compatible with Archer C59/c60 code? BTW factory u-boot fits on first
64kbytes and second 64K
sector is completely 0xFF.
As for now partitions from 0xe40000 is not writable to preserve OEM
firmware compatibility. IMHO it is not good idea to broke it.

Thank You on future advice.

Serg Studzinski



More information about the Lede-dev mailing list