Compile rygel for yocto with plugins - yocto

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.

Related

How to install tar.gz package to Yocto by adding new layer?

I new to Yocto so there are probably some mistakes and misunderstanding that I've had, I appreciate if you can help.
So, I want to add a new package (tar file) to my custom image.
I have followed steps and steps in manual and some online instructions. While running: "bitbake mylayer", the layer is built fine but I got this error while building the image, here is the log file:
DEBUG: Executing python function rootfs_deb_bad_recommendations
DEBUG: Python function rootfs_deb_bad_recommendations finished
DEBUG: Executing python function extend_recipe_sysroot
NOTE: Installed into sysroot: []
NOTE: Skipping as already exists in sysroot: ['depmodwrapper-cross', 'apt-native', 'dpkg-native', 'pseudo-native', 'update-rc.d-native', 'prelink-native', 'makedevs-native', 'ldconfig-native', 'opkg-util$
DEBUG: Python function extend_recipe_sysroot finished
DEBUG: Executing python function do_rootfs
NOTE: ###### Generate rootfs #######
NOTE: Installing the following packages: apt busybox copy-uefiimg-to-sda coreutils dpkg e2fsprogs-resize2fs libfontconfig1 libfreetype6 libglib-2.0-0 gptfdisk libjemalloc2 kernel-module-axi-dma-sensor ku$
ERROR: Unable to install packages.
Reading package lists...
Building dependency tree...
Reading state information...
Package mypackage is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'mylayer' has no installation candidate
DEBUG: Python function do_rootfs finished
ERROR: Function failed: do_rootfs
And here is mylayer.bb:
SUMMARY = ""
LICENSE = "CLOSE"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://mypackage.tar"
Also, I have included the package in conf/local.conf:
IMAGE_INSTALL_append += " mylayer"
So beside trying to figure out how to solve this problem, I also have some questions:
I have read some example of .bb, and they mentioned about LIC_FILES_CHKSUM. The mypackage.tar.gz is a package to install a platform for the device and I don't know much about the source code, so I don't know if it is necessary to include the license? Or how to know that this package need license to install?
In some answer I found online, there is one saying that I need to include PACKAGE_CLASSES ?= "package_deb" (they want to install the .deb file), so probably in my case I will need PACKAGE_CLASSES ?= "package.tar" right? I have tried to change variable, but it still not successful.
The mypackage.tar includes some deb files. If I could not install mypackage.tar, can I instead install these .deb files? Can I put it all in mylayer.bb?
Thank you in advanced, I have tried to study much documents as I could but I get so confused and there is huge amount of information to digest.
First, before answering your questions
Let me mention some best practices advice for you:
Rename the recipe to some significant name related to you compressed package.
Naming the recipe to mylayer confuses Yocto users, because there is the term layer also.
Regarding you recipe:
There is no need for FILESEXTRAPATHS because the recipe path is added automatically to Yocto paths.
FILESEXTRAPATHS it is required for .bbappend files.
You need to override the do_install task function, it does nothing by default.
do_install is the first essential task to make sure that your sources are included in the final image.
Beside that, when specifying a compressed source file into SRC_URI, yocto automatically decompresses it.
This is mentioned here.
So, here what your recipe should look like:
SUMMARY = ""
LICENSE = "CLOSED"
# Prevent Yocto from decompressing the file
SRC_URI = "file://mypackage.tar;unpack=0"
do_install(){
# Create the opt folder into the final image, ${D} is ${WORKDIR}/image
install -d ${D}/opt
# Copy the compressed file there; You can change permissions as you want
install -m 0755 ${WORKDIR}/mypackage.tar ${D}/opt
}
# Very important to specify what you installed in (do_install)
FILES_${PN} = "/opt/*"
Now, when you run IMAGE_INSTALL_append += " mylayer" your file will be installed.
Regarding your questions:
You mentioned that your compressed file contains .deb files, I assume that no license checksum is needed. Also, I understand that you may wanted to point to SRC_URI[md5sum] or other checksums for the full package. That is also not needed for local files, it is used to check for the integrity of online sources.
PACKAGE_CLASSES as mentioned here, is used by the system to know in what type the data should be packaged. By the data I mean the data that you installed with do_install. That data get packaged for according to your PACKAGE_CLASSES variable, for example, to deb file. And that is used, along side with all other recipes packages, to build the final rootfs.
Yes, if you are installing the tar file into the image and then unpack it to install all deb files, for example, with dpkg. You can use the bin_package class to do that, now the recipe must be changed for that reason:
Decompress the tar file and provide the deb files in the local files folder.
Add all deb files to SRC_URI
Inherit the bin_package class
Specify the files to be packaged.
Your recipe should look like this:
SUMMARY = ""
LICENSE = "CLOSED"
SRC_URI = "file://deb_file1.deb \
file://deb_file2.deb"
# No need to `do_install` , it is invoked by the (bin_package) class
FILES_${PN} = ""
Important:
About FILES_${PN}, you need to add all what the deb installed into the image folder
Example, if your deb file installs this:
/usr/bin/hello
/etc/hello.cfg
Specify them:
FILES_${PN} = "/usr/bin/*"
FILES_${PN} += "/etc/*"
Use * so if other deb files install files into the same folder as others it will include all.

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,

Adding a lib to yocto rootfs

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

Yocto: : does bitbake cleanall ,cleans dependencies as well

bitbake cleanall
Removes all output files, shared state cache, and downloaded source files for a target
It is not clear or documented if it cleans all build time dependencies as well
If you want to clean everything do,
bitbake world -c cleanall --continue
The --continue will ignore any dependency errors while cleaning. Continue as much as possible after an error.
No, cleanall does not clean dependencies. eg
bitbake -c cleanall core-image-minimal
only removes the output of that named recipe.
What i usually do to clean "everything" is running cleanall on the receipe "world":
bitbake -c cleanall world
If that fails because of unresolvable packages like that:
ERROR: Nothing PROVIDES 'sg3-utils' (but /home/blubb/meta-freescale/recipes-devtools/utp-com/utp-com_git.bb DEPENDS on or otherwise requires it).
I just add the packages temporary to the ASSUME_PROVIDED variable like this :
bitbake -c cleanall world --ignore-deps=python-nativedtc-native --ignore-deps=sg3-utils
If nothing provides this packages it is unlikely that they where ever build.
Please read the mega-manual section do_cleanall .
do_cleanall removes:
all output files
shared state (sstate) cache
and downloaded source files for a target (i.e. the contents of DL_DIR).
You can run this task using BitBake as follows:
$ bitbake -c cleanall <recipe-name>
If recipe name is not passed to cleanall task it does not work.
Removes all output files, shared state (sstate) cache, and downloaded source files for a target (i.e. the contents of DL_DIR). Essentially, the do_cleanall task is identical to the do_cleansstate task with the added removal of downloaded source files.
You can run this task using BitBake as follows:
$ bitbake -c cleanall recipe
Typically, you would not normally use the cleanall task. Do so only if you want to start fresh with the do_fetch task.
Other folks have already answered that bitbake does not automatically clean dependencies, but you can create an Inter-task dependency (https://www.yoctoproject.org/docs/3.1/bitbake-user-manual/bitbake-user-manual.html#inter-task-dependencies) to clean your dependencies if needed by adding a command to the recipe:
do_task[depends] = "recipe:task"
We've extended bitbake to build native recipes and automatically run unit tests during a build. In that case we need to clean the native recipe when cleaning the target so you could add:
do_clean[depends] = "${PN}-native:do_clean"
do_cleanall[depends] = "${PN}-native:do_cleanall"
do_cleansstate[depends] = "${PN}-native:do_cleansstate"
That solution falls a bit short because the native recipes will attempt to clean ${PN}-native-native, so you'll need a conditional to not apply if it's already native:
do_clean[depends] += "${#'' if bb.data.inherits_class('native', d) else '${PN}-native:do_clean'}"
do_cleanall[depends] += "${#'' if bb.data.inherits_class('native', d) else '${PN}-native:do_cleanall'}"
do_cleansstate[depends] += "${#'' if bb.data.inherits_class('native', d) else '${PN}-native:do_cleansstate'}"

Adding new recipe to Yocto fails during generate root fs

I have been using Yocto to create Linux builds for an ARM board.
I had been cross compiling add on applications manually. Now we are in a place where we would like a nice integrated build so I started adding custom recipes to yocto.
I have been struggling with the ARM build (a x86 build with the same code seems fine).
Even a basic 'hello world' pretty much cut and paste from the development manual does not work (http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#new-recipe-writing-a-new-recipe)
Here is the recipe:
SUMMARY = "Simple helloworld application"
SECTION = "examples"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
RPROVIDES_${PN} = "helloworld"
FILES_${PN} += "${bindir}"
SRC_URI = "file://helloworld.c"
S = "${WORKDIR}"
do_compile() {
${CC} helloworld.c -o helloworld ${LDFLAGS}
}
do_install() {
install -d ${D}${bindir}
install -m 0755 helloworld ${D}${bindir}
}
Here is the error:
ERROR: helloworld not found in the base feeds (smarc_samx6i cortexa9t2hf-vfp-neon-mx6qdl cortexa9hf-vfp-neon-mx6qdl cortexa9t2hf-vfp-neon cortexa9t2hf-vfp cortexa9hf-vfp-neon cortexa9hf-vfp armv7at2hf-vfp-neon armv7ahf-vfp-neon armv7at2hf-vfp armv7ahf-vfp armv6thf-vfp armv6hf-vfp armv5tehf-vfp armv5ehf-vfp armv5thf-vfp armv5hf-vfp noarch any all).
ERROR: Function failed: do_rootfs
Any suggestions as to what would be causing this error?
The package does build properly; the problem seems to be isolated to finding it for the rootfs.
Thanks!
EDIT:
I have a solution that seems to work, although it is not ideal long term.
Changing the package name under IMAGE_INSTALL from helloworld to helloworld-0.0.1 resolves the issue. Obviously I would rather not hard code the version of each package in the top level recipe and other packages do not require this, so hopefully there is another solution.
EDIT 2:
Renaming the recipe and removing the version string also resolves the issue. Once again, this does not seem ideal long term.
OK, after some further testing I discovered this was a naming issue with the recipe.
It was named helloworld-0.0.1.bb (the same format with the other recipes I had put together driving me to try this simple test).
If anyone else encounters this simply replacing the '-' with a '_' resolves this.
1.Rename your recipe name e.g hello-0.1.bb to hello_0.1.bb
2.Add below line at last only:
FILES_${PN} = "${bindir}/*"
Abvoe line helps you copy your binary to rootfs.