Re: suse 2.6.5 insmod: error inserting 'kprobe.o': -1 Invalid module format

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

 



Thanks Xiangfei,
I am referring to the exactly the same kernel which i
am running.
but i am getting this output, if you compare to the
output given by you, i am not getting CC and LD lines
(which means it is not compiling the module)
Any idea what is the problem ?

make -C
/lib/modules/2.6.5-7.162-bigsmpAnvoraKprobe/build
M=/local/oracle/try modules
make[1]: Entering directory
`/local/oracle/linux-2.6.5-7.162'
  Building modules, stage 2.
  MODPOST
make[1]: Leaving directory
`/local/oracle/linux-2.6.5-7.162'

Here is my makefile:
# If KERNELRELEASE is defined, we've been invoked from
the
# kernel build system and can use its language.
ifneq ($(KERNELRELEASE),)
        obj-m := hello.o

# Otherwise we were called directly from the command
# line; invoke the kernel build system.
else
        KERNELDIR ?= /lib/modules/$(shell uname
-r)/build
        PWD := $(shell pwd)

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

--- Xiangfei Jia <xjianz@xxxxxxxxx> wrote:

> I can roughly guess the problem from the output
> message: you are compiling 
> your module using user-space library. What you
> really should use is kernel 
> header files. (1) if you use your own compiled
> kernel, the header files are 
> at "/usr/src/$(shell uname -r)/include/". In the
> Makefile, it specifies that 
> the kernel path is "/lib/modules/$(shell uname
> -r)/build" - this path will 
> be used by kernel build system to figure out the
> real kernel path which is 
> "/usr/src/$(shell uname -r)/include/". (2) If you
> don't have your own 
> compiled kernel, you should install the kernel
> header package that is 
> matched with your current running kernel. If you use
> Debian,
> this can be easily solved by command "apt-cache
> search kernel header", or 
> something like that. 
> 
> I strongly suggest that you should have your own
> kernel running. It not only 
> solve the compilation problem, but you can also find
> docs under the 
> "Documentation" directory and hack into the kernel
> source.
> 
> Final thing, this is the right output you should
> have for compiling your 
> module:
> make -C /lib/modules/2.6.10/build
> M=/home/fei/ldd-3ed-examples/misc-modules 
> modules
> make[1]: Entering directory `/usr/src/linux-2.6.10'
> CC [M]
> /home/fei/ldd-3ed-examples/misc-modules/kobject.o
> Building modules, stage 2.
> MODPOST
> CC
>
/home/fei/ldd-3ed-examples/misc-modules/kobject.mod.o
> LD [M]
> /home/fei/ldd-3ed-examples/misc-modules/kobject.ko
> make[1]: Leaving directory `/usr/src/linux-2.6.10'
> 
> 
> Fei
> 
> 
> On 4/24/05, anew bie <anewbie79@xxxxxxxxx> wrote:
> > 
> > Thanks a lot Xiangfei for your pointers.
> > (Ignore my previous mail, i was not giving
> "myprobe"
> > argument to make)
> > I am facing a different problem now, please give
> your
> > suggestion
> > 
> > make -f Makefile myprobe
> > cc myprobe.c -o myprobe
> > In file included from
> /usr/include/linux/sched.h:12,
> > from /usr/include/linux/module.h:9,
> > from myprobe.c:2:
> > /usr/include/linux/jiffies.h:16: error: parse
> error
> > before "jiffies_64"
> > /usr/include/linux/jiffies.h:20: error: parse
> error
> > before "get_jiffies_64"
> > In file included from
> /usr/include/linux/sched.h:21,
> > from /usr/include/linux/module.h:9,
> > from myprobe.c:2:
> > /usr/include/asm/mmu.h:13: error: field `sem' has
> > incomplete type
> > In file included from
> /usr/include/linux/signal.h:4,
> > from /usr/include/linux/sched.h:25,
> > from /usr/include/linux/module.h:9,
> > from myprobe.c:2:
> > /usr/include/linux/list.h:604:2: warning: #warning
> > "don't include kernel headers in userspace"
> > In file included from
> /usr/include/asm/siginfo.h:4,
> > from /usr/include/linux/signal.h:7,
> > from /usr/include/linux/sched.h:25,
> > from /usr/include/linux/module.h:9,
> > from myprobe.c:2:
> > /usr/include/asm-generic/siginfo.h:58: error: size
> of
> > array `_pad' is too large
> > In file included from
> /usr/include/linux/sched.h:27,
> > from /usr/include/linux/module.h:9,
> > from myprobe.c:2:
> > oracle@indl104ga:/local/oracle/try>
> > oracle@indl104ga:/local/oracle/try>
> > oracle@indl104ga:/local/oracle/try> make -f
> > Makefile.kprobe2 myprobe
> > cc myprobe.c -o myprobe
> > In file included from
> /usr/include/linux/sched.h:12,
> > from /usr/include/linux/module.h:9,
> > from myprobe.c:2:
> > /usr/include/linux/jiffies.h:16: error: parse
> error
> > before "jiffies_64"
> > /usr/include/linux/jiffies.h:20: error: parse
> error
> > before "get_jiffies_64"
> > In file included from
> /usr/include/linux/sched.h:21,
> > from /usr/include/linux/module.h:9,
> > from myprobe.c:2:
> > /usr/include/asm/mmu.h:13: error: field `sem' has
> > incomplete type
> > In file included from
> /usr/include/linux/signal.h:4,
> > from /usr/include/linux/sched.h:25,
> > from /usr/include/linux/module.h:9,
> > from myprobe.c:2:
> > /usr/include/linux/list.h:604:2: warning: #warning
> > "don't include kernel headers in userspace"
> > In file included from
> /usr/include/asm/siginfo.h:4,
> > from /usr/include/linux/signal.h:7,
> > from /usr/include/linux/sched.h:25,
> > from /usr/include/linux/module.h:9,
> > from myprobe.c:2:
> > /usr/include/asm-generic/siginfo.h:58: error: size
> of
> > array `_pad' is too large
> > In file included from
> /usr/include/linux/sched.h:27,
> > from /usr/include/linux/module.h:9,
> > from myprobe.c:2:
> > /usr/include/linux/fs_struct.h:9: error: parse
> error
> > before "rwlock_t"
> > /usr/include/linux/fs_struct.h:13: error: parse
> error
> > before '}' token
> > In file included from
> /usr/include/linux/sched.h:29,
> > from /usr/include/linux/module.h:9,
> > from myprobe.c:2:
> > /usr/include/linux/completion.h:15: error: parse
> error
> > before "wait_queue_head_t"
> > /usr/include/linux/completion.h: In function
> > `init_completion':
> > /usr/include/linux/completion.h:26: error:
> > dereferencing pointer to incomplete type
> > /usr/include/linux/completion.h:27: error:
> > dereferencing pointer to incomplete type
> > In file included from
> /usr/include/linux/sched.h:30,
> > from /usr/include/linux/module.h:9,
> > from myprobe.c:2:
> > /usr/include/linux/pid.h: At top level:
> > /usr/include/linux/pid.h:18: error: field
> `task_list'
> > has incomplete type
> > /usr/include/linux/pid.h:19: error: field
> `hash_chain'
> > has incomplete type
> > /usr/include/linux/pid.h:24: error: field
> `pid_chain'
> > has incomplete type
> > In file included from
> /usr/include/linux/module.h:9,
> > from myprobe.c:2:
> > /usr/include/linux/sched.h:93: error: parse error
> > before "process_counts"
> > In file included from
> /usr/include/linux/sched.h:102,
> > from /usr/include/linux/module.h:9,
> > from myprobe.c:2:
> > /usr/include/linux/timer.h:10: error: field
> `entry'
> > has incomplete type
> > myprobe.c:11: error: variable or field
> > `__attribute_used__' declared void
> > myprobe.c:11: error: parse error before
> "myprobe_exit"
> > myprobe.c:16: error: parse error before
> > "__attribute_used__"
> > myprobe.c:16: error: conflicting declarations of
> > `__attribute_used__'
> > myprobe.c:11: error: `__attribute_used__'
> previously
> > declared here
> > myprobe.c:16: warning: initialization makes
> integer
> > from pointer without a cast
> > myprobe.c:16: warning: data definition has no type
> or
> > storage class
> 
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--
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