无线论坛 门户 我要刷机 查看内容

最全的u-boot命令详解

2016-6-28 13:59| 查看: 12432| 评论: 6|来自: Anywlan

uboot一个小型的linux核心,其命令非常丰富,本文收集了常用的命令和操作供大家参考。
五、Nand Flash操作指令


常用的Nand Flash指令如下:

指令

功能

nand info显示可使用的Nand Flash
nand device [dev]显示或设定当前使用的Nand Flash
nand read
addr off
size
Nand Flash读取命令,从Nand off 偏移地址处读取size 字节的数据到SDRAM addr地址。
nand write
addr off
size
Nand Flash烧写命令,将SDRAM addr地址处的size 字节的数据烧写到Nand off 偏移地址。
nand write[.yaffs[1]]
addr off size
烧写yaffs 映像专用的命令,.yaffs1 for 512+16 NAND
nand erase [clean] [off size]Nand Flash檫除命令,擦除Nand Flash off 偏移地址处的size 字节的数据
nand bad显示Nand Flash的坏块
nand dump[.oob] off显示Nand Flash中的数据(16进制)
nand scrub彻底擦除整块Nand Flash中的数据,包括OOB。可以擦除软件坏块标志。
nand markbad off标示 Nand off 偏移地址处的块为坏块

使用范例:
  
[u-boot@MINI2440]# nand info

Device 0: NAND 128MiB 3,3V 8-bit, sector size 128 KiB
[u-boot@MINI2440]# nand device 0
Device 0: NAND 128MiB 3,3V 8-bit... is now current device
[u-boot@MINI2440]# nand read 0x30008000 0x60000 200000

NAND read: device 0 offset 0x60000, size 0x200000
2097152 bytes read: OK
[u-boot@MINI2440]# nand bad

Device 0 bad blocks:
  030a0000
  030c0000
  030e0000
  07ee0000
[u-boot@MINI2440]# nand markbad 0x500000
block 0x00500000 successfully marked as bad
[u-boot@MINI2440]# nand bad 

Device 0 bad blocks:
  00500000
  030a0000
  030c0000
  030e0000
  07ee0000
[u-boot@MINI2440]# nand scrub

NAND scrub: device 0 whole chip
Warning: scrub option will erase all factory set bad 
         There is no reliable way to recover them.
         Use this command only for testing purposes if you
         are sure of what you are 

Really scrub this NAND flash? <y/N>
Erasing at 0x2f4000008000000 -- 0% complete.
NAND 128MiB 3,3V 8-bit: MTD Erase failure: -5

NAND 128MiB 3,3V 8-bit: MTD Erase failure: -5

NAND 128MiB 3,3V 8-bit: MTD Erase failure: -5
Erasing at 0x7ea000008000000 -- 0% complete.
NAND 128MiB 3,3V 8-bit: MTD Erase failure: -5
Erasing at 0x7fe000008000000 -- 0% complete.
OK
[u-boot@MINI2440]# nand bad

Device 0 bad blocks:
  030a0000
  030c0000
  030e0000
  07ee0000
[u-boot@MINI2440]# nand dump 0x8000
Page 00008000 dump:
    ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
         ()
OOB:
    ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff
[u-boot@MINI2440]# tftp u-boot.bin
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:08:11:18:12:27
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 192.168.1.100; our IP address is 192.168.1.101
Filename 'u-boot.bin'.
Load address: 0x30008000
Loading: T ##################
done
Bytes transferred = 256220 (3e8dc hex)
[u-boot@MINI2440]# nand write 0x30008000 0 40000

NAND write: device 0 offset 0x0, size 0x40000
Writing at 0x2000000020000 -- 100% is complete. 262144 bytes written: OK
[u-boot@MINI2440]# nand dump 0x8000
Page 00008000 dump:
    00 00 53 e1 01 00 00 2a 15 40 e0 e3 19 00 00 ea
         ()
    60 30 97 e5 03 00 54 e1 f6 ff ff ba 00 40 a0 e3
OOB:
    ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff
    ff ff ff ff ff ff ff ff
    65 a9 6b f3 ff 33 fc 30
    f3 33 cf 33 0f f0 ff 00
    cc 0f 59 55 57 96 a5 5b


    nboot 指令也是一条Nand Flash 读取指令,它是将Nand Flash 的 offset 偏移地址的内核映像读取到SDRAM的loadAddr位置。它会自动读取到内核映像(使用mkimage处理过的)的结束,所以不用给出读取大小。
格式:nboot  loadAddr  dev  offset
使用范例:
[u-boot@MINI2440]# tftp 192.168.1.100:zImage.img
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:08:11:18:12:27
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 192.168.1.100; our IP address is 192.168.1.101
Filename 'zImage.img'.
Load address: 0x30008000
Loading: T #################################################################
     #################################################################
     ##########################
done
Bytes transferred = 2277540 (22c0a4 hex)
[u-boot@MINI2440]# nand erase 0x100000 300000

NAND erase: device 0 offset 0x100000, size 0x300000
Erasing at 0x3e000001800000 -- 0% complete.
OK
[u-boot@MINI2440]# nand write 0x30008000 0x100000 300000

NAND write: device 0 offset 0x100000, size 0x300000
Writing at 0x3e000000020000 -- 100% is complete. 3145728 bytes written: OK
[u-boot@MINI2440]# nand device 0
Device 0: NAND 128MiB 3,3V 8-bit... is now current device
[u-boot@MINI2440]# nboot 30008000 0 0x100000

Loading from NAND 128MiB 3,3V 8-bit, offset 0x100000
   Image Name: tekkaman
   Created: 2010-03-29 12:59:51 UTC
   Image Type: ARM Linux Kernel Image (uncompressed)
   Data Size: 2277476 Bytes = 2.2 MB
   Load Address: 30008000
   Entry Point: 30008040

[u-boot@MINI2440]# bootm 30008000
## Booting kernel from Legacy Image at 30008000 ...
   Image Name: tekkaman
   Created: 2010-03-29 12:59:51 UTC
   Image Type: ARM Linux Kernel Image (uncompressed)
   Data Size: 2277476 Bytes = 2.2 MB
   Load Address: 30008000
   Entry Point: 30008040
   Verifying Checksum ... OK
   XIP Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.33.(tekkaman@MAGI-Linux) (gcc version 4.3.2(crosstool-NG-1.6.1-tekkaman) ) #5 Mon Mar 29 20:58:50 CST 2010
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: MINI2440
(略)

19

高人
2

专业

握手

霸气

雷人

吐血

山寨

奋斗

刚表态过的朋友 (21 人)

发表评论

最新评论

引用 gd28084646 2016-10-26 19:04
看不懂
引用 deepinwl 2016-8-8 01:37
搞成一个PDF文件更好学与用吧
引用 deepinwl 2016-8-8 01:35
与CISCO的IOS一样的啦
引用 below63 2016-6-29 13:07
但是uboot已经不再更新了/微笑
引用 wyzabc110 2016-6-28 22:13
学习下...............
引用 modi5156 2016-6-28 21:53
菜鸟来学习下!灰常感谢大神科普

查看全部评论(6)

文章栏目
论坛新贴
今日热议
本周排行
最新文章

站点统计 | Archiver | 手机版 | 无线门户 ( 粤ICP备11076993号|粤公网安备44010602008359号 ) |网站地图

GMT+8, 2025-5-1 18:54

返回顶部