I have a yocto project, the kernel version is 6.1.55. With generated kernel source, it fails to compile my driver code, and generates errors:
error: ‘drm_ioctl’ undeclared here (not in a function);
And found drm_ioctl.h is missing from the kernel built with yocto. recipes-graphics has libdrm_2.4.115.imx.bb configured. And drm/drm_gem_cma_helper.h is also missing.
How to configure recipes-graphics so that it generates DRM dev package for my driver to be compiled with kernel drm (drm/dma) support?
I have a yocto project, the kernel version is 6.1.55. With generated kernel source, it fails to compile my driver code, and generates errors:
error: ‘drm_ioctl’ undeclared here (not in a function);
And found drm_ioctl.h is missing from the kernel built with yocto. recipes-graphics has libdrm_2.4.115.imx.bb configured. And drm/drm_gem_cma_helper.h is also missing.
How to configure recipes-graphics so that it generates DRM dev package for my driver to be compiled with kernel drm (drm/dma) support?
Share Improve this question edited Mar 19 at 13:30 genpfault 52.2k12 gold badges91 silver badges151 bronze badges asked Mar 19 at 13:19 dxyzhou-tigerdxyzhou-tiger 12 bronze badges1 Answer
Reset to default 0The error indicates that your driver needs DRM support in the kernel, but some essential headers like drm_ioctl.h
and drm/drm_gem_cma_helper.h
are missing from your Yocto-built kernel.
Here's how to properly configure your Yocto project to include the necessary DRM support:
First, you need to ensure the kernel has DRM support enabled. Create a kernel fragment file or modify your existing one:
# In your layer, create or modify a .cfg file, for example:
# meta-yourlayer/recipes-kernel/linux/linux-yocto/drm.cfg
CONFIG_DRM=y
CONFIG_DRM_KMS_HELPER=y
CONFIG_DRM_GEM_CMA_HELPER=y
CONFIG_DRM_KMS_FB_HELPER=y
CONFIG_DRM_FBDEV_EMULATION=y
And Please Make sure this kernel configuration fragment is included in your kernel recipe. Add to your kernel recipe (e.g.,
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://drm.cfg"