Skip to contentSkip to conversation

machine specific task

DISCUSSION Mircea Gliga 3 participants 3 messages Oct 12, 2016

lore
Share & tools
lore
#0 lore raw

According to the docs here http://www.yoctoproject.org/docs/2.1.1/mega-manual/mega-manual.html#structure-your-layers one can specify variables that are machine specific, eg KERNEL_DEVICETREE_qemuarm = "versatile-pb.dtb". I can't find a reference on how to create a task specific only for a certain machine. Is there some mechanism to add and execute a custom task just for a specific machine, using *addtask* ?

As an alternative, I could check the machine name right in the beginning of the do_mycustomtask function, and execute code accordingly, something like (pseudo-code):

do_mycustomtask {
    if {MACHINE} != 'myMachineName'
        return;
    # code executing for all other machines
    [...]
}

addtask mycustomtask after do_configure before do_compile

Thanks

#1 lore raw
Quoted 12 lines · Mircea Gliga

According to the docs here
http://www.yoctoproject.org/docs/2.1.1/mega-manual/mega-manual.html#structure-your-layers
one can specify variables that are machine specific, eg KERNEL_DEVICETREE_qemuarm = "versatile-pb.dtb". I can't find a reference on how to create a task specific only for a certain machine. Is there some mechanism to add and execute a custom task just for a specific machine, using *addtask* ?

As an alternative, I could check the machine name right in the beginning of the do_mycustomtask function, and execute code accordingly, something like (pseudo-code):

Quoted 7 lines
do_mycustomtask {
     if {MACHINE} != 'myMachineName'
         return;
     # code executing for all other machines
     [...]
}

addtask mycustomtask after do_configure before do_compile

It is possible to add the task conditionally in an anonymous Python method:

python () {
if '${MACHINE}' == 'myMachineName':
bb.build.addtask('do_mycustomtask', 'do_compile', 'do_configure', d)
}

I personally find that nicer than the if check in the function itself, because the tasks will only show up in build logs when it actually does something.

Signature · 6 lines
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.
#2 lore raw
Quoted 31 lines · Patrick Ohly
Quoted 2 lines · Mircea Gliga

According to the docs here
http://www.yoctoproject.org/docs/2.1.1/mega-manual/mega-

manual.html#structure-your-layers

Quoted 10 lines

one can specify variables that are machine specific, eg KERNEL_DEVICETREE_qemuarm = "versatile-pb.dtb". I can't find a reference on how to create a task specific only for a certain machine. Is there some mechanism to add and execute a custom task just for a specific machine, using *addtask* ?

As an alternative, I could check the machine name right in the beginning of the do_mycustomtask function, and execute code accordingly, something like (pseudo-code):

Quoted 7 lines
do_mycustomtask {
     if {MACHINE} != 'myMachineName'
         return;
     # code executing for all other machines
     [...]
}

addtask mycustomtask after do_configure before do_compile

It is possible to add the task conditionally in an anonymous Python method:

python () {
if '${MACHINE}' == 'myMachineName':
bb.build.addtask('do_mycustomtask', 'do_compile', 'do_configure',
d)
}

Quoted 3 lines

I personally find that nicer than the if check in the function itself, because the tasks will only show up in build logs when it actually does something.

Good idea, but use d.getVar() :)

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics