1.Makefile分析
make smdk2410_config
make
从而生成u-boot.bin,下面分析上面的两个命令干了什么?
########################
make smdk2410_config
########################
在Makefile中查找smdk2410_config,得到:
smdk2410_config : unconfig
@./mkconfig $(@:_config=) arm arm920t smdk2410 NULL s3c24x0
显然smdk2410_config依赖于unconfig,同时执行mkconfig文件,后面arm arm920t smdk2410 NULL s3c24x0是作为脚本mkconfig
的参数
在Makefile中查找unconfig,得到:
unconfig:
@rm -f include/config.h include/config.mk board/*/config.tmp
显然unconfig是将原来的配置信息删除,没什么可说的
现在查看mkconfig 脚本文件,文件作用:
# Script to create header files and links to configure
# U-Boot for a specific board.
在mkconfig脚本中,首先Create link to architecture specific headers,然后Create include file for Make
echo "ARCH = $2" > config.mk
echo "CPU = $3" >> config.mk
echo "BOARD = $4" >> config.mk
生成config.mk文件,最后Create board specific header file
if [ "$APPEND" = "yes" ] # Append to existing config file
then
echo >> config.h
else
> config.h # Create new config file
fi
查看mkconfig生成的文件config.mk,由于在mkconfig中
if [ "$SRCTREE" != "$OBJTREE" ] ; then
mkdir -p ${OBJTREE}/include
mkdir -p ${OBJTREE}/include2
cd ${OBJTREE}/include2
rm -f asm
ln -s ${SRCTREE}/include/asm-$2 asm
LNPREFIX="../../include2/asm/"
cd ../include
rm -rf asm-$2
rm -f asm
mkdir asm-$2
ln -s asm-$2 asm
else
cd ./include
rm -f asm
ln -s asm-$2 asm
fi
显然是首先进入./include中,然后生成config.mk和config.h
config.mk只是体系相关的参数
ARCH = arm
CPU = arm920t
BOARD = smdk2410
SOC = s3c24x0
config.h
/* Automatically generated - do not edit */
#include <configs/smdk2410.h>
smdk2410.h主要是班子的配置信息,例如:
/*-----------------------------------------------------------------------
* Stack sizes
*
* The stack sizes are set up in start.S using the settings below
*/
############################
make
############################
之后执行make命令,再次查看Makefile,查找得到:
# load ARCH, BOARD, and CPU configuration
include $(OBJTREE)/include/config.mk
export ARCH CPU BOARD VENDOR SOC
加载一些宏定义信息,例如上面的ARCH CPU BOARD VENDOR SOC,然后根据相应的规则make
2.编译u-boot(不设计移植,使用u-boot源文件配置)
整体上u-boot编译使用下面的命令,不涉及到内核的移植
make smdk2410_config
make
于是产生u-boot.bin文件
3.u-boot启动模式
未完,待续...