我是一个搞自动化的老新人,前段时间搞了一个IOT2050 Basic版,正在学习中,遇到了一些问题,通过摸索有了一点心得,记录下来。计划逐步更新学习中遇到的各种心得和问题,与大家交流探讨。
1、自行编译example镜像和SDK镜像总是发生错误的解决方法
============问题描述===============
按照官方说明在linux开发环境下编译镜像,总是发生多个错误,编译失败。
比如执行命令:
./kas-docker --isar build kas-iot2050-example.yml:kas/opt/sdk.yml
编译sdk时,发生了较多错误,异常终止。错误举例如下:
一个错误
ERROR: isar-bootstrap-host-1.0-r0 do_bootstrap: Execution of '/work/build/tmp/work/isar-arm64/isar-bootstrap-host/1.0-r0/temp/run.do_bootstrap.212' failed with exit code 1:
W: Target architecture is the same as host architecture; disabling QEMU support
I: Running command: debootstrap --arch amd64 --verbose --variant=minbase --include=locales,gnupg --components=main,contrib,non-free buster /work/build/tmp/work/isar-arm64/isar-bootstrap-host/1.0-r0/rootfs http://deb.debian.org/debian
I: Retrieving InRelease
I: Retrieving Release
E: Failed getting release file http://deb.debian.org/debian/dists/buster/Release
WARNING: exit code 1 from a shell command.
另一个错误
ERROR: isar-bootstrap-target-1.0-r0 do_bootstrap: Execution of '/work/build/tmp/work/isar-arm64/isar-bootstrap-target/1.0-r0/temp/run.do_bootstrap.213' failed with exit code 1:
I: Running command: debootstrap --arch arm64 --foreign --verbose --variant=minbase --include=locales,gnupg --components=main,contrib,non-free buster /work/build/tmp/work/isar-arm64/isar-bootstrap-target/1.0-r0/rootfs http://deb.debian.org/debian
I: Retrieving InRelease
I: Retrieving Release
E: Failed getting release file http://deb.debian.org/debian/dists/buster/Release
WARNING: exit code 1 from a shell command.
ERROR: Logfile of failure stored in: /work/build/tmp/work/isar-arm64/isar-bootstrap-target/1.0-r0/temp/log.do_bootstrap.213
最终命令终止
NOTE: Tasks Summary: Attempted 84 tasks of which 82 didn't need to be rerun and 2 failed.
Summary: 2 tasks failed:
/work/isar/meta/recipes-core/isar-bootstrap/isar-bootstrap-host.bb:do_bootstrap
/work/isar/meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb:do_bootstrap
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
2020-11-10 09:39:07 - ERROR - Command returned non-zero exit status 1
84个任务,失败了2个,没有编译成功。
=================问题分析==================
官方英文论坛上没有人报过类似问题,在网上搜索,也没有搜索到类似问题,说明大多数人都可以编译成功,这个问题很可能是外部原因导致的。
分析错误信息,Failed getting release file说明文件获取不到,应该是有些文件链接失效。大概率是国内网访问部分国外网站不稳定。
=================问题解决==================
首先尝试了科学上网,看能不能解决。但是经过尝试,发现还是会出现一样的问题。这说明科学上网不能完全保证能够文件可下载,而且这种方式通过代理中转,速度和稳定性都不够有保证。
换个思路,把编译服务器直接放到境外,获取资源应该会好很多。
尝试建立了一个境外VPS,机房所在地为new york,基本配置为2GB内存,50GB硬盘,安装ubuntu18.04
通过ssh登录到VPS上,按照指导书进行镜像编译,顺利成功。
下一步就是怎么把编译好的镜像取回来,我采取的方式是将整个IOT2050_Images目录打包(tar 命令),然后用winscp工具传送回来。这样不仅取回了编译好的镜像文件,连带整个运行环境也取回来了,整体覆盖到本地的linux系统中,也许以后再进行编译工作会方便些。
现在打包文件已经传回到本地电脑,正在解压到目标文件夹。
希望接下来的步骤顺利。