康熙来了20130205,李廷亮,李小璐不雅视屏
oe-init-build-env是yocto构建环境运行的第一个脚本,通过运行下面的命令:
. oe-init-build-env build-arm64
即可对yocto项目进行构建,顾名思义,该脚本主要目的还在于给yocto项目构建进行环境准备,在运行前后,可以观察到本地的一些变化,先看环境变量上的一些变化:
对于原有环境变量,yocto修改了下面几个环境变量:
oldpwd:记录脚本运行前的工作目录;
path:修改执行程序搜索路径,这样就可以在后续操作中运行bitbake等命令;
pwd:记录脚本运行后的工作目录;
bbpath:记录bbpath,具体含义,在后面的分析当中进行阐述;
builddir:记录yocto构建目录;
bb_env_extrawhite: 记录bb_env_extrawhite,具体含义,在后面的分析当中进行阐述。
除了对环境变量进行修改,同时也在本地建立了build-arm64这个构建目录。
下面是oe-init-build-env源码:
if [ -n "$bash_source" ]; then
this_script=$bash_source
elif [ -n "$zsh_name" ]; then
this_script=$0
else
this_script="$(pwd)/oe-init-build-env"
fi
if [ -n "$bbserver" ]; then
unset bbserver
fi
if [ -z "$zsh_name" ] && [ "$0" = "$this_script" ]; then
echo "error: this script needs to be sourced. please run as '. $this_script'"
exit 1
fi
if [ -z "$oeroot" ]; then
oeroot=$(dirname "$this_script")
oeroot=$(readlink -f "$oeroot")
fi
unset this_script
export oeroot
. $oeroot/scripts/oe-buildenv-internal &&
templateconf="$templateconf" $oeroot/scripts/oe-setup-builddir || {
unset oeroot
return 1
}
unset oeroot
[ -z "$builddir" ] || cd "$builddir"
脚本逻辑也不复杂,主要步骤:
1、设置this_script变量,若bash_source不为空,this_script指向bash_source,若zsh_name不为空,this_script指向脚本文件本身,缺省情况下,this_script指向oe-init-build-env脚本文件绝对路径;
2、重置bbserver变量;
3、检查oe-init-build-env运行方式,确认一定是以“. oe-init-build-env <builddir>”的方式运行;
4、运行scripts/oe-buildenv-internal以及scripts/oe-setup-builddir脚本;
5、进入构建目录;
从上面5个步骤来看,关于环境变量的变化,并没有在该脚本进行修改,因此只有可能在oe-buildenv-internal以及oe-setup-builddir中进行,具体情况,将在下回分解。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Python 实现将numpy中的nan和inf,nan替换成对应的均值
python爬虫把url链接编码成gbk2312格式过程解析
网友评论