quinta-feira, 2 de agosto de 2018

Loadable kernel module (LKM) examples

[UNDER CONSTRUCTION]

Simple example adding 2 loadable kernel modules. Module B depends on Module A to be loaded:

In order to load kernel modules, we should push .ko files to device's file system (for example, to /sdcard/):

$ adb push /lkm_a.ko /sdcard/
$ adb push /lkm_b.ko /sdcard/

Then use 'insmod' (or 'modprobe', depending on availability) command:

$ adb root $ adb shell insmod /sdcard/lkm_a.ko
$ adb shell insmod /sdcard/lkm_b.ko

Checking if modules are properly loaded:

$ adb shell lsmod
(result...)

Char device driver example

[UNDER CONSTRUCTION]