如何使用 u-boot 和 linux 控制台将固件从一个设备传输到另一个设备?

How to transfer firmware from device to device using u-boot and linux console?

我有相同的设备,我想将一个的固件复制到另一个。我已经尝试过 Hacking HI3518 based IP camera that is copying mtd partitions and storing them to other device using sf commands. However, I failed at probing stage (another problem 中描述的方法)。所以,我正在寻找另一种方式。

您知道如何使用 u-boot 和 linux 控制台将固件从一个设备传输到另一个设备吗?

  • 检查 mtd 分区:cat /proc/mtd(linux 设备)

    mtd0: 00100000 00020000 "boot1"
    mtd1: 00100000 00020000 "m0patch"
    mtd2: 00100000 00020000 "dtb"
    mtd3: 00200000 00020000 "config"
    mtd4: 00100000 00020000 "info"
    mtd5: 00200000 00020000 "u-boot1"
    mtd6: 00200000 00020000 "u-boot2"
    mtd7: 00800000 00020000 "kernel1"
    mtd8: 00800000 00020000 "kernel2"
    mtd9: 01e00000 00020000 "initrd"
    mtd10: 3c600000 00020000 "rootfs"
    
  • 复制 mtd 分区:dd if=/dev/mtdblock9 of=/tmp/mtdblock9 bs=65536(linux 设备)

  • 使用任何可用的通道(我使用 z-modem)将 mtd 从设备复制到主机:lsz /tmp/mtdblock9

  • 从Nand中删除mtd分区:nand erase initrd(其他设备的u-boot)

  • 从mtdparts中删除mtd分区mtdparts del initrd(其他设备的u-boot)

  • Get the mtd image from host to other device (I use kermit and loadb): 给出下一个命令中使用的地址和大小。 (假设它们分别是 0x00000001 和 0x4000)

  • 写入nand这个复制的图像:nand write <memory address> <offset> <size>(0x1e00000在第一个命令中作为偏移量给出)

     nand write 0x00000001  0x1e00000  0x4000
    
    NAND write: device 0 offset 0x01e00000  , size 0x4000
    16384 bytes written: OK