overriding defconfig in bbappend file - yocto

In my chip vendors recipe they define
SRC_URI += "file://defconfig"
In my own layer, I want to override their defconfig and use my own.
I have a bbappend file in my recipe-kernel layer that adds my own defconfig file. My bbappend file:
SECTION = "kernel"
SUMMARY = "Kernel config and device tree customization"
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://defconfig"
SRC_URI += "file://tree_changes.diff"
The tree_changes.diff file is being applied so my bbappend file is being used at least for that.
The problem is that the vendor defconfig is always used. I dont really want to touch the vendors recipes, is there any better way of overriding the defconfig?
The chip vendor (Atmel/Microchip) bbfile is here:
https://github.com/linux4sam/meta-atmel/blob/dunfell/recipes-kernel/linux/linux-at91_5.4.bb

Could it be that your defconfig file is not located under ${THISDIR}/files/<machine> in your layer but rather under ${THISDIR}/files ?
${THISDIR}/files/<distro> or ${THISDIR}/files/<machine> have a higher priority than just ${THISDIR}/files.
The different defconfig files are located in
${THISDIR}/files/at91sam9
${THISDIR}/files/sam9x60
${THISDIR}/files/sama5
${THISDIR}/files/sama5d4
in vendor meta-layer, so they would still be used.
So you would need to move your defconfig file to ${THISDIR}/files/<your_machine> in your custom layer. Note that FILESEXTRAPATHS_prepend = "${THISDIR}/files:" remains the same in the recipe. Yocto takes care of extending the path.

Related

Yocto custom application through custom layer does not copy source files to destination rootfs

