Using bitbake is it possible to have a different do_install for a package based on the target image?

一曲冷凌霜 提交于 2019-12-11 03:46:27

问题


We have a single MACHINE which we use to build two target images; foo-image and foobar-image. Both images consume the same version of a package, but we would like to add a change to the do_install task based on which image is built. So that the recipe file for the package looks something like this:

do_install (){
    //Some work
}

do_install_append_foobar-image(){
   //Some foobar work
}

Eventually when we do the build for the two images:

MACHINE=custom bitbake foo-image
MACHINE=custom bitbake foobar-image

The image for foobar will contain the installed package that has done the work in the appends task, but the image for foo will not.

Is there any way to do what I have outlined or what would be an alternative?


回答1:


No, you can't perform different tasks in a recipe based on which image is being built. There might be a possibility of checking the image name in the do_install though I'm highly unsure.

What I'd do is the following:

  • In the recipe, add a 2nd package which includes the additional files (if that's what you want to do).
  • Have your 2nd image recipe include this 2nd package.

Another possibility, depending on if you can detect which image you have built, is to add a post_install-script, that does the modification for you. A third, maybe less good option would be to do changes in a ROOTFS_POSTPROCESS_COMMAND.

Which solution you choose, will depend on what kind of customization you want to.




回答2:


After some deliberation we were probably thinking about this backwards. We probably want to inject separation at the MACHINE level. Since both will be separate products in the end this makes the most sense. Doing it this way will allow us to introduce changes to packages for that specific product.

Our build lines will become:

MACHINE=custom1 bitbake foo-image
MACHINE=custom2 bitbake foobar-image

And our install task for the package can be:

do_install (){
    //Some work
}

do_install_append_custom2(){
   //Some more work
}


来源:https://stackoverflow.com/questions/33288622/using-bitbake-is-it-possible-to-have-a-different-do-install-for-a-package-based

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!