yocto的Linux的AT指令,使用yocto的Linux功能

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"

# 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=*"

要把它放到你的形象的食谱,如果它很重要。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值