mkimage制作zImage.img下载启动Linux
1.生成zImage.img
[root@localhost tftpboot]# ls
uImage zImage
[root@localhost tftpboot]# mkimage -n 'linux-2.6.32.2' -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008000 -d zImage zImage.img
Image Name: linux-2.6.32.2
Created: Thu Jan 22 16:36:52 2015
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2286756 Bytes = 2233.16 kB = 2.18 MB
Load Address: 30008000
Entry Point: 30008000
[root@localhost tftpboot]# ls
uImage zImage zImage.img
(
介绍使用mkimage生成镜像文件并下载运行的方法。
1、首先,用u-boot/tools/mkimage这个工具为你的内核加上u-boot引导所需要的文件头,具体做法如下:
[root@localhost tftpboot]#mkimage -n 'linux-2.6.14' -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008000 -d zImage zImage.img
Image Name: linux-2.6.14
Created: Fri Jan 12 17:14:50 2007
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1262504 Bytes = 1232.91 kB = 1.20 MB
Load Address: 0x30008000
Entry Point: 0x30008000
这里解释一下参数的意义:
-A ==> set architecture to 'arch'
-O ==> set operating system to 'os'
-T ==> set image type to 'type'
-C ==> set compression type 'comp'
-a ==> set load address to 'addr' (hex)
-e ==> set entry point to 'ep' (hex)
-n ==> set image name to 'name'
-d ==> use image data from 'datafile'
-x ==> set XIP (execute in place)
)
2.下载运行zImage.img
U-Boot 2009.11 (04 2010 - 12:09:25)
modified by tekkamanninja (tekkamanninja@163.com)
Love Linux forever!!
I2C: ready
DRAM: 64 MB
Flash: 2 MB
NAND: 256 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 forever!!
Hit any key to stop autoboot: 0
[u-boot@MINI2440]#
[u-boot@MINI2440]# tftp 31000000 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.0.101; our IP address is 192.168.0.105
Filename 'zImage.img'.
Load address: 0x31000000
Loading: T #################################################################
#################################################################
##########################
done
Bytes transferred = 2286820 (22e4e4 hex)
[u-boot@MINI2440]#bootm 31000000
## Booting kernel from Legacy Image at 31000000 ...
Image Name: linux-2.6.32.2
Created: 2015-01-22 8:36:52 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2286756 Bytes = 2.2 MB
Load Address: 30008000
Entry Point: 30008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux.............................................................
................................................................................
........ done, booting the kernel.
Linux version 2.6.32.2-FriendlyARM (root@localhost.localdomain) (gcc version 4.3
.2 (Sourcery G++ Lite 2008q3-72) ) #1 Wed Jan 21 10:07:44 CST 2015
在u-boot-2010.03-tekkaman-master\tools文件夹下有mkimage.c和mkimage.h
make后生成mkimage
但是我在开发板输入mkimage出现以下
[u-boot@MINI2440]# mkimage
Unknown command 'mkimage' - try 'help'
我在PC虚拟机redhat Linux下出现以下
/U-boot-2009.11_tekkaman-master/tools
[root@localhost tools]# ./mkimage
[root@localhost tools]# ./mkimage
Usage: ./mkimage -l image
-l ==> list image header information
./mkimage [-x] -A arch -O os -T type -C comp -a addr -e ep -n name -d data_file[:data_file...] image
-A ==> set architecture to 'arch'
-O ==> set operating system to 'os'
-T ==> set image type to 'type'
-C ==> set compression type 'comp'
-a ==> set load address to 'addr' (hex)
-e ==> set entry point to 'ep' (hex)
-n ==> set image name to 'name'
-d ==> use image data from 'datafile'
-x ==> set XIP (execute in place)
./mkimage [-D dtc_options] -f fit-image.its fit-image
如何使用啊