如何将配方限制为仅限本机和nativesdk?

kdo*_*pen 5 openembedded bitbake yocto

我有一个配方,我想阻止为目标构建该配方。

据我所知,给定一个配方xyz.bb,添加BBCLASSEXTEND += " native nativesdk"“神奇”可以实现以下所有功能:

$ bitbake xyz           # 1
$ bitbake nativesdk-xyz # 2
$ bitbake xyz-native    # 3
Run Code Online (Sandbox Code Playgroud)

我只想要数字 2 和 3。我明确不希望数字 #1 成为可能(可能xyz有 GPL v3 许可证,所以我从不希望它出现在目标图像中)

我尝试命名配方xyz-native.bb并添加BBCLASSEXTEND += " nativesdk",但这产生了可构建的目标,如下所示。

$ bitbake xyz-native           # which is what I want
$ bitbake nativesdk-xyz-native # which is NOT what I want
Run Code Online (Sandbox Code Playgroud)

我能看到的唯一其他选项是重命名xyz.bbxyz.inc,然后创建nativesdk-xyz.bband xyz-native.bb,两者都只需要通用xyz.inc文件。

我缺少什么?

luk*_*ard 5

您错过了添加所需的类 -用于创建食谱的nativenativesdk ,

$ grep -rn inherit test-layer/recipes-example/example/ 
test-layer/recipes-example/example/nativesdk-example_0.1.bb:5:inherit nativesdk
test-layer/recipes-example/example/example-native_0.1.bb:5:inherit native
Run Code Online (Sandbox Code Playgroud)

然后你会看到native和nativesdk食谱:

$ bitbake -s | grep example
example-native                                        :0.1-r0                                                  
nativesdk-example                                     :0.1-r0    
Run Code Online (Sandbox Code Playgroud)