Dkms is a tool used to compile out of tree modules directly on
target devices (sometimes you have sources or binaries which
need to be compiled directly on target, outside OE).
I used a simple module and a dkms config to test it, and dkms
compiled and installed the module on target.

For example:
.
├── dkms.conf
└── src
    ├── hello.c
    └── Makefile

hello.c:
        #include <linux/module.h>

        int init_module(void)
        {
                printk("Hello World!\n");
                return 0;
        }

        void cleanup_module(void)
        {
                printk("Goodbye Cruel World!\n");
        }

        MODULE_LICENSE("GPL");

Makefile:
        obj-m += hello.o

        KERNELDIR ?= /lib/modules/$(shell uname -r)/build

        PWD := $(shell pwd)

        install:
                $(MAKE) -C $(KERNELDIR) M=$(PWD) modules

        clean:
                rm -rf *.o *.ko *~ core .depend .*.cmd *.mod.c modules.order 
Module.symvers

dkms.conf:
        MAKE="make -C src/ KERNELDIR=/lib/modules/${kernelver}/build"
        CLEAN="make -C src/ clean"
        BUILT_MODULE_NAME=hello
        DEST_MODULE_LOCATION=/kernel/drivers/scsi
        BUILT_MODULE_LOCATION=src/
        PACKAGE_NAME=hello
        PACKAGE_VERSION=0.1
        AUTOINSTALL=yes
        REMAKE_INITRD=yes

All files should be in /usr/src/<package-name>-<package-version>,
in our case in /urs/src/hello-0.1.

Signed-off-by: Alexandru Vasiu <alexandru.va...@ni.com>
---
 meta/recipes-kernel/dkms/dkms_2.4.0.bb | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 meta/recipes-kernel/dkms/dkms_2.4.0.bb

diff --git a/meta/recipes-kernel/dkms/dkms_2.4.0.bb 
b/meta/recipes-kernel/dkms/dkms_2.4.0.bb
new file mode 100644
index 0000000000..78b23c43e9
--- /dev/null
+++ b/meta/recipes-kernel/dkms/dkms_2.4.0.bb
@@ -0,0 +1,12 @@
+SUMMARY = "DKMS Recipe - Adds DKMS tool for target"
+HOMEPAGE = "https://github.com/dell/dkms/";
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3"
+
+SRC_URI = "https://github.com/dell/${PN}/archive/v${PV}.tar.gz";
+
+SRC_URI[md5sum] = "d2e74dd79086c564a924b5763794091b"
+
+RDEPENDS_${PN} += "bash kmod gcc make patch"
+
+inherit autotools-brokensep
-- 
2.13.2

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to