I am trying to install a custom application on my Yocto build.
I currently use a Raspberry Pi 4 64 bit setup, for which I want PyQt5 to display an application directly on the frame buffer (so no windowing manager or desktop envoirement).
My current build with Yocto completes and boots on the Raspberry Pi. All the Qt5 libraries are also present in the root fs after the bitbake build.
Although, I'm having problems getting a custom layer, that adds a custom recipe with a custom application to also copy over to the destination root fs.
My custom layer is called 'meta-rpikms' with recipe 'recipes-kms-qt-app' which contains the application bb files. This files is called 'basicquick_0.1.bb' and has the following contents (this test application tries to add a EGLFS friendly Qt5 applicaiton, i'll try PyQt5 later):
SUMMARY = "Simple Qt5 Quick application"
#SECTION = "examples"
LICENSE = "MIT"
#PACKAGE_ARCH = "all"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
DEPENDS += "qtbase qtdeclarative qtquickcontrols2"
SRCREV = "${AUTOREV}"
SRC_URI = "git://github.com/shigmas/BasicQuick.git"
S = "${WORKDIR}/git"
require recipes-qt/qt5/qt5.inc
do_install() {
install -d ${D}${bindir_native}
install -m 0755 BasicQuick ${D}${bindir_native}
}
FILES_${PN} += "${bindir_native}"
When I bitbake the custom layer of my meta-rpikms (called 'qt5-kms-rpi-image'), it does compute. When I take a look at the 'image_initial_manifest' file, my custom application does show up, suggesting that it does compile and try to install the application:
# This file was generated automatically and contains the packages
# passed on to the package manager in order to create the rootfs.
# Format:
# <package_type>,<package_name>
# where:
# <package_type> can be:
# 'mip' = must install package
# 'aop' = attempt only package
# 'mlp' = multilib package
# 'lgp' = language package
mip,basicquick
mip,bluez5
mip,bridge-utils
mip,hostapd
mip, bla bla bla etc etc etc.
And if I take a look in: '~/builds/pyqt5_try1/poky/rpi64-build/tmp/work/cortexa72-poky-linux/basicquick/0.1-r0', the expected files do show up. Also suggesting that it does atleast build the application. This makes the think that the 'install' arguments in my .bb file are pointing to the wrong folder.
In my basicquick_*.bb file this is to make the directory and install (copy) the built files:
install -d ${D}${bindir_native}
install -m 0755 BasicQuick ${D}${bindir_native}
I used the 'bitbake -e' command to trace the variable D and bindir_native:
D="/home/mats/builds/pyqt5_try1/poky/rpi64-build/tmp/work/raspberrypi4_64-poky-linux/qt5-kms-rpi-image/1.0-r0/image"
bindir_native="/usr/bin"
This seems okay at first glance, but when I manually follow the destination of the variable 'D', there is no 'images' folder created. I also wonder why everybody installs their custom applications on ${D}/usr/bin? Should this not be written to the build/tmp/deploy directory? Or am I missing a step here.
So, in this 'qt5-kms-rpi-image/1.0-r0' folder, there is a folder called 'deploy-qt5-kms-rpi-image-image-complete', which contains a rootfs. But there also is a rootfs folder in the 'qt5-kms-rpi-image/1.0-r0' folder. Both of these rootfs's do not contain any mention of my basicquick application, or a BasicQuick folder being created in /usr/bin.
Also, the rootfs found in the "build/tmp/deploy/images/raspberrypi4-64/qt5-kms-rpi-image-raspberrypi4-64.tar.bz2" does not contain any mention of the basicquick application being present in the filesystem.
Does anybody have any clues on what I am missing? Am I just not copying my files to the correct location? Or does the final deploy image end up somewhere else from where I am expecting it?
Thanks in advance.
With kind regards,
Mats de Waard

How to include the kernel configuration to my meta-layer and into the build?

I am using cl-som-imx7 board, using gatesgarth branch to setup the yocto env.
I have changed the kernel configurations by
Executing the command
bitbake -c memuconfig virtual/kernel
Rename the .config to defconfig
I don't have any luck in including those changes inside my build. Any suggestion would be appreciated.
The following section of the Yocto Manual illustrates how to do that:
https://www.yoctoproject.org/docs/2.5/kernel-dev/kernel-dev.html#changing-the-configuration
You basically need to rename this .config file to defconfig and add it with your kernel recipe to be as follows
linux_x.x.bb
linux
|
|_ defconfig
and add the following lines to your recipe:
# This to add the package name directory to search paths (i.e. The recipe name which is linux in this example)
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://defconfig"

Yocto: Difference between CORE_IMAGE_EXTRA_INSTALL and IMAGE_INSTALL

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.

Replace bitbake task with bbappend

The task do_kernel_configme is defined in yocto base layers and added to by meta-raspberrypi. How do I override only the parts added by meta-raspberrypi using a bbappend file?
Current setup is something like:
meta-mylayer rpi-recipe.bbappend do_kernel_configme_prepend()
meta-raspberrypi rpi-recipe.bb do_kernel_configme_prepend()
<yocto base layers> some-recipe.bb do_kernel_configme()
When I run this, both additions are prepended which means the "mylayer" code is run first, then meta-raspberrypi, then base.
How do I completely override the meta-raspberrypi additions so only the "mylayer" code followed by base layer code is executed.
(The same question also applies to do_configure task.)

Yocto using .bbappend file to override writing of default init scripts for initramfs

I am trying to write a .bbappend file that will append to the initramfs-live-boot_1.0.bb which has a statement inside the do_install() that writes the contents of init-live.sh, a shell script that manages the boot procedure, to init, an initialisation script that runs upon boot. The purpose of my .bbappend file is to reference a modified version of the startup script to be copied in place of the original without changing the base openembedded-core and/or poky environments. The .bbappend file and my version of the script is therefore placed in my project directory with the rest of my own recipes to be built.
My initramfs-live-boot_1.0.bbappend looks like this:
SUMMARY = "Replacement recipe"
FILESEXTRAPATH_prepend := "${THISDIR}/files:"
SRC_URI += "file://init.sh"
do_install_append() {
install -m 0755 ${WORKDIR}/init.sh ${D}/init
}
I have a folder files in the same directory as the .bbappend file that contains the init.sh script it should be reading from.
The problem is when I try to build the image, it spits out this error:
WARNING: Failed to fetch URL file://init.sh, attempting MIRRORS if available
and then attempts to search through the poky directory for the missing files rather than in my project directory.
Have I written my .bbappend file wrong? How would I go about editing the initramfs scripts using the .bbappend file?
FILESEXTRAPATH_prepend := "${THISDIR}/files:" should be FILESEXTRAPATHS_prepend := "${THISDIR}/files:". Note the last S in FILESEXTRAPATHS.
That should make it work for you.
Another improvement would be to rename you file file from init.sh to init-live.sh. I.e. use the same name as the file in the original initramfs-live-bootrecipe. That would allow you to remove your do_install_append()-function as well as SRC_URI += "file://init.sh" from the bbappend. The recipe itself would handle those for you. Thus, the only line you'd actually need is the FILESEXTRAPATHS_prepend := "${THISDIR}/files:".