forcing a task to run while building an image
Hello all,
How do I force a particular task to run every time while building an
image? At present in my custom image recipe I've added the following lines
SOME_VARIABLE = "Blah" do_bootimg[depends] += "base-files:do_install"
But the contents of ${SOME_VARIABLE} is not available in the 'base-files' recipe. Even
export SOME_VARIABLE = "Blah"
doesn't solve the problem. So, I would like to know whether the approach used here to force a task is correct. Moreover how can I make the variable defined here to be available in the forced task.
Regards
Joshua
Signature · 3 lines
Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in
Hello,
Quoted 6 lines · Joshua Immanuel
At present in my custom image recipe I've added the following lines
SOME_VARIABLE= "Blah" do_bootimg[depends] += "base-files:do_install"
Quoted 6 lines
But the contents of ${SOME_VARIABLE} is not available in the 'base-files' recipe. Even
export
SOME_VARIABLE= "Blah"doesn't solve the problem.
$ bitbake custom-image -c devshell
In the above devshell I can find the contents of ${SOME_VARIABLE} available but the content of it is empty in 'base-files' recipe. Can someone guide me?
Regards
Joshua
Signature · 3 lines
Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in
creating global variables in a recipes
Hello all,
Quoted 9 lines · Joshua Immanuel
Quoted 9 lines
At present in my custom image recipe I've added the following lines
SOME_VARIABLE= "Blah" do_bootimg[depends] += "base-files:do_install"But the contents of ${SOME_VARIABLE} is not available in the 'base-files' recipe. Even
Quoted 8 lines
Quoted 3 lines
export
SOME_VARIABLE= "Blah"doesn't solve the problem.
$ bitbake custom-image -c devshellIn the above devshell I can find the contents of ${SOME_VARIABLE} available but the content of it is empty in 'base-files' recipe.
In other words, I need to define global variables in a package which can be used across multiple packages. At present the only option I have is to export the variable in build/conf/local.conf. IMHO, this doesn't feel like a proper solution (as the variable is my layer specific). Moreover, I can't change the value of it in one package to be used in other package(s).
Is there any other way to do this? Please guide me.
Regards
Joshua
Signature · 3 lines
Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in
Re: creating global variables in a recipes
Nope. Recipes cannot modify the metadata of other recipes or the configuration metadata, ever. In particular cases, we emit content to tmpdir and read it back in elsewhere, but in general you should just not do what you're trying to do, and find a better solution.
Signature · 1 line
Christopher Larson
Quoted 47 lines · Joshua Immanuel
Hello all,
Quoted 11 lines · Joshua Immanuel
Quoted 11 lines
At present in my custom image recipe I've added the following lines
SOME_VARIABLE= "Blah"
do_bootimg[depends] += "base-files:do_install"But the contents of ${SOME_VARIABLE} is not available in the 'base-files' recipe. Even
export
SOME_VARIABLE= "Blah"Quoted 9 lines
Quoted 2 lines
doesn't solve the problem.
$ bitbake custom-image -c devshellIn the above devshell I can find the contents of ${SOME_VARIABLE} available but the content of it is empty in 'base-files' recipe.
In other words, I need to define global variables in a package which can be used across multiple packages. At present the only option I have is to export the variable in
build/conf/local.conf. IMHO, this doesn't feel like a proper solution (as the variable is my layer specific). Moreover, I can't change the value of it in one package to be used in other package(s).Is there any other way to do this? Please guide me.
Regards
JoshuaSignature · 8 lines
Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in _______________________________________________ yocto mailing list [email protected] (mailto:[email protected]) https://lists.yoctoproject.org/listinfo/yocto
Re: creating global variables in a recipes
In reply to Joshua ImmanuelQuoted 21 lines · Joshua Immanuel
Hello all,
Quoted 9 lines · Joshua Immanuel
Quoted 9 lines
At present in my custom image recipe I've added the following lines
SOME_VARIABLE= "Blah" do_bootimg[depends] += "base-files:do_install"But the contents of ${SOME_VARIABLE} is not available in the 'base-files' recipe. Even
Quoted 8 lines
Quoted 3 lines
export
SOME_VARIABLE= "Blah"doesn't solve the problem.
$ bitbake custom-image -c devshellIn the above devshell I can find the contents of ${SOME_VARIABLE} available but the content of it is empty in 'base-files' recipe.
Quoted 9 lines
In other words, I need to define global variables in a package which can be used across multiple packages. At present the only option I have is to export the variable in
build/conf/local.conf. IMHO, this doesn't feel like a proper solution (as the variable is my layer specific). Moreover, I can't change the value of it in one package to be used in other package(s).Is there any other way to do this? Please guide me.
I am not sure I can give you a better option that local.conf but I can explain why what your doing does not work.
It may feel from your usage that the image recipe is the ancestor of all the recipes but this is really not true. The settings in a image recipe effect the assembly of that image and not the packages that they depend on. An image could be assembled from packages that were built long ago or inherited via shared state.
settings in local,conf on the other hand affect all recipes. If you add something there it will be seen by all recipes. Unfortunately this means that all recipes are dependent on the settings and everything will need to be rebuilt in case the new setting effects them. I believe this also means you will not be able to used share state with someone with a different setting of (or unset) SOME_VARIABLE. (Well you can but you will both be rebuild everything.)
Alternatives to the whole approach are to make alternative packages for the various cases (busybox-minimal vs busybox-full) or use an image task to create an asset in the file system that then makes a difference at run time.
Quoted 9 lines
Regards
Joshua_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
Re: creating global variables in a recipes
Hello William, Christopher,
Thanks for the detailed explanation.
Quoted 18 lines · William Mills
I am not sure I can give you a better option that local.conf but I can explain why what your doing does not work.
It may feel from your usage that the image recipe is the ancestor of all the recipes but this is really not true. The settings in a image recipe effect the assembly of that image and not the packages that they depend on. An image could be assembled from packages that were built long ago or inherited via shared state.
settings in local,conf on the other hand affect all recipes. If you add something there it will be seen by all recipes. Unfortunately this means that all recipes are dependent on the settings and everything will need to be rebuilt in case the new setting effects them. I believe this also means you will not be able to used share state with someone with a different setting of (or unset)
SOME_VARIABLE. (Well you can but you will both be rebuild everything.)
Quoted 4 lines
Alternatives to the whole approach are to make alternative packages for the various cases (busybox-minimal vs busybox-full) or use an image task to create an asset in the file system that then makes a difference at run time.
My use-case is that I am creating an /etc/fstab file via base-files.bbappend recipe. In that fstab, I use uuid (generated via uuidgen) to denote different partition filesystems. So, I have to use this uuid in the extended image_types.bbclass file to set them to the generated partition images appropriately (via tune2fs).
One more approach I can think of is to echo the uuid to some file in the deploy images directory (while creating the fstab file) and read them back in image_types class. But this process looks messy.
Regards
Joshua
Signature · 3 lines
Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in
Re: creating global variables in a recipes
Quoted 30 lines · Joshua Immanuel
Quoted 18 lines · William Mills
I am not sure I can give you a better option that local.conf but I can explain why what your doing does not work.
It may feel from your usage that the image recipe is the ancestor of all the recipes but this is really not true. The settings in a image recipe effect the assembly of that image and not the packages that they depend on. An image could be assembled from packages that were built long ago or inherited via shared state.
settings in local,conf on the other hand affect all recipes. If you add something there it will be seen by all recipes. Unfortunately this means that all recipes are dependent on the settings and everything will need to be rebuilt in case the new setting effects them. I believe this also means you will not be able to used share state with someone with a different setting of (or unset)
SOME_VARIABLE. (Well you can but you will both be rebuild everything.)Quoted 4 lines
Alternatives to the whole approach are to make alternative packages for the various cases (busybox-minimal vs busybox-full) or use an image task to create an asset in the file system that then makes a difference at run time.
My use-case is that I am creating an
/etc/fstabfile via base-files.bbappend recipe. In that fstab, I use uuid (generated via uuidgen) to denote different partition filesystems. So, I have to use this uuid in the extended image_types.bbclass file to set them to the generated partition images appropriately (via tune2fs).
Quoted 3 lines
One more approach I can think of is to echo the uuid to some file in the deploy images directory (while creating the fstab file) and read them back in
image_typesclass. But this process looks messy.
I'd say generate them in the configuration metadata via inline python or an anonymous python function, then use those variables both in the base-files recipe and images.
Signature · 1 line
Christopher Larson
Re: creating global variables in a recipes
Hello Chris,
Thanks for the reply.
Quoted 6 lines · Chris Larson
Quoted 6 lines
My use-case is that I am creating an
/etc/fstabfile via base-files.bbappend recipe. In that fstab, I use uuid (generated via uuidgen) to denote different partition filesystems. So, I have to use this uuid in the extended image_types.bbclass file to set them to the generated partition images appropriately (via tune2fs).
Quoted 7 lines
Quoted 3 lines
One more approach I can think of is to echo the uuid to some file in the deploy images directory (while creating the fstab file) and read them back in
image_typesclass. But this process looks messy.I'd say generate them in the configuration metadata via inline python or an anonymous python function, then use those variables both in the base-files recipe and images.
Please bear with my ignorance. What do you mean by "generating them in configuration metadata"? In which file should I do that?
At present as an ugly hack I exported the uuids in the build/conf/local.conf.
Regards
Joshua
Signature · 3 lines
Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in
Re: creating global variables in a recipes
In reply to William MillsQuoted 9 lines · William Mills
I am not sure I can give you a better option that local.conf but I can explain why what your doing does not work.
It may feel from your usage that the image recipe is the ancestor of all the recipes but this is really not true. The settings in a image recipe effect the assembly of that image and not the packages that they depend on. An image could be assembled from packages that were built long ago or inherited via shared state.
Quoted 7 lines
settings in local,conf on the other hand affect all recipes. If you add something there it will be seen by all recipes. Unfortunately this means that all recipes are dependent on the settings and everything will need to be rebuilt in case the new setting effects them. I believe this also means you will not be able to used share state with someone with a different setting of (or unset)
SOME_VARIABLE. (Well you can but you will both be rebuild everything.)
Just a small clarification:
With sstate, it actually depends whether SOME_VARIABLE is used by the given sstate task or its dependencies. We have variable dependency tracking code and can tell where variables are used and with what value.
The end result is you can have different local.conf files and share sstate output in many cases, but real differences to the individual task inputs will get accounted for.
Cheers
Richard
Re: creating global variables in a recipes
Quoted 1 line · Richard Purdie
Just a small clarification:
Thanks Richard. I wondered about that but figured you would jump in if I over simplified.
Quoted 3 lines · Joshua Immanuel
Hello all,
How do I force a particular task to run every time while building an image?
You may have look at this
http://docs.openembedded.org/usermanual/usermanual.html#usage_workwithsinglerecipe.
I think, image are build from the packages that are build from the recipe. And there is no way for the bitbake to detect that source is changed like the makefile.
But there is always another way to do things we need. Here is my tip, you can do to this.( need comments on this).
add a task in your recipe, like,
do_mytask() {
#add commands to clean and do your stuff.
#you can also pull from version control. #ordinary shell commands , need not to master anythings.
}
addtask do_mytask before do_build
add this to one of your recipe to build the image, now use bitbake -b <your recipe> -c <do_mytask()>
Signature · 3 lines
Regards, Sathishkumar D http://flowersopenlab.weebly.com/
Hello Sathishkumar,
Quoted 3 lines · Sathishkumar Duraisamy
I think, image are build from the packages that are build from the recipe. And there is no way for the bitbake to detect that source is changed like the makefile.
My use-case is such that I need to run a particular task irrespective of the changes in that recipe. By adding the task to do_bootimg[depends] I was able to accomplish that. (I am not sure whether it is the preferred way of doing it)
However, the variables defined in the custom image recipe were not getting exposed to the task added to the do_bootimg[depends]. Thats the part that I've to figure out (need help).
Regards
Joshua
Signature · 3 lines
Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in
Quoted 1 line · Joshua Immanuel
Hello Sathishkumar,
hello
Quoted 5 lines · Sathishkumar Duraisamy
Quoted 3 lines
I think, image are build from the packages that are build from the recipe. And there is no way for the bitbake to detect that source is changed like the makefile.
Quoted 8 lines
My use-case is such that I need to run a particular task irrespective of the changes in that recipe. By adding the task to do_bootimg[depends] I was able to accomplish that. (I am not sure whether it is the preferred way of doing it)
However, the variables defined in the custom image recipe were not getting exposed to the task added to the do_bootimg[depends]. Thats the part that I've to figure out (need help).
I understood what you trying to mean. Can you please clarify what image means, whether final image of rfs like jffs2 or package from a recipe.
Signature · 3 lines
Regards, Sathishkumar D http://flowersopenlab.weebly.com/
Hello Sathishkumar,
Quoted 3 lines · Sathishkumar Duraisamy
I understood what you trying to mean. Can you please clarify what image means, whether final image of rfs like jffs2 or package from a recipe.
I meant the final rootfs image as in 'core-image-minimal'.
Regards
Joshua
Signature · 3 lines
Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in
Hello,
Quoted 4 lines · Joshua Immanuel
My use-case is such that I need to run a particular task irrespective of the changes in that recipe. By adding the task to do_bootimg[depends] I was able to accomplish that. (I am not sure whether it is the preferred way of doing it)
After removing the INHERIT += "rm_work" from my build/conf/local.conf, the dependency added to following
do_bootimg[depends] += "base-files:do_install"
failed to force rebuild. So, again I am stuck with local.conf file manipulation :(
I guess there should be a cleaner approach to this than doing
$ bitbake -c clean base-files
$ bitbake custom-imagethe above, every time I build my custom image.
Regards
Joshua
Signature · 3 lines
Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in
The following is the scenario, you are in. If I wrong, please correct me. " You have your development program/application in some place. You want to build and include it in your rootfs. And you don't want to edit the recipe/other things for each build of rootfs."
The scenario is very common. What we actually do is, for development we usually test by downloading the specific application binary to rfs by compiling with the sdk (created from oe). And usually our application will be in some version control say hg or git. Once the apps is ready, modify the recipe to include the particular version of apps.
Signature · 3 lines
Regards, Sathishkumar D http://flowersopenlab.weebly.com/
Hello Sathishkumar,
Quoted 5 lines · Sathishkumar Duraisamy
The following is the scenario, you are in. If I wrong, please correct me.
" You have your development program/application in some place. You want to build and include it in your rootfs. And you don't want to edit the recipe/other things for each build of rootfs."
Let me explain (though I've mentioned in many places in bits and pieces). At present situation, when we build an image (say 'core-image-minimal') everything goes under one partition. But, for my use-case I am trying to generate two sets of images denoting different partitions as I already mentioned in
https://lists.yoctoproject.org/pipermail/yocto/2012-January/006611.html
So, in order to do that, I've to identify the different partitions in my etc/fstab file. This is done by denoting filesystems by their uuids.
So, every time I build my custom-image I have to construct the /etc/fstab file with the generated uuids (by using uuidgen) and set the same uuids in the generated images using tune2fs. Setting the uuid to generated images is done by overriding image_types.bbclass file.
Similarly constructing the fstab file is done by adding base-files_3.0.14.bbappend in my custom layer.
So, I have to force the base-files:do_install task to run whenever we build the custom-image. Otherwise the uuids in the /etc/fstab will be the older ones and the uuids set to the generated images will be the newer ones. They will not match thereby defeating the whole purpose of building partition based images.
In this context, I was trying to create a global variables to store the uuids in order to be shared across multiple packages (i.e base-files and image_types) But that too doesn't look like a piece of cake.
Am I trying something too weird?
Sorry for bombarding the list over and over again with the same issue.
Regards
Joshua
Signature · 3 lines
Joshua Immanuel HiPro IT Solutions Private Limited http://hipro.co.in