How to add RPMSG to a BSP 5.7 image using yocto

Thanks @hfranco.tx,

I came to the same conclusion concerning which files to change. The M4 side will not cause any problems, since it is a straight compilation into an executable.

The complexity is on the Linux side. The file you mentioned can be found under oe-core/build/tmp/work-shared/colibri-imx7-emmc/kernel-source/drivers/rpmsg/imx_rpmsg.c in my Yocto directory but since this is a tmp directory, it is not the one to change.

I suppose I have to add a recipe similar to what is described here but that example describes a patch, not the replacement of a source file as a whole.
Being very new to Yocto, I would really appreciate to have an (detailed) description of what to do in Yocto for this particular case.
Or you may perhaps be able to point me to another page which describes a similar case…

Before I can test it, I also need to solve the other issue I have with the modified device tree (here).

Best regards,
Jeroen