bitbake addtask bbclass dependancies
Hi everyone,
I try to figure if the approach is good.
For my embeeded image, I need to run a function name do_thisattheend. The approach I've is:
Into a thisattheend.bbclass file, I write:
inherit loggingdo_thisattheend () {
bbplain Well, it's done
}
do_thisattheend [nostamp] = "1"
addtask after do_image_complete
bitbake show the do_rootfs execution, a little quickly do_image_complete and done.
If I replace addtask thisattheend a fter do_image_complete
by addtask thisattheend before do_build after do_image_complete
I see Well, it's done
And I see it 2 times, when my comprehension is the do_image_complete is called one time.
I've to say that I'm confused about the dependency structure and layout because when I look at the picture:
The do_image_complete is the last state of the build process, exactly where I need to run my task.
What I'm doing wrong?
Any help is appreciated.
Thank you
Tasks you add are *not* automatically run, unless they’re explicitly requested with -c or they’re pulled in as a dependency by a task already being run (i.e. our default task, do_build, see BB_DEFAULT_TASK). i.e. addtask thisattheend after do_image_complete before do_build.
--
Christopher “kergoth” Larson
[email protected], [email protected], [email protected]
Quoted 52 lines · On Feb 11, 2022, 10:55 AM -0700, Martin Leduc <[email protected]>…
Hi everyone,
I try to figure if the approach is good.
For my embeeded image, I need to run a function name do_thisattheend. The approach I've is:
Into a thisattheend.bbclass file, I write:
inherit logging
do_thisattheend() {
bbplain Well, it's done
}do_thisattheend[nostamp] = "1"
addtask after
do_image_completebitbake show the
do_rootfsexecution, a little quicklydo_image_completeand done.If I replace addtask thisattheend after
do_image_completeby addtask thisattheend beforedo_buildafterdo_image_completeI see Well, it's doneAnd I see it 2 times, when my comprehension is the
do_image_completeis called one time.I've to say that I'm confused about the dependency structure and layout because when I look at the picture:
<dummyfile.0.part>
The
do_image_completeis the last state of the build process, exactly where I need to run my task.What I'm doing wrong?
Any help is appreciated.
Thank you
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13340): https://lists.openembedded.org/g/bitbake-devel/message/13340
Mute This Topic: https://lists.openembedded.org/mt/89077246/3617123
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Hi Christopher,
Thank you for this fast answer. I’ve tested your suggestions, and it works. Thank you but, this put me more in the dark by 2 topics because I try to understand.
#1: when you say:
Tasks you add are *not* automatically run, unless they’re explicitly requested with -c or they’re pulled in as a dependency by a task already being run
Did I don’t explicitely don’t request to run it by defining task to be run after do_image_complete?
In build recipes and based on the diagram shown into the mega manual, if the do_rootfs is run, the do_image_complete will be call after the do_rootfs right?. So, again, in my mind, if I have one bbclass file having:
do_thisattheend () { …}
do_thisattheend2 () {…}
addtask thisattheend after do_image_complete
addtask thisattheend2 after thisattheend
I explicitely ask them to be runned no?
#2: do_build … why do_build?
MEGA MANUAL: 27.1.1. do_build¶<https://www.yoctoproject.org/docs/2.7.4/mega-manual/mega-manual.html#ref-tasks-build>
The default task for all recipes. This task depends on all other normal tasks required to build a recipe.
I don’t intend to build a recipe, my intention is to run x functions AFTER the do_image_complete so why the do_build is invoked in that scenario?
Thank you so much for your answers
Martin Leduc
T : (418) 856-6896 [email protected]<mailto:[email protected]>
De : Christopher Larson <[email protected]>
Envoyé : 11 février 2022 17:06
À : [email protected]; Martin Leduc <[email protected]> Objet : [EXTERNAL] Re: [bitbake-devel] bitbake addtask bbclass dependancies
CAUTION: This email originated from outside of Luminator Technology Group. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Tasks you add are *not* automatically run, unless they’re explicitly requested with -c or they’re pulled in as a dependency by a task already being run (i.e. our default task, do_build, see BB_DEFAULT_TASK). i.e. addtask thisattheend after do_image_complete before do_build.
--
Christopher “kergoth” Larson
[email protected]<mailto:[email protected]>, [email protected]<mailto:[email protected]>, [email protected]<mailto:[email protected]> On Feb 11, 2022, 10:55 AM -0700, Martin Leduc <[email protected]<mailto:[email protected]>>, wrote:
Hi everyone,
I try to figure if the approach is good.
For my embeeded image, I need to run a function name do_thisattheend. The approach I've is:
Into a thisattheend.bbclass file, I write:
inherit logging
do_thisattheend () {
bbplain Well, it's done
}
do_thisattheend[nostamp] =
"1"
addtask after do_image_complete
bitbake show the do_rootfs execution, a little quickly do_image_complete and done.
If I replace addtask
thisattheend after do_image_complete
by addtask
thisattheend
before do_build after do_image_complete
I see
Well, it's done
And I see it 2 times, when my comprehension is the do_image_complete is called one time.
I've to say that I'm confused about the dependency structure and layout because when I look at the picture:
<dummyfile.0.part>
The do_image_complete is the last state of the build process, exactly where I need to run my task.
What I'm doing wrong?
Any help is appreciated.
Thank you
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13340): https://lists.openembedded.org/g/bitbake-devel/message/13340
Mute This Topic: https://lists.openembedded.org/mt/89077246/3617123
Group Owner: [email protected]<mailto:[email protected]>
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Hi Martin,
Quoted 10 lines · Martin Leduc
Hi Christopher,
Thank you for this fast answer. I’ve tested your suggestions, and it works. Thank you but, this put me more in the dark by 2 topics because I try to understand.
#1: when you say:
Tasks you add are *not* automatically run, unless they’re explicitly requested with -c or they’re pulled in as a dependency by a task already being run
Did I don’t explicitely don’t request to run it by defining task to be run after
do_image_complete?
Imagine a tree of tasks, each node (task) having their dependencies represented as parent nodes. When you Bitbake a task, all parent nodes (hence dependencies) are run first (from "root" task, usually fetch) and then the actual requested node is run. Anything that is not required for the task to be run won't be run, that is an obvious performance choice. It is very rare to have tasks that aren't dependent on other tasks, meaning if we were to build all tasks with a dependency, the build would take much longer and we would run tasks that aren't interesting.
Take the example of menuconfig of the Linux kernel. To be able to run this, you obviously need the sources of the kernel, but do you want this task to be run every time the Linux kernel is fetched or built? Probably not.
Quoted 1 line
In build recipes and based on the diagram shown into the mega manual, if the
do_rootfsis run, thedo_image_completewill be call after thedo_rootfsright?.
Not always no. You can run do_rootfs without running do_image_complete by requesting Bitbake to run the do_rootfs task (and its dependencies) only. This is done by doing:
bitbake -c do_rootfs myimage-recipe
Quoted 11 lines
So, again, in my mind, if I have one bbclass file having:
do_thisattheend() { …}
do_thisattheend2() {…}addtask thisattheend after
do_image_complete
addtask thisattheend2 after thisattheendI explicitely ask them to be runned no?
No. You explicitly ask thisattheend2 to run thisattheend task when requested to be run and do_image_complete to be run when thisattheend task is requested to be run.
Quoted 6 lines
#2:
do_build… whydo_build?
MEGA MANUAL: 27.1.1. do_build¶<https://www.yoctoproject.org/docs/2.7.4/mega-manual/mega-manual.html#ref-tasks-build>The default task for all recipes. This task depends on all other normal tasks required to build a recipe.
I don’t intend to build a recipe, my intention is to run x functions AFTER thedo_image_completeso why thedo_buildis invoked in that scenario?
An image recipe is a recipe. When you run:
bitbake myimage-recipe
you're building a recipe. An image recipe. You're also actually running the do_build task of myimage-recipe. Which in turns make Bitbake run all dependencies of do_build of that image recipe. Since do_image_complete is a dependency of do_build, it'll get run. However, your custom task, is not a dependency of do_build. Instead it has a dependency of do_image_complete. If you want it to run you need to either run it directly, or add it to a task that is a dependency of the task you're running (usually do_build at the very least) or you make it a direct dependency of this task.
The after and before words do not convey the same meaning in English than it does in Bitbake.
Replace "after" by "depends on" and "before" by "is depended on by", that might help to draw the picture in your mind of those dependencies and how they interact with each other.
Cheers,
Quentin
Quoted 86 lines
Thank you so much for your answers
Martin Leduc
T : (418) 856-6896 [email protected]<mailto:[email protected]>De : Christopher Larson <[email protected]>
Envoyé : 11 février 2022 17:06
À : [email protected]; Martin Leduc <[email protected]> Objet : [EXTERNAL] Re: [bitbake-devel] bitbake addtask bbclass dependanciesCAUTION: This email originated from outside of Luminator Technology Group. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Tasks you add are *not* automatically run, unless they’re explicitly requested with -c or they’re pulled in as a dependency by a task already being run (i.e. our default task,do_build, seeBB_DEFAULT_TASK). i.e. addtask thisattheend afterdo_image_completebeforedo_build.--
Christopher “kergoth” Larson
[email protected]<mailto:[email protected]>, [email protected]<mailto:[email protected]>, [email protected]<mailto:[email protected]> On Feb 11, 2022, 10:55 AM -0700, Martin Leduc <[email protected]<mailto:[email protected]>>, wrote:Hi everyone,
I try to figure if the approach is good.
For my embeeded image, I need to run a function name
do_thisattheend. The approach I've is:Into a thisattheend.bbclass file, I write:
inherit logging
do_thisattheend() {bbplain Well, it's done
}
do_thisattheend[nostamp] =
"1"addtask after
do_image_completebitbake show the
do_rootfsexecution, a little quicklydo_image_completeand done.If I replace addtask
thisattheend afterdo_image_completeby addtask
thisattheend
beforedo_buildafterdo_image_completeI see
Well, it's doneAnd I see it 2 times, when my comprehension is the
do_image_completeis called one time.I've to say that I'm confused about the dependency structure and layout because when I look at the picture:
<dummyfile.0.part>
The
do_image_completeis the last state of the build process, exactly where I need to run my task.What I'm doing wrong?
Any help is appreciated.
Thank you
HI to all,
Thank you so much for your explanations. His name, bitbake, was well chosen (bit bake). I think I've to work on the different functions and, I've to learn in deep Python.
Again, thank you guy's, you solved my issues and fix my comprehension of all of this.
Cheers,
Martin Leduc
T : (418) 856-6896
[email protected]
-----Message d'origine-----
De : Richard Purdie <[email protected]>
Envoyé : 14 février 2022 18:10
À : Quentin Schulz <[email protected]>; Martin Leduc <[email protected]>; Christopher Larson <[email protected]>; [email protected] Objet : [EXTERNAL] Re: [bitbake-devel] bitbake addtask bbclass dependancies
CAUTION: This email originated from outside of Luminator Technology Group. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Quoted 28 lines · Quentin Schulz
Quoted 11 lines · Martin Leduc
#2:
do_build… whydo_build?
MEGA MANUAL: 27.1.1. do_build¶<https://www.yoctoproject.org/docs/2.7.4/mega-manual/mega-m anual.html#ref-tasks-buildQuoted 1 line
The default task for all recipes. This task depends on all other normal tasks required to build a recipe.
I don’t intend to build a recipe, my intention is to run x functions AFTER thedo_image_completeso why thedo_buildis invoked in that scenario?An image recipe is a recipe. When you run:
bitbake myimage-recipe
you're building a recipe. An image recipe. You're also actually
running thedo_buildtask of myimage-recipe. Which in turns make
Bitbake run all dependencies ofdo_buildof that image recipe. Sincedo_image_completeis a dependency ofdo_build, it'll get run. However,
your custom task, is not a dependency ofdo_build. Instead it has a dependency ofdo_image_complete. If you want it to run you need to either run it directly, or add it to
a task that is a dependency of the task you're running (usuallydo_buildat the very
least) or you make it a direct dependency of this task.
Quoted 6 lines
The after and before words do not convey the same meaning in English than it does in Bitbake.
Replace "after" by "depends on" and "before" by "is depended on by", that might help to draw the picture in your mind of those dependencies and how they interact with each other.
Put another way, you requested "after do_image_complete" but you didn't specify it had to run before any other task. This means it ends up as an endpoint on the task graph and the only way to run it is to call it directly. Sometimes this is what you need/want.
The default task is "do_build" so "bitbake some-image" is really "bitbake -c build some-image". If you want the task to run as part of the default build, you'd specify "before do_build" as well as the after constraint.
Cheers,
Richard