解决lablin版本升级之前toolchain重复编译的问题
1、先前的toolchain每次编译都需要从头开始,所以我在lablin/toolchain/build下增加了BuildToolchainPkg和BuildToolchainList两个函数
#-----------------------------------------------------------------------
# STERLING ZHOU SUPPORT THE FOLLOWING CODE
#-----------------------------------------------------------------------
TOOLCHAIN_TOP="${MW_TOP_DIR}/toolchain"
BUILD_TAG=".maxwit_built"
BuildToolchainPkg()
{
local df=""
local subdir="${TOOLCHAIN_TOP}/${1}"
#local srcdir="${TOOLCHAIN_BUILD_PATH}/${1}-build"
local srcdir=""
case "${1}" in
${MWP_BINUTILS})
srcdir="${TOOLCHAIN_BUILD_PATH}/binutils-build"
;;
${MWP_GCC})
if [ -z $gcc_flag ]; then
srcdir="${TOOLCHAIN_BUILD_PATH}/gcc-build-1"
gcc_flag="THE FIRST TIME HAS PASSED"
else
srcdir="${TOOLCHAIN_BUILD_PATH}/gcc-build-2"
fi
;;
${MWP_GLIBC})
srcdir="${TOOLCHAIN_BUILD_PATH}/glibc-build"
;;
*)
echo "SOMETHING HAS BEEN WRONG..."
echo
exit 0
;;
esac
#if [ ! -e ${KERNEL_BUILD_PATH}/${MWP_KERNEL}/${BUILD_TAG} ] && [ ! -d TOOLCHAIN_BUILD_PATH ]; then
if [ ! -e ${KERNEL_BUILD_PATH}/${MWP_KERNEL}/${BUILD_TAG} ]; then
build_toolchain
#else if it has kernel and toolchain diretory
else
if [ -e "${srcdir}/${BUILT_TAG}" ]; then
echo ""${1}" has been built."
echo
return 0
fi
if [ -f ${subdir}/dep ]
for df in `cat ${subdir}/dep`
do
BuildToolchainPkg ${df} || return 1
done
fi
#gcc has been expanded the other time...NEED CHECK
check_pkgs ${1}
Unpack ${1} toolchain
cd ${srcdir} || exit 1
#if test -x ${subdir}/build.sh; then
${subdir}/build.sh && touch ${srcdir}/${BUILT_TAG} ||
{
if [ -e "${srcdir}/${BUILD_TAG}_1" ]
${subdir}/build_2.sh && touch ${srcdir}/${BUILT_TAG}_2
else
${subdir}/build_1.sh && touch ${srcdir}/${BUILT_TAG}_1
}
echo
return 0
fi
}
BuildToolchainList()
{
local pkg=""
local gcc_flag=""
for pkg in $*
do
BuildToolchainPkg $pkg || exit 1
done
}
2、在lablin/build下面增加build_all_toolchain()函数,它可以调用BuildToolchainList函数
build_all_toolchain()
{
BuildToolchainList
${MWP_BINUTILS}
${MWP_GCC}
${MWP_GLIBC}
${MWP_GCC} ||
exit 1
}
不过代码还不是很完美,欢迎批评指正。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论