`google-authenticator-libpam` and yocto - yocto

I'm using OpenBMC. I want to add google-authenticator-libpam package. But I don't know how can I notify yocto to compile and add meta-security/recipes-security/google-authenticator-libpam to image as a PAM module. Can anyone help me?
Thanks in advance
---Update---
I moved google-authenticator-libpam package (its directory) from meta-security/recipes-security/ to meta-openembedded/meta-oe/recipes-security and it's visible to bitbake by appending its name to OBMC_IMAGE_EXTRA_INSTALL variable currently (it will append to CORE_IMAGE_EXTRA_INSTALL variable finally).
How can I make meta-security recipes visible to bitbake (same as recipes of meta-openembedded/meta-oe/)?

Related

Restrict a library from going into final image

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

Avoid a library from going to final image in Yocto

I am working on building an Yocto image in which I use some Open Source libraries whiich are required only during the build time. Currently they are not part of the final image. Is there a way to make sure that they do not make it to the final image in the future also?
Thanks in advance.
If any recipe is found in the final image that means the recipe is specified into one of the install variables (IMAGE_INSTALL, IMAGE_FEATURES, ...) or it is specified as a run time dependency of another recipe (RDEPENDS).
I could be one of these cases:
If the libraries are provided by a separate recipe and that recipe is specified as DEPENDS of your main recipe. Make sure that the recipe of the libraries is not present in IMAGE_INSTALL or any image installation variable. And make sure that it is not present in any RDEPENDS variable.
If the main recipe is generating libraries and using them to compile the final result, it is easy, just make sure that they are not installed or mentioned in do_install task.
I found PACKAGE_EXCLUDE to be more helpful which throws an error when the packages of the OSS libraries are being installed on the image by anyone.
Refer the doc - https://docs.yoctoproject.org/2.5.1/ref-manual/ref-manual.html#var-PACKAGE_EXCLUDE

Mapping source file to recipes in yocto

To edit source in Yocto, I have to execute devtool modify <recipe>. I know the name of the source file, say foo.cpp, not the recipe. Using information captured elsewhere I can find out which recipe corresponds to my source file. To me that's the brute force method. Is there a recommended way to find the recipe using Yocto tools?
I have already viewed dependencies and reverse dependencies with Toaster. That did not help.

How to build a recipe but not include it in the OS image

I have custom recipes in my project which I include in the build process using IMAGE_INSTALL_append. This builds & adds all the recipes to the image.
What I need is that only certain recipes get added to the image and others are just built but not added to the image, so That I can install these manually using the rpms.
Is there a way to do this?
Thanks in advance
you can build every package independently using bitbake without including it in the final image:
bitbake <recipe name>
This will build the recipe and put the rpm in the build/deploy/rpm directory.

How to add a missing library (or executable or other file) to Yocto/bitbake

For an application I am running, there is a run time error as it cannot find libwayland-client.so.0 shared object. How do I know which package provides it and where do I add it. I tried as shown below but it gave me a Nothing PROVIDES error.
CORE_IMAGE_EXTRA_INSTALL += "libwayland-client"
You don't typically work with single files when building Yocto images
In reverse order
You install packages to the image
You build packages by using a recipe
You find (or as a last resort write) recipes as part of layers.
Generally when something is missing you take the following steps:
Check the layerindex https://layers.openembedded.org/layerindex/branch/master/recipes/?q=wayland It tells you that there is a recipe called wayland in layer openembedded-core
Add the layer in question. openembedded-core is already contained in Yocto's poky (directly under the name meta, just to confuse the newcomer...), so nothing to add in this example
Create the environment listing of the recipe in question, bitbake -e wayland >wayland.env
Check what packages the recipe in question creates grep ^PACKAGES= wayland.env. In this case it is easy because there is really only one package wayland (-debug, -dev etc. are special purpose that would not contain the library)
Add a package to the image by its package name. How to do that exactly depends on the image type you create. The variable name given in the question works for some images, but not all. Search for IMAGE_INSTALL in the manual https://www.yoctoproject.org/docs/2.6.1/mega-manual/mega-manual.html for other options.
Once you have built the recipe in question you can also check what files are contained in a package (In this case recipe name and package name are identical, but that is not always the case. Some recipes build more than one package suitable for installation, so obviously they need to use different names)
$ oe-pkgdata-util list-pkg-files wayland
wayland:
/usr/lib/libwayland-client.so.0
/usr/lib/libwayland-client.so.0.3.0
/usr/lib/libwayland-cursor.so.0
/usr/lib/libwayland-cursor.so.0.0.0
/usr/lib/libwayland-server.so.0
/usr/lib/libwayland-server.so.0.1.0