U-Boot: manipulating NAND devices

U-Boot provides a set of commands to manipulate NAND devices, grouped under the nand command

  • nand info Show available NAND devices and characteristics
  • nand device [dev] Select or display the active NAND device
  • nand read[.option] Read data from NAND
  • nand write[.option] Write data on NAND
    • Use nand write.trimffs to avoid writing empty pages (those filled with 0xff)
  • nand erase Erase a NAND region
  • nand erase.part Erase a NAND partition
  • More commands for debugging purposes

U-Boot: manipulating NOR devices

  • U-Boot provides a set of commands to manipulate NOR devices
  • Memory mapped NOR devices

    • flinfo [devid] Display information of all NOR devices or a specific one if devid is provided
    • cp.[bwl] Read/write data from/to the NOR device
    • erase or erase + Erase a memory region
    • erase bank Erase a memory bank
    • erase all Erase all banks
    • protect on|off Protect a memory range
  • SPI NOR devices

  • Grouped under the sf command
  • sf probe [[bus:]cs] [hz] [mode] Probe a NOR device on
  • sf read|write Read/write data from/to a SPI NOR
  • sf erase + Erase a memory region
  • sf update Erase + write operation

Linux: MTD devices interface with user space

  • MTD devices are visible in /proc/mtd
  • The user space only see MTD partitions, not the flash device under those partitions
  • The mtdchar driver creates a character device for each MTD device/partition of the system
    • Usually named /dev/mtdX or /dev/mtdXro
    • Provide ioctl() to erase and manage the flash
    • Used by the mtd-utils utilities

Linux: user space flash management tools

  • mtd-utils is a set of utilities to manipulate MTD devices
    • mtdinfo to get detailed information about an MTD device
    • flash_erase to partially or completely erase a given MTD device
    • flashcp to write to NOR flash
    • nandwrite to write to NAND flash
    • Flash filesystem image creation tools: mkfs.jffs2, mkfs.ubifs, ubinize, etc.
  • On your workstation: usually available as the mtd-utils package in your distribution.
  • On your embedded target: most commands now also available in BusyBox.
  • See

results matching ""

    No results matching ""