백업 낸드 플래시 메모리 영역

백업 낸드 플래시 메모리 영역

Linux 버전 2.6.26.5 임베디드 시스템 탑재. 장치는 전체 이미지의 커널을 사용합니다. NAND 플래시 메모리에 저장된 파일 시스템, Hynix NAND 32MiB 3,3V 8비트.

# printenv
baudrate=115200
ethaddr=FF:FF:FF:FF:FF:FF
netmask=255.255.255.0
ipaddr=192.168.1.1
serverip=192.168.1.100
bootfile=firetux.kernel
bootcmd1=setenv bootargs ${bootargs} && nboot 0x20200000 0 ${image_addr} && bootm 0x20200000
bootcmd2=setenv bootargs ${bootargs} && tftpboot 20200000 firetux.kernel && bootm 20200000
phymode=auto
mtdids=nand0=gen_nand
unlock=yes
verify=y
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
HwModel=Hw_Model=NXPi02
bootcmd=run bootcmd1
halfImage=half_image=0
cy_boot_code_ver=1.0.1 (Oct  6 2011 - 20:04:00)
RouterMode=Router_Mode=0
stdin=serial
stdout=serial
stderr=serial
bootcmd=run bootcmd1
image_addr=0x80000
bootargs=console=ttyS1,115200n8 rootfstype=squashfs noalign half_image=0 verify=y Hw_Model=NXPi02 Router_Mode=0
ethact=ETN1
bootdelay=3

U-boot에서 NAND 메모리(NVRAM)의 일부 영역을 백업해야 합니다. 직렬 인터페이스(UART)를 통해 보드에 연결하지만 네트워크 연결을 사용할 수 없습니다. U-boot에는 Nand 메모리 관리를 위한 특정 옵션이 있습니다.

# 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)

특히,nand dump[.oob] off - dump page

낸드 란 무엇입니까?오프셋 주소이것을 위해? 덤프할 파티션 크기가 지정되지 않았습니다. 전체 NVRAM을 덤프해야 합니다.

장치가 커널 이미지를 로드한 후 11개의 MTD 파티션을 생성합니다.

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"

nvram 오프셋 주소 입니까 0x01f00000? nvram 크기는 무엇입니까? 0x80000인가요? U-boot에도 명령이 있습니다 md - memory display.

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

터미널에 nvram을 표시하는 명령을 시도했지만 md.b 0x01f00000 0x80000아무 것도 출력하지 않고 터미널이 중단됩니다.


편집: [추가]

# 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

명령을 사용하여 수행하는 작업에 더욱 주의를 기울이고 싶을 것입니다. md 명령은 해당 위치의 메모리를 보여줍니다. md.b를 사용하면 바이트 단위로 출력되므로 의심할 여지 없이 tty를 혼란스럽게 합니다. 귀하의 명령은 기본적으로 0x01f00000에서 0x01f00000 + 0x80000까지 메모리의 모든 바이트를 라인을 통해 나에게 보내라고 말합니다. 또한 nand dumb은 당신이 생각하는 대로 행동하지 않습니다.

기기 가져오기

nand info

장치 설정

nand device nand0

파티션 이름만 사용하세요.

nand read 0x20000000 NVRAM 0x00080000

이것이 수행하는 작업을 명확히 하려면 파티션 nvram에서 524288(16진수로 0x00080000) 바이트를 메모리 위치 0x20000000으로 읽습니다. 전체 파티션을 원할 경우 크기를 생략할 수도 있습니다.

nand read 0x20000000 NVRAM

이제 메모리에 NVRAM이 있으므로 어딘가에 기록해야 합니다. ext4 파일 시스템을 가정해 보겠습니다.

ext4write LINUX_ROOTFS /NVRAM.img 0x20000000 0x00080000

관련 정보