Yocto Issues | The TMPDIR: /home12/calm.xia/poky/qemuarm/tmp can't be located on nfs.

【背景】

最近工作要学习Yocto,之前没有了解过,想跟着经典书《Embedded Linux Development using Yocto Porject 2th Edition - Alex Gonzalez.pdf》,下载原生的Yocto(Poky)体验一把。

登录服务器server.xxx.com,直接从网上下载原生yocto 2.4版本,然后执行如下命令进行构建体验:

source ./oe-init-build-env qemuarm
MACHINE=qemuarm bitbake core-image-minimal

【报错】

calm.xia@server[16:33:32]:source ./oe-init-build-env qemuarm
...
calm.xia@server[16:33:32]:~/poky/qemuarm$ MACHINE=qemuarm bitbake core-image-minimal
ERROR:  OE-core's config sanity checker detected a potential misconfiguration.
    Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
    Following is the list of potential problems / advisories:

    The TMPDIR: /home12/calm.xia/poky/qemuarm/tmp can't be located on nfs.


Summary: There was 1 ERROR message shown, returning a non-zero exit code.

【分析】

https://www.yoctoproject.org/docs/3.0/ref-manual/ref-manual.html#ref-images

Note
By default, the Build Directory contains TMPDIR, which is a temporary directory the build system uses for its work. TMPDIR cannot be under NFS. Thus, by default, the Build Directory cannot be under NFS. However, if you need the Build Directory to be under NFS, you can set this up by setting TMPDIR in your local.conf file to use a local drive. Doing so effectively separates TMPDIR from TOPDIR, which is the Build Directory.

看官方文档解释,TMPDIR 不能挂载到nfs,这说明我们服务器给开发人员分配的目录是挂载到nfs的,实际上通过mount命令查看确实如此,TMPDIR指定的目录必须是本机磁盘目录,google了搜到的答案都是类似。

【解决办法】

  • 方法一:在根目录/创建tmp,不出意外提示没有权限(公司级别的服务器岂容你瞎搞,公司IT这块做的还是蛮不错);失败
  • 方法二:参照C文档创建docker环境,并在docker环境下从新git clone代码并编译,报同样的错误,原因同样是docker环境下TMPDIR挂载的依然是nfs文件系统;失败
You can also run generated qemu images with a command like 'runqemu qemux86'
docker@4cb6aa0def47:~/docker_poky/poky/qemuarm$ MACHINE=qemuarm bitbake core-image-minimal
ERROR:  OE-core's config sanity checker detected a potential misconfiguration.
    Either fix the cause of this error or at your own risk disable the checker (see sanity.conf).
    Following is the list of potential problems / advisories:

    The TMPDIR: /home/docker/docker_poky/poky/qemuarm/tmp can't be located on nfs.


Summary: There was 1 ERROR message shown, returning a non-zero exit code.
docker@4cb6aa0def47:~/docker_poky/poky/qemuarm$ mount | grep "calm.xia"
shext_9k1:/and_home5/calm.xia on /home/docker type nfs (rw,relatime,vers=3,rsize=32768,wsize=32768,namlen=255,acregmin=60,acdirmin=60,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.29.1.111,mountvers=3,mountport=635,mountproto=tcp,local_lock=none,addr=10.29.1.111)
docker@4cb6aa0def47:~/docker_poky/poky/qemuarm$
  • 方法三:原生Yocto项目要解决TMPDIR不能挂载到nfs文件系统这个问题根本方法还是要在本机磁盘新建目录,作为TMPDIR指定目录。
    书上的操作目录就是/opt/yocto,我就死马当活马医进入/opt看看,惊喜来啦 – 意外发现服务器已经有了目录 /opt/tmp,而且这个目录就是777权限(荧光绿!)(后面发现还有个/tmp也是如此),也就是说可以在这里自由新建(读写执行)本地目录作为TMPDIR的指定目录,问题就在这么机缘巧合下解决,还好没放弃。
    Y:\poky\qemuarm\conf\local.conf 文件修改如下
    TMPDIR = “/opt/tmp/calm.xia/yocto/poky/qemuarm/tmp”
  • 方法四:听大牛说还可以通过其他方式设置TMPDIR,而且不需要设置本机磁盘目录,待研究。。。

总结思考:

  • 不抛弃不放弃,问题总归有解决办法
    此问题block了我两天,网上搜索了各种方法都是要在本机磁盘创建目录用你来制定TPMDIR的路径,但是公司级别的开发服务器对于开发人员是没有这种权限的。中间暂停了近一天,后面还是想解决掉它。在坚持想尽一切办法的情况下,终于柳暗花明。
  • 办法不止一种
    问题的解决办法肯定不止一种,如果只有一种,那么只可能是你能力、经验、见识不够,没见过想不到其他解决办法,努力学习积累吧,奋斗的骚年。
  • 站在巨人的肩膀上
    常见的需求通常已经有解决方案的,要有意识记住这一点,不要认为你是第一个遇到这个问题的人,吭哧吭哧忙活半天,其实别人早就已经有解决方案了,你只是缺乏发现的能力,要善于借用资源。
    比如服务器 /tmp和/opt/tmp 这种开放权限的目录,公司级别的开发肯定是有不少人会遇到此类需求,既然需求这么普遍,那么肯定会有解决办法,试着去找找?
    比如除了/tmp和/opt/tmp这种方法,大牛们还有其他方法,你要做的就是要知道是否有人解决过这个问题?想尽一切办法找到这个信息,再找到那位大牛!
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章