This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: BEAGLEBK
Tool/software: Linux
Hi,
I use Yocto build system for building Beaglebone Black software. The requirement is to have kernel modules (specifically USB host) loaded automatically when the system boots up.
I was able to do this by running "depmod -a" and a series of "mobprobe <module>" after Linux boots. The questions are:
1. Is this a proper way to do - to run "depmod" every time the system starts?
2. Can Yocto generate the module dependency during build time and deploy it to the image? If so, please explain how it can be done. This way kernel modules can be loaded automatically without running "depmod" when booting.
I'm using Yocto's default init program System V, not systemd, if that makes a difference.
Thank you for the help!
Hello Matt,
Matt Tsai52 said:1. Is this a proper way to do - to run "depmod" every time the system starts?
Matt Tsai52 said:2. Can Yocto generate the module dependency during build time and deploy it to the image? If so, please explain how it can be done. This way kernel modules can be loaded automatically without running "depmod" when booting.
Hi Kemal,
Thank you for the answers.
I followed the description of Yocto Mega-Manual by adding KERNEL_MODULE_AUTOLOAD in my linux-ti-staging_4.14.bbappend. It does not work. Also, I tried adding KERNEL_MODULE_AUTOLOAD in different places like conf/local.conf, the appended image recipe. None of them produces the expected results. There is no /etc/modules-load.d, /etc/modules-load.d/modname.conf populated in the rootfs.
Question: What are still not done correctly using KERNEL_MODULE_AUTOLOAD?
I was able to make the modules loaded by appending "kernel-modules" to IMAGE_INSTALL in my image recipe. However, it does not generate /etc/modules-load.d, either. I can only observe difference in /lib/modules/$(uname -r) in the rootfs.
Questions:
1. I do not see much description about this approach on Internet, but it works. Is this a proper way to do?
2. What is the difference between this approach and the KERNEL_MODULE_AUTOLOAD approach?
Thank you for the help!
It is not possible not to work. Use this syntax KERNEL_MODULE_AUTOLOAD += "modname" add it to the recipe file, and make sure that you have cleaned the shared states with -c do_cleansstate before rebuilding.
Hi Kemal,
Thank you for the quick response.
I put KERNEL_MODULE_AUTOLOAD += "modname" in my linux-ti-staging_%.bbappend and had success on one of the kernel modules that deployed with core-image-base. I believe I used the module name that is displayed by "lsmod" is different from the real module name (modname.ko). That caused the problem.
However, for the kernel modules that are deployed by modules-am335x-evm.tgz (specifically musb_am335x.ko), the /etc/modules-load.d/modname.conf is not populated after the image is built.
What is the proper way to get around this?
Thank you for your help!
Hi Kemal,
I got the recipes from poky repository tag "rocko-18.0.3" and meta-ti repository tag "ti2018.03". I think it does not contain an arago-core-tisdk-image target. In this case, would you please advice how I can get around this problem? Thank you for your help!
In this case create a regular modname.conf file and copy it to /etc/modules-load.d/ in this way.
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI_append += "\
file://modname.conf \
"
do_install_append() {
install -m 0644 ${WORKDIR}/modname.conf ${D}${sysconfdir}/modules-load.d/
}
Thank you. I believe this should work if the module dependency modules.dep is generated at build time.
Would you please help on solving this final piece of puzzle of how to generate module dependencies at build time (running depmod and generate modules.dep, ...etc. in the rootfs)?
Or I will just have to hack the init scripts somewhere to run "depmod -a" before the /etc/init.d/modutils.sh is executed?
Thank you for the great help!
In build-time if the USE_DEPMOD is set to 1 the module dependency files are generated by depmodwrapper.
In runtime the module dependency files are generated by /etc/init.d/modutils.sh. See this code snippet at the beginning of the script.
if [ ! -f /lib/modules/`uname -r`/modules.dep ]; then [ "$VERBOSE" != no ] && echo "Calculating module dependencies ..." depmod -Ae fi
Hi Kemal,
Thank you for the answers.
I think the fact that modules-am335x-evm.tgz is deployed separately is causing the problem. The module dependencies deployed with rootfs is generated at build time, but not for those in modules-*.tgz filet. At the end, I use a "hybrid" solution: 1. Add "kernel-modules" in my local.conf, as this seems to create module dependencies for all modules at build time. 2. Manually create the /etc/modules-load.d/modname.conf in the rootfs, although this seems not matter if "kernel-modules" is used.
Now the "hybrid" solution works for me. But I think to create a new image target instead of including core-image-base may solve this more elegantly, but not sure how much more work is needed? Please let me know if you happen to know a more elegant solution.
Thank you for your help!