首页 / LINUX / yocto的Linux功能
yocto的Linux功能
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了yocto的Linux功能,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1935字,纯文字阅读大概需要3分钟。
内容图文
![yocto的Linux功能](/upload/InfoBanner/zyjiaocheng/950/111b6529d3f2462db8b30212bbd3474d.jpg)
我想给Linux提供几个文件功能(例如CAP_NET_ADMIN).
我正在使用Yocto,并且我的文件系统应该是只读的,并且在刷新软件后不能更改(这意味着通常无法正常运行的带有setcap的pkg_postinst).
引导目标后,还有其他方法可以为文件提供功能而不更改文件结构吗?
解决方法:
pkg_postinst脚本在构建只读rootfs时已经执行,因此此方法有效.但是,您必须确保您在脚本中调用的命令在构建主机中可用,否则脚本的执行将失败,并且将推迟到设备上的首次启动.如何确保setcap命令可用取决于Yocto版本,这将在Yocto 2.3中更改.这是一个完整的示例食谱:
LICENSE = "MIT"
do_install () {
install -d ${D}/${bindir}
touch ${D}/${bindir}/foobar
}
pkg_postinst_${PN} () {
setcap cap_chown+e "$D/${bindir}/foobar"
}
# Dependency when installing on the target.
RDEPENDS_${PN} = "libcap"
# Dependency for rootfs construction, Yocto > 2.3.
PACKAGE_WRITE_DEPS = "libcap-native"
# Dependency for rootfs construction, Yocto <= 2.3 (untested).
# Enabling this makes builds slightly less efficient with
# Yocto > 2.3 because it implies that libcap-native is
# needed for building this recipe, which isn't the case.
# DEPENDS += "libcap-native"
小心保存Xattrs.默认的.tar图像格式会删除它们.从https://github.com/01org/meta-intel-iot-security/blob/master/meta-security-framework/classes/xattr-images.bbclass的顶部开始:
# xattr support is expected to be compiled into mtd-utils. We just need to
# use it.
EXTRA_IMAGECMD_jffs2_append = " --with-xattr"
# By default, OE-core uses tar from the host, which may or may not have the
# --xattrs parameter which was introduced in 1.27. For image building we
# use a recent enough tar instead.
#
# The GNU documentation does not specify whether --xattrs-include is necessary.
# In practice, it turned out to be not needed when creating archives and
# required when extracting, but it seems prudent to use it in both cases.
IMAGE_DEPENDS_tar_append = " tar-replacement-native"
EXTRANATIVEPATH += "tar-native"
IMAGE_CMD_TAR = "tar --xattrs --xattrs-include=*"
如果有必要,将其放入您的图像配方中.
内容总结
以上是互联网集市为您收集整理的yocto的Linux功能全部内容,希望文章能够帮你解决yocto的Linux功能所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。