专栏首页程序手艺人[ 物联网篇 ] 14 - 联发科MTK8516 Yocto技巧

[ 物联网篇 ] 14 - 联发科MTK8516 Yocto技巧

MTK8516 提供的SDK通过Yocto来进行构建, 由于Yocto入门门槛较高,刚开始也才过不少坑,这里记录下.

Yocto中相关.bb文件中如何添加打印

在recipes中加入打印信息,有两种方式

  1. 第一是Python形式,该形式可在console上打印出来: bb.plain, bb.note, bb.warn, bb.error, bb.fatal, bb.debug
  2. 另一种是bash形式,该形式会在temp目录下的log中包含,需要inherit logging(base.bbclass会包含,通常不需要特意添加): bbplain, bbnote, bbwarn, bberror, bbfatal, bbdebug

直接一点通过第一种方式添加打印, 如:

bbplain "#### debug D path : :\n${D}"
/build/tmp/work/aarch64-poky-linux/avs-demo/1.0-r0/image

其他一些相关变量的含义

//${S}指出source code存放的位置
S:
build/tmp/work/aarch64-poky-linux/avs-demo/1.0-r0/git

//{D}指存放编译后生成binary的地址
D:
/build/tmp/work/aarch64-poky-linux/avs-demo/1.0-r0/image

//${bindir}指文件系统的 /usr/bin

 SB:
/build/tmp/work/aarch64-poky-linux/avs-demo/1.0-r0/build

 STAGING_LIBDIR:
/build/tmp/work/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/avs-demo/1.0-r0/recipe-sysroot/

 WORKDIR:
 64bit对应的目录
/build/tmp/work/aarch64-poky-linux/avs-demo/1.0-r0
32bit 对应的目录
/build/tmp/work/cortexa7hf-neon-vfpv4-poky-linux-gnueabi/avs-demo/1.0-r0

install -d 指建立一个folder
install -m 指把文件收集到指定目录下,并修改权限

主要参考Yocto 一些细节

Yocto 打包rootfs报错
#### 打包rootfs报错

NOTE: scatter: compiling from external source tree /mtk8516/build/../src/bsp/scatter
NOTE: lib64-lk: compiling from external source tree/mtk8516/build/../src/bsp/lk
ERROR: mtk-image-aud-8516-1.0-r0 do_rootfs: Could not invoke dnf. Command '/mtk8516/build/tmp/work/aud8516p1v2_consys_slc-poky-linux-gnueabi/mtk-image-aud-8516/1.0-r0/recipe-sysroot-native/usr/bin/dnf -y -c mtk8516/build/tmp/work/aud8516p1v2_consys_slc-poky-linux-gnueabi/mtk-image-aud-8516/1.0-r0/rootfs/etc/dnf/dnf.conf --setopt=reposdir=mtk8516/build/tmp/work/aud8516p1v2_consys_slc-poky-linux-gnueabi/mtk-image-aud-8516/1.0-r0/rootfs/etc/yum.repos.d --repofrompath=oe-repo,mtk8516/build/tmp/work/aud8516p1v2_consys_slc-poky-linux-gnueabi/mtk-image-aud-8516/1.0-r0/oe-rootfs-repo --installroot=mtk8516/build/tmp/work/aud8516p1v2_consys_slc-poky-linux-gnueabi/mtk-image-aud-8516/1.0-r0/rootfs --setopt=logdir=mtk8516/build/tmp/work/aud8516p1v2_consys_slc-poky-linux-gnueabi/mtk-image-aud-8516/1.0-r0/temp --nogpgcheck install shadow avs-demo run-postinsts android-tools-adbd base-passwd tzapp iperf3 utf-gbk bluetooth-vendor mtkwlan packagegroup-mtk-upgrade-kit-native wpa-supplicant-passphrase wpa-supplicant mtk-audio-service dhcp-server-config upgrade_app dhcpcd dibbler custom glibc-gconv-gbk appmainprog glibc-gconv-libgb libasound thermal-manager nvram wlanmon wireless-tools ppc mtd-utils ipcd mtkcombotool wifi-mw coreutils libfuse2 bluetooth mtk-alsa-plugins sntp mtd-utils-ubifs openssl data-ubi-mnt assistantcenter prog glibc-gconv-gbgbk libnvramcustom glibc-gconv-gb18030 hostapd wpa-ctrl ppccli alsa-utils mtkwifitesttool app-prebuilt curl libcjson1 iptables tcpdump ntpdate mdnsresponder packagegroup-core-boot-aud mtkcombo glibc-gconv-euc-cn smtcn-mw smartaudioplayer ntp buildinfo' returned 1:
Added oe-repo repo from mtk8516/build/tmp/work/aud8516p1v2_consys_slc-poky-linux-gnueabi/mtk-image-aud-8516/1.0-r0/oe-rootfs-repo
Last metadata expiration check: 0:00:00 ago on Sat 14 Dec 2019 05:43:29 AM UTC.
Error: 
 Problem: conflicting requests
  - nothing provides liburiparser.so needed by avs-demo-1.0-r0.cortexa7hf_neon_vfpv4

