I am trying to add the example external kernel module hello-mod from meta-skeleton/recipes-kernel to my image using the Yocto build system. When I try to compile it with bitbake hello-mod
, however, it fails at a second stage complaining that struct module
has no member named name
on the line .name = KBUILD_MODNAME,
. It seems as if struct module
is not being defined even though linux/module.h has been included. This is the generic module code that doesn't seem to compile:
#include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>
MODULE_INFO(vermagic, VERMAGIC_STRING);
MODULE_INFO(name, KBUILD_MODNAME);
__visible struct module __this_module
__attribute__((section(".gnu.linkonce.this_module"))) = {
.name = KBUILD_MODNAME,
.init = init_module,
#ifdef CONFIG_MODULE_UNLOAD
.exit = cleanup_module,
#endif
.arch = MODULE_ARCH_INIT,
};
#ifdef RETPOLINE
MODULE_INFO(retpoline, "Y");
#endif
static const char __module_depends[]
__used
__attribute__((section(".modinfo"))) =
"depends=";
I am unable to see anything wrong in the compilation log, make is being invoked (correctly, to the best of knowledge) with the following line:
make -C /path/to/poky-rocko/build/tmp/work-shared/duovero/kernel-source \
M=/path/to/poky-rocko/build/tmp/work/duovero-poky-linux-gnueabi/hello-mod/0.1-r0
and I can confirm that module.h exists in the directory: /path/to/poky-rocko/build/tmp/work-shared/duovero/kernel-source/include/linux
So I am running out of and looking for ideas on how to debug this issue. For the record, these are the current versions of the layers, kernel etc:
Any help or hints would really be appreciated!
It seems to be an issue with the Yocto build system. The hello-mod module builds when I follow these steps.
MACHINE_ESSENTIAL_EXTRA
_RRECOMMENDS
and watch the build fail. So far I have observed this when moving from 4.16.5 to 4.16.8 and vice versa. So at this point I am pretty sure that this is an issue with the build system.
I had a close look at the output of bitbake -e
using grep (against "hello" and "MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS") and diff but couldn't find any significant differences. I also checked the compilation and configuration logs, the only interesting thing I saw was in the configuration logs where on the second run this is printed:
DEBUG: Executing shell function do_configure
NOTE: make KERNEL_SRC=/path/to/poky-rocko/build/tmp/work-shared/duovero/kernel-source clean
rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c
rm -f Module.markers Module.symvers modules.order
rm -rf .tmp_versions Modules.symvers
DEBUG: Shell function do_configure finished
DEBUG: Executing python function do_qa_configure
DEBUG: Python function do_qa_configure finished
while on the first run, we only have:
DEBUG: Executing shell function do_configure
DEBUG: Shell function do_configure finished
DEBUG: Executing python function do_qa_configure
DEBUG: Python function do_qa_configure finished
Although this may have just occurred since this was the second run of the configure task for hello-mod. This seems very much like a bug in the build system to me. To this end, I have reported the issue on Bugzilla:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.