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

时间:2017-10-05 14:03:08

标签: linux u-boot

我有相同的设备,我想将一个固件复制到另一个。我在Hacking HI3518 based IP camera尝试了这里描述的方法,即复制mtd分区并使用sf命令将它们存储到其他设备。但是,我在探测阶段(another problem)失败了。所以,我正在寻找另一种方式。

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

1 个答案:

答案 0 :(得分:-1)

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

    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设备)

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

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

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

  • 从主机获取mtd映像到其他设备(我使用kermitloadb):给出下一个命令中使用的地址和大小。 (假设它们分别是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