Recently, I tried to include open source package (iperf3) to target image via Yocto build. (Updating local.conf for IMAGE_INSTALL += "iperf3", as the project already corresponding recipe).
But the final image did not include in root file system.
I tried the same by adding to package group recipe in <DistroMetaLayer>/recipe-core/packagegroups/RDEPENDS_packagegroup* and was able to include it successfully.
Can someone provide me explanation for the behavior.
When you write IMAGE_INSTALL += "iperf3" in your local.conf, that will immediately add iperf3 to IMAGE_INSTALL. If your image adds the base rootfs by doing IMAGE_INSTALL ?= "....", then that default value will never be added, as IMAGE_INSTALL already have a value.
If you want to modify IMAGE_INSTALL from local.conf (and a lot other variables), you should always do that with a delayed append / prepend. I.e.
IMAGE_INSTALL_append = " iperf3"
Note the leading space.
Related
What changes should make to enable dlt-system.
In build folder dlt-system application is not generating.
Manually by using command: cmake -D with dlt-system=ON it will generate but I need to generate while building please look at recipie image
Your recipe supports dlt-system via PACKAGECONFIG.
In order to activate that flags in the compilation process, you just need to add dlt-system to PACKAGECONFIG in .bb or .bbappend file to the recipe:
PACKAGECONFIG_append = " dlt-system"
If you want to add it from local.conf:
PACKAGECONFIG_pn-name_append = " dlt-system"
Just change name with your recipe name.
This will add -DWITH_DLT_SYSTEM=ON to EXTRA_OECMAKE which is used in do_configure of the cmake class.
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.
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
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
I am trying to build gstreamer for IMX53 Evk board.
I downloaded Yocto from http://freescale.github.io/#download and run the following commands.
#MACHINE=imx53qsb
#source setup-environment build
#bitbake core-image-minimal
It built the u-boot, kernel and filesystem. The file system doesn't have gstreamer. I want to built gstreamer also.
As per my understanding there two approaches to built gstreamer now.
Approach 1. Modify the distro.conf file to build gstreamer also. I
am not sure how to add gstreamer entries in the distro.conf. The
distribution is poky distribution.
Approach 2. Add IMAGE_INSTALL_append with gstreamer entries. My
doubht here is what names we have to add in the IMAGE_INSTALL_append.
I could see the following bb files related to gstreamer. Can you please help what strings I have to add in IMAGE_INSTALL_append in local.conf.
./meta-fsl-arm/recipes-multimedia/gstreamer/gst-fsl-plugin_4.0.3.bb
./meta-fsl-arm/recipes-multimedia/gstreamer/gst1.0-fsl-plugin_4.0.3.bb
./meta-fsl-arm/recipes-multimedia/gstreamer/gstreamer1.0-plugins-imx_0.11.1.bb
./poky/meta/recipes-multimedia/gstreamer/gst-plugins-good_0.10.31.bb
./poky/meta/recipes-multimedia/gstreamer/gst-meta-base_0.10.bb
./poky/meta/recipes-multimedia/gstreamer/gstreamer1.0_git.bb
./poky/meta/recipes-multimedia/gstreamer/gst-fluendo-mp3_0.10.31.bb
./poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_1.4.5.bb
./poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-meta-base.bb
./poky/meta/recipes-multimedia/gstreamer/gstreamer1.0_1.4.5.bb
./poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_git.bb
./poky/meta/recipes-multimedia/gstreamer/gstreamer_0.10.36.bb
./poky/meta/recipes-multimedia/gstreamer/gst-openmax_0.10.1.bb
./poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_git.bb
./poky/meta/recipes-multimedia/gstreamer/gst-plugins-ugly_0.10.19.bb
./poky/meta/recipes-multimedia/gstreamer/gst-ffmpeg_0.10.13.bb
./poky/meta/recipes-multimedia/gstreamer/gst-player_git.bb
./poky/meta/recipes-multimedia/gstreamer/gst-plugins-base_0.10.36.bb
./poky/meta/recipes-multimedia/gstreamer/gst-plugins-gl_0.10.3.bb
./poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-libav_1.4.5.bb
./poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_git.bb
./poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.4.5.bb
./poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.4.5.bb
./poky/meta/recipes-multimedia/gstreamer/gst-plugins-bad_0.10.23.bb
./poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.4.5.bb
./poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_git.bb
./poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-omx_1.2.0.bb
./poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-ugly_git.bb
./poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-rtsp-server_1.4.5.bb
./poky/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_git.bb
./poky/meta/recipes-multimedia/gstreamer/gst-fluendo-mpegdemux_0.10.85.bb
./poky/meta/recipes-connectivity/bluez/gst-plugin-bluetooth_4.101.bb
./meta-fsl-demos/recipes-fsl/packagegroups/packagegroup-fsl-gstreamer.bb
./meta-fsl-demos/recipes-fsl/packagegroups/packagegroup-fsl-gstreamer-full.bb
./meta-fsl-demos/recipes-multimedia/packagegroups/packagegroup-fslc-gstreamer1.0-full.bb
./meta-fsl-demos/recipes-multimedia/packagegroups/packagegroup-fslc-gstreamer1.0-commercial.bb
./meta-fsl-demos/recipes-multimedia/packagegroups/packagegroup-fslc-gstreamer1.0.bb
./meta-openembedded/meta-multimedia/recipes-multimedia/gstreamer/gst-rtsp_0.10.8.bb
./meta-openembedded/meta-multimedia/recipes-multimedia/nonworking/gstreamer/gst123_0.3.1.bb
You may add just
IMAGE_INSTALL_append += "gstreamer"
Long answer is that you should add the package name that usually stored in PN recipe variable. You may read about PN variable here. Package names may also be managed with PACKAGES variable.
You either use
IMAGE_INSTALL_append = " gstreamer"
or
IMAGE_INSTALL += " gstreamer"
They do the same things but IMAGE_INSTALL_append is best when using with this variable.
The space in front of gstreamer is important because.
let's say IMAGE_INSTALL is a string: "opkg qtbase"
and if we do not add a space in front.
IMAGE_INSTALL will be like this: "opkg qtbasegstreamer" which will cause error.
Advice is correct on getting package name. First find recipe. bitbake-layers is useful for this. Then check that PN and PACKAGES variables are not set, if they are things get tricky. For gstreamer they are not
If you're new to Yocto, I'd go with adding package in local.conf. Entry in should be be IMAGE_INSTALL_append += " gstreamer". The space before gstreamer is important.