Toon Heyrman
Toon Heyrman

Reputation: 111

How to insert OV5640 camera driver as module in yocto

I am trying to use the OV5640 camera driver as a module in yocto. So I took the .c code and made a makefile (based on the example hello-mod)

obj-m += OV5640.o
SRC := $(shell pwd)
all:
    $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules
modules_install:
    $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install
clean:
    $(MAKE) -C $(KERNEL_SRC) M=$(SRC) clean

I also made a recipe in yocto

DESCRIPTION = "..."
LICENSE = "GPL-2.0"
LIC_FILES_CHKSUM = "\
   file:// ${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6 \
"

inherit module

SRCREV = "${AUTOREV}"
BPV = "0.0.0"
PV = "${BPV}+git${SRCREV}"

SRC_URI = "git://git/my-repo;protocol=ssh;user=git;branch=master \
"

S = "${WORKDIR}/git"

In the git repo I have the .c code of the camera and the Makefile.

But when I try to build, it fails on do_compile and says:

fatal error: v4l2-int-device.h: No such file or directory

When I search on the file in the 'tmp' folder of yocto I find one in:

tmp/work-shared/myboard/kernel-source/drivers/media/platform/mxc/capture/v4l2-int-device.h

The question is, How can I modify the recipe to be able to build the module without changing the source code or the makefile?

Note:
I also tried to add snippet below to the recipe but this gave no succes.

CFLAGS_prepend = " -I${STAGING_KERNEL_DIR}/drivers/media/platform/mxc/capture "

Upvotes: 1

Views: 1136

Answers (1)

PierreOlivier
PierreOlivier

Reputation: 1556

You need to modify your Makefile and add:

ccflags-y += -I$(KERNEL_SRC)/drivers/media/platform/mxc/capture/

You can also try to compile it out of the tree, you need to set the variable KERNEL_SRC, source your environment, and compile it.

Upvotes: 1

Related Questions