I created a new layer in yocto: meta-abc, a recipe: abc-efg_0.1.bb and an .bbapend: abc-efg_01.bbapend file.
With the bbappend file I want to overwrite a file from intel-edison board.
More exactly, the wpa_supplicant.conf from /etc/wpa_supplicant/.
This wpa_supplicant.conf is already created from another layer (meta-intel-edison-distro).
I can write my file in /etc/ so my recipe and my bbappend file are working.
I can bitbake my recipe, but when I try to creat the image I receive the message:
" * check_data_file_clashes: Package abc-efg wants to install file /home/atr-int/Desktop/Yocto/yocto-edison/build_edison/tmp/work/edison-poky-linux/edison-image/1.0-r0/rootfs/etc/wpa_supplicant/wpa_supplicant.conf
But that file is already provided by package * wpa-supplicant
* opkg_install_cmd: Cannot install package abc-etc.
"
Here is my bbappend file content:
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://wpa_supplicant.conf"
do_install_append() {
install -d ${D}${sysconfdir}/wpa_supplicant
install -m 0755 ${WORKDIR}/wpa_supplicant.conf
${D}${sysconfdir}/wpa_supplicant
}
Can anyone give my any tip ?
Thank you.
You shouldn't rewrite the wpa_supplicant.conf from another recipe, as the files will clash.
Instead, rename your abc-efg_01.bbapend to wpa-supplicant_%.bbappend, and it should work.
If for some reason you need to have wpa_supplicant.conf in abc-efg, you need to add a wpa-supplicant_%.bbappend in which you'll need to remove wpa_supplicant.conf.
Install extra files for p910nd with bbappend file:
layout of p910nd directory
.
├── files
│ ├── p910nd.conf
│ └── p910nd.init
└── p910nd_0.97.bbappend
Content of the bbappend file
SUMMARY = "install init script"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://p910nd.init"
SRC_URI += "file://p910nd.conf"
RDEPENDS_${PN} += "bash"
do_install_append() {
install -D -m 0644 ${WORKDIR}/p910nd.conf ${D}${sysconfdir}/default/p910nd
install -D -m 0755 ${WORKDIR}/p910nd.init ${D}/etc/init.d/p910nd
}
In my test, do_install_append will also overwrite the file if the it is already installed in the destination.
Related
I'm trying to unpack .tar.gz file to my root during the building system, but it doesn't work because of an unclear reason for me. I did it in the same way as other recipes in my meta (which works fine), but in this case, I have an empty directory in the target system root. The recipe has the same name as tar.gz.
Based on Yocto Project Documentation and my other experience it should work fine. I tried to remove manually tmp, sstate-cache directories and rebuild system, but it doesn't change anything. The recipe is building, but the /my-app is empty. Can I force extract my archive?
Tree file:
├── meta-my
│ └── recipe-my-app-files
│ └── my-app
| └── my-app.bb
│ └── files
│ ├── my-app.tar.gz
....
my-app.bb
DESCRIPTION = "My Application package preinstall"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
RDEPENDS_my-app="bash qtdeclarative qtbase"
DEPENDS = "bash"
FILES_${PN} += "/my-app"
SRC_URI = "file://my-app.tar.gz"
BB_STRICT_CHECKSUM = "0"
S = "${WORKDIR}"
do_install() {
# Create directories
install -d ${D}/my-app
}
As mentionned in the link you provided that:
The unpack call automatically decompresses and extracts files with
".Z", ".z", ".gz", ".xz", ".zip", ".jar", ".ipk", ".rpm". ".srpm",
".deb" and ".bz2" extensions as well as various combinations of
tarball extensions.
it extracts .gz automatically into ${WORKDIR}.
The issue with your recipe is that you are creating /my-app but not filling it with any content.
Keep in mind that the compressed file is unpacked under ${WORKDIR}, so install it into ${D}/my-app:
do_install(){
# Create directories
install -d ${D}/my-app
# Install unpacked application
# install -m 0755 app ${D}/my-app
# ...
}
I do not know the content of your application, so change that according to it.
I wrote a basic hello world recipe
DESCRIPTION = "Simple helloworld C application"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI = "file://userprog.c file://ReadMe.txt"
S = "${WORKDIR}"
do_compile() {
${CC} -DUSE_SYSCALL userprog.c ${LDFLAGS} -o userprog
}
do_install() {
install -d ${D}${bindir}
install -m 0755 userprog ${D}${bindir}
install -d ${D}${docdir}
install -m 0644 ReadMe.txt ${D}${docdir}
}
After, looking at the WORKDIR, the contents of 'package' and 'image' folder are same.
$ tree image/
image/
└── usr
├── bin
│ └── userprog
└── share
└── doc
└── ReadMe.txt
$ tree package
package
└── usr
├── bin
│ └── userprog
└── share
└── doc
└── ReadMe.txt
What is the difference between both folders, I know image folder is controlled in do_install task, what about in package folder?
images/ is for staging install dir, something like make install DESTDIR=<..>
package is for do_package task which is then further split into individual output packages in packages-split,
even though the content looks similar context is different, since it operates on PACKAGES and FILES variables, and if the files are not mentioned in these variables it won't copy those from image/ into package/ it is described in detail in Yocto project manual
I have created a new recipe is helloworld example in manual.
I'm using imx6sx processor, so created it in meta-freescale-3rdparty folder as recipes-helloword and checked this layer whether has been added to bblayer.conf. It can be compiled with bitbake helloworld there was no error and it exists in rpm folder. After that, the image compiled again with bitbake fsl-image-qt5-validation-imx and generated a new rootfs and sdcard file.
However, I can't find the application in rootfs. Where is the application in rootfs? (the recipe has been inserted in local.conf : IMAGE_INSTALL_append = " helloworld")
.
./recipes-helloworld/
└── helloworld
├── helloworld
│ ├── COPYING
│ └── helloworld.c
└── helloworld_0.0.bb
2 directories, 3 files
helloworld_0.0.bb
SUMMARY = "Hello World Cpp App Sources"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
PV = "1.5"
TARGET_CC_ARCH += "${LDFLAGS}"
SRC_URI = "file://helloworld.c"
S= "${WORKDIR}"
do_compile() {
${CC} helloworld.c -o helloworld
}
do_install() {
install -d ${D}${bindir}
install -m 0755 helloworld ${D}${bindir}
}
Can you check the build manifest of the image to see if helloworld is in there:
{build_folder}/tmp/deploy/licenses/{image_name + last_timestamp}/package.manifest
If it's there you should find helloworld in /usr/bin/helloworld
If it's not, helloworld package is not being included in the image.
Can you check 'helloword' application is available in 'helloword' package. Means it is built and put in /usr/bin. If it's available in image directory it means this binary is being installed into rootfs as part of the helloword package.
(build_dir)/tmp/work/***/hello word/***/image/usr/bin
If it is available it indicates the helloword package is being built and create the binary and it's installed in to /usr/bin and plan to put into rootfs.
Since you have already added the package in local.conf as IMAGE_INSTALL_append, it should built as part of target.
If it is not available still, can you please add the following line in recipe
FILES_${PN} += "${bindir}/helloword"
Then try to rebuild 'helloword' and final traget and check the binary is available in rootfs.
SECTION = "devel"
LICENSE = "CLOSED"
EXTERNALSRC := "${THISDIR}/../../../sample-applications/sampleap/src"
inherit cmake externalsrc
inherit autotools gettext
do_compile() /*section to compile */
{
${CC} ${EXTERNALSRC}/sampleapp.c ${LDFLAGS} -o sample
}
/* To install executable in to specified D */
do_install()
{
install -d ${D} ${bindir}##
install -m 0755 sample ${D} ${bindir}
}
I am new to Yocto build. I wrote simple .bb file.
Here my question is how to I change my destination directory ${D}.
I want to place my executable in different path.
The D variable represents the target rootfs. You can choose a specific folder on the target rootfs by specifying one of the prefixes defined in bitbake.conf or a relative path after ${D}.
Example:
...
install -d ${D}/home/root/mySamples
install -m 0755 sample ${D}/home/root/mySamples
...
If you want to place artifacts outside of the target rootfs instead, then you are actually misusing the Yocto Project. Anyway you can find the outputs of your recipe under the <BUILD_DIR>/tmp/work/<DISTRO-TARGET>/<RECIPE_NAME>/<RECIPE_VERSION>/image dir.
I have a package (openssl) that must be built for the host and the target. It creates some .so and .a libraries that some other packages need for runtime and compilation time respectively.
When I compile this package for the target everything works fine and every file ends up in the place I tell it to go, but when I compile for the host (${PN}-native target) it just doesn't put the libraries in the host sysroot directory (./build/tmp/sysroot/x86_64-linux).
This is the recipe:
SUMMARY = "Secure Socket Layer"
SECTION = "libs/network"
LICENSE = "openssl"
LIC_FILES_CHKSUM = "file://LICENSE;md5=4004583eb8fb7f89"
branch = "yocto"
SRC_URI = "git://www.myserver.com/openssl.git;protocol=ssh;branch=${branch}"
SRCREV = "${AUTOREV}"
S = "${WORKDIR}/git"
BBCLASSEXTEND += "native nativesdk"
# This is because I am porting this package from other project and I can't modify it.
FILES_${PN} += "${libdir}/libssl.so ${base_libdir}/libcrypto.so"
FILES_SOLIBSDEV = ""
do_compile() {
${MAKE}
}
do_install() {
DESTDIR=${D} ${MAKE} install
}
Could anyone let me know what I am doing wrong? Thanks in advance
First, why are you writing your own recipe for openssl instead of using the one in oe-core?
Anyway the problem is that at no point do you tell the recipe what prefix to use. In native builds the prefix is what relocates the package correctly into the native sysroot.
Ok, I know what the problem is:
It seems like for native recipes, you have to install it using the full path to your host sysroot inside the image folder. This means that when compiling for the target, the image folder looks like this:
$ tree -d
/openssl/1.0.0-r0/image
├── lib
└── usr
├── include
│ └── openssl
└── lib
but for the host, it looks like this in my case:
$ tree -d
openssl-native/1.0.0-r0/image
└── home
└── xnor
└── yocto
└── build
└── tmp
└── sysroots
└── x86_64-linux
├── lib
└── usr
├── include
│ └── openssl
└── lib
EDIT
The right solution is to modify the Makefile to take ${prefix}, ${bindir}, ${libdir}, etc. from the environment instead of hardcoding those paths in the Makefile. In my case this is not possible because of the project requirements, so I have to do this:
SUMMARY = "Secure Socket Layer"
SECTION = "libs/network"
LICENSE = "openssl"
LIC_FILES_CHKSUM = "file://LICENSE;md5=4004583eb8fb7f89"
branch = "yocto"
SRC_URI = "git://www.myserver.com/openssl.git;protocol=ssh;branch=${branch}"
SRCREV = "${AUTOREV}"
S = "${WORKDIR}/git"
BBCLASSEXTEND += "native nativesdk"
# This is because I am porting this package from other project and I can't modify it.
FILES_${PN} += "${libdir}/libssl.so ${base_libdir}/libcrypto.so"
FILES_SOLIBSDEV = ""
do_compile() {
${MAKE}
}
do_install() {
# The change is here!
DESTDIR=${D}${base_prefix} ${MAKE} install
}
and as you can imagine, ${base_prefix} expands to "/home/xnor/yocto/build/tmp/sysroots/x86_64-linux/" for the host (openssl-native) recipe and to "" for the target (openssl).