首页 > 解决方案 > Yocto rust recipe 还产生需要打包的 -native 输出

问题描述

我在 hardknott 上尝试了这种方法,但我无法让它工作配方也产生需要打包的 -native 输出

这是一个生成 x86_64 应用程序的 rust 配方,我想将它以正确的方式打包到 sdk 中,以便可以使用。

我可以将主包分离到-native-bin,并在recipe-sysroot中看到它,但是在构建-native-helper配方时,我无法让它填充文件的workdir的recipe-sysroot。我怀疑原因是我收到一个错误,即找不到 x86_64 的主要配方?

ERROR: Manifest xxxxxx.populate_sysroot not found in vs_imx8mp cortexa53 armv8a-crc armv8a aarch64 allarch x86_64_x86_64-nativesdk (variant '')?

因此,任何有用的信息将不胜感激!

标签: yoctobitbakeopenembedded

解决方案


像这样被黑客入侵:

食谱.bb:

do_install_append() {
    # Set permision without run flag so that it doesn't fail on checks
    chmod 644 ${D}/usr/bin/@RECIPE@-compiler
}

# @RECIPE@ generates a compiler during the target generation step
#separate this to the -native-bin package, and skip the ARCH checks
#also in the image file for stations_sdk move the app to right dir and add execute flag
PACKAGES_prepend = "${PN}-native-bin "
PROVIDES_prepend = "${PN}-native-bin "
INSANE_SKIP_${PN}-native-bin = "arch"
FILES_${PN}-native-bin = "/usr/bin/@RECIPE@-compiler"

SYSROOT_DIRS += "/"

图片.bb:

# @RECIPE@ produces a compiler that is produced as a part of the target generation
#so we use the recipe and hack it to supply the -compiler as part of the 
#host binaries
TOOLCHAIN_TARGET_TASK_append = " @RECIPE@-native-bin"

do_fix_@RECIPE@() {
    mv ${SDK_OUTPUT}/${SDKTARGETSYSROOT}/usr/bin/@RECIPE@-compiler ${SDK_OUTPUT}/${SDKPATHNATIVE}/usr/bin/@RECIPE@-compiler
    chmod 755 ${SDK_OUTPUT}/${SDKPATHNATIVE}/usr/bin/@RECIPE@-compiler
}

SDK_POSTPROCESS_COMMAND_prepend = "do_fix_@RECIPE@; "

这会在最后生成正确目录中的二进制文件


推荐阅读