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

最全的u-boot命令详解

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

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


boot  和bootd  都是运行ENV”bootcmd”中指定的指令。

bootm 指令是专门用于启动在SDRAM中的用U-boot的mkimage工具处理过的内核映像。
格式:bootm [addr [arg ...]]
addr 是内核映像所在的SDRAM中的地址
当启动的是Linux内核时,'arg' 可以使 initrd 的地址。

[u-boot@MINI2440]# setenv bootcmd tftp\;bootm
[u-boot@MINI2440]# saveenv
Saving Environment to NAND...
Erasing Nand...
Erasing at 0x6000000000002 -- 0% complete.
Writing to Nand... done
[u-boot@MINI2440]# boot
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)
## 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
(略)


U-Boot 2009.11 ( 4月 04 2010 - 12:09:25)

modified by tekkamanninja (tekkamanninja@163.com)
Love Linux 

I2C: ready
DRAM: 64 MB
Flash: 2 MB
NAND: 128 MiB
Video: 240x320x16 20kHz 62Hz
In: serial
Out: serial
Err: serial
Net: dm9000
U-Boot 2009.11 ( 4月 04 2010 - 12:09:25)
modified by tekkamanninja
(tekkamanninja@163.com)
Love Linux 
Hit any key to stop autoboot: 0
[u-boot@MINI2440]# bootd
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)
## 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 ...
(略)


12)EEPROM 读写指令eeprom  - I2C 接口的EEPROM 读写指令
格式:
eeprom read  addr off cnt
eeprom write addr off cnt
第一个参数addr 是要写入或读出的数据在SDRAM中的存放地址;
第二个参数off 是在EEPROM中的偏移;
第三个参数cnt 是读写的数据字节数。
使用范例:
[u-boot@MINI2440]# md.b 0x30008000 2
30008000: aa aa ..
[u-boot@MINI2440]# eeprom read 0x30008000 10 2

EEPROM @0x50 read: addr 30008000 off 0010 count 2 ... done
[u-boot@MINI2440]# md.b 0x30008000 2
30008000: ff ff ..
[u-boot@MINI2440]# mm.b 0x30008000
30008000: ff ? aa
30008001: ff ? 55
30008002: aa ? q
[u-boot@MINI2440]# md.b 0x30008000 2
30008000: aa 55 .U
[u-boot@MINI2440]# eeprom write 0x30008000 10 2

EEPROM @0x50 write: addr 30008000 off 0010 count 2 ... done
[u-boot@MINI2440]# eeprom read 0x30008010 10 2

EEPROM @0x50 read: addr 30008010 off 0010 count 2 ... done
[u-boot@MINI2440]# md.b 0x30008010 2
30008010: aa 55 .U


(13)设置和读取RTC指令

date    - 设置和读取RTC
格式:
date [MMDDhhmm[[CC]YY][.ss]]
MM:月份
DD:日期
hh:小时
mm 分钟
CC:年份的前两个数字
YY:年份的后两个数字
ss:秒数
使用范例:
[u-boot@MINI2440]# date
Date: 1980-00-06 (Thursday) Time: 20:30:25
[u-boot@MINI2440]# date 041100582010.20
Date: 2010-04-11 (Sunday) Time: 0:58:20

十四、脚本运行指令

run var [...]
var :ENV中的脚本名 
使用范例:
[u-boot@MINI2440]# setenv a_run_test echo $bootfile \; version
[u-boot@MINI2440]# run a_run_test
zImage.img

U-Boot 2009.11 ( 4月 04 2010 - 12:09:25)

十五、系统重启指令

reset
重启CPU

[u-boot@MINI2440]# reset
resetting ...


U-Boot 2009.11 ( 4月 04 2010 - 12:09:25)

modified by tekkamanninja (tekkamanninja@163.com)
Love Linux 

I2C: ready
DRAM: 64 MB
Flash: 2 MB
NAND: 128 MiB
Video: 240x320x16 20kHz 62Hz
In: serial
Out: serial
Err: serial
Net: dm9000
U-Boot 2009.11 ( 4月 04 2010 - 12:09:25)
modified by tekkamanninja
(tekkamanninja@163.com)
Love Linux 
Hit any key to stop autoboot: 0
[u-boot@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 19:18

返回顶部