Re: yocto support


Quentin Schulz
 

Hi Senthamilarasi.M,

On 7/14/22 06:59, Senthamilarasi mathiyan wrote:
Hi Alexandre,
Good Morning!
I am not introducing any change to kernel.
This is one of my project requirement to enable coverage support to kernel
for specific build for my project.
In my project, Already we have few image recipes.
Ex: core_image_minimal.bb core_image_a.bb core_image_b.bb
These image recipes are using same kernel with same configuration, Apart
from default kernel configuration, I want to enable few driver support in
kernel to enable coverage support for specific requirement.
To enable coverage support in kernel, I have added coverage.cfg in
meta-layer.
Ex: /recipes-kernel/linux-msm/files/coverage.cfg
cat coverage.cfg
CONFIG_GCOV=y
CONFIG_DEBUG_FS=y
CONFIG_GCOV_KERNEL=y
If I add coverage.cfg in my kernel recipe(snippet below) - It will be taken
for all the image build. Whenever do bitbake of following recipe -
core_image_minimal.bb, core_image_a.bb, core_image_b.bb
The below changes will be added to the build, since this kernel is common
for all the image recipes(core_image_minimal.bb core_image_a.bb
core_image_b.bb).
Recipe content:
+++ b/recipes-kernel/linux-kernel/linux-kernel_5.x.bb
@@ -21,6 +21,7 @@ SRC_URI = "\
file://audio-kpi.cfg \
file://ptp-virtual.cfg \
file://xfs.cfg \
+ file://coverage.cfg \
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '
file://systemd.cfg', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'virtualization', '
file://virtualization.cfg', '', d)} \
Similarly, I have patch for file other recipes.
In my case, I should not add this change to all the image build.
My requirement:
I want to create separate image recipe. Ex: core_image_myrecipe.bb
In this recipes
- I should include "inherit core-image-minimal" + "My specific
coverage_support changes".
As per project requirement, I should not create a separate meta layer to
maintain this patches.
Can you please help for creating a separate image recipe with specific
changes?
It is not possible to modify a recipe from another recipe. Meaning you cannot decide which config file to use for the kernel from the image recipe.

You have however two options:
- only include this configuration file for a given machine (you therefore need a new machine). This makes sense if the actual target HW is different,
- only include this configuration file for a given distro (you therefore need a new distro file). This makes sense if the actual target HW is the same for all configuration file of your kernel, just that they differ in terms of "policy".

If you're trying to build "a debug image", it is most likely a new distro you're after.

However, there could be a way to still do this with images and that is with the use of kernel modules. The plan would be to *always* build GCOV, DEBUG_FS and GCOV_KERNEL as modules (if even possible?). Yocto actually splits kernel modules in their own packages. Therefore, you could have the default configuration for your kernel used in all images, but have your special coverage image include also kernel-module-gcov/debug-fs/gcov-kernel/etc.. packages and modprobe/insmod them at boot when needed.

Cheers,
Quentin

Join yocto@lists.yoctoproject.org to automatically receive all group messages.