yoctoyocto-recipe

How to build two images with different settings of a recipe in Yocto


I'm using Yocto. I have two images with the same distro and the same machine and each image should contain the same package, but build with different settings.

For example, the config file sshd_config is part of the opensshd package, but I need a different set of HostKeyAlgorithms depending on the image. (Yes, I could use Include, but that's not the point of this question.)

How can I build two different flavours of the same package? One way would be to have a different distro for each image, but this wouldn't scale. My other idea is to use local.conf to change the build behaviour of the recipe and control the image content (and the difference between both) with the local.conf. But what's best practice?


Solution

  • Best would be different local.conf. You could do in it:

    OVERRIDES:append = ":<something_that_will_distinguish_the_image>"
    

    And then have in your openssh_%.bbappend

    SRC_URI:append:<something_that_will_distinguish_the_image> = " file://different_config"
    

    Reference: https://docs.yoctoproject.org/bitbake/2.2/bitbake-user-manual/bitbake-user-manual-ref-variables.html#term-OVERRIDES