How to build two images with different settings of a recipe in Yocto
[I posted this question on Stackoverflow: https://stackoverflow.com/q/77871008/8452187]
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 different local.conf. (BTW: I'm using KAS ( https://ghcr.io/siemens/kas ) which makes local.conf generation easy.) But what's best practice?
Putting image specific tweaks into local.conf is not a good practice. Local.conf should be extremely minimal, and ideally contain only MACHINE and DISTRO.
I would do it with two different image recipes that share almost everything via common .inc, except ROOTFS_POSTPROCESS_COMMAND. You can find examples for how to manipulate sshd_config using that in meta/classes-recipe/rootfs-postcommands.bbclass
Alex
Quoted 18 lines · Jörg Sommer via lists.yoctoproject.org
[I posted this question on Stackoverflow: https://stackoverflow.com/q/77871008/8452187]
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_configis 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 different local.conf. (BTW: I'm using KAS which makes local.conf generation easy.) But what's best practice?
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#62308): https://lists.yoctoproject.org/g/yocto/message/62308
Mute This Topic: https://lists.yoctoproject.org/mt/103992605/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Thanks for your reply. It helps, but I see some issues with the ROOTFS_POSTPROCESS_COMMAND.
For the config file this is a possible solution. But what can I do if I need code changes? SSH announced they'll disable DSA support by default in a few months and for all other images except one I would stay with this default. I have to supply another setting to configure when building the recipe for one image. And I have more images they require reduced (or widened) settings of packages.
And editing the image has the drawback that it doesn't play well with package management. If I install/update the sshd ipk, it doesn't contain the change from ROOTFS_POSTPROCESS_COMMAND.
There's no way around this: you can't build the same recipe in two different ways for two different images in the same DISTRO. The different behavior has to be specified through config files and picked up at runtime, and not through build time settings. All products and builds and CI infrastructure for them must be planned with that in mind.
Different local.conf is essentially a different distro in all but name, and less understandable or maintainable.
Alex
Quoted 6 lines · Jörg Sommer via lists.yoctoproject.org
Thanks for your reply. It helps, but I see some issues with the
ROOTFS_POSTPROCESS_COMMAND.For the config file this is a possible solution. But what can I do if I need code changes? SSH announced they'll disable DSA support by default in a few months and for all other images except one I would stay with this default. I have to supply another setting to configure when building the recipe for one image. And I have more images they require reduced (or widened) settings of packages.
And editing the image has the drawback that it doesn't play well with package management. If I install/update the sshd ipk, it doesn't contain the change from
ROOTFS_POSTPROCESS_COMMAND.
A message that is not in the archive (sent off-list or not yet received): [email protected]
That said, if the difference between distros is only in specific recipe settings, then I think the builds will reuse each other's sstate, other than the recipes that differ, and their consumers.
Alex
Quoted 30 lines · Alexander Kanavin via lists.yoctoproject.org
There's no way around this: you can't build the same recipe in two different ways for two different images in the same DISTRO. The different behavior has to be specified through config files and picked up at runtime, and not through build time settings. All products and builds and CI infrastructure for them must be planned with that in mind.
Different local.conf is essentially a different distro in all but name, and less understandable or maintainable.
Alex
Quoted 6 lines · Jörg Sommer via lists.yoctoproject.org
Thanks for your reply. It helps, but I see some issues with the
ROOTFS_POSTPROCESS_COMMAND.For the config file this is a possible solution. But what can I do if I need code changes? SSH announced they'll disable DSA support by default in a few months and for all other images except one I would stay with this default. I have to supply another setting to configure when building the recipe for one image. And I have more images they require reduced (or widened) settings of packages.
And editing the image has the drawback that it doesn't play well with package management. If I install/update the sshd ipk, it doesn't contain the change from
ROOTFS_POSTPROCESS_COMMAND.-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#62314): https://lists.yoctoproject.org/g/yocto/message/62314
Mute This Topic: https://lists.yoctoproject.org/mt/103992605/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 4 lines · Alexander Kanavin
That said, if the difference between distros is only in specific recipe settings, then I think the builds will reuse each other's sstate, other than the recipes that differ, and their consumers.
Except for example when e.g. icecc is used which adds DISTRO in all sstate signatures in icecc_version:
https://git.openembedded.org/openembedded-core/tree/meta/classes/icecc.bbclass#n217
Regards,
Quoted 50 lines
Alex
Quoted 8 lines · Alexander Kanavin via lists.yoctoproject.org
There's no way around this: you can't build the same recipe in two different ways for two different images in the same DISTRO. The different behavior has to be specified through config files and picked up at runtime, and not through build time settings. All products and builds and CI infrastructure for them must be planned with that in mind.
Quoted 9 lines
Different local.conf is essentially a different distro in all but name, and less understandable or maintainable.
Alex
Quoted 2 lines · Jörg Sommer via lists.yoctoproject.org
Thanks for your reply. It helps, but I see some issues with the
ROOTFS_POSTPROCESS_COMMAND.Quoted 2 lines
Quoted 2 lines
For the config file this is a possible solution. But what can I do if
I need code changes? SSH announced they'll disable DSA support by default in a few months and for all other images except one I would stay with this default. I have to supply another setting to configure when building the recipe for one image. And I have more images they require reduced (or widened) settings of packages.
Quoted 2 lines
Quoted 2 lines
And editing the image has the drawback that it doesn't play well with
package management. If I install/update the sshd ipk, it doesn't contain the change from
ROOTFS_POSTPROCESS_COMMAND.Quoted 3 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#62316):
https://lists.yoctoproject.org/g/yocto/message/62316
Mute This Topic: https://lists.yoctoproject.org/mt/103992605/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-