Here is another thread on the topic of rpmsg and how do I increase the buffer size.
I have set up a YOCTO build environment and I can create a Torizon OS BSP that behaves on the module in the same way as a BSP provided directly by Toradex.
Now I want to edit 2 source files. I am aware that there are several approaches to this.
However, I now want to use the approach via a meta-custom layer, as partially described here:
Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!
Did you like my answer?
Hello Gerald,
To create a custom layer for a simple change in an in-tree kernel module using Yocto, and ensure your changes are compiled and included in the final image, your .bbappend file should instruct Yocto to apply your patches and possibly force a recompilation of the affected modules. Here’s a simplified approach:
Create the .bbappend File: This file should append the necessary tasks to apply your patches. Assuming you’re modifying the rpmsg module in the Linux kernel provided by Toradex, your linux-toradex_%.bbappend might look something like this:
FILESEXTRAPATHS_prepend := "${THISDIR}/linux-toradex:"
SRC_URI += " \
file://rpmsg_char.patch \
file://virtio_rpmsg_bus.patch \
"
# Force a recompilation of the kernel to ensure your changes are applied
do_configure:append() {
oe_runmake oldconfig
}
Ensure Patches Are Correctly Formatted: Your patches (rpmsg_char.patch and virtio_rpmsg_bus.patch) need to be correctly formatted diff files. They should be created based on the differences between the original and modified source files. Use the diff -u command to generate these patches if you haven’t already.
Place the Patches in the Correct Directory: As per your directory structure, place your patches in the recipes-kernel/linux/linux-toradex directory. Ensure the path in SRC_URI correctly points to these patch files.
Force Kernel Recompilation (If Needed): The do_configure:append() function with oe_runmake oldconfig is a simple way to ensure the kernel is reconfigured. This step might be necessary if your patches alter configuration options. However, if your patches only modify source files and don’t require changes to the kernel configuration, this step might not be strictly necessary. Yocto should detect the changes and rebuild the affected modules automatically.
Layer Configuration: Ensure your layer.conf in the meta-customer/conf directory is correctly set up to include your custom layer in the build. It should look something like this:
BBPATH .= ":${LAYERDIR}"
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "meta
Please, also check if these links can help you solve your problem:
https://developer.toradex.com/software/linux-resources/linux-features/enabling-spread-spectrum-clocking-on-ddr-interface
https://developer.toradex.com/linux-bsp/os-development/build-yocto/custom-meta-layers-recipes-and-images-in-yocto-project-hello-world-examples.
However, I was able to see from a changed message in linux/drivers/rpmsg/virtio_rpmsg_bus.c:724:
dev_warn(dev, "inbound msg is too big: (%d, %d)\n", len, msg_len);
that this part was not recompiled. With the addition: do_configure:append() ...
will definitely be recompiled.
In my case, however, this takes about 1/4 hour.
I think I have gained a little more certainty.
Whether recompilation is decided based on the local git repository. If there is a valid commit that contains all the required files, it is also recompiled.
I think with git commit -a you are on the safe side
And whether it is also appended may decide whether to use *.bbappend or just *.bb ???
Just to clarify this point, .bbappend files should be used when modifying an existing recipe, which is the case for the Linux kernel, while .bb files should be used when declaring new recipes, which will likely be the case when adding a custom application, for example.