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

micke.prag at telldus.se micke.prag at telldus.se
Tue Feb 16 06:23:12 EST 2016


2016-02-16 11:43 skrev John kerry:

> 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
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel [1]

You may modify these three lines for your application. You need to 
alter the offset for the mac address:

dd if=/dev/mtd5 of=/tmp/art.img
printf "\xAA\xBB\xCC\xDD\xEE\xFF" | dd conv=notrunc of=/tmp/art.img 
bs=1 seek=$((0x10))
mtd write /tmp/art.img art
_______________________________________________
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