Re: Re: building makefiles/modules in 2.6.0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks, your solution works like a charm.

Best regards,
threadhead


> Please read the doc at Documentation/kbuild/makefiles.txt and
> modules.txt in the kernel sources.
> 
> In a nutshell: You have to write a simple makefile as:
> 
> obj-m += your_module.o
> your_module-objs := main.o obj1.o obj2.o # if needed
> 
> where main.o, obj1.o and so are the objects that have to be linked in
> your module. If there is only an object named as your module, you can
> ommit that line.
> 
> Then, you have to do make from your module's directory:
> 
> make -C path/to/kernel/src SUBDIRS=$PWD modules
> 
> Regards,
> Jaime Medrano
> 
> On Fri, Jan 02, 2004 at 05:05:00PM +0100, threadhead@web.de wrote:
> > dear list,
> > 
> > i was compiling/booting the new 2.6.0 stable kernel release.
> > everything worked fine, i am able to load modules etc.
> > 
> > one problem remains unsolved:
> > i was working on a module for the 2.4.20 kernel, that i previously used.
> > 
> > compilation flags for that module:
> > "gcc -c -O2 -W -I/mnt/src/linux-2.4.20/include -fomit-frame-pointer bleh.c"
> > __KERNEL__ and MODULE were defined in the source file directly.
> > 
> > when i am compiling that module under the 2.6.0 kernel, i cannot insmod it because
> > it is an 'invalid module format'. i've read a dozen articles about that the modules are
> > named .ko since 2.6.0 or 2.5.0; but obviously, simply renaming the object file doesnt fix that.
> > 
> > i've also read, that it is required to link the module, against the current
> > source tree of the configured and compiled kernel tree.
> > 
> > my question is now, how am i able to build my module in a simple way so that i can insmod it?
> > there has to be a way to write a simple makefile that will build your module, no?
> > 
> > thanks for your time
> > threadhead
> > 
> > PS: yes i read
> > http://lwn.net/Articles/21823/
> > http://lwn.net/Articles/driver-porting/
> > 
> > i tried the makefile posted in one of the articles, but it doesnt work because:
> > "no rule to make bleh.c".
> > 
> > ______________________________________________________________________________
> > Nachrichten, Musik und Spiele schnell und einfach per Quickstart im 
> > WEB.DE Screensaver - Gratis downloaden: http://screensaver.web.de/?mc=021110
> > 
> > --
> > Kernelnewbies: Help each other learn about the Linux kernel.
> > Archive:       http://mail.nl.linux.org/kernelnewbies/
> > FAQ:           http://kernelnewbies.org/faq/


______________________________________________________________________________
Erdbeben im Iran: Zehntausende Kinder brauchen Hilfe. UNICEF hilft den
Kindern - helfen Sie mit! https://www.unicef.de/spe/spe_03.php

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux