1

I need to access the target path to kernel modules in a recipe, is there a variable with such information?

I mean, where can i get "/lib/modules/4.1.23-fslc+g3617c73" since this path may change because of configuration?

ErniBrown
  • 1,283
  • 12
  • 25
  • Hi, did you read [this](http://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#incorporating-out-of-tree-modules) ? – Nayfe Jan 11 '18 at 08:55
  • Yes, but i don't get it. From this I understand where i can find my kernel sources, right? I need the path to the ".ko" once on the target machine. Am i missing something from the manual? – ErniBrown Jan 11 '18 at 09:21
  • why do you want the path for .ko? You can just add [KERNEL_MODULE_AUTOLOAD](http://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#var-KERNEL_MODULE_AUTOLOAD) that will take care of module loading. – Nayfe Jan 11 '18 at 10:38
  • I've got this app, not developed by me, which need to know the path, and that information is hardcoded at build time. I do not want to patch the code, i just need the path inside its recipe. After asking I arranged to use "/lib/modules/KERNEL_VERSION", but maybe there is a better option? – ErniBrown Jan 11 '18 at 11:34
  • `INSTALL_MOD_PATH` is used by native kernel *Makefile*, I think Yocto should set it somewhere. – 0andriy Jan 11 '18 at 23:55

2 Answers2

2

The destination directory is as follows.

Look into bbclass file kernel.bbclass in poky/meta/classes/ function kernel_do_install It is passed as a make option

 oe_runmake DEPMOD=echo MODLIB=${D}${nonarch_base_libdir}/module/${KERNEL_VERSION} INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install
Varun
  • 447
  • 4
  • 9
1

I hope below info will help you, the kernel modules path is `

tmp-glibc/work/beaglebone-linux-gnueabi/linux-ti/3.12.30-phy10-r0.0/image/lib/modules/3.12.30-AM335x-PD15.3.0`

if you add your code in your linux kernel and compile as modules(.ko) by default it will add in above mentioned path.

If you want to copy your module(.ko) manually to the lib/modules path copy your.ko file to sources/meta-youlayer/recipes-kernel/linux and create linux-ti_%.bbappend file ad below line

FILESEXTRAPATHS_prepend := "${THISDIR}:"
SRC_URI +="file://your.ko"
do_install_append(){
install -m 0777 ${S}/your.ko ${D}/lib/modules/version
}

I did not try this yet. hope it will work.

yoctotutor.com
  • 5,145
  • 4
  • 26
  • 36