一.离线编译方法
原始SDK在联网状态下已经编译成功一次的基础上,如果想离线编译,执行以下命令:
cd SDX55_apps/app_proc/poky
source build/conf/set_bb_env.sh
#必须执行这个,告诉编译系统当前为离线编译
export BB_NO_NETWORK="1"
build-sdxprairie-image
二.遇到问题及解决方法
1.ERROR: ExpansionError during parsing /home/sdx55-le-1-2_amss_standard_oem/SDX55_apps/apps_proc/poky/meta-qti-data/recipes/zonedetect/zonedetect.bb
ERROR: ExpansionError during parsing /home/sdx55-le-1-2_amss_standard_oem-r00085/SDX55_apps/apps_proc/poky/meta-qti-data/recipes/zonedetect/zonedetect.bb
Traceback (most recent call last):
bb.data_smart.ExpansionError: Failure expanding variable SRCPV, expression was ${@bb.fetch2.get_srcrev(d)} which triggered exception NetworkAccess: Network access disabled through BB_NO_NETWORK (or set indirectly due to use of BB_FETCH_PREMIRRORONLY) but access requested with command git -c core.fsyncobjectfiles=0 ls-remote CodeLinaro / le / ZoneDetect · GitLab (for url https://git.codelinaro.org/clo/le/ZoneDetect.git)
问题原因:
SRCREV用于指定Git仓库的提交版本号(即commit hash),Yocto在编译时会根据此版本号拉取对应的源码。例如:SRCREV = "abc123..." # 显式指定提交哈希
AUTOREV是一个特殊变量,表示自动获取Git仓库的最新提交版本号。Yocto在编译时会通过git ls-remote命令查询远程仓库的最新哈希。
在离线编译中,必须显式指定所有Git仓库的SRCREV,否则 Yocto 无法解析版本号。
解决方法:
打开文件SDX55_apps/apps_proc/poky/meta-qti-data/recipes/zonedetect/zonedetect.bb 按照如下修改:
#SRCREV = "${AUTOREV}"
SRCREV = "f4aef3b5437edfc7ec0ab3fa63454fe274e51839"
注意:用浏览器打开 Files · caf_migration/BertoldVdb/master · CodeLinaro / le / ZoneDetect · GitLab,选择对应的库,然后复制右边的哈希值,这个哈希值就是上面需要的值,我们把值填写到SRCREV = "f4aef3b5437edfc7ec0ab3fa63454fe274e51839"
除了上面方法,如果你的项目没用到这个软件,也可以直接给zonedetect.bb改个名字,让编译系统不知道还要编译这个。
执行如下命令:
mv SDX55_apps/apps_proc/poky/meta-qti-data/recipes/zonedetect/zonedetect.bb SDX55_apps/apps_proc/poky/meta-qti-data/recipes/zonedetect/zonedetect.bb.org
2.ERROR: ExpansionError during parsing /home/sdx55-le-1-2_amss_standard_oem/SDX55_apps/apps_proc/poky/meta-qti-bsp/recipes-devtools/jsoncpp/jsoncpp10_1.0.0.bb
ERROR: ExpansionError during parsing /home/sdx55-le-1-2_amss_standard_oem-r00085/SDX55_apps/apps_proc/poky/meta-qti-bsp/recipes-devtools/jsoncpp/jsoncpp10_1.0.0.bb
Traceback (most recent call last):
bb.data_smart.ExpansionError: Failure expanding variable SRCPV, expression was ${@bb.fetch2.get_srcrev(d)} which triggered exception NetworkAccess: Network access disabled through BB_NO_NETWORK (or set indirectly due to use of BB_FETCH_PREMIRRORONLY) but access requested with command git -c core.fsyncobjectfiles=0 ls-remote CodeLinaro / la / platform / external / jsoncpp · GitLab (for url Log in | CodeLinaro GitLab Service
解决方法:
打开文件SDX55_apps/apps_proc/poky/meta-qti-bsp/recipes-devtools/jsoncpp/jsoncpp10_1.0.0.bb
按照如下修改:
#SRCREV = "${AUTOREV}"
除了上面方法,如果你的项目没用到这个软件,也可以直接给jsoncpp10_1.0.0.bb改个名字,让编译系统不知道要编译这个。
执行如下命令:
mv SDX55_apps/apps_proc/poky/meta-qti-bsp/recipes-devtools/jsoncpp/jsoncpp10_1.0.0.bb SDX55_apps/apps_proc/poky/meta-qti-bsp/recipes-devtools/jsoncpp/jsoncpp10_1.0.0.bb.org