疯雨-版权所有,转载请注明【http://blog.csdn.net/u010346967】
为了以后能很快掌握uboot的新版本,推荐大家拿到uboot的第一步就是阅读README文档。
1.下载u-boot-2012.10.tar.bz2源代码
uboot官网: ftp://ftp.denx.de/pub/u-boot/
2.解压u-boot-2012.10.tar.bz2
root@crazyrain:/home/share/uboot# tar xjvf u-boot-2012.10.tar.bz2
(将u-boot-2012.10.tar.bz2文件复制到linux系统解压,window系统不区分字母大小写。)
3.通过阅读README帮助文档,了解uboot的大致结构
root@crazyrain:/home/share/uboot# cd u-boot-2012.10
root@crazyrain:/home/share/uboot/u-boot-2012.10# ls api config.mk drivers lib nand_spl snapshot.commit arch COPYING dts MAINTAINERS net spl board CREDITS examples MAKEALL post test boards.cfg disk fs Makefile README tools common doc include mkconfig rules.mk
root@crazyrain:/home/share/uboot/u-boot-2012.10# vim README
</pre>以下内容截取自README文件:<p></p><p>uboot目录结构信息:可以想得到,我们最常修改的是哪些文件?</p><p>board ---不同的开发板硬件不同,这个当然得要改 </p><p>arch/arm/cpu/xxx ----体系结构相关,有时有点改动</p><p>include/configs/xxx.h-----开发板的配置文件,毫无疑问必须改</p><p>Configuration Options:----------------------Configuration depends on the combination of board and CPU type; allsuch information is kept in a configuration file"include/configs/<board_name>.h".Example: For a TQM823L module, all configuration settings are in"include/configs/TQM823L.h".</p><p></p><pre name="code" class="html">Directory Hierarchy: ==================== /arch Architecture specific files----------------体系结构相关文件,也就是包含的所有支持处理器的类型 /arm Files generic to ARM architecture --------arm处理器支持 /cpu CPU specific files------------------------支持的arm cpu /arm720t Files specific to ARM 720 CPUs------------具体的cpu类型 /arm920t Files specific to ARM 920 CPUs /at91 Files specific to Atmel AT91RM9200 CPU /imx Files specific to Freescale MC9328 i.MX CPUs /s3c24x0 Files specific to Samsung S3C24X0 CPUs /arm925t Files specific to ARM 925 CPUs /arm926ejs Files specific to ARM 926 CPUs /arm1136 Files specific to ARM 1136 CPUs /ixp Files specific to Intel XScale IXP CPUs /pxa Files specific to Intel XScale PXA CPUs /s3c44b0 Files specific to Samsung S3C44B0 CPUs /sa1100 Files specific to Intel StrongARM SA1100 CPUs /lib Architecture specific library files------------一些arm体系的库文件 /api Machine/arch independent API for external apps----这里一般不用修改,有兴趣的自己了解 /board Board dependent files-----------------------------开发板相关文件 /common Misc architecture independent functions-----------通用代码文件,包括uboot命令和一些通用函数。 /disk Code for disk drive partition handling /doc Documentation (don't expect too much) /drivers Commonly used device drivers----------------------各类设备驱动程序 /examples Example code for standalone applications, etc. /fs Filesystem code (cramfs, ext2, jffs2, etc.)-------支持的文件系统 /include Header Files--------------------------------------头文件和开发板配置信息,所有的开发板配置文件都位于/include/configs目录下 /lib Files generic to all architectures /libfdt Library files to support flattened device trees /lzma Library files to support LZMA decompression /lzo Library files to support LZO decompression /net Networking code-----------------------------------支持的各种网络协议 /post Power On Self Test /rtc Real Time Clock drivers /tools Tools to build S-Record or U-Boot images, etc.---常用工具,如制作uImage的mkimage工具
/Makefile 控制整个工程的编译
4.建立编译配置文件
uboot这么大的一个工程文件,不可能全编译吧。这时候就得建立编译配置文件,当然uboot本身就建立好了一些默认配置文件,我们只需 make xxxx_config.
为什么是xxx_config呢?在很多博客里,经常看到有人写到make xxx_config建立配置,让我们来看看根源在哪?看README文档:对于uboot支持的开发板,只需:
Later we will add a configuration tool - probably similar to or even identical to what's used for the Linux kernel. Right now, we have to do the configuration by hand, which means creating some symbolic links and editing some configuration files. We use the TQM8xxL boards as an example here. Selection of Processor Architecture and Board Type: --------------------------------------------------- For all supported boards there are ready-to-use default configurations available; just type "make <board_name>_config". Example: For a TQM823L module type: cd u-boot make TQM823L_config
正如前面所说,我们在goni这块开发板的基础上做修改,那么goni的配置怎么建立呢?make goni_config吗?很遗憾弹出错误信息,显然Makefile里没有这个目标
root@crazyrain:/home/share/uboot/u-boot-2012.10# make goni_config make: *** No rule to make target `goni_config'. Stop. make: *** [goni_config] 错误 1这里有两种思路可以解决。第一,去看Makefile。第二,还记得前面说的配置文件目录(include/configs)吗?去配置文件目录看看
root@crazyrain:/home/share/uboot/u-boot-2012.10# ls include/configs/ |grep "goni" s5p_goni.h
然后
root@crazyrain:/home/share/uboot/u-boot-2012.10# make s5p_goni_config Configuring for s5p_goni board...果然 ok
这样好像有投机取巧的味道在里面,那么接下来将分析Makefile文件建立自己的开发板配置文件。。。。。