Kernel Module Definition .mdef

The .mdef files supports declaring pre-built kernel modules to use Legato.

.mdef files contain the following sections:

preBuilt

The mandatory preBuilt: section specifies the path to the pre-built kernel module binary file. This binary file will be bundled with Legato and installed on the target using @ insmod Linux command.

The module binary file specified must have an extension .ko to indicate the kernel module binary.

This code sample shows how the kernel module binary file /path/to/module/hello.ko is bundled with Legato:

{
preBuilt: /path/to/kernel/module/hello.ko
}

params

The optional params: section lists all module parameters that must be provided to the module’s insmod command.

The following code sample will execute this command insmod <module> param1=value1 param2=value2 …:

params:
{
param1 = “value1”
param2 = “value2”
}

The mandatory quotes (“ ”) around each parameter value indicate a string type.

Build Kernel Modules

For info on how to build Linux kernel modules, see the Yocto kernel dev docs and

$(KERNEL_SRC)/Documentation/kbuild/modules.txt file

Build Directory

Kernel module binares are built in the Yocto Linux kernel build environment, preferably with Yocto cross-build tools.

Modules have to be built from the Yocto kernel’s build directory.

From the Yocto tree root, this is the path to kernel build directory:

<Yocto-root>/build_bin/tmp/work/swi_mdm9x15-poky-linux-gnueabi/linux-yocto/<kernel-version>/linux-swi_mdm9x15-standard-build

From the Legato directory, this is the path to kernel build directory:

../build_bin/tmp/work/swi_mdm9x15-poky-linux-gnueabi/linux-yocto/<kernel-version>/linux-swi_mdm9x15-standard-build