[yocto] How to build a simple kernel modul

Petter Mabäcker petter at technux.se
Mon May 9 21:50:36 PDT 2016


 

2016-05-09 17:06 skrev 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 [1] 
> file://Makefile [2] 
> " 
> 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
> 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.

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>
www.technux.se
 

Links:
------
[1]
file://sek4_ledmodule.c/
[2] file://Makefile/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20160510/512a4ff8/attachment.html>


More information about the yocto mailing list