Adding a lib to yocto rootfs - yocto

I am using this recipe, which by default doesn't copy the resulting .a lib (it expects header only usage I think)
I am trying to get the resultant libspdlog.a into my sysroot, but I can't seem to make that happen. I coppied the recipe to my layer (had to anyway because my project refereces an older version of meta-oe)
So far i've tried:
FILES_${PN} += "${libdir}/libspdlog.a"
FILES_${PN}-dev += "${libdir}/libspdlog.a"
FILES_${PN}-staticdev += "${libdir}/libspdlog.a"
and
do_install() {
install -d ${D}${libdir}
install -m 0644 libspdlog.a ${D}${libdir}
}
I'm pretty sure do_install is not getting called.
I had to add to my IMAGE_INSTALL spd-dev so maybe this has something to do with it
Thanks

do_install is right and for now just have FILES_${PN} += "${libdir}/libspdlog.a".
If you have kept the same name of the recipe when you copied over you will need to add the following IMAGE_INSTALL_append = " spdlog" (in either local.conf or an image recipe if you have one) to put into image.
To verify do_install is working ok:
Inside your build folder (where you issue bitbake from) there will be tmp/work (if you haven't changed this in your local.conf)
Find the location of your recipe folder <recipe_name>/<recipe_version> (eg. spdlog/1.8.0-r0/)
Inside here there will be a packages-split/spdlog folder
Inside this you should see your structure usr/lib/libspdlog.a

Related

Problem with Yocto recipe modification (.bbappend)

I am new in Yocto environment, and I am trying to modify my initscripts recipe (from Poky) with .bbappend file. The problem is that everything I tried with it, it never worked. My file (../sources/recipes-core/initscripts/initscripts_%.bbappend) contains:
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://type.sh"
do_install_append () {
install -d ${D}/${sysconfdir}/init.d/test
install -m 755 ${WORKDIR}/type.sh ${D}${sysconfdir}/init.d/test/type.sh
update-rc.d -r ${D} type.sh start 30 2 3 4 5 .
}
It seems that nothing is working ("test" folder is not even created in the rootfs, nor with another folder in /etc).
If I write a mistaken file in SRC_URI in .bbbappend file, bitbake shows a warning (OK).
If I write some syntax error in .bbappend file, bitbake not finishes, it returns an error (OK).
Typing bitbake-layers show-appends , I can see that my .bbappend file appears and it is not skipped.
Maybe the problem is the bitbake, I am doing it with bitbake core-image-minimal, maybe I need another target.
Please, let me know any advice because I don't know what else I can check.
Thank you so much,

How do I add my custom directory entirely to the rootfs of the yocto project?

How do I add my custom directory entirely to the rootfs of the yocto project?
I want to add a non-empty directory to Yocto rootfs
I proceeded by writing the do_install statement, but it was not possible to copy an entire non-empty folder to rootfs with "install -m".
do_install() {
install -m 0755 /MYDirectory ${D}/MyDirectory
}
This seems to fail because you can only copy a single file
What can I try?
see https://stackoverflow.com/a/47084404/3151114
and don't forget to add the directory to FILES, e.g.
FILES_${PN} += "/MyDirectory"
(just as https://stackoverflow.com/a/54311741/3151114)

Installing library into yocto rootfs

I am working on yocto i have compiled a library using yocto, which installed library inside
/tmp/work/corei7-64-poky-linux/lib-ad/git-r0/package/usr/lib/libad.a
Now inside my recipe i have included
FILES_${PN} += " \
libad.a \
"
Now this is adding this file into build-corei7-64/tmp/sysroots/corei7-64/usr/lib/libad.a
but not into final rootfs, I assume FILES_${PN} will copy my files into rootfs.
but this is not happening.
Any help is appreciated, Thank You
Well, up to now you managed to build and package your code correctly.
I guess you mean with rootfs the image that you build. To add a package to an image you can set IMAGE_INSTALL_append = "lib-ad" within your local conf

Compile rygel for yocto with plugins

I'm using bitbake to compile rygel for yocto from the meta-openembedded layer, with the plugins mpris and gst-launch.
As per the PACKAGECONFIG docs, I created a bbappend file and added the following:
EXTRA_OECONF = "--disable-introspection \
--disable-tracker-plugin \
--with-media-engine=gstreamer \
--enable-mpris-plugin \
--enable-gst-launch-plugin"
PR = "r1"
It compiles and installs, but has no plugins.
The append shows up when I run bitbake-layers show-appends, so at least bitbake is finding it. After running bitbake the directory tmp/work/core2-64-poky-linux/rygel/0.26.1-r1/image/usr/lib/rygel-2.6/plugins/ is populated. Then when I run the image /usr/lib/rygel-2.6/ contains an engines dir and nothing else.
Any idea where I'm going wrong?
I don't think your read all the way down to "If you want to change an existing PACKAGECONFIG block, you can do so one of two ways:".
From a bbappend, just do
PACKAGECONFIG_append = " mpris gst-launch"
In the recipe do_install, they remove some of the engines and plugins files. This might be the reason you do not see them in your image.
do_install_append() {
# Remove .la files for loadable modules
rm -f ${D}/${libdir}/rygel-${LIBV}/engines/*.la
rm -f ${D}/${libdir}/rygel-${LIBV}/plugins/*.la
}
your compiling plugins successfully and not able to see in board(rootfs)? if yes please add below line in your .bbappend file. '
FILES_${PN} += "${libdir}/*"
this will add all your compiled plugins to your rootfs image.

With Yocto, how can I add a lot of files to an image?

How can I add a lot of files to an image with a BitBake recipe?
The pattern that I follow to add files to an image is the following:
SRC_URI += "file://bar"
do_install () {
install -m 0775 ${S}/bar/baz/foo.txt ${D}${prefix}/test
}
FILES_${PN} += "${prefix}"
FILES_${PN} += "${prefix}test"
FILES_${PN} += "${prefix}test/foo.txt"
Which works great for a few files. However, this can be really tedious for large amounts of files. The problem seems to be that I need to specify each file that I want to package. Is there some way to avoid this?
If all the files are in a single directory you can just put the directory in FILES and it will recurse for you. So if you had another 100 files in ${prefix}/test then FILES_${PN} = "${prefix}/test" would package them all in $PN.