linux编译内核后文件存放,petalinux编译好内核后,内核文件的解决方法

我们将内核编译成功后下载到flash不能自动启动,于是将编译完成的u-boot.bin写到FLASH中将内核加入0x40字节的头:方法如下:

使用u-boot中的mkimage:

mkimage的用法

uboot源代码的tools/目录下有mkimage工具,这个工具可以用来制作不压缩或者压缩的多种可启动映象文件。

mkimage在制作映象文件的时候,是在原来的可执行映象文件的前面加上一个0x40字节的头,记录参数所指定的信息,这样uboot才能识别这个映象是针对哪个CPU体系结构的,哪个OS的,哪种类型,加载内存中的哪个位置,

入口点在内存的那个位置以及映象名是什么

[root@localhost tools]# ./mkimage

Usage: ./mkimage -l

image

-l ==> list image header information

./mkimage -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)

参数说明:

-A

指定CPU的体系结构:

取值 表示的体系结构

alpha Alpha

arm A RM

x86 Intel

x86

ia64 IA64

mips MIPS

mips64 MIPS 64 Bit

ppc PowerPC

s390 IBM

S390

sh SuperH

sparc SPARC

sparc64 SPARC 64 Bit

m68k

MC68000

-O

指定操作系统类型,可以取以下值:

openbsd、netbsd、freebsd、4_4bsd、linux、svr4、esix、solaris、irix、sco、dell、ncr、lynxos、vxworks、psos、qnx、u-boot、rtems、artos

-T

指定映象类型,可以取以下值:

standalone、kernel、ramdisk、multi、firmware、script、filesystem

-C

指定映象压缩方式,可以取以下值:

none 不压缩

gzip 用gzip的压缩方式

bzip2 用bzip2的压缩方式

-a

指定映象在内存中的加载地址,映象下载到内存中时,要按照用mkimage制作映象时,这个参数所指定的地址值来下载

-e

指定映象运行的入口点地址,这个地址就是-a参数指定的值加上0x40(因为前面有个mkimage添加的0x40个字节的头)

-n

指定映象名

-d 指定制作映象的源文件[root@localhost tools]# mkimage -A microblaze -O linux -C none -a 0x2008000 -d image.bin Image

Image Name:

Created:      Fri Jul 10 11:28:55 2009

Image Type:   MicroBlaze Linux Kernel Image (uncompressed)

Data Size:    64 Bytes = 0.06 kB = 0.00 MB

Load Address: 0x02008000

Entry Point:  0x02008000

[root@localhost tools]# mkimage -l Image

Image Name:

Created:      Fri Jul 10 11:28:55 2009

Image Type:   MicroBlaze Linux Kernel Image (uncompressed)

Data Size:    64 Bytes = 0.06 kB = 0.00 MB

Load Address: 0x02008000

Entry Point:  0x02008000

OK能运行了!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值