All of lore.kernel.org
 help / color / mirror / Atom feed
* machine specific task
@ 2016-10-12  9:58 Mircea Gliga
  2016-10-12 11:08 ` Patrick Ohly
  0 siblings, 1 reply; 3+ messages in thread
From: Mircea Gliga @ 2016-10-12  9:58 UTC (permalink / raw)
  To: yocto

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: machine specific task
  2016-10-12  9:58 machine specific task Mircea Gliga
@ 2016-10-12 11:08 ` Patrick Ohly
  2016-10-12 15:36   ` Christopher Larson
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick Ohly @ 2016-10-12 11:08 UTC (permalink / raw)
  To: Mircea Gliga; +Cc: yocto

On Wed, 2016-10-12 at 12:58 +0300, Mircea Gliga wrote:
> 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

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.

-- 
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.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: machine specific task
  2016-10-12 11:08 ` Patrick Ohly
@ 2016-10-12 15:36   ` Christopher Larson
  0 siblings, 0 replies; 3+ messages in thread
From: Christopher Larson @ 2016-10-12 15:36 UTC (permalink / raw)
  To: Patrick Ohly; +Cc: yocto

[-- Attachment #1: Type: text/plain, Size: 1603 bytes --]

On Wed, Oct 12, 2016 at 4:08 AM, Patrick Ohly <patrick.ohly@intel.com>
wrote:

> On Wed, 2016-10-12 at 12:58 +0300, Mircea Gliga wrote:
> > 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
>
> 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.


Good idea, but use d.getVar() :)
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

[-- Attachment #2: Type: text/html, Size: 2347 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-12 15:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-12  9:58 machine specific task Mircea Gliga
2016-10-12 11:08 ` Patrick Ohly
2016-10-12 15:36   ` Christopher Larson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.