mtd|mtd 追加配置文件失败

Usage: mtd [ ...] [ ...] [:...]The device is in the format of mtdX (eg: mtd4) or its label. mtd recognizes these commands: unlockunlock the device refreshrefresh mtd partition eraseerase all data on device verify |-verify (use - for stdin) to device write |-write (use - for stdin) to device jffs2write append to the jffs2 partition on the device fixseamafix the checksum in a seama header on first boot Following options are available: -qquiet mode (once: no [w] on writing, twice: no status messages) -nwrite without first erasing the blocks -rreboot after successful command -fforce write without trx checks -e erase before executing the command -d directory for jffs2write, defaults to "tmp" -j integrate into jffs2 data when writing an image -s skip the first n bytes when appending data to the jffs2 partiton, defaults to "0" -pwrite beginning at partition offset -l the length of data that we want to dumpExample: To write linux.trx to mtd4 labeled as linux and reboot afterwards mtd -r write linux.trx linux

mtd工具可以使用-j 参数,使在更新的固件里带上某些文件,一般是配置文件,用法如下参考
mtd -r -j /tmp/sysupgrade.tgz write /tmp/LW1102-2.0.18.7.bin "firmware"

firmware 是指固件所处的分区的名称,如下
root@OpenWrt:~# cat /proc/mtd dev:sizeerasesizename mtd0: 00030000 00010000 "u-boot" mtd1: 00010000 00010000 "u-boot-env" mtd2: 00010000 00010000 "factory" mtd3: 007b0000 00010000 "firmware" mtd4: 001171fe 00010000 "kernel" mtd5: 00698e02 00010000 "rootfs" mtd6: 000f0000 00010000 "rootfs_data" root@OpenWrt:~# cat /proc/partitions major minor#blocksname310192 mtdblock0 31164 mtdblock1 31264 mtdblock2 3137872 mtdblock3 3141116 mtdblock4 3156755 mtdblock5 316960 mtdblock6

【mtd|mtd 追加配置文件失败】上述命令含义为,将/tmp/LW1102-2.0.18.7.bin 固件与/tmp/sysupgrade.tgz一起烧写进入 firmware分区中,之后重启。但是重启之后,mips设备上却没有该文件。目前准备尝试使用jffs2write 尝试看看是否可以将文件传入新固件中,从而获得之前的配置文件。

    推荐阅读