3

I have some images that are only relevant on a particular platform (let's say some are only for intel core and others are only for sabrelite).

Is it possible that the image automatically sets the MACHINE variable for the build, independently of the local.conf ?

If not, can I at least make the image refuse to build for other machines ?

I tried to do some googling but of course "yocto image selects machine" or similar requests only return generic Yocto tutorials.

Thanks.

navaati
  • 29
  • 5

2 Answers2

1

To add packages depending on machine, you could use the python function base_contains or base-conditional. E.G. bitbake-how-to-add-package-depending-on-machine

There is COMPATIBLE_MACHINE = " " for input in the recipe to check for compatible machine. building-yocto-image-for-dragonboard-410c-how-to-build-chromium

Community
  • 1
  • 1
Charles C.
  • 3,725
  • 4
  • 28
  • 50
1

No, an image can't influence which machine you're building for.

Background: In OpenEmbedded the concepts of a machine, an image, and a distro iare supposed to be orthogonal to each other. I.e. any image should be buildable for any combination of distro and machine. (Of course, that might not always be true in practice though).

You can make the image refuse to build by setting

 COMPATIBLE_MACHINE = "macha"

in your image recipe.

Another idea, if the images are pretty similar, would be to only install the machine specific packages if the image is being built for the correct machine. This can easily be done by:

 IMAGE_INSTALL_append_macha = " package1 package2"

Note the leading space in the string. (_append doesn't prepend your string with a space).

This latter part, is what is normally done. Restricting an image to a particular machine is something that's rarely done, at least in public layers.

Note: macha is the imagined name of the machine.

Anders
  • 8,541
  • 1
  • 27
  • 34