Hello...
I am trying to build a multiple-file kernel module, and am
having some difficulty. It seems that the linker is trying
to build and executable.
The paradigm I am using is from
http://www.linuxdoc.org/LDP/lkmpg/node13.html.
I compile two source files with the following gcc command:
gcc -c -D__KERNEL__ -I/usr/src/linux/include -DMODULE -Wall -O2 -DLINUX
schar.c
gcc -c -D__KERNEL__ -I/usr/src/linux/include -DMODULE -Wall -O2 -DLINUX
procschar.c
/usr/src/linux/include/linux/mount.h: In function `mntput':
In file included from /usr/src/linux/include/linux/dcache.h:7,
from /usr/src/linux/include/linux/fs.h:19,
from procschar.c:25:
/usr/src/linux/include/linux/mount.h:46: warning: implicit declaration of
function `printk_Rsmp_1b7d4074'
procschar.c: At top level:
procschar.c:41: warning: `schar_mmap' defined but not used
I have the statement: #define __NO_VERSION__
in procschar.c, but not in schar.c.
The link command is:
ld -m elf_i386 -o scharmod.o schar.o procschar.o
At this point I get reams of output such as:
ld: warning: cannot find entry symbol _start; defaulting to 08048080
schar.o: In function `schar_timer_handler':
schar.o(.text+0x21): undefined reference to `jiffies_Rsmp_0da02d67'
schar.o(.text+0x40): undefined reference to `add_timer_Rsmp_a19eacf8'
schar.o(.text+0x5c): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x65): undefined reference to `__this_module'
schar.o(.text+0x6d): undefined reference to `__this_module'
schar.o(.text+0x81): undefined reference to `__this_module'
schar.o(.text+0xa2): undefined reference to `__wake_up_Rsmp_b173f14c'
schar.o(.text+0xb6): undefined reference to `__wake_up_Rsmp_b173f14c'
schar.o: In function `schar_ioctl':
schar.o(.text+0x262): undefined reference to `__get_user_4'
schar.o(.text+0x2a9): undefined reference to `__get_user_4'
schar.o(.text+0x2e9): undefined reference to `__get_user_4'
schar.o(.text+0x33f): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x34c): undefined reference to `printk_Rsmp_1b7d4074'
schar.o: In function `schar_read_proc':
schar.o(.text+0x390): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x3a1): undefined reference to `get_zeroed_page_Rsmp_6807e076'
schar.o(.text+0x3b8): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x3cb): undefined reference to
`__generic_copy_from_user_Rsmp_116166aa
schar.o(.text+0x3e6): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x3f5): undefined reference to `free_pages_Rsmp_234535e0'
schar.o(.text+0x41b): undefined reference to `sprintf_Rsmp_3c2c5af5'
schar.o(.text+0x435): undefined reference to `sprintf_Rsmp_3c2c5af5'
schar.o(.text+0x44f): undefined reference to `sprintf_Rsmp_3c2c5af5'
schar.o(.text+0x46c): undefined reference to `sprintf_Rsmp_3c2c5af5'
schar.o(.text+0x486): undefined reference to `sprintf_Rsmp_3c2c5af5'
schar.o(.text+0x49a): more undefined references to `sprintf_Rsmp_3c2c5af5'
follow
schar.o: In function `schar_read_proc':
schar.o(.text+0x52e): undefined reference to `proc_dostring_Rsmp_3954dab5'
schar.o: In function `schar_read':
schar.o(.text+0x563): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x59b): undefined reference to
`__generic_copy_to_user_Rsmp_d523fdd3'
schar.o(.text+0x5e9): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x5f6): undefined reference to
`interruptible_sleep_on_Rsmp_8c23e4cb'
schar.o(.text+0x612): undefined reference to `printk_Rsmp_1b7d4074'
schar.o(.text+0x639): undefined reference to
`__generic_copy_to_user_Rsmp_d523fdd3'
schar.o(.text+0x673): undefined reference to `printk_Rsmp_1b7d4074'
schar.o: In function `schar_write':
schar.o(.text+0x6b0): undefined reference to
`__generic_copy_from_user_Rsmp_116166aa
schar.o(.text+0x6db): undefined reference to `__wake_up_Rsmp_b173f14c'
schar.o(.text+0x6ef): undefined reference to `__wake_up_Rsmp_b173f14c'
schar.o(.text+0x709): undefined reference to `printk_Rsmp_1b7d4074'
schar.o: In function `schar_poll':
My guess is that I need to explicitly link with some kernel
objects? Can anyone point me in the right direction?
Thanks
Tom
-----Original Message-----
From: [email protected]
[mailto:[email protected]]
Sent: Wednesday, February 28, 2001 11:07 AM
To: [email protected]
Subject: drivers/block/rd.c under 2.2.16
I am attempting to get something figured out dealing with the ramdisk
under Linux 2.2.16. I am trying to figure out whether you can use the
ramdisk to act as a RAM filesystem doing normal file creations and
deletion. I noticed that within the code it makes comments about not
having to free stuff up. Does that mean you can't delete things off the
ramdisk filesystem? I have created a ramdisk, formatted ext2, and mounted
it. When I create stuff on there, and then I delete it, I notice that if
I do a df, the size doesn't go back down after I have deleted the file.
I am trying to figure out if that is how it was intended to happen, or
whether I have just done something not quite correctly and you can't
really use it as a RAM file system.
Thanks,
Matthew M. Copeland
I've recompiled my kernel to 2.4.2 (even tried 2.4.1) and I am having
problems with pppd. The error I am getting is pppd[1491]: read: bad file
descriptor (9). Under the kernel 2.2.22-16 (or whatever came default with
redhat 7.0) it work fine. I am using a default redhat 7.0 install.
I have tried compiling the ppp and options as modules and another time into
the kernel. I keep getting the same results. I have also downloaded and
installed the latest version of modutilities after getting the error. I
recompiled again and recieved the same error.
If for some reason this is not the right list, please tell me where I can go
to get help with this problem.
Thank you for any help,
Xavier
[email protected]
Well, I tried ld -r -o scharmod.o schar.o procschar.o
and it still seems to be trying to build an exectuable...the
output is the same as before...
Thanks
Tom
-----Original Message-----
From: Lee Ho [mailto:[email protected]]
Sent: Wednesday, February 28, 2001 12:00 PM
To: [email protected]
Cc: Collins, Tom
Subject: Re: Multiple file module build problems
It seems that linker tried to build executable file.
When building multiple module source into one module object file,
ld with '-r' option is used.
ld -r -o scharmod.o schar.o procschar.o
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Lee, Ho. Software Engineer, Embedded Linux Dep, LinuxOne
Mail : [email protected] (work), [email protected] (personal)
Homepage : http://flyduck.com, http://linuxkernel.to
Collins, Tom Wrote:
I am trying to build a multiple-file kernel module, and am
having some difficulty. It seems that the linker is trying
to build and executable.
The link command is:
ld -m elf_i386 -o scharmod.o schar.o procschar.o
It seems that linker tried to build executable file.
When building multiple module source into one module object file,
ld with '-r' option is used.
ld -r -o scharmod.o schar.o procschar.o
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Lee, Ho. Software Engineer, Embedded Linux Dep, LinuxOne
Mail : [email protected] (work), [email protected] (personal)
Homepage : http://flyduck.com, http://linuxkernel.to
Collins, Tom Wrote:
I am trying to build a multiple-file kernel module, and am
having some difficulty. It seems that the linker is trying
to build and executable.
The link command is:
ld -m elf_i386 -o scharmod.o schar.o procschar.o