ERROR: mtk-image-aud-8516-1.0-r0 do_rootfs: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /mtk8516/build/tmp/work/aud8516p1v2_consys_slc-poky-linux-gnueabi/mtk-image-aud-8516/1.0-r0/temp/log.do_rootfs.181418
ERROR: Task (meta/poky/../meta-mediatek-mt8516/recipes-audio/images/mtk-image-aud-8516.bb:do_rootfs) failed with exit code '1'

这个打印看的一头雾水,完全不知道从哪里下手,有点大海捞针的感觉,整整排查了一天,才有方向, 最终比较坑的问题是, 根本不是rootfs打包的问题, 而是其中一个.bb 文件写错导致的, 比如源码是app_demo , 而app-demo.bb 这种类型的错误导致的.

Yocto demo install 报错
WARNING: avs-demo-1.0-r0 do_package: avs-sdk-1.0 was registered as shlib provider for libAudioPlayer.so, changing it to avs-demo-1.0 because it was built later
WARNING: avs-demo-1.0-r0 do_package: avs-sdk-1.0 was registered as shlib provider for libAlerts.so, changing it to avs-demo-1.0 because it was built later
WARNING: avs-demo-1.0-r0 do_package: avs-sdk-1.0 was registered as shlib provider for libEqualizer.so, changing it to avs-demo-1.0 because it was built later
WARNING: avs-demo-1.0-r0 do_package: avs-sdk-1.0 was registered as shlib provider for libSettings.so, changing it to avs-demo-1.0 because it was built later
WARNING: avs-demo-1.0-r0 do_package: avs-sdk-1.0 was registered as shlib provider for libBluetooth.so, changing it to avs-demo-1.0 because it was built later
WARNING: avs-demo-1.0-r0 do_package: avs-sdk-1.0 was registered as shlib provider for libDoNotDisturbCA.so, changing it to avs-demo-1.0 because it was built later
WARNING: avs-demo-1.0-r0 do_package: avs-sdk-1.0 was registered as shlib provider for libPlaybackController.so, changing it to avs-demo-1.0 because it was built later
WARNING: avs-demo-1.0-r0 do_package: avs-sdk-1.0 was registered as shlib provider for libAVSSystem.so, changing it to avs-demo-1.0 because it was built later
WARNING: avs-demo-1.0-r0 do_package: avs-sdk-1.0 was registered as shlib provider for libInteractionModel.so, changing it to avs-demo-1.0 because it was built later
WARNING: avs-demo-1.0-r0 do_package: avs-sdk-1.0 was registered as shlib provider for libAIP.so, changing it to avs-demo-1.0 because it was built later
WARNING: avs-demo-1.0-r0 do_package: avs-sdk-1.0 was registered as shlib provider for libTemplateRuntime.so, changing it to avs-demo-1.0 because it was built later
WARNING: avs-demo-1.0-r0 do_package: avs-sdk-1.0 was registered as shlib provider for libNotifications.so, changing it to avs-demo-1.0 because it was built later
WARNING: avs-demo-1.0-r0 do_package: avs-sdk-1.0 was registered as shlib provider for libExternalMediaPlayer.so, changing it to avs-demo-1.0 because it was built later
WARNING: avs-demo-1.0-r0 do_package: avs-sdk-1.0 was registered as shlib provider for libESP.so, changing it to avs-demo-1.0 because it was built later
WARNING: avs-demo-1.0-r0 do_package: avs-sdk-1.0 was registered as shlib provider for libADSL.so, changing it to avs-demo-1.0 because it was built later
WARNING: avs-demo-1.0-r0 do_package: avs-sdk-1.0 was registered as shlib provider for libSpeechEncoder.so, changing it to avs-demo-1.0 because it was built later
WARNING: avs-demo-1.0-r0 do_package: avs-sdk-1.0 was registered as shlib provider for libContextManager.so, changing it to avs-demo-1.0 because it was built later
ERROR: avs-demo-1.0-r0 do_package: Fatal QA errors found, failing task.
ERROR: avs-demo-1.0-r0 do_package: Function failed: do_package
ERROR: Logfile of failure stored in:/mtk8516/build/tmp/work/aarch64-poky-linux/avs-demo/1.0-r0/temp/log.do_package.86147
ERROR: Task (/mtk8516/meta/poky/../meta-mediatek-mt8516/recipes-apps/avs-demo/avs-demo.bb:do_package) failed with exit code '1'

参考yocto-qa-issue解决

添加如下到demo.bb解决

INSANE_SKIP_${PN} = "ldflags"
INSANE_SKIP_${PN}-dev = "ldflags"
FILES_${PN}-dev = "${includedir}"
Yocto LICENSE_FLAGS_WHITELIST问题
  1. LICENSE_FLAGS_WHITELIST=“commercial(商业的)” 参考见 Yocto tips (17): Yocto License问题:restricted license not whitelisted in LICENSE_FLAGS_WHITELIST
ERROR: Nothing PROVIDES 'gstreamer1.0-plugins-ugly' (but/mtk8516/meta/poky/../meta-mediatek-mt8516/recipes-apps/avs-sdk/avs-sdk.bb DEPENDS on or otherwise requires it)
gstreamer1.0-plugins-ugly was skipped: because it has a restricted license not whitelisted in LICENSE_FLAGS_WHITELIST

解决办法:

因此如果我们需要添加一些commercial Lincense的软件包,就需要添加对commercial的支持,只需要在local.conf中添加一行即可:LICENSE_FLAGS_WHITELIST=“commercial”

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • FFMPEG 配置选项详细说明

    使用以下任何一个开关将允许FFmpeg链接到 相应的外部库。所有组件都依赖于该库 如果所有其他依赖项都得到满足而未满足,则将启用 明确禁...

    程序手艺人
  • 智能音箱中喇叭腔体的参数测量

    最近一直忙碌于喇叭腔体的测试, 只有平衡好 喇叭 / 腔体 / 功放三者之间的关系, 才能保证好的效果.

    程序手艺人
  • 学习Shell笔记记录

    程序手艺人
  • 【机器学习入门系列】梯度下降法

    什么是梯度下降法?学习速率的引入;如何调整学习速率;Adagrad算法介绍;用泰勒展开式对梯度下降法进行数学理论支持。

    张耀琦
  • SAS获取某目录下某种类型文件最后修改时间

    今天介绍一下用FILENAME PIPE来获取某一目录下某种类型文件的最后修改时间。比如要获取程序所在目录下SAS数据集的最后修改时间,代码如下:

    专业余码农
  • 3.着色语言

    3.着色语言 OpenGL ES 3.0新增加功能 非方矩阵,全整数支持,插值限定符号,统一变量块,局部限定符号,新的内建函数,全循环,全分支支持以及无限的...

    大壮
  • MD5 到底是不是加密?

    最近在做线上教学,感触很多。比如,备课比我想象的累多了,超级累,总想做得更好,一天到晚就是备呀备;比如,直播讲课和现场演讲的感觉很不一样,我第一次带着 100 ...

    扔物线
  • 项目的milestone

    要开发一套软件,需要经过一定的流程和阶段。例如:信息搜集,需求分析,系统设计,系统开发,系统测试, 其中有4个阶段产生交付物,每一份交付物都是开发过程中的里程碑...

    公众号php_pachong
  • Kubernetes中,两种常见类型的Volume深度实践

    版权声明:本文为耕耘实录原创文章,各大自媒体平台同步更新。欢迎转载,转载请注明出处,谢谢

    耕耘实录
  • 汉诺塔问题

    _DIY

扫码关注云+社区

领取腾讯云代金券