How to override bitbake file conflicts - yocto

Working on a couple of recipe's that have file conflicts with base packages.I am trying to figure out how to force override the conflicts. In particular I am overwriting the /etc/network/interfaces file with a custom one within my recipe. How do I tell bitbake that the file(s) in my package are to take precedence over the file(s) from the base packages?
I am using RPM as the package management subsystem with in the build environment.
Running transaction test
Error: Transaction check error:
file /etc/network/interfaces conflicts between attempted installs of router-1.0-r0.noarch and init-ifupdown-1.0-r7.qemuarm64
file /etc/udhcpc.d/50default conflicts between attempted installs of router-1.0-r0.noarch and busybox-udhcpc-1.24.1-r0.aarch64

You can't. Either don't install one of the packages in the conflict or override the original recipe's file with a bbappend.

Related

How to (force Yocto to) create ${PN}.deb file?

I'm trying to add a library (a cmake project) to my Yocto project/image.
The package essentially consists of one static library (named hello.a) with some header files in C.
I wrote a recipe and could configure, compile, package it.
The packaging results are four files {hello-dbg, hello-dev, hello-src, hello-staticdev}.deb
So there is no hello.deb.
And that seems to be a problem preventing me to create image.
The following packages have unmet dependencies:
packagegroup-utils-extra : Depends: hello but it is not installable
E: Unable to correct problems, you have held broken packages.
When I try to add that by defining:
FILES_${PN} += "/usr/lib/hello.a"
bitbake does not allow adding static libraries to anything but staticdev -> so that does not work.
My question is then, as the title says, how to (force Yocto to) create ${PN}.deb file?
The empty packages (i.e. containing no files) are not created by default. If you want to override it, you can do it via the ALLOW_EMPTY variable for a package like this:
ALLOW_EMPTY:${PN} = "1"
You can also check the official documentation for ALLOW_EMPTY.
Just for clarification:
You can install the ${PN} package (it won't install any file on the target system).
As before, your static library will still be shipped in the ${PN}-staticdev package.

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.

Does a recipe provided as DEPENDS can have own do_install() in yocto?

I am trying to build a custom recipe with Yocto (Rocko) for my Linux i.MX6 based embedded system.
The main recipe had dependency on a other custom recipe(as the main recipe is using header-files from this recipe) which is also creating some binaries which needs to be included in the final image.
I have added other_recipe(nbdkit) in the "DEPENDS" of main_recipe.bb
DEPENDS += "nbdkit"
the main recipe is creating a .so with the help of its own source file which is including header-files from the 'kit' recipe. I am able to install the binaries & .so generated using this main_recipe by adding it in do_install().
Now in the other_recipe(nbdkit http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-support/nbdkit/nbdkit_git.bb?h=master), When I add do_install()to include the binaries generated from that recipe the main_recipe build gets failed with PKG_CONFIG error as follow,
| Package nbdkit was not found in the pkg-config search path.
| Perhaps you should add the directory containing `nbdkit.pc'
| to the PKG_CONFIG_PATH environment variable
| No package 'nbdkit' found
Other build errors says that the header-files of kit included in the main_recipe is not found.
app-nbdkit-plugin.c:2:10: fatal error: nbdkit-plugin.h: No such file or directory
Where app-nbdkit-plugin.c is source file of main_recipe & kit-plugin.h is header file of other_recipe.
The strange thing is, when I remove do_install() from other_recipe(nbdkit) the main_recipe is getting built successfully.
Now I doubt, Is it possible to set a recipe as DEPENDS of other recipe and at the same time it provides output file as do_install()?
Will sharing header-files from other_recipe to main_recipe resolves the issue? If yes, how to do that?
Thanks.
[EDIT] Added nbdkit recipe link.

buildroot package from local source with snapshots

I want to fork buildroot, add a custom package, add the package's source directly in-tree, and have buildroot use the in-tree source to build the custom package. I've done that, following chapter 17 of the buildroot user manual, but buildroot doesn't seem to be picking up local changes that I've made.
For example, I built the entire image, and it also built my custom application. Then I went into the source for my custom application and added an intentional syntax error -- but then I ran make again and it happily generated an image using the old version of my custom app.
How do I tell buildroot to look for local source modifications, even if it already has a cached build of the package with a matching version?
These are the new files which I have added to my buildroot fork:
buildroot/
package/
customapp/
customapp.mk
Config.in
customapp/
configure.ac
Makefile.am
README
src/
main.c
Makefile.am
(I also edited buildroot/package/Config.in so that it sources the buildroot/package/customapp/Config.in file. All the Config.in stuff is just a simple boolean to enable customapp, and they work fine, so I'll omit them from this question.)
Here are the contents of the build-related files:
buildroot/package/customapp/customapp.mk
CUSTOMAPP_VERSION = 0.1
CUSTOMAPP_SITE = customapp
CUSTOMAPP_SITE_METHOD = local
CUSTOMAPP_AUTORECONF = YES
$(eval $(autotools-package))
buildroot/customapp/configure.ac
AC_INIT([customapp], [0.1], [name#email.tld])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
src/Makefile
])
AC_OUTPUT
buildroot/customapp/Makefile.am
SUBDIRS = src
dist_doc_DATA = README
buildroot/customapp/src/Makefile.am
bin_PROGRAMS = customapp
customapp_SOURCES = main.c
Section 8.3 of the buildroot manual explains how to rebuild a single package. The easiest way is with [package name]-rebuild target. In your case it would be:
make customapp-rebuild
You may want to also trigger the buildroot post build actions to rebuild the target device file system images after your package re-build is complete:
make target-post-image
To rebuild a buildroot package, you have to remove the stamp files in output/build/customapp-version/.stamp*. The easiest way is to remove the whole build directory.
Buildroot relies only on the .stamp files for understanding what needs to be rebuild.

Solaris package upgrade

I'm having a lot of trouble wrapping my head around how Solaris 11 does packaging. I understand that there is a yum type packaging approach, but I would expect there to be a rpm -i and rpm -U approach that allows a package to be delivered and then installed or upgrade.
For now I have tracked down how to make a package, ie pkgmk and pkgtrans. Given this I can create a "foo_1.0.pkg" file that can be installed like this:
pkgadd -d foo_1.0.pkg
However I can not figure out how to upgrade this package with "foo_2.0.pkg":
root#hostname # pkgadd -d foo_2.0.pkg
The following packages are available:
1 foo foo
(x86) private_build
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: all
Processing package instance <foo> from </root/foo_2.0.pkg>
foo(x86) private_build
Current administration requires that a unique instance of the <foo>
package be created. However, the maximum number of instances of the
package which may be supported at one time on the same system has
already been met.
No changes were made to the system.
What am I doing wrong? It would appear that i should use pkg update, but this seems to imply that I need to release my pkg in a repo.
First, you aren't using Solaris 11 packaging (IPS) but the legacy SVR4 packaging.
With the latter, you cannot upgrade a custom package. The only way is then simply to remove the old package and install the newer one, which is what rpm -U is doing under the hood anyway.
pkgrm foo
pkgadd -d foo_2.0.pkg foo
I had the same problem, but I was able to workaround it by passing a config file into the cmd. This is especially useful in a script when used with the "echo |" as it bypasses the confirmation prompt as well. The config file overwrites the default install properties which are located in a file here: /var/sadm/install/admin/default. The key is the instance=overwrite line. I changed some of the others as well, to avoid any other prompts that may come up. As an alternate solution you can change the default file directly and not have to reference the additional config file.
with myprog1.0 (or 2.0) already installed run the following command.
echo | pkgadd -a /opt/myprog/install.conf -d myprog2.0
contents of /opt/myprog/install.conf file:
mail=
instance=overwrite
partial=nocheck
runlevel=nocheck
idepend=nocheck
rdepend=nocheck
space=ask
setuid=ask
conflict=nocheck
action=nocheck
networktimeout=60
networkretries=3
authentication=quit
keystore=/var/sadm/security
proxy=
$UPDATE
This variable does not exist under most installation environments. If it does exist (with the value yes), it means that a PKG with the same name, version and architecture is already installed on the system or that the installing PKG will overwrite an installed PKG. The original BASEDIR is then used.
So, this variable you can use in preinstall or postinstall script for any updation.