Linux下USB燒寫uImage kernel
U-Boot 2011.06 (Mar 19 2012 - 08:45:34) for MINI6410
CPU: S3C6400@667MHz
Fclk = 667MHz, Hclk = 133MHz, Pclk = 66MHz (ASYNC Mode)
Board: MINI6410
DRAM: 256 MiB
NAND: 512 MiB
MMC: SAMSUNG SD/MMC: Host controler CH0
SD card is SD_VERSION_2
SD/MMC size : 3911680 block * 512B = 1910MB
Video: no Video params found, try bootargs~~ 640x480x24 31kHz 59Hz
[petworm] video_hw_init: <640, 480, 640, 480>
Error: Bad gzipped data
Error: no valid bmp or bmp.gz image at 57500000
In: serial
Out: serial
Err: serial
Net: dm9000
Hit any key to stop autoboot: 3
2.按任意鍵進入指令行狀态後,運作dnw指令,檔案存放位址作為參數傳入(十六進制):
MINI6410 # dnw 50008000
Insert a OTG cable into the connector!
3.插入USB電纜,連接配接主機和開發闆,minicom會出現如下提示:
USB Cable is Connected
Now, Waiting for DNW to transmit data
4.另開一個終端,加載secbulk驅動:
sudo insmod secbulk
5.建立secbulk驅動裝置節點(通過試驗,可跳過此步):
sudo mknod /dev/secbulk0 c 102 0
6.運作dnw程式,将欲傳送的uImage的帶路徑的檔案名作為參數傳入:
sudo ./dnw uImage_a70 #(我們選擇目前目錄下的uImage_a70檔案)
回車後傳輸開始,直至傳送完畢。Minicom端提示如下:
Download Done!! Download Address: 0x50008000, Download Filesize:0x40de8
Checksum is being calculated.
Checksum O.K.
主機端提示如下:
liwei@liwei:~/Desktop/dnw_linux/dnw$ sudo ./dnw uImage_a70
file name : uImage_a70
file size : 3763296 bytes
Writing data...
100% 3763306 bytes OK
此時,檔案傳送完畢,且校驗正确。這時我們就可以用u-boot指令來将檔案寫入相應
的nandflash位址中:
MINI6410 # nand erase 80000 400000
NAND erase: device 0 offset 0x80000, size 0x400000
Erasing at 0x460000 -- 100% complete.
OK
MINI6410 # nand write 50008000 80000 400000
NAND write: device 0 offset 0x80000, size 0x400000
4194304 bytes written: OK
7.将S2調整到NAND啟動位置,重新開機開發闆後從NandFlash讀取核心到記憶體,運作結
果如下:
U-Boot 2011.06 (Mar 16 2012 - 13:58:27) for MINI6410
No SD/MMC card detected!
No MMC card for env!
Using default environment
Video: No MMC card for background image!
Hit any key to stop autoboot: 0
MINI6410 # nand read 50008000 80000 400000
NAND read: device 0 offset 0x80000, size 0x400000
4194304 bytes read: OK
8.從記憶體中啟動核心:
MINI6410 # bootm 50008000
## Booting kernel from Legacy Image at 50008000 ...
Image Name: petworm
Data Size: 3763232 Bytes = 3.6 MiB
Load Address: 50008000
Entry Point: 50008040
Verifying Checksum ... OK
XIP Kernel Image ... OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Initializing cgroup subsys cpu
Linux version 2.6.38-FriendlyARM (root@jensen) (gcc version 4.5.1 (ctng-1.8.1-F1
CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7), cr=00c5387f
CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine: MINI6410
。。。 。。。
至此,Linux下用USB電纜燒寫uImage成功完成!
附:
我們可以通過使用u-boot自帶的mkimage指令來将zImage轉換為uImage檔案,指令如下:
mkimage -A arm -O linux -T kernel -C none -a 0x50008000 -e
0x50008040 -n "image-name" -d zImage_a70 uImage_a70
此指令将zImage_a70檔案轉換為uImage_a70檔案,鏡像的名稱為image-name。