How to cross-compile code in pyro

Sometimes you want to cross-compile some local code for your dreambox.

In krogoth this was done by calling . /oe/krogoth/cross-compile.env


In pyro, there is no more global build root, but only target specific (and therefore really clean) buildroots.

For that reason, the signature of cross-compile.env and the requirements to use it have changed.

Let's have a look at what cross-compile.env tells you to do


usage: . ./cross-compile.env ${MACHINE} ${TARGET}


What you see is and additional argument called ${TARGET}.
Target equals any available bitbake receipe name.

It could be enigma2, enigma2-plugins or anything alike.

Proceeding this example you might call something like


. /oe/pyro/cross-compile.env dreamone enigma2-plugins


If the current package revision of enigma2-plugins has never been built before, you will see the following output:

[*] Generating conf/opendreambox.conf

[*] Generating /oe/pyro/.env/cross-compile-dreamone-enigma2-plugins.env

No toolchain for enigma2-plugins exists. You should bitbake enigma2-plugins first.


Do fix that go and build the package using bitbake

cd /oe/pyro/

. bitbake.env

cd build/dreamone

bitbake enigma2-plugins


Now, go back to your local source directory and call. /oe/pyro/cross-compile.env dreamone enigma2-plugins again.

You should now get a list of created aliases.

[*] Generating /oe/pyro/.env/cross-compile-dreamone-enigma2-plugins.env

Creating shell command aliases:

* oe_autoreconf

* oe_runconf

* oe_runmake

* oe_runmake_kernel

* oe_env

* oe_env_kernel

* oe_setenv

* oe_setenv_kernel

* oe_cmake

* oe_meson


In a typical, simple autotools projcect, all you have to do now is some simple straight autotool calls using the aliases created by cross-compile-env

oe_autoreconf

oe_runconf <your conf args here>

oe_runmake -j<number_of_cpu_threads>


You may omit -j<number_of_cpu_threads> or just insert the number of available cpu threads. On a Ryzen 7, with 8 cores with 2 threads each (16 threads), that would lead to

oe_runmake -j16


Once you've used the cross compile environment you may run into some issues when trying to compile a new version of your package later on.

Everytime the package revision changes the path of all tools changes, too.

To fix that you could use the following set of commands:


oe_autoreconf

oe_runconf <your conf args here>

oe_runmake distclean

oe_runconf <your conf args here>

oe_runmake -j<number_of_cpu_threads>


Side-Note:

If you just want to compile some simple project you could try using another projects receipe or creating a dummy receipe that injects all required dependencies.

    Comments