Mero
Mero

Reputation: 1350

bitbake build can't find sparse

I am trying to compile the kernel module inside Yocto recipe. However, I always get this error /bin/sh: 1: sparse: not found. If I cross-compile the module with the populated SDK, it works perfectly fine.

Somehow, sh can't find sparse. Note: sparse is downloaded

Here is my recipe

SUMMARY = "test Linux kernel module"
LICENSE = "CLOSED"

inherit module

SRC_URI = "git://github.com/xyz/test_yocto.git;protocol=https"
SRCREV = "${AUTOREV}"
#SRCREV = "5c6224fee66d8e4eb167f4c74d42e5cfa479e9eb"

S = "${WORKDIR}/git"

# The inherit of module.bbclass will automatically name module packages with
# "kernel-module-" prefix as required by the oe-core build environment.

RPROVIDES_${PN} += "kernel-module-test"

and here is my make file:

obj-m := test.o

SRC := $(shell pwd)

all:
        $(MAKE) KBUILD_CHECKSRC=1 -C $(KERNEL_SRC) M=$(SRC)

modules_install:
        $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install

clean:
        rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c
        rm -f Module.markers Module.symvers modules.order
        rm -rf .tmp_versions Modules.symvers

If I remove KBUILD_CHECKSRC=1, which will pass checks, it will work fine.

What am I missing here?

Upvotes: 0

Views: 612

Answers (1)

Jussi Kukkonen
Jussi Kukkonen

Reputation: 14617

I'm not a kernel expert but this seems pretty clear: When you define KBUILD_CHECKSRC=1 the module build uses an external tool called 'sparse'. This tool is not currently a build dependency for the kernel module so the build fails.

You can either avoid using KBUILD_CHECKSRC (and this is probably what you want: KBUILD_CHECKSRC sounds like something your module developers should be using). Alternatively you can add "sparse-native" to your module recipes DEPENDS and then make sure you are using a layer that provides that (layers.openembedded.org says meta-sca has it).

Upvotes: 1

Related Questions