Search code examples
yoctobitbakeopenembedded

How to restrict a recipe to native and nativesdk only?


I have a recipe which I want to prevent from being built for the target.

I understand that, given a recipe xyz.bb, adding BBCLASSEXTEND += " native nativesdk" 'magically' allows all of the following:

$ bitbake xyz           # 1
$ bitbake nativesdk-xyz # 2
$ bitbake xyz-native    # 3

I want only numbers 2 and 3. I explicitly do NOT want number #1 to be possible (perhaps xyz has a GPL v3 license, so I never want it in the target image)

I tried naming the recipe xyz-native.bb and addingBBCLASSEXTEND += " nativesdk", but this produced buildable targets as follows.

$ bitbake xyz-native           # which is what I want
$ bitbake nativesdk-xyz-native # which is NOT what I want

The only other option I can see is to rename xyz.bb to xyz.inc and then create nativesdk-xyz.bb and xyz-native.bb with both simply requiring the common xyz.inc file.

What am I missing?


Solution

  • You missed adding required classes - native and nativesdk for created recipes,

    $ 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
    

    Then You shall see native and nativesdk recipes:

    $ bitbake -s | grep example
    example-native                                        :0.1-r0                                                  
    nativesdk-example                                     :0.1-r0