Yocto Recipe for automatically loading Out of Tree Linux Device Drivers on Start

We can instruct Yocto to automatically start our own Linux Kernel Module on Start.

Steps:

1. Create a folder 'recipes-kernel' in your own custom meta layer if it doesn't exist
$ mkdir recipes-kernel
2. Inside 'recipes-kernel', create a folder 'my-module' for storing recipe and device driver files
$ cd recipes-kernel; mkdir my-module
3. Inside 'my-module', create 'files' folder and copy your device driver files
$ cd my-module; mkdir files
4. Copy this Makefile in the 'files' directory

5. Come back to the parent folder (i.e., my-module) and create a recipe for building the module
$ cd .. ; touch my-module_0.1.bb

You should have the following tree after this step.

6. Add this module into your configuration file (local.conf file or machine.conf)
MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-module-mymod"
KERNEL_MODULE_AUTOLOAD += "mymod"

MACHINE_ESSENTIAL_EXTRA_RDEPENDS tells yocto to build this module and include it in the build image 
KERNEL_MODULE_AUTOLOAD is to load the module automatically on start

Comments

Popular posts from this blog

bb.utils.contains yocto

make config vs oldconfig vs defconfig vs menuconfig vs savedefconfig

PREFERRED_PROVIDER and PREFERRED_VERSION in Yocto