uboot下U盘烧写系统及应用程序
今天,现场出现了一台桩,启动的时候,uboot提示如下:
CPU: NUC972
DRAM: 64 MiB
NAND: 128 MiB
MMC: mmc: 0
In: serial
Out: serial
Err: serial
Net: emac
Hit any key to stop autoboot: 0
Loading from nand0, offset 0x200000
** Unknown image type
Wrong Image Format for bootm command
ERROR: can't get kernel image!
以上就是内核损坏了,现场只有U盘口,所以以下就uboot模式下,烧写系统及应用程序
## nand存储划分
我们需要烧写的几个文件及区域如下:
文件名称 起始地址 大小
1:linux-kernel 0x200000 2.5M左右
2:root-fs 0x700000 12M左右
3:app 0x1B00000 3M左右
烧写命令及流程
烧写kernel详细过程如下
U-Boot> usb start
( Re) start USB.. .
USB0: USB EHCI 0.95
scanning bus 0 for devices.. . 2 USB Device( s) found
scanning usb for storage devices.. . 1 Storage Device( s) found
U-Boot> usb dev
USB device 0 : Vendor: USB Rev: 1100 Prod: Flash Disk
Type: Removable Hard Disk
Capacity: 7681.0 MB = 7.5 GB ( 15730688 x 512 )
U-Boot> fatls usb 0
system volume information/
128 autorun.inf
boot/
413738 bootmgr
1541648 bootmgr.efi
efi/
74184 setup.exe
sources/
support/
°
a8_tcu/
xrd_tft/
ui/
2400064 970uimage
5 file( s) , 9 dir( s)
U-Boot> fatload usb 0 0x3000000 970uimage
reading 970uimage
2400064 bytes read in 136 ms ( 16.8 MiB/s)
U-Boot> nand erase 0x200000 0x400000
NAND erase: device 0 offset 0x200000, size 0x400000
Erasing at 0x5e0000 -- 100 % complete.
OK
U-Boot> nand write 0x3000000 0x200000 0x400000
NAND write: device 0 offset 0x200000, size 0x400000
4194304 bytes written: OK
完整命令及说明
usb start //启动usb
usb dev //查看usb设备
fatls usb 0 //查看usb内的文件
fatload usb 0 0x3000000 uImage //将指定文件加载到内存中
nand erase 0x200000 0x400000 //擦除nand上指定位置的数据
nand write 0x3000000 0x200000 0x400000 //将文件烧写到nand的指定位置
mw.b 0x3000000 0xff 0x1400000 //清除内存指定位置上的数据
fatload usb 0 0x3000000 rootfs.cramfs //加载usb上文件到内存上
nand erase 0x700000 0x1400000 //清除nand上指定位置,指定大小空间
nand write 0x3000000 0x700000 0x1400000 //将内存上文件写到nand指定位置
//同上,写app区数据
mw.b 0x3000000 0xff 0x500000
fatload usb 0 0x3000000 cl5899_tcu_app.img
nand erase 0x1B00000 0x500000
nand write 0x3000000 0x1B00000 0x500000