一、源码解压和打包
1、注意:
a、解压必须在linux源生目录下,因为uboot源码中用到符号链接而windows下是没有符号链接的。
b、权限问题,要么在root用户下操作,要不操作前加sudo。
c、一定要在解压后的源码根目录下配制和编译。
解压:tar -jxvf u-boot-2013.01.tar.bz2
清除:make distclean 清除中间文件和配制(uboot不是一个通用的系统,是定制化的,配制去适应特定的板子)
配制:make x210_sd_config 配制
出现:Configuring for x210_sd board… 提示表示配制成功
编译:make
打包:打包命令 tar -vcjf uboot.tar.bz2 后面是要打包的文件夹 (传windows中用于分析源码)
实验时遇到的问题:编译时生不成自动文件注意权限问题(提示:make: *** [include/version_autogenerated.h] 错误 2)
二、执行清除、配制 编译Makefile的执行情况
1、make distclean、make x210_sd_config、中后面跟的参数(distclean、x210_sd_config)是uboot中主Makefile两个目标所以我们先打开Makefile在里面搜索(distclena、x210_sd_config)看代码都干了什么
(1)、执行make distclean的情况,查看三段代码依赖调用关系:
a、目标distclean (依赖clobber和unconfig)
b、目标clobber(除自身执行了一些删除以外依赖clean)
c、目标clean 执行的是删除命令
(2)执行make x210_sd_config情况:
伪目标unconfig代码:
(3)执行make 编译情况:
主Makefile1~130为变量定义,第130行(ifeq (
(
o
b
j
)
i
n
c
l
u
d
e
/
c
o
n
f
i
g
.
m
k
,
(obj)include/config.mk,
(obj)include/config.mk,(wildcard $(obj)include/config.mk)))这句是判断在include是否有config.mk存在,
若存在则130~454会被编译进makefile中,config.mk在make x210_sd_config配置生成
运行make默认执行第291行的目标,根据依赖链规则依次执行以下步骤
1 主Makefile454行sinclude $(obj)include/autoconf.mk.dep预处理时未找到该文件则找到生成规则在440行
2 执行$(VERSION_FILE)即include/version_autogenerated.h目标得到include/version_autogenerated.h版本文件
3 执行主Makefile447行目标得到include/autoconf.mk该文件为系统中所有的"CONFIG_"开头的宏开关
4 执行主Makefile380行目标进入SUBDIRS中每个文件执行make _depend
5 执行主Makefile340行目标进入SUBDIRS中每个文件执行make all
6 执行主Makefile331行目标make -C cpu/s5pc11x start.o得到start.o
7 执行主Makefile334行目标进入相应文件执行make
8 执行主Makefile343行执行make -C /root/uboot/board/samsung/x210/ u-boot.lds
9 执行主Makefile337行执行make -C board/samsung/x210/
10 执行主Makefile324行生成u-boot
11 执行主Makefile296行生成u-boot.srec
12 执行主Makefile299行生成u-boot.bin
13 执行主Makefile429行生成System.map
14 执行主Makefile321行生成u-boot.dis



