I want to install my own custom deb package in yocto image. For this I am using following mydebpkg.bb recipe using ROOTFS_POSTPROCESS_COMMAND
SUMMARY = "Recipe for installing deb package"
DESCRIPTION = "It installs own deb package"
HOMEPAGE = ""
LICENSE = "CLOSED"
inherit bin_package
my_install_pkg_deb() {
${STAGING_BINDIR_NATIVE}/dpkg \
--root=${IMAGE_ROOTFS}/ --admindir=${IMAGE_ROOTFS}/var/lib/dpkg/ \
-i /home/pi1/install/own_1.3-07u_armhf.deb
}
ROOTFS_POSTPROCESS_COMMAND += "my_install_pkg_deb; "
But while building image the process fails with following error cannot install package mydebpkg and Function failed: do_rootfs. Where I am making mistake and what will be the correct recipe for installing any deb package.
Installing precompiled .deb is an awful decision, you should avoid doing so anytime you are able to compile the package from source code. If this isn't the case, I'd suggest doing something like this:
SUMMARY = "Recipe for installing deb package"
DESCRIPTION = "It installs own deb package"
HOMEPAGE = ""
LICENSE = "CLOSED"
DEPENDS += " dpkg-native "
SRC_URI += " \
file://own_1.3-07u_armhf.deb.zip \
"
do_install_append() {
touch ${STAGING_DIR_NATIVE}/var/lib/dpkg/status
${STAGING_BINDIR_NATIVE}/dpkg --instdir=${D}/ \
--admindir=${STAGING_DIR_NATIVE}/var/lib/dpkg/ \
-i ${WORKDIR}/own_1.3-07u_armhf.deb
}
So: use SRC_URI variable to let bitbake copy your .deb file to the working dir. I suggest you zip the file as bitbake tries to unpack all the archives you supply him, and .deb is just another archive. So pack it to zip and let bitbake bring your .deb file to the working directory. Place your .deb.zip file by /path/to/your/recipe/files folder. Remember: never use absolute paths in yocto!
Then in do_install function invoke dpkg to install your .deb file into deploy dir of your package. This code is not complete as in case of a successful installation (don't forget about conflict resolution), you will get a list of files and directories that installed but not shipped in any package. You will need to add to your recipe FILES_${PN} variable:
FILES_${PN} += " \
/usr/bin/some_file \
/etc/some_config_file \
/and_so_on \
"
The complete list what you need to add you can get from the error message.
And remember: this method will only work if your target architecture is the same as your host architecture. Regarding that you used STAGING_BINDIR_NATIVE variable this is the case, regarding that your package contains arm, this isn't.
Related
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 add a recipe that create a file helloworld under directory /myDir.
After building image, I could see the file under /build/tmp/work/../../mydir/helloworld.
But the same is not present on the board.
app = "helloworld"
usrdir = "/myDir"
FILES_${PN} += "${usrdir}/${app}"
FILES_${PN}-dbg += "${usrdir}/.debug"
do_install() {
install -D -m 0755 ${B}/${app} ${D}/myDir/${app}
}
If I install helloworld under /usr/bin, then the file is present on the board.
What is wrong? Why the file installed in /usr/bin are deployed while files in /myDir are not? Any idea?
Regards,
Suresh.
I want copy folders and it's content to yocto during image build process. For this process I am using following recipe
SUMMARY = "Installation Recipe"
DESCRIPTION = "It installs folder"
HOMEPAGE = ""
LICENSE = "CLOSED"
MY_FILES1 = "/home/jane/d1fold"
MY_FILES2 = "/home/jane/d2fold"
inherit allarch
do_install() {
install -d ${D}/home/root
cp -R ${MY_FILES1}/* ${D}/home/root
cp -R ${MY_FILES2} ${D}/home/root
}
FILES_${PN} += " /home/root"
But I receive following error ERROR: QA Issue: weaved: Recipe inherits the allarch class, but has packaged architecture-specific binaries [arch]. How can I resolve this error?
This error means that you are trying to install architecture-specific binaries (compiled for x86, arm64 etc), while inheriting allarch class. From yocto reference manual:
The allarch class is inherited by recipes that do not produce architecture-specific output.
This is an obvious contradiction.
What are you trying to do? Creating of recipe that only installs some files seems like wrong architecture decision. And why do you want to inherit allarch?
You are just coping files to rootfs. So you no need use inherit allarch. remove that and compile.
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.