Tiny4412 u-boot分析(1)u-boot配置流程分析
参考Friendlyarm的文档,编译uboot的流程为
make tiny4412_config
make
这个过程主要涉及到两个文件,顶层的Makefile文件和mkconfig文件,makeconfig文件是一个脚本,通过文件的注释可以了解到它的作用
# Script to create header files and links to configure
# U-Boot for a specific board.
#
# Parameters: Target Architecture CPU Board [VENDOR] [SOC]
意思是,mkconfig 是用来创建头文件和链接脚本,并以此来为特定的开发板配置u-boot的脚本。它的主要参数有
Target Architecture CPU Board [VENDOR] [SOC]
首先来分析顶层的Makefile文件,在Makefile文件中我们可以看到下面的代码
%_config:: unconfig
@$(MKCONFIG) -A $(@:_config=)
%在Makefile中作为通配符用来通配任意长度的字符,因此当我们执行 make tiny4412_config的时候就会匹配到%_config这条语句。::在Makefile中用来强制执行下面的命令,所以匹配到%_config之后,就会去执行unconfig,unconfig的作用是去除原来的配置信息。然后去执行
@$(MKCONFIG) -A $(@:_config=)
这条命令,@的作用是用来去除回显,$(MKCONFIG)在前面被定义为
MKCONFIG := $(SRCTREE)/mkconfig
SRCTREE := $(CURDIR)
我们将@去掉,然后执行make tiny4412_config,可以通过回显看到以下内容
make tiny4412_config
awk '(NF && $1 !~ /^#/) { print $1 ": " $1 "_config; $(MAKE)" }' boards.cfg > .boards.depend
/....../uboot_tiny4412/mkconfig -A tiny4412
Configuring for tiny4412 board...
所以我们执行make tiny4412_config实际上被解析成
/....../uboot_tiny4412/mkconfig -A tiny4412
指定了-A选项,mkconfig脚本会自动去解析boards.cfg文件,找到以下内容
# Target ARCH CPU Board name Vendor SoC Options
tiny4412 arm armv7 tiny4412 samsung exynos
所以我们最终执行的命令为
./mkconfig tiny4412 arm armv7 tiny4412 samsung exynos
总结一下,mkcongif脚本主要做了以下几件事
(1)解析boards.cfg tiny4412相关数据
tiny4412 arm armv7 tiny4412 samsung exynos
()针对平台做了一系列链接,创建平台、开发板相关的头文件的链接
#
# Create link to architecture specific headers
#
if [ "$SRCTREE" != "$OBJTREE" ] ; then
mkdir -p ${OBJTREE}/include
mkdir -p ${OBJTREE}/include2
cd ${OBJTREE}/include2
rm -f asm
ln -s ${SRCTREE}/arch/${arch}/include/asm asm
LNPREFIX=${SRCTREE}/arch/${arch}/include/asm/
cd ../include
rm -f asm
ln -s ${SRCTREE}/arch/${arch}/include/asm asm
else
cd ./include
rm -f asm
ln -s ../arch/${arch}/include/asm asm
fi
rm -f asm/arch
if [ -z "${soc}" ] ; then
ln -s ${LNPREFIX}arch-${cpu} asm/arch
else
ln -s ${LNPREFIX}arch-${soc} asm/arch
fi
if [ "${arch}" = "arm" ] ; then
rm -f asm/proc
ln -s ${LNPREFIX}proc-armv asm/proc
fi
实际执行的命令为
cd ./include
rm -f asm
ln -s ../arch/arm/include/asm asm
ln -s arch-exynos asm/arch
(3)创建顶层Makefile包含的文件 include/ config.mk
#
# Create include file for Make
#
echo "ARCH = ${arch}" > config.mk
echo "CPU = ${cpu}" >> config.mk
echo "BOARD = ${board}" >> config.mk
[ "${vendor}" ] && echo "VENDOR = ${vendor}" >> config.mk
[ "${soc}" ] && echo "SOC = ${soc}" >> config.mk
# Assign board directory to BOARDIR variable
if [ -z "${vendor}" ] ; then
BOARDDIR=${board}
else
BOARDDIR=${vendor}/${board}
fi
生成的config.mk内容如下
ARCH = arm CPU = armv7
BOARD = tiny4412
VENDOR = samsung
SOC = exynos
(4)创建开发板相关的头文件inlucde/config.h
#
# 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
echo "/* Automatically generated - do not edit */" >>config.h
for i in ${TARGETS} ; do
i="`echo ${i} | sed '/=/ {s/=/\t/;q } ; { s/$/\t1/ }'`"
echo "#define CONFIG_${i}" >>config.h ;
done
cat << EOF >> config.h
#define CONFIG_BOARDDIR board/$BOARDDIR
#include <config_defaults.h>
#include <configs/${CONFIG_NAME}.h>
#include <asm/config.h>
EOF
生成的include/config.h内容为
/* Automatically generated - do not edit */
#define CONFIG_BOARDDIR board/samsung/tiny4412
#include <config_defaults.h>
#include <configs/tiny4412.h>
#include <asm/config.h>
Tiny4412 u-boot分析(1)u-boot配置流程分析的更多相关文章
- springBoot高级:自动配置分析,事件监听,启动流程分析,监控,部署
知识点梳理 课堂讲义 02-SpringBoot自动配置-@Conditional使用 Condition是Spring4.0后引入的条件化配置接口,通过实现Condition接口可以完成有条件的加载 ...
- u-boot分析(二)----工作流程分析
u-boot分析(二) 由于这两天家里有点事,所以耽误了点时间,没有按时更新,今天我首先要跟大家说说我对于u-boot分析的整体的思路,然后呢我以后的博客会按照这个内容更新,希望大家关注. 言归正传, ...
- uboot的配置流程分析
简单介绍一下uboot的基本配置流程.和绝大多数源码编译安装一样,uboot在执行make之前需要执行make XXXconfig来配置相关信息,而且uboot本身是针对多种平台的bootloader ...
- 常见SOC启动流程分析
本文以s5pv210这款SOC为例,分析了其启动流程 在s5pv210的SOC内部,存在着一个内部的ROM和一个内部的RAM 这个内部的ROM叫做 IROM,它是norflash的一种.其不同于板子上 ...
- spring boot实战(第十三篇)自动配置原理分析
前言 spring Boot中引入了自动配置,让开发者利用起来更加的简便.快捷,本篇讲利用RabbitMQ的自动配置为例讲分析下Spring Boot中的自动配置原理. 在上一篇末尾讲述了Spring ...
- Spring Boot从入门到精通(八)日志管理实现和配置信息分析
Spring Boot对日志的处理,与平时我们处理日志的方式完全一致,它为Java Util Logging.Log4J2和Logback提供了默认配置.对于每种日志都预先配置使用控制台输出和可选的文 ...
- Spring Boot 启动(二) 配置详解
Spring Boot 启动(二) 配置详解 Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698.html) Spring Boot 配置 ...
- 涨姿势:Spring Boot 2.x 启动全过程源码分析
目录 SpringApplication 实例 run 方法运行过程 总结 上篇<Spring Boot 2.x 启动全过程源码分析(一)入口类剖析>我们分析了 Spring Boot 入 ...
- Spring Boot 2.x 启动全过程源码分析(上)入口类剖析
Spring Boot 的应用教程我们已经分享过很多了,今天来通过源码来分析下它的启动过程,探究下 Spring Boot 为什么这么简便的奥秘. 本篇基于 Spring Boot 2.0.3 版本进 ...
随机推荐
- BZOJ3671/UOJ6 [Noi2014]随机数生成器
本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000 作者博客:http://www.cnblogs.com/ljh2000-jump/ ...
- Git---之上传远程仓库
一:在GitHub上注册账号 官网 : https://github.com/ 二:与远程仓库关联 在本地生成ssh key 运行命令 ssh-keygen -t rsa -C "50 ...
- dp4--codeVs1043 方格取数
dp4--codeVs1043 方格取数 一.心得 二.题目 1043 方格取数 2000年NOIP全国联赛提高组 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 钻石 Dia ...
- JavaScript数组和函数的使用
数组 数组:一个有顺序,有长度的数据集合 作用:存储大量数据 一.数组的定义 1.构造函数法:使用构造函数法的时候,都会使用new关键字 var arr=new Array(): 当长度为0 的时候, ...
- Dom节点操作常用方法
1.访问/获取节点 document.getElementById(id); //返回对拥有指定id的第一个对象进行访问 document.getElementsByName(name); //返回带 ...
- hdu 1847 Good Luck in CET-4 Everybody!(sg)
Good Luck in CET-4 Everybody! Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ...
- nohup+命令+& 【退出终端后,程序依然在后台运行】
[ 如果你正在运行一个进程,而且你觉得在退出帐户时该进程还不会结束,那么可以使用nohup命令. 该命令可以忽略所有挂断(SIGHUP)信号,在你退出帐户/关闭终端之后继续运行相应的进程. nohup ...
- Apache CommonLogging + Log4J
package cn.byref.demo.logging; import org.apache.commons.logging.Log; import org.apache.commons.logg ...
- deep learning (六)logistic(逻辑斯蒂)回归中L2范数的应用
zaish上一节讲了线性回归中L2范数的应用,这里继续logistic回归L2范数的应用. 先说一下问题:有一堆二维数据点,这些点的标记有的是1,有的是0.我们的任务就是制作一个分界面区分出来这些点. ...
- git教程3-添加远程库与从远程库拷贝
一.添加到github 1.github上创建新的库learngit.git 2.git remote add origin git@github.com:moisiet/learngit.git ...