[yocto] Antwort: Re: How to build a simple kernel modul

Esponde, Joel Joel.Esponde at Honeywell.com
Fri May 13 02:02:22 PDT 2016


Hi,

I guess you forgot to add your module to the image recipe:

IMAGE_INSTALL_append = " ledmodule"

If you are working on your module code, you may prefer to copy your module with ssh to the target system and load it dynamically with commands like this:
$ scp $BUILDDIR/tmp/work/<machine>-poky-linux-gnueabi/ledmodule/0.1-r0/ledmodule.ko <system address>:/lib/modules/<kernel version>/kernel/drivers/<subfolder>
$ ssh <system address> /sbin/depmod -a
$ ssh <system address> /sbin/modprobe ledmodule

Hope this helps !

Joël Esponde
Honeywell | Sensing and Productivity Solutions


De : S.Jaritz at esa-grimma.de [mailto:S.Jaritz at esa-grimma.de]
Envoyé : jeudi 12 mai 2016 14:43
À : Esponde, Joel
Objet : Antwort: Re: [yocto] How to build a simple kernel modul

Hej Joel,

Thanks for the template. But could it be that the recipe creates an empty or non working package?

I call my modul "ledmodul". The compilation works fine. The object and ko files are created. Under the kernel the ledmodule/0.1-r0 dir is created. The "deploy-rpms" dir contains 4 rpm packages. The "kernel-module-ledmodule-..." contains the ko file. I think this is fine.

I don't know how to include this modul. I found that the "local.conf" has to be extended by:

KERNEL_MODULE_AUTOLOAD += "ledmodule"

By doing it nothings happens. My driver is not loaded. Seems my new modul is not installed into the system.  Maybe you can tell me how to include a driver right into the system?

Regards from Germany!

Stefan Jaritz

------------------------------------------------------------
ESA Elektroschaltanlagen Grimma GmbH
Broner Ring 30
04668 Grimma
Telefon: +49 3437 9211 176
Telefax: +49 3437 9211 26
E-Mail: s.jaritz at esa-grimma.de<mailto:s.jaritz at esa-grimma.de>
Internet: www.esa-grimma.de


Geschäftsführer:
Dipl.-Ing. Jörg Gaitzsch
Jörg Reinker

Sitz der Gesellschaft: Grimma
Ust.-ID: DE 141784437
Amtsgericht: Leipzig, HRB 5159
Steuernummer: 238/108/00755


Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten
haben, informieren Sie bitte sofort den Absender und löschen Sie diese
Nachricht. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail
ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are
not the intended recipient (or have received this e-mail in error) please
notify the sender immediately and destroy this e-mail. Any unauthorized
copying, disclosure or distribution of the material in this e-mail is strictly
forbidden.



Von:        "Esponde, Joel" <Joel.Esponde at Honeywell.com<mailto:Joel.Esponde at Honeywell.com>>
An:        "petter at technux.se<mailto:petter at technux.se>" <petter at technux.se<mailto:petter at technux.se>>, "yocto at yoctoproject.org<mailto:yocto at yoctoproject.org>" <yocto at yoctoproject.org<mailto:yocto at yoctoproject.org>>
Datum:        10.05.2016 12:30
Betreff:        Re: [yocto] How to build a simple kernel modul
Gesendet von:        yocto-bounces at yoctoproject.org<mailto:yocto-bounces at yoctoproject.org>
________________________________



Hi,

And here is a hello world module example:
http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta-skeleton/recipes-kernel/hello-mod

Joël Esponde
Honeywell | Sensing and Productivity Solutions

De : yocto-bounces at yoctoproject.org<mailto:yocto-bounces at yoctoproject.org> [mailto:yocto-bounces at yoctoproject.org] De la part de Petter Mabäcker
Envoyé : mardi 10 mai 2016 06:51
À : yocto at yoctoproject.org<mailto:yocto at yoctoproject.org>
Objet : Re: [yocto] How to build a simple kernel modul


2016-05-09 17:06 skrev S.Jaritz at esa-grimma.de<mailto:S.Jaritz at esa-grimma.de>:
Hej,

I want to build a recipe for a simple GPIO Module. I found no tutorial at the documentation. What is the comon way to build a simple kernel module?

The Makefile looks like:
#########
obj-m += ledmodule.o

SRC := $(shell pwd)

all: modules

modules:
       $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules

modules_install:
       $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install

clean:
       rm -rf *.o *.ko *.mod.c
#########
The recipe contains:
#########
SUMMARY = "ledmodule"
SECTION = ""
LICENSE = "CLOSED"

inherit module

SRC_URI = "file://ledmodule.c<file:///\\sek4_ledmodule.c\> \
       file://Makefile<file:///\\Makefile\> \
       "
S = "${WORKDIR}/ledmodule-0.1"
#########

Regards

Stefan Jaritz
Entwickler

------------------------------------------------------------
ESA Elektroschaltanlagen Grimma GmbH
Broner Ring 30
04668 Grimma
Telefon: +49 3437 9211 176
Telefax: +49 3437 9211 26
E-Mail: s.jaritz at esa-grimma.de<mailto:s.jaritz at esa-grimma.de>
Internet: www.esa-grimma.de<http://www.esa-grimma.de/>


Geschäftsführer:
Dipl.-Ing. Jörg Gaitzsch
Jörg Reinker

Sitz der Gesellschaft: Grimma
Ust.-ID: DE 141784437
Amtsgericht: Leipzig, HRB 5159
Steuernummer: 238/108/00755


Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten
haben, informieren Sie bitte sofort den Absender und löschen Sie diese
Nachricht. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail
ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are
not the intended recipient (or have received this e-mail in error) please
notify the sender immediately and destroy this e-mail. Any unauthorized
copying, disclosure or distribution of the material in this e-mail is strictly
forbidden.

Hi,

There are actually some guides for this, see lab4 in:
https://www.yoctoproject.org/sites/default/files/kernel-lab-2.1_0.pdf

But to simply build a module using bitbake, you can just do:

$ bitbake ledmodule

then you will find your recipe and the module in the ./tmp/work/ structure (assuming you are not inheriting 'rm_work' in local.conf...).



if you just want to compile it, you can run:

$ bitbake ledmodule -c compile



BR Petter
Petter Mabäcker

Technux <petter at technux.se<mailto:petter at technux.se>>
www.technux.se<http://www.technux.se/>--
_______________________________________________
yocto mailing list
yocto at yoctoproject.org<mailto:yocto at yoctoproject.org>
https://lists.yoctoproject.org/listinfo/yocto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20160513/8b821ef5/attachment.html>


More information about the yocto mailing list