Extracting particular executable from Yocto build files - yocto

I have a project that could be built with the Yocto build system to generate a full disk image. According to the existing procedure, I can get only a full disk image that should be flashed on SD card.
And this does not suit my needs because I can't flash the image on the board. In my case, I need to build a certain project (that currently has a recipe) to an executable. (This project currently is a part of the full disk that is built with Yocto)
So I am wondering, is it possible to extract this executable (and the libraries that this executable depends on) from Yocto build files, so that I could copy and install it on the board? Which possibilities do I have to do this? Do I have some quick and dirty way to do this?
P.S: I heard something about that Yocto can provide a package for a certain project, that could be installed by the corresponding package manager on the board. On the board installed dpkg package manager.

It's a solution to add tar.gz to your IMAGE_FSTYPE.
After building the image, you can extract the executable you were looking for from the created archive.
Or you add the output format you need for your target and install the full image.

Related

Yocto check which packages are installed on target system

I have a Yocto system where I'm running some Chef InSpec scans. Chef InSpec offers a command to check if a package is installed, however, that doesn't work with Yocto (I imagine it would if you'd install a package manager, but I don't want to do that). What would be the best way to check if a certain package is installed on the system?
I know that bitbake can show every package that would be in the built image, but I need to check on the target system. Is there a way I can get this information from bitbake from within a recipe that would just route the output into a file on the rootfs? Or is there a better approach without installing a package manager on the target system?
Inside the folder tmp/deploy/images/$MACHINE/${IMAGE}/
You should see a file named with manifest extension. It is often named like this : [image-name]-[image-version].manifest"
In this file you will find all packages that are present in your linux image built with Yocto, so packages that will be deployed in your target.

Yocto deploy Debug or Release prebuild?

I am writing a bitbake recipe to deploy a third party pre-built tool, similar to this wiki page: https://wiki.yoctoproject.org/wiki/TipsAndTricks/Packaging_Prebuilt_Libraries
However, I have a Release and Debug pre-build versions of the tool available as *.so files. How do I distinguish inside the recipe which one of both build types I shall deploy?
Thanks and regards,
Martin
You can have two different virtual recipes each with their own .so file. This then warrants a selection in a configuration file (with PREFERRED_PROVIDER_virtual/my-recipe), so either in a machine or distro configuration file. This is probably preferred if you consider having release and debug distros.
A second option is to install the libraries in two different paths, in two different PACKAGES (use FILES_my-package for that) and make them RCONFLICTS_my-package each other to be sure they can't both be in the rootfs. After that, you could write a pkg_postinst_my-package() task specific to each package that actually move the library from the "different" path to the intended one. This will be run both at build time when creating the rootfs and at runtime on first boot, so you need to make sure to exclude one or the other (it's usually done by checking if ${D} exists, which does at build time but not runtime).
c.f.: http://docs.yoctoproject.org/dev-manual/dev-manual-common-tasks.html#post-installation-scripts
If you can manage to have both libraries installed in your rootfs and select the one you want with the LIBRARY_PATH environment variable, a simple recipe, with two packages with each library in a different location, will be sufficient.

Add Libraries from Backed Up Managed Libraries Folder in CoDeSys

Recently I had a computer failure that resulted in reinstalling the windows operating system. Fortunately, I was able to back up my machine before doing the reinstall. However, I am now trying to make my CoDeSys project compile but I can't seem to figure out how to make CoDeSys recognize the libraries located in C:\ProgramData\CODESYS\Managed Libraries\. Before I reinstalled the operating system I was able to back up the managed libraries directory and now I have copied the directory back to the C:\ProgramData\CODESYS\Managed Libraries\ location. I can see the CODESYS library files in the directory through the file explorer but CoDeSys does not recognize them.
I have attempted to add a repository location using the library repository but I when I add a dummy location it won't let me delete the original location (to then re-add it).
I am using CoDeSys 3.5 SP11 Patch 4. I understand this is not the newest version of CoDeSys.
Thanks
It is not enough to copy libraries to this catalogue.
You need to install package with all hardware from your supplier.
What you have to do is download the .package file from supplier of your hardware.
Then you have to open codesys go to tools -> package manager -> install.
After that library will be installed properly.
Please take a look for this youtube movie if I didn't explain it well.
https://youtu.be/GFkA4E1R4aQ?t=393
Cheers!

Where can I find what drivers built in my yocto project Linux kernel image?

I'm using Yocto project to build a linux kernel image following these steps:
https://www.at91.com/linux4sam/bin/view/Linux4SAM/Sama5d27Som1EKMainPage
For some reasons I just want to reduce my Image size so I can flash it on QSPI 8 Mega octet memory. I have tried to reduce the size of my rootFS, I have removed some packages that I found in .manifest file and some Distro features. But I did not find how can I modify the kernel size which size is fixed ( 4.2 Mega octet ).
I think that when I can remove some drivers that I don't need the kernel size will be reduced.
I just want to know how can I find what drivers are built in my image and where can I find them ? and later how can I delete the ones that I don't need ?
Thank you.
if you check the .config file that was generated for your BSP, it will show what drivers (and other things) were built into your kernel (check for the 'y' on all the options).
Such file should be somewhere in:
tmp/work//linux-yocto//linux-*-build/.config
Sorry that I can't give you the exact location, but it literally depends on what BSP/MACHINE you are building for.
Also, if you want to modify such configuration, you can call:
$ bitbake -c menuconfig virtual/kernel
that will bring up the menuconfig ncurses interface, in which you can not only see what is installed but also modify what you need.

Building a bitbake component locally

I am writing a component that goes into the yocto build, but during development I don't want to build the entire image. I want to checkout my component(in its own GIT repo), build it using the cross-compiler used for building the entire tree, and test that before checking in(devtest) and building the entire filesystem for system test. I have not found a way to do that.
If I understand your question correctly, what you want to do is to build the SDK?
Run
bitbake - c populate_sdk <image-name>
that'll give you a nice SDK in a tarball. Then you execute that tarball to install it on you desired location.
In the shell where you're developing your application, you source the environment-.... file in the installed location. Now everything is configured to crosscompile, as long as you're using eg CC instead of directly calling gcc.