<p><span style="font-size: medium;"><span style="color: #000000;">对于Linux内核,编译可以生成不同格式的映像文件,例如:<br>
# make zImage<br>
# make uImage<br><br>
zImage是ARM
Linux常用的一种压缩映像文件,uImage是U-boot专用的映像文件,它是在zImage之前加上一个长度为0x40的“头”,说明这个映像文
件的类型、加载位置、生成时间、大小等信息。换句话说,如果直接从uImage的0x40位置开始执行,zImage和uImage没有任何区别。另
外,Linux2.4内核不支持uImage,Linux2.6内核加入了很多对嵌入式系统的支持,但是uImage的生成也需要设置。</span>
</span>
</p>
<p><span style="font-size: medium;"><br></span>
</p>
<p><span style="font-size: medium;"><span style="">
</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style=""><strong>一、vmlinuz</strong>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">vmlinuz是可引导的、压缩的内核。“vm”代表“Virtual Memory”。Linux 支持虚拟内存,不像老的操作系统比如DOS有640KB内存的限制。Linux能够使用硬盘空间作为虚拟内存,因此得名“vm”。</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">vmlinuz
的建立有两种方式。一是编译内核时通过“make zImage”创建,然后通过:“cp
/usr/src/linux-2.4/arch/i386/linux/boot/zImage/boot/vmlinuz”产生。zImage适用于
小内核的情况,它的存在是为了向后的兼容性。</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">二
是内核编译时通过命令make
bzImage创建,然后通过:“cp/usr/src/linux-2.4/arch/i386/linux/boot/bzImage
/boot/vmlinuz”产生。bzImage是压缩的内核映像,需要注意,bzImage不是用bzip2压缩的,bzImage中的bz容易引起
误解,bz表示“big zImage”。 bzImage中的b是“big”意思。
zImage(vmlinuz)和bzImage(vmlinuz)都是用gzip压缩的。它们不仅是一个压缩文件,而且在这两个文件的开头部分内嵌有
gzip解压缩代码。所以你不能用gunzip 或 gzip –dc解包vmlinuz。 </span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style=""><strong>二、initrd-x.x.x.img</strong>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">initrd是“initial ramdisk”的简写。initrd一般被用来临时的引导硬件到实际内核vmlinuz能够接管并继续引导的状态。</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">initrd
映象文件是使用mkinitrd创建的。mkinitrd实用程序能够创建initrd映象文件。这个命令是RedHat专有的。其它Linux发行版或
许有相应的命令。这是个很方便的实用程序。具体情况请看帮助:man mkinitrd下面的命令创建initrd映象文件。</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">最后生成的内核镜象有两种</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">zImage</span>
</span>
<span style="">以及</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">uImage</span>
</span>
<span style="">。其中</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">zImage</span>
</span>
<span style="">下载到目标板中后,可以直接用</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">uboot</span>
</span>
<span style="">的命令</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">go</span>
</span>
<span style="">来进行直接跳转。这时候内核直接解压启动。但是无法挂载文件系统,因为</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">go</span>
</span>
<span style="">命令没有将内核需要的相关的启动参数传递给内核。传递启动参数我们必须使用命令</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">bootm</span>
</span>
<span style="">来进行跳转。</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">Bootm</span>
</span>
<span style="">命令跳转只处理</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">uImage</span>
</span>
<span style="">的镜象。</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">uboot</span>
</span>
<span style="">源代码的</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">tools/</span>
</span>
<span style="">目录下有</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">mkimage</span>
</span>
<span style="">工具,这个工具可以用来制作不压缩或者压缩的多种可启动映象文件。</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">mkimage</span>
</span>
<span style="">在制作映象文件的时候,是在原来的可执行映象文件的前面加上一个</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">0x40</span>
</span>
<span style="">字节的头,记录参数所指定的信息,这样</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">uboot</span>
</span>
<span style="">才能识别这个映象是针对哪个</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">CPU</span>
</span>
<span style="">体系结构的,哪个</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">OS</span>
</span>
<span style="">的,哪种类型,加载内存中的哪个位置,</span>
<span style="">入口点在内存的那个位置以及映象名是什么</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">用法如下: </span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">./mkimage -A arch -O os -T type -C comp -a addr -e ep -n name -d data_file[:data_file...] image</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">-A ==> set architecture to 'arch'</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">-O ==> set operating system to 'os'</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">-T ==> set image type to 'type'</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">-C ==> set compression type 'comp'</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">-a ==> set load address to 'addr' (hex)</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">-e ==> set entry point to 'ep' (hex)</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">-n ==> set image name to 'name'</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">-d ==> use image data from 'datafile'</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">-x ==> set XIP (execute in place)</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">参数说明:</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"></span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">-A </span>
</span>
<span style="">指定</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">CPU</span>
</span>
<span style="">的体系结构:</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"></span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">取值</span>
<span style="">表示的体系结构</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">alpha Alpha </span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">arm A RM </span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">x86 Intel x86</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">ia64 IA64</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">mips MIPS</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">mips64 MIPS 64 Bit</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">ppc PowerPC</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">s390 IBM S390</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">sh SuperH</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">sparc SPARC</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">sparc64 SPARC 64 Bit</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">m68k MC68000</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"></span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">-O </span>
</span>
<span style="">指定操作系统类型,可以取以下值:</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">openbsd</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">netbsd</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">freebsd</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">4_4bsd</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">linux</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">svr4</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">esix</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">solaris</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">irix</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">sco</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">dell</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">ncr</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">lynxos</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">vxworks</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">psos</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">qnx</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">u-boot</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">rtems</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">artos</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"></span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">-T </span>
</span>
<span style="">指定映象类型,可以取以下值:</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">standalone</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">kernel</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">ramdisk</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">multi</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">firmware</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">script</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">filesystem</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"></span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">-C </span>
</span>
<span style="">指定映象压缩方式,可以取以下值:</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">none </span>
</span>
<span style="">不压缩</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">gzip </span>
</span>
<span style="">用</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">gzip</span>
</span>
<span style="">的压缩方式</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">bzip2 </span>
</span>
<span style="">用</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">bzip2</span>
</span>
<span style="">的压缩方式</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"></span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">-a </span>
</span>
<span style="">指定映象在内存中的加载地址,映象下载到内存中时,要按照用</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">mkimage</span>
</span>
<span style="">制作映象时,这个参数所指定的地址值来下载</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"></span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">-e </span>
</span>
<span style="">指定映象运行的入口点地址,这个地址就是</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">-a</span>
</span>
<span style="">参数指定的值加上</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">0x40</span>
</span>
<span style="">(因为前面有个</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">mkimage</span>
</span>
<span style="">添加的</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">0x40</span>
</span>
<span style="">个字节的头)</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"></span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">-n </span>
</span>
<span style="">指定映象名</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"></span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">-d </span>
</span>
<span style="">指定制作映象的源文件</span>
</p>
<p>
<span style=""><span style="">
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">我在编译时用到的命令如下: </span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"># make zImage //</span>
</span>
<span style="">生成</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">zImage</span>
</span>
<span style="">镜象</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21pt; text-align: left;" align="left"><span style="">#</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">/usr/local/arm/k9uboot/tools/</span>
</span>
<span style="font-family: verdana;" lang="EN-US">mkimage -n 'Linux 2.4.27' -A arm -O linux -T</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="font-family: verdana;" lang="EN-US">kernel -C none -a 0x20007fc0 -e 0x20008000 -d zImage </span>
<span lang="EN-US"><span style="font-family: Times New Roman;">uImage</span>
</span>
</p>
</span>
</span>
</p>
# make zImage<br>
# make uImage<br><br>
zImage是ARM
Linux常用的一种压缩映像文件,uImage是U-boot专用的映像文件,它是在zImage之前加上一个长度为0x40的“头”,说明这个映像文
件的类型、加载位置、生成时间、大小等信息。换句话说,如果直接从uImage的0x40位置开始执行,zImage和uImage没有任何区别。另
外,Linux2.4内核不支持uImage,Linux2.6内核加入了很多对嵌入式系统的支持,但是uImage的生成也需要设置。</span>
</span>
</p>
<p><span style="font-size: medium;"><br></span>
</p>
<p><span style="font-size: medium;"><span style="">
</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style=""><strong>一、vmlinuz</strong>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">vmlinuz是可引导的、压缩的内核。“vm”代表“Virtual Memory”。Linux 支持虚拟内存,不像老的操作系统比如DOS有640KB内存的限制。Linux能够使用硬盘空间作为虚拟内存,因此得名“vm”。</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">vmlinuz
的建立有两种方式。一是编译内核时通过“make zImage”创建,然后通过:“cp
/usr/src/linux-2.4/arch/i386/linux/boot/zImage/boot/vmlinuz”产生。zImage适用于
小内核的情况,它的存在是为了向后的兼容性。</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">二
是内核编译时通过命令make
bzImage创建,然后通过:“cp/usr/src/linux-2.4/arch/i386/linux/boot/bzImage
/boot/vmlinuz”产生。bzImage是压缩的内核映像,需要注意,bzImage不是用bzip2压缩的,bzImage中的bz容易引起
误解,bz表示“big zImage”。 bzImage中的b是“big”意思。
zImage(vmlinuz)和bzImage(vmlinuz)都是用gzip压缩的。它们不仅是一个压缩文件,而且在这两个文件的开头部分内嵌有
gzip解压缩代码。所以你不能用gunzip 或 gzip –dc解包vmlinuz。 </span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style=""><strong>二、initrd-x.x.x.img</strong>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">initrd是“initial ramdisk”的简写。initrd一般被用来临时的引导硬件到实际内核vmlinuz能够接管并继续引导的状态。</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">initrd
映象文件是使用mkinitrd创建的。mkinitrd实用程序能够创建initrd映象文件。这个命令是RedHat专有的。其它Linux发行版或
许有相应的命令。这是个很方便的实用程序。具体情况请看帮助:man mkinitrd下面的命令创建initrd映象文件。</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">最后生成的内核镜象有两种</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">zImage</span>
</span>
<span style="">以及</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">uImage</span>
</span>
<span style="">。其中</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">zImage</span>
</span>
<span style="">下载到目标板中后,可以直接用</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">uboot</span>
</span>
<span style="">的命令</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">go</span>
</span>
<span style="">来进行直接跳转。这时候内核直接解压启动。但是无法挂载文件系统,因为</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">go</span>
</span>
<span style="">命令没有将内核需要的相关的启动参数传递给内核。传递启动参数我们必须使用命令</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">bootm</span>
</span>
<span style="">来进行跳转。</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">Bootm</span>
</span>
<span style="">命令跳转只处理</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">uImage</span>
</span>
<span style="">的镜象。</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">uboot</span>
</span>
<span style="">源代码的</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">tools/</span>
</span>
<span style="">目录下有</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">mkimage</span>
</span>
<span style="">工具,这个工具可以用来制作不压缩或者压缩的多种可启动映象文件。</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">mkimage</span>
</span>
<span style="">在制作映象文件的时候,是在原来的可执行映象文件的前面加上一个</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">0x40</span>
</span>
<span style="">字节的头,记录参数所指定的信息,这样</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">uboot</span>
</span>
<span style="">才能识别这个映象是针对哪个</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">CPU</span>
</span>
<span style="">体系结构的,哪个</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">OS</span>
</span>
<span style="">的,哪种类型,加载内存中的哪个位置,</span>
<span style="">入口点在内存的那个位置以及映象名是什么</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">用法如下: </span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">./mkimage -A arch -O os -T type -C comp -a addr -e ep -n name -d data_file[:data_file...] image</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">-A ==> set architecture to 'arch'</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">-O ==> set operating system to 'os'</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">-T ==> set image type to 'type'</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">-C ==> set compression type 'comp'</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">-a ==> set load address to 'addr' (hex)</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">-e ==> set entry point to 'ep' (hex)</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">-n ==> set image name to 'name'</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">-d ==> use image data from 'datafile'</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><em><span lang="EN-US"><span style="font-family: Times New Roman;">-x ==> set XIP (execute in place)</span>
</span>
</em>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">参数说明:</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"></span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">-A </span>
</span>
<span style="">指定</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">CPU</span>
</span>
<span style="">的体系结构:</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"></span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">取值</span>
<span style="">表示的体系结构</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">alpha Alpha </span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">arm A RM </span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">x86 Intel x86</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">ia64 IA64</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">mips MIPS</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">mips64 MIPS 64 Bit</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">ppc PowerPC</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">s390 IBM S390</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">sh SuperH</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">sparc SPARC</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">sparc64 SPARC 64 Bit</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">m68k MC68000</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"></span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">-O </span>
</span>
<span style="">指定操作系统类型,可以取以下值:</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">openbsd</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">netbsd</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">freebsd</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">4_4bsd</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">linux</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">svr4</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">esix</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">solaris</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">irix</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">sco</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">dell</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">ncr</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">lynxos</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">vxworks</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">psos</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">qnx</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">u-boot</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">rtems</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">artos</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"></span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">-T </span>
</span>
<span style="">指定映象类型,可以取以下值:</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">standalone</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">kernel</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">ramdisk</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">multi</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">firmware</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">script</span>
</span>
<span style="">、</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">filesystem</span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"></span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">-C </span>
</span>
<span style="">指定映象压缩方式,可以取以下值:</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">none </span>
</span>
<span style="">不压缩</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">gzip </span>
</span>
<span style="">用</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">gzip</span>
</span>
<span style="">的压缩方式</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">bzip2 </span>
</span>
<span style="">用</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">bzip2</span>
</span>
<span style="">的压缩方式</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"></span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">-a </span>
</span>
<span style="">指定映象在内存中的加载地址,映象下载到内存中时,要按照用</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">mkimage</span>
</span>
<span style="">制作映象时,这个参数所指定的地址值来下载</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"></span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">-e </span>
</span>
<span style="">指定映象运行的入口点地址,这个地址就是</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">-a</span>
</span>
<span style="">参数指定的值加上</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">0x40</span>
</span>
<span style="">(因为前面有个</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">mkimage</span>
</span>
<span style="">添加的</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">0x40</span>
</span>
<span style="">个字节的头)</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"></span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">-n </span>
</span>
<span style="">指定映象名</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"></span>
</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;">-d </span>
</span>
<span style="">指定制作映象的源文件</span>
</p>
<p>
<span style=""><span style="">
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="">我在编译时用到的命令如下: </span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span lang="EN-US"><span style="font-family: Times New Roman;"># make zImage //</span>
</span>
<span style="">生成</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">zImage</span>
</span>
<span style="">镜象</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21pt; text-align: left;" align="left"><span style="">#</span>
<span lang="EN-US"><span style="font-family: Times New Roman;">/usr/local/arm/k9uboot/tools/</span>
</span>
<span style="font-family: verdana;" lang="EN-US">mkimage -n 'Linux 2.4.27' -A arm -O linux -T</span>
</p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21.75pt;"><span style="font-family: verdana;" lang="EN-US">kernel -C none -a 0x20007fc0 -e 0x20008000 -d zImage </span>
<span lang="EN-US"><span style="font-family: Times New Roman;">uImage</span>
</span>
</p>
</span>
</span>
</p>