Compiling kernel modules (crosscompiler problem?)
Posted: Sun Feb 01, 2009 12:52 pm
Hi!
I just started to integrate a cross compiler into my project. I have binutils 2.19 and gcc 4.3.3 compiled to run on linux and compile binary to my own OS.
Unfortunately I have a little problem when I try to compile my kernel modules with the above mentioned cross compiler. Here's the command line what I've used for kernel modules to compile with my native Linux compiler before I started to use the new cross compiler:
... and ...
This works fine until I use my native Linux compiler but when I switch to my cross compiler I got a few errors when I try to link the final kernel module:
#1: Tries to link it as a normal executable and looks for _start:
#2: All the symbols that are defined inside the kernel are undefined
Do you have any idea what did I wrong?
Thanks,
giszo
I just started to integrate a cross compiler into my project. I have binutils 2.19 and gcc 4.3.3 compiled to run on linux and compile binary to my own OS.
Unfortunately I have a little problem when I try to compile my kernel modules with the above mentioned cross compiler. Here's the command line what I've used for kernel modules to compile with my native Linux compiler before I started to use the new cross compiler:
Code: Select all
gcc -c -O2 -m32 -Wall -Wshadow -nostdinc -nostdlib -fno-builtin -fPIC pci.c -I../../../kernel/include -o objs/pci.o
Code: Select all
gcc -m32 -shared -nostartfiles -nodefaultlibs objs/devices.o objs/pci.o -o objs/pci
#1: Tries to link it as a normal executable and looks for _start:
Code: Select all
/home/giszo/prog/yaosp/build/crosscompiler/lib/gcc/i686-pc-yaosp/4.3.3/../../../../i686-pc-yaosp/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000040000080
Code: Select all
objs/devices.o: In function `create_device_node_for_pci_device':
devices.c:(.text+0x44): undefined reference to `snprintf'
devices.c:(.text+0x5a): undefined reference to `create_device_node'
...
Thanks,
giszo