2

I am building a Yocto image. There are some GPLv3 libraries which are required only at build time. I have put GPLv3 as INCOMPATIBLE_LICENSE and whitelisted the libraries which are required at build time. But these libraries are getting into the final image. How can I restrict them into the final image and only use them at the build time?

Captain Levi
  • 55
  • 1
  • 8

3 Answers3

1

If we think about the Yocto basics, we know that everything goes into the final image is a collection of recipes providing packages that are collected together in a single root file system.

So, what makes a recipe goes into the final rootfs ?

  • Added via IMAGE_INSTALL.
  • Be set as RDEPENDS of another recipe.

You need to analyse that deeply to find out what goes into your final rootfs.

Also, you may not find it obvious in the content of IMAGE_INSTALL by running:

bitbake -e <your_image_recipe> | grep ^IMAGE_INSTALL= 

but, you may see some packagegroups that are shipped. A packagegroup is a group that RDEPENDS on a list of other recipes.

So, you need to carefully analyse them (if found) to see what provides the lib you want to inhibit from rootfs.

packagegroups usually gets shipped dynamically via IMAGE_FEATURES variable.

So, those are the most important points that are responsible of shipping a recipe to the rootfs. So, Analyse your wanted recipe.

  • Is it an RDEPENDS of another recipe ?
  • Find out where exactly it gets called to be shipped.
Talel BELHADJSALEM
  • 3,199
  • 1
  • 10
  • 30
  • This solution might work but I was looking for a variable based solution where I just need to list down the such packages. – Captain Levi Jul 13 '22 at 11:42
  • If you give a specific example maybe I can understand more, because your question is too generic . – Talel BELHADJSALEM Jul 13 '22 at 12:14
  • I have put GPLv3 license as INCOMPATIBLE_LICENSE. The packages which are required in build, I have put in WHITELIST_GPL-3.0. But I only want these packages during build, I do not want them to go into the image. – Captain Levi Jul 13 '22 at 13:02
1

Removing the installation of lib from do_install task by adding something like this in recipe e.g gdb as you said

do_install:append()
{
#remove the lib which you don't want to ship into image
}

And make sure the same lib is not added to FILES var in recipe

e.g FILES:${PN} += "< lib >"

Prashant
  • 43
  • 5
0

PACKAGE_EXCLUDE worked for me. If packages listed under PACKAGE_EXCLUDE is getting into the final image, then this will raise an error. Also if any other package has a runtime dependency on a package listed under PACKAGE_EXCLUDE, then this will raise an error too.

References: https://docs.yoctoproject.org/ref-manual/variables.html#term-PACKAGE_EXCLUDE https://git.yoctoproject.org/poky/tree/meta/conf/documentation.conf#n313

Captain Levi
  • 55
  • 1
  • 8