Linux version embedded system on board. Device use full Image's Kernel. File system stored on NAND Flash memory, Hynix NAND 32MiB 3,3V 8-bit.

# printenv
bootcmd1=setenv bootargs ${bootargs} && nboot 0x20200000 0 ${image_addr} && bootm 0x20200000
bootcmd2=setenv bootargs ${bootargs} && tftpboot 20200000 firetux.kernel && bootm 20200000
update.uboot=echo Update u-boot && tftpboot 0x20000000 nandboot.flash && nand erase 0x0 0x03ffff && nand write.jffs2 0x20000000 0x0 ${filesize}
update.kernel=echo Update kernel && tftpboot 0x20000000 uImage && nand erase 0x80000 0x180000 && nand write.jffs2 20000000 0x80000 0x180000
update.romimg=echo Update RomImage && tftpboot 0x20000000 romimage.img && nand erase 0x80000 0x13e0000&& nand write.jffs2 20000000 0x80000 ${filesize}
update.halfimg=echo Update HalfImage && tftpboot 0x20000000 recovery.img && nand erase 0x1460000 0x700000&& nand write.jffs2 20000000 0x1460000 ${filesize}
eraseenv=echo Erase Environment && nand erase 0x60000 0x20000
bootcmd=run bootcmd1
cy_boot_code_ver=1.0.1 (Oct  6 2011 - 20:04:00)
bootcmd=run bootcmd1
bootargs=console=ttyS1,115200n8 rootfstype=squashfs noalign half_image=0 verify=y Hw_Model=NXPi02 Router_Mode=0

Need to backup some areas of NAND memory (NVRAM) from U-boot, connection to board via serial interface (UART), network connection is not available. U-boot have certain options for managing nand memory:

# help nand
nand info - show available NAND devices
nand device [dev] - show or set current device
nand read - addr off|partition size
nand write - addr off|partition size
    read/write 'size' bytes starting at offset 'off'
    to/from memory address 'addr', skipping bad blocks.
nand erase [clean] [off size] - erase 'size' bytes from
    offset 'off' (entire device if not specified)
nand bad - show bad blocks
nand dump[.oob] off - dump page
nand scrub - really clean NAND erasing bad blocks (UNSAFE)
nand markbad off - mark bad block at offset (UNSAFE)
nand biterr off - make a bit error at offset (UNSAFE)

In particular, nand dump[.oob] off - dump page

What is nand offset address for this? There was not specified partition size to dump. I need dump the whole NVRAM.

After device loading Kernel Image, it creates 11 MTD partitions:

Creating 11 MTD partitions on "gen_nand":
0x00000000-0x00060000 : "u-boot"
0x00060000-0x00080000 : "u-bootenv"
0x00080000-0x01460000 : "ROMIMAGE"
0x01460000-0x01b60000 : "HALFIMAGE"
0x00200000-0x01460000 : "LINUX_ROOTFS"
0x01b60000-0x01d60000 : "HS_FW"
0x01d60000-0x01e60000 : "FPAR"
0x01e60000-0x01ee0000 : "SNOM"
0x01ee0000-0x01f00000 : "EEPROM"
0x01f00000-0x01f80000 : "NVRAM"
0x01f80000-0x02000000 : "CA_DATA"

Is the 0x01f00000 nvram offset address? What is nvram size? Is it 0x80000? U-boot also have command md - memory display.

=> help md
md - memory display
md [.b, .w, .l] address [# of objects]

I tried command md.b 0x01f00000 0x80000 to display nvram on terminal, but it doesn't output anything, terminal hungs up.

EDIT: [an addition]

# nand info

Device 0: NAND 32MiB 3,3V 8-bit, sector size 16 KiB
# nand device nand0
Device 0: NAND 32MiB 3,3V 8-bit... is now current device
# nand read 0x20000000 NVRAM

NAND read: mtdparts variable not set, see 'help mtdparts'
incorrect device type in NVRAM
'NVRAM' is not a number
# nand read 0x20000000 0x01f00000 0x00080000

NAND read: device 0 offset 0x1f00000, size 0x80000
 524288 bytes read: OK

BusyBox v1.10.2 (2015-09-06 10:58:05 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/bin/sh: can't access tty; job control turned off
# help

Built-in commands:
    . : [ [[ alias bg break cd chdir continue echo eval exec exit
    export false fg hash help jobs let local pwd read readonly return
    set shift source test times trap true type ulimit umask unalias
    unset wait

# ext4write LINUX_ROOTFS /NVRAM.img 0x20000000 0x00080000
/bin/sh: ext4write: not found

1 Answer 1


You're going to want to be more careful what you do with commands. The md command shows you memory at that location. When you use md.b it outputs in bytes which no doubt confuses your tty. Your command basically says send me all bytes in memory from 0x01f00000 to 0x01f00000 + 0x80000 over the line. Also nand dumb doesn't do what you think it does.

Get devices

nand info

Set your device

nand device nand0

Just use the name of the partition

nand read 0x20000000 NVRAM 0x00080000

To be clear what this does: read 524288 (0x00080000 in hex) bytes from the partition nvram into memory location 0x20000000. You can also just omit the size if you want the whole partition.

nand read 0x20000000 NVRAM

Now with the NVRAM in memory you need to write it somewhere. Lets say an ext4 file system.

ext4write LINUX_ROOTFS /NVRAM.img 0x20000000 0x00080000
  • That's helpful. I tried use nand read 0x20000000 NVRAM 0x00080000, its not works on this board, but works with numerical offset. So for offset value we take the start offset of the partition, the size is difference between the start and end offsets of the partitions as hex values. And 'addr' is loadAddress in RAM where nand data should be loaded: 0x20000000 is start address of DRAM bank. Am I correct?
    – Lexx Luxx
    Commented Nov 26, 2017 at 23:43
  • There are difficulties to save nand data somewhere: ext4write command not available, board have no USB, and also no network connection. Therefore, is it possible hex dump of nand partition to the terminal serial line, so then I can use some script to convert the ASCII hex back into binary?
    – Lexx Luxx
    Commented Nov 27, 2017 at 10:19
  • @triwo You are correct. nand read [where in ram to start] [offset of start] [how many bytes to read] all values in hex. There is file transfer over serial line but I dind't mention it ibecause its complicated and I've never done it. You can using loadb (Kermit) and loady (YMODEM) commands. But it requires specific software on the host to download the data into a file.
    – jdwolf
    Commented Nov 28, 2017 at 0:13
  • If I were just loading a text file I would just pipe it over serial with job control off. But for binary I doubt thats safe.
    – jdwolf
    Commented Nov 28, 2017 at 0:15
  • nand dump[.oob] off - dump page -> does it dumps single page from specified offset, not a complete area? So we can't dump the complete nvram partition with it? loadb and loady(ymodem) is handy and easy to use for loading files over the serial line, but in u-boot they allow transfer files only in one direction, from computer to the RAM address, I can't see any support for sending files. Is there way to print nvram dump to terminal?
    – Lexx Luxx
    Commented Nov 28, 2017 at 13:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .