uboot 命令行常用命令

uboot命令行常用命令 setenv ipaddr 192.168.0.55 //开发板 IP 地址 setenv ethaddr 00:04:9f:04:d2:35 //开发板网卡 MAC 地址 setenv gatewayip 192.168.0.1 //开发板默认网关 setenv netmas...


一、配置网络方法


setenv ipaddr 192.168.0.55 //开发板 IP 地址
setenv ethaddr 00:04:9f:04:d2:35 //开发板网卡 MAC 地址
setenv gatewayip 192.168.0.1 //开发板默认网关
setenv netmask 255.255.255.0 //开发板子网掩码
setenv serverip 192.168.0.249 //服务器地址,也就是 Ubuntu 地址
saveenv //保存环境变量


二、MMC


  用于操作MMC device


=> help mmc
mmc - MMC sub system

Usage:
mmc info - display info of the current MMC device
mmc read addr blk# cnt
mmc write addr blk# cnt
mmc erase blk# cnt
mmc rescan
mmc part - lists available partition on current mmc device
mmc dev [dev] [part] - show or set current mmc device [partition]
mmc list - lists available devices
mmc hwpartition [args...] - does hardware partitioning
  arguments (sizes in 512-byte blocks):
    [user [enh start cnt] [wrrel {on|off}]] - sets user data area attributes
    [gp1|gp2|gp3|gp4 cnt [enh] [wrrel {on|off}]] - general purpose partition
    [check|set|complete] - mode, complete set partitioning completed
  WARNING: Partitioning is a write-once setting once it is set to complete.
  Power cycling is required to initialize partitions after set to complete.
mmc bootbus dev boot_bus_width reset_boot_bus_width boot_mode
 - Set the BOOT_BUS_WIDTH field of the specified device
mmc bootpart-resize <dev> <boot part size MB> <RPMB part size MB>
 - Change sizes of boot and RPMB partitions of specified device
mmc partconf dev boot_ack boot_partition partition_access
 - Change the bits of the PARTITION_CONFIG field of the specified device
mmc rst-function dev value
 - Change the RST_n_FUNCTION field of the specified device
   WARNING: This is a write-once field and 0 / 1 / 2 are the only valid values.
mmc setdsr <value> - set DSR register value


应用:结合nfs和mmc在uboot命令行下,烧录uboot


步骤:
1、"mmc list"查看当前的可用设备
2、"mmc info"查看当前选择的存储设备信息
3、使用nfs从nfs服务器下载uboot到DRAM的80800000地址
4、"mmc dev 0 0",选择第0个存储设备的第0个分区(emmc是 mmc dev 1 1)
5、"mmc write 80800000 2 33E",将DRAM的80800000写入SD卡分区0,从第二个块开始写(前两个分区存放MBR分区表),总共写33E(文件大小/块大小=424960/512=0x33E)个快


=> mmc list   
FSL_SDHC: 0 (SD)
FSL_SDHC: 1
=> mmc info
Device: FSL_SDHC
Manufacturer ID: 3
OEM: 5344
Name: SL16G 
Tran Speed: 50000000
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 14.8 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes
=> nfs 80800000 192.168.31.79:/home/fu/linux/nfs/u-boot.imx
Using FEC1 device
File transfer via NFS from server 192.168.31.79; our IP address is 192.168.31.23
Filename '/home/fu/linux/nfs/u-boot.imx'.
Load address: 0x80800000
Loading: #################################################################
         ###################
done
Bytes transferred = 424960 (67c00 hex)
=> mmc dev 0 0
switch to partitions #0, OK
mmc0 is current device
=> mmc write 80800000 2 33E
MMC write: dev # 0, block # 2, count 830 ... 830 blocks written: OK
=> reset 


三、nand操作命令


用于操作nand flash


=> help nand
nand - NAND sub-system

Usage:
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 read.raw - addr off|partition [count]
nand write.raw - addr off|partition [count]
    Use read.raw/write.raw to avoid ECC and access the flash as-is.
nand write.trimffs - addr off|partition size
    write 'size' bytes starting at offset 'off' from memory address
    'addr', skipping bad blocks and dropping any pages at the end
    of eraseblocks that contain only 0xFF
nand erase[.spread] [clean] off size - erase 'size' bytes from offset 'off'
    With '.spread', erase enough for given file size, otherwise,
    'size' includes skipped bad blocks.
nand erase.part [clean] partition - erase entire mtd partition'
nand erase.chip [clean] - erase entire chip'
nand bad - show bad blocks
nand dump[.oob] off - dump page
nand scrub [-y] off size | scrub.part partition | scrub.chip
    really clean NAND erasing bad blocks (UNSAFE)
nand markbad off [...] - mark bad block(s) at offset (UNSAFE)
nand biterr off - make a bit error at offset (UNSAFE)


应用 结合nfs命令在uboot中烧录nand flash。 可以通过打印环境变量bootargs,查看nand的分区大小和位置.


=> printenv bootargs
bootargs=console=ttymxc0,115200 ubi.mtd=3 root=ubi0:rootfs rw rootflags=sync rootfstype=ubifs mtdparts=gpmi-nand:3m(boot),8m(kernel),1m(dtb),-(rootfs)
#boot: 3MB,起试地址为0
#kernel: 8MB,起试地址为0x300000
#dtb:1MB,起试地址为0xB00000


下方命令演示通过nfs下载kernel到内存中,并使用nand命令烧录flash.


#1、使用nfs下载文件到指定内存地址
nfs 80800000 192.168.0.123:/fu/industio_work/nfs/boot_evk.img
#2、擦除nand flash
nand erase 0x300000 0x800000
#3、将80800000内存中的数据写入nand flash300000位置,写入内容大小为800000
nand write 80800000 0x300000 0x800000


三、uboot重启


reset


四、bootcmd


  bootcmd 环境变量保存着uboot开机的时候执行的引导命令合集。
设置环境变量bootcmd从mmc 设备1的分区1加载zImage和dtb文件启动,命令如下。


setenv bootcmd 'mmc dev 1;fatload mmc 1:1 80800000 zImage;fatload mmc 1:1 83000000 imx6ull-14x14-evk.dtb;bootz 80800000 - 83000000;'


五、bootargs


  bootargs保存着uboot传递给linux内核的参数。 设置console的和root的挂载设备,命令如下


setenv bootargs 'console=ttymxc0, 115200 root=/dev/mmcblk1p2 rootwait rw'



  • 发表于 2020-03-27 15:30
  • 阅读 ( 709 )
  • 分类:i.MX6ULL

你可能感兴趣的文章

相关问题

0 条评论

请先 登录 后评论
大飞
大飞

3 篇文章

作家榜 »

  1. BBelephant 13 文章
  2. ronnie 11 文章
  3. FU 9 文章
  4. toca 4 文章
  5. 大飞 3 文章
  6. Vivek 3 文章
  7. jack-fang 2 文章
  8. Bin 1 文章