Search code examples
yoctobitbake

Build image for mips AND application (part of same image) for host


I can successfully build and run a MIPS image on my target device. I use a command such as:

bitbake <image-name>

I also want to be able to build an executable (and all its dependencies) that is part of the same image, to run on my x86_64 host. Using my image configuration of build above, I can execute a partial build of my image simply by giving the following command:

bitbake <name-of-executable>

Obviously, without any changes the executable (and all its dependencies) will be a MIPS-build.

What do I have to change to have the executable (and all its dependencies) be built to run on my developer machine, an x86_64?


Solution

  • You would need to build a -native version of your recipe.

    Often, this is possible by adding the following line to your recipe, example.bb:

    BBCLASSEXTEND = "native"
    

    That would allow you to call bitbake example to still create the package for MIPS, while allowing you to call bitbake example-native to create a package / binary to be used within the bitbake environment. (I.e. it's built for x86_64 in your case).