【嵌入式Linux学习七步曲之第三篇 Linux系统bootlaoder移植】U-BOOT全线移植分析系列之四--U-boot如何引导Linux内核启动?

 

 

U-BOOT全线移植分析系列之四

――U-boot如何引导Linux内核启动?

 

Sailor_forever  [email protected] 转载请注明

http://blog.csdn.net/sailor_8318/archive/2008/08/05/2773412.aspx

 

【摘要】本节介绍了U-boot使用gobootm启动linux内核的方法。首先介绍了mkimage的参数意义和bootm的详细执行流程。然后分析了如何利用mkimage生成内核映象的方法。对于bootm方式的内核是否压缩、-a、-e、运行地址等16种组合情况,给出了详细的测试过程,提出了6种可用方法种的三种最优解。

 

【关键字】:U-bootAT91RM9200bootmmkimage;-a;-e;-c

 

U-boot如何引导Linux内核启动?

4.1  GO命令引导未用mkimage生成的内核

4.1.1 非压缩内核Image

1)       运行地址!=链接地址0x20008000,不能启动

Uboot> tftp 21000000 Image;tftp 21100000 ramdisk;go 21000000

。。。。

done

Bytes transferred = 6993691 (6ab71b hex)

## Starting application at 0x21000000 ...

Error: a 在哪提示的?

 

2)       运行地址=链接地址0x20008000不能启动,难道是ramdisk的问题

Uboot> tftp 20008000 Image;tftp 21100000 ramdisk;go 20008000

。。。。

done

Bytes transferred = 6993691 (6ab71b hex)

## Starting application at 0x21000000 ...

Error: a

 

4.1.2 压缩内核zImage

1)       运行地址!=链接地址0x20008000,能启动,内核自解压成功,但是解压后的内核运行错误

Uboot> tftp 21000000 zImage;tftp 21100000 ramdisk;go 21000000

。。。。。。。。。。。

done

Bytes transferred = 6993691 (6ab71b hex)

## Starting application at 0x21000000 ...

Uncompressing Linux............................................................. done, booting the kernel.

€?~??鄜屈

 

2)       运行地址==链接地址0x20008000,能启动,内核自解压成功,但是解压后的内核运行错误

 

Uboot> tftp 20008000 zImage;tftp 21100000 ramdisk; go 20008000

## Starting application at 0x20008000 ...

Uncompressing Linux............................................................. done, booting the kernel.

€?~??鄜屈

 

上面的ramdisk都是添加了uboot的头的,去掉头部再试试。去掉了还是不行,go方法的ramdisk的地址是怎么设置的??要详细看下ubootramdisk这块是如何跟内核交互的?

 

4.2 Mkimage参数意义解析

通过mkimage这个tool可以给zImage添加一个header

typedef struct image_header {

        uint32_t    ih_magic; /* Image Header Magic Number      */

        uint32_t    ih_hcrc;    /* Image Header CRC Checksum    */

        uint32_t    ih_time;    /* Image Creation Timestamp   */

        uint32_t    ih_size;     /* Image Data Size           */

        uint32_t    ih_load;    /* Data     Load  Address              */

        uint32_t    ih_ep;              /* Entry Point Address             */

        uint32_t    ih_dcrc;    /* Image Data CRC Checksum        */

        uint8_t             ih_os;               /* Operating System         */

        uint8_t             ih_arch;    /* CPU architecture         */

        uint8_t             ih_type;    /* Image Type                  */

        uint8_t             ih_comp;  /* Compression Type                */

        uint8_t             ih_name[IH_NMLEN];    /* Image Name                */

} image_header_t;

 

header是如何生成的?利用u-boot里面的mkimage工具来生成uImage   u-boot源码包/tools/mkimage.c )

这里解释一下参数的意义:

-A ==> set architecture to 'arch'

-O ==> set operating system to 'os'

-T ==> set image type to 'type' “kernel或是ramdisk”

-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,即不进行文件的拷贝,在当前位置执行)

 

对于ARM linux内核映象用法:

-A arm     -------- 架构是arm
-O linux    --------
操作系统是
linux
-T kernel  --------
类型是
kernel
-C none/bzip/gzip    --------
压缩类型

-a 20008000 ---- image
的载入地址(hex),通常为0xX00008000
-e 200080XX----

  • 0
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值