Skip to contentSkip to conversation

Simple module for 2.6 request?

DISCUSSION [email protected] 3 participants 3 messages Nov 4, 2006

lore
Share & tools
lore
#0 lore raw

Hello,
it is not so easy to find online an *working* example of how to by hand build a module.

gcc -o foo.c -ko foo.ko -DMODULE -D__KERNEL__
-I/usr/src/kernel-headers-directory/include/

with module license define macro

almost worked, but it misses thoes extra symbols created in post-compilation.

How to add them by hand (not using all the big Makefiles normally included in kernel tree)?

Like
some-command foo.ko foo.c
insmod foo.ko
done

Signature · 4 lines
LimCore    C++ Software Architect / Team Lead
---> oo    Linux programs
limcore
software
#1 lore raw
Quoted 3 lines

Hello,
it is not so easy to find online an *working* example of how to by hand build a module.

Please find information on how to build (external) modules in "Documentation/kbuild/modules.txt" directory of your linux source tree. More (implementation) info can be found in the top Makefile.

Quoted 8 lines

gcc -o foo.c -ko foo.ko -DMODULE -D__KERNEL__
-I/usr/src/kernel-headers-directory/include/

with module license define macro

almost worked, but it misses thoes extra symbols created in post-compilation.

Quoted 7 lines

How to add them by hand (not using all the big Makefiles normally included in kernel tree)?

Like
some-command foo.ko foo.c
insmod foo.ko
done

____

#2 lore raw
In reply to [email protected]
Quoted 2 lines

how to by hand build a module.

Compilation has too many flags and too many steps to be reasonably done by hand. Unlike *cough* BSD or Solaris, the Linux kernel makefile system is designed to reasonably support external modules using all the necessary parameters the kernel you are compiling for needs. You know, I always get a shudder when I have to think of Solaris not having MODVERSIONS or even VERMAGIC -- it is dangerous because it allows you to build stuff that can fubar more easily.

Quoted 2 lines

gcc -o foo.c -ko foo.ko -DMODULE -D__KERNEL__
-I/usr/src/kernel-headers-directory/include/

gcc: unrecognized option '-ko'

Quoted 2 lines

How to add them by hand (not using all the big Makefiles normally included in kernel tree)?

Who said they are big? Look at
http://jengelh.hopto.org/f/oops_ko.tar.bz2 for a _really_ simple module.

	-`J'