July 01, 2005

最简单编译2.6 module的办法

make -C /usr/src/linux-2.6.12 M=`pwd` modules

Makefile:
obj-m := helloworld.o

helloworld.c:

#include 《linux/init.h》
#include 《linux/module.h》
MODULE_LICENSE( "Dual BSD/GPL" );

static int hello_init( void )
{
printk( KERN_ALERT "Hello, world!\n" ) ;
return 0 ;
}

static void hello_exit( void )
{
printk( KERN_ALERT "Goodbye, cruel world\n" ) ;
}

module_init( hello_init ) ;
module_exit( hello_exit ) ;

Posted by hufey at July 1, 2005 06:24 PM | TrackBack
Comments
Post a comment









Remember personal info?