LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-22-2010, 08:36 AM   #31
David Li
Member
 
Registered: Mar 2010
Posts: 42

Original Poster
Rep: Reputation: 15

This is the makefile:

KERNELDIR = ../../kernel/linux-2.6.22.6

gedv0-objs := p3defs.o p3api.o gedrv.o
obj-m := gedv0.ko
PWD := $(shell pwd)

call-kernel-build-system:
make -C $(KERNELDIR) SUBDIRS=$(PWD) ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- modules

After run make following erros occured:
Building modules, stage 2.
MODPOST 0 modules
/bin/sh: scripts/mod/modpost: No such file or directory
make[2]:***[__modpost]Error 127
make[1]:***[modules] Error 2
make[1]:***Leaving directory 'usr/iNetPLC5x/Source/kernel/linux-2.6.22.6'
make: ***[call-kernel-build-system] Error 2
 
Old 03-22-2010, 09:56 AM   #32
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
For some reason the modpost tool has not been built yet. Do the following: Go to the kernel source directory and enter "make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- SUBDIRS=scripts/mod". This command should build the modpost tool. Normally this tool is created, when you build the kernel. Check if the executable scripts/mod/modpost exists and try again.
 
Old 03-22-2010, 10:00 AM   #33
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
There is a little error in the makefile: Change "obj-m := gedv0.ko" to "obj-m := gedv0.o". Sorry for the misinformation.
 
Old 03-22-2010, 10:24 AM   #34
David Li
Member
 
Registered: Mar 2010
Posts: 42

Original Poster
Rep: Reputation: 15
I was able to use the command you sent me to compile the modpost. But when I make my kernel module, here are the messages:

WARNING: Symbol version dump /usr/iNetPLC5x/Source/kernel/linux-2.6.22.6/Module.symvers is missing; modules will have no dependencies and modversions.

Building modules, stage 2.
MODPOST 0 modules
make[1]: Leaving directory '/usr/iNetPLC5x/Source/kernel/linux-2.6.22.6

No binary file was generated.

btw: for 2.6 kernel, module binary files have extension .ko instead of o.
 
Old 03-22-2010, 10:49 AM   #35
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
You have to make the change from ko -> o. The .ko file will be created then. modpost will create a file gedrv0.mod.c this file will contain all needed version information. This file is compiled and linked with gedrv0.o to give the .ko-file.

When using obj-m := ...ko you will get the warning
Code:
target `...' doesn't match the target pattern
The file Module.symvers is normally created when compiling the kernel for the target system. Perhaps you can find it in the original compilation directory. It will tell modpost to on which modules your module depends. If it is not present, the module should be created anyway and should be usable.

Last edited by irmin; 03-22-2010 at 10:51 AM.
 
Old 03-22-2010, 11:00 AM   #36
David Li
Member
 
Registered: Mar 2010
Posts: 42

Original Poster
Rep: Reputation: 15
I do have several application header files, do I need some how to add them in the make file, or the make file will pick them up automatically?
 
Old 03-22-2010, 11:03 AM   #37
David Li
Member
 
Registered: Mar 2010
Posts: 42

Original Poster
Rep: Reputation: 15
I do have several application header files, do I need some how to add them in the make file, or the make file will pick them up automatically
 
Old 03-22-2010, 11:38 AM   #38
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
The makefile will automatically pick up all dependencies.
 
Old 03-22-2010, 11:43 AM   #39
David Li
Member
 
Registered: Mar 2010
Posts: 42

Original Poster
Rep: Reputation: 15
It is so strange, no erro, but no module was created either. I thought it may be saved somewhere else, but no.
 
Old 03-22-2010, 11:50 AM   #40
David Li
Member
 
Registered: Mar 2010
Posts: 42

Original Poster
Rep: Reputation: 15
No object files were created either.
 
Old 03-22-2010, 12:01 PM   #41
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
I created empty files and when I build the kernel module I get:
Code:
make -C /usr/src/linux-2.6.32 SUBDIRS=`pwd`
make[1]: Entering directory `/usr/src/linux-2.6.32'
  LD      /tmp/mod/built-in.o
  CC [M]  /tmp/mod/p3defs.o
  CC [M]  /tmp/mod/p3api.o
  CC [M]  /tmp/mod/gedrv.o
  LD [M]  /tmp/mod/gedv0.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /tmp/mod/gedv0.mod.o
  LD [M]  /tmp/mod/gedv0.ko
make[1]: Leaving directory `/usr/src/linux-2.6.32'
And a file gedv0.ko is created. Can you remove all object files from the directory, type make and show me the output?
 
Old 03-22-2010, 12:15 PM   #42
David Li
Member
 
Registered: Mar 2010
Posts: 42

Original Poster
Rep: Reputation: 15
make -C ../../kernel/linux-2.6.22.6 SUBDIRS=/usr/iNetPLC5x/Source/drivers/ge_io ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- modules
make[1]: Entering directory '/usr/iNetPLC5x/source/kernel/linux-2.6.22.6'
WARNING: Symbol version dump /usr/iNetPLC5x/Source/kernel/linux-2.6.22.6/Module.symvers is missing; modules will have no dependencies and modversions.

Building modules, stage 2.
MODPOST 0 modules
make[1]: Leaving directory '/usr/iNetPLC5x/source/kernel/linux-2.6.22.6'
 
Old 03-22-2010, 12:50 PM   #43
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
Is /usr/iNetPLC5x/Source/drivers/ge_io/Makefile the makefile containing the "obj-m := ..." line? It looks like this makefile does not contain any information for KBuild!
 
Old 03-22-2010, 01:13 PM   #44
David Li
Member
 
Registered: Mar 2010
Posts: 42

Original Poster
Rep: Reputation: 15
I am sorry, I have two make files (makefile, Makfile), I have got rid of the wrong one. Now I have following output after make:

make[2]: *** No rule to make target'/usr/iNetPLC5x/Source/drivers/ge_io/gedv0.c' needed by '/usr/iNetPLC5x/Source/drivers/ge_io/gedv0.o'. Stop
make[1]:***[_module_/usr/iNetPLC5x/Source/drivers/ge_io] Error 2
make[1]: Leaving directory '/usr/iNetPLC5x/source/kernel/linux-2.6.22.6'
make: ***[call-kernel-build-system] Error 2
 
Old 03-22-2010, 02:04 PM   #45
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
Is the variable containing the object filenames called "gedv0-objs" or did you misspell it? You get errors like this, if do not define gedv0-objs.

Last edited by irmin; 03-22-2010 at 02:06 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the error "invalid module format" and "insert kernel module"? shayori Linux - Newbie 8 02-25-2010 04:48 AM
[SOLVED] booting a newly compiled kernel error :"invalid or unsupported executable format" shivanth Linux - Kernel 1 09-16-2009 07:57 AM
ns:"error when calling class OldSim"&tclsh:"invalid command+child process exits abn." shojaru Linux - Newbie 0 03-05-2009 05:23 AM
error: Error for wireless request "Set Mode" (8B06) : invalid argument "roaming" penguin chick Linux - Wireless Networking 5 08-22-2008 02:16 PM
Ndiswrapper "Invalid driver" error - but it worked before i switched distros! drewbug01 Linux - Wireless Networking 5 11-01-2006 01:36 PM


All times are GMT -5. The time now is 03:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration