[OpenWrt-Devel] write/read from mtd ART partition

John Crispin blogic at openwrt.org
Tue Feb 16 06:16:00 EST 2016


On 16/02/2016 11:43, John kerry wrote:
> Hi
> 
> I am trying to write mac address and Serial number in ART partition.
> 
> Creating 6 MTD partitions on "spi0.0":
> 0x000000000000-0x000000040000 : "u-boot"
> 0x000000040000-0x000000050000 : "u-boot-env"
> 0x000000050000-0x000000680000 : "rootfs"
> mtd: partition "rootfs" set to be root filesystem
> mtd: partition "rootfs_data" created automatically, ofs=5B0000, len=D0000
> 0x0000005b0000-0x000000680000 : "rootfs_data"
> 0x000000680000-0x0000007f0000 : "kernel"
> 0x0000007f0000-0x000000800000 : "art"
> 0x000000050000-0x0000007e0000 : "firmware"
> 
> cat /proc/mtd
> dev:    size   erasesize  name
> mtd0: 00040000 00010000 "u-boot"
> mtd1: 00010000 00010000 "u-boot-env"
> mtd2: 00630000 00010000 "rootfs"
> mtd3: 000d0000 00010000 "rootfs_data"
> mtd4: 00170000 00010000 "kernel"
> mtd5: 00010000 00010000 "art"
> mtd6: 00790000 00010000 "firmware"
> 
> Could anyone help me to write wifi mac address and Serial number to ART
> partition without overwriting on calibration data.
> 
> Thanks,
> John
> 

Hi,

you need to read the whole partition, edit it and write it back. there
is no way to just write 6 bytes without previously deleting all data and
then writing a 64k sector.

John


> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
> 
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list