u-boot分析一

同步于简书: https://www.jianshu.com/p/c60cf237ffd1
以及个人博客: https://hades2013.github.io

u-boot分析以ar9331和ar953x 的为例。
获取u-boot源码

git clone https://github.com/pepe2k/u-boot_mod.git 

一般u-boot的初始化过程:
- 硬件设备初始化
- 加载U-Boot都RAM空间
- 设置好栈
- 跳转到C语言入口

LSDK中最后编译完成后生成的u-boot为tuboot,查看顶层Makefile :

ifdef COMPRESSED_UBOOT
all: $(ALL) tuboot.bin
else
all: $(ALL) u-boot.img
endif

最后生成的u-boot的压缩文件,到底如何压缩呢:

tuboot.bin: System.map bootstrap.bin u-boot.lzimg
    @echo
    $(call echo_green,Merging bootstrap.bin with u-boot.lzimg...)
    $(call echo_size,    Bootstrap size,bootstrap.bin)
    $(call echo_size,   LZMA image size,u-boot.lzimg)
    @cat bootstrap.bin > $@
    @cat u-boot.lzimg >> $@
    $(call echo_size,  Total image size,$@)

tuboot.bin依赖三个文件: System.map bootstrap.bin u-boot.lzimg,并使用cat命令将bootstrap.bin与u-boot.lzimg拼接在一起生成tub-boot.bin
- System.map为编译生成的符号连接表
- bootstrap.bin 为bootstrap引导程序
- u-boot.lzimg 为u-boot的lzma压缩文件
编译信息如下:

rm -rf u-boot.bin.lzma
../../../util/lzma/bin/lzma --best --keep u-boot.bin
./tools/mkimage -A mips -T firmware -C lzma \
        -a 0xffffffff80010000 \
        -e 0xffffffff80010000 \
        -n 'u-boot image' -d u-boot.bin.lzma u-boot.lzimg
Imag
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值