mtd 追加配置文件失败

Usage: mtd [ ...]  [ ...] [:...]

The device is in the format of mtdX (eg: mtd4) or its label.
mtd recognizes these commands:
        unlock                  unlock the device
        refresh                 refresh mtd partition
        erase                   erase 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
        fixseama                fix the checksum in a seama header on first boot
Following options are available:
        -q                      quiet mode (once: no [w] on writing,
                                           twice: no status messages)
        -n                      write without first erasing the blocks
        -r                      reboot after successful command
        -f                      force 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"
        -p                      write beginning at partition offset
        -l              the length of data that we want to dump

Example: 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:    size   erasesize  name
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  #blocks  name

  31        0        192 mtdblock0
  31        1         64 mtdblock1
  31        2         64 mtdblock2
  31        3       7872 mtdblock3
  31        4       1116 mtdblock4
  31        5       6755 mtdblock5
  31        6        960 mtdblock6

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

你可能感兴趣的:(mtd 追加配置文件失败)