Upload firmware from Flash using U-Boot

11,435

Solution 1

Assuming that you are using NAND flash and U-Boot 2013.07 or similar:

  1. Use the nand info command to see the NAND device names, sizes and erase block sizes for each NAND device that U-Boot detects
  2. Use the nand read command to read from the NAND into RAM. How much NAND to read into RAM depends on the RAM size
  3. If you have an SD (MMC) drive you can write from RAM to SD using the mmc write command
  4. If you have a USB device you can use start usb to scan the USB for a mass storage or "ethernet" (i.e. OTG) device
  5. If start usb detects a mass storage device, you can write from RAM to the mass storage device using the usb write command
  6. There is no way to transfer from RAM to a USB or Ethernet network connection
  7. Use the md command to hex dump arbitrary size block of memory to the serial line, then use some program to translate the ASCII hex back into binary

Solution 2

If you're willing to rebuild uboot and reflash your board, you can enable the tftpput command with the CONFIG_CMD_TFTPPUT option. (Assuming a recent version of uboot.)

Assuming not, within the embedded Linux, you can access your flash through /dev/mtd* (cat /proc/mtd to see the partitions). You can use dd to copy a partition to a ramdisk file, then use cat to combine the files into a single image, and the use ftpput to send it to your host. (This assumes that your embedded busybox has been built with these commands.)

Share:
11,435

Related videos on Youtube

user3396423
Author by

user3396423

Updated on June 04, 2022

Comments

  • user3396423
    user3396423 almost 2 years

    I have a problem. My system is an embedded Linux plaform. I am connecting to my board using serial port and I can access U-Boot.

    I need to extract the complete firmware residing in flash through the console or through Ethernet. It looks like downloading is easy using TFTP or serial (Kermit, etc), but uploading it to the host PC for backup isn't obvious.

    Does anyone know how this can be done?

  • user3396423
    user3396423 about 10 years
    Will tftp load u-boot to RAM?
  • DoxyLover
    DoxyLover about 10 years
    Sorry, I don't understand your question.
  • Abbafei
    Abbafei about 7 years
    Used md.b on device, and cut -b 12-58 | xxd -r -p on computer, works well, thank G-d :-)
  • Abbafei
    Abbafei about 7 years
    invoking md.b like this: md.b 0x<offset> <length_in_bytes>