声明:本文由个人学习过程中整理而成,转载请注明出处。
1、uboot/mkconfig
(1)uboot是一个多CPU多架构的统一bootloader,
为了完成针对的特定目标板,目标架构的编译,需要给Makefile指明哪些文件需要编译,相当与从整体上控制
需要编译的cpu,单板等。
2、主Makefile传递的6个参数
$1:x210_sd
$2:arm
$3: s5pc11x
$4:x210
$5: samsumg
$6:s5pc110
解析传递的参数
while [ $# -gt 0 ] ; do
case "$1" in
--) shift ; break ;;
-a) shift ; APPEND=yes ;;
-n) shift ; BOARD_NAME="${1%%_config}" ; shift ;;
*) break ;;
esac
done
[ "${BOARD_NAME}" ] || BOARD_NAME="$1"
[ $# -lt 4 ] && exit 1
[ $# -gt 6 ] && exit 1
echo "Configuring for ${BOARD_NAME} board..."
3、创建相应文件夹的符号链接
在uboot/include文件夹下建立相应的文件夹软连接
第一个:include目录下创建asm文件,指向asm-arm。
第二个:include目录下创建regs.h文件,指向include/s5pc110.h
第三个:inlcude/asm-arm下创建一个arch文件,指向include/asm-arm/arch-s5pc11x
第四个:include/asm-arm下创建一个proc文件,指向include/asm-arm/proc-armv
一共创建了4个符号链接。这4个符号链接在uboot源代码中头文件包含时用到。
创建符号链接的目的是让uboot具有可移植性。
4、创建include/config.mk文件
echo "ARCH = $2" > config.mk
echo "CPU = $3" >> config.mk
echo "BOARD = $4" >> config.mk
[ "$5" ] && [ "$5" != "NULL" ] && echo "VENDOR = $5" >> config.mk
[ "$6" ] && [ "$6" != "NULL" ] && echo "SOC = $6" >> config.mk
5、创建include/config.h文件
config.h文件里面的内容就一行#include<configs/x210_sd.h>,这个头文件是我们移植x210开发板时,对开发板的宏定义配置文件。是我们移植x210时最主要的文件。
if [ "$APPEND" = "yes" ]# Append to existing config file
then
echo >> config.h
else
> config.h# Create new config file
fi
echo "" >>config.h
echo "#include <configs/$1.h>" >>config.h
exit 0
参考资料:《uboot和系统移植---朱有鹏老师》
转载于:https://blog.51cto.com/1121516993/1915757