lkml.org 
[lkml]   [1999]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectFirst steps in module hacking...
Hi,

I'm very interested in a little bit kernel hacking, so I bought
myself the book 'Linux device drivers' (O'Reilly) and started
to code a simple 'Hello world' module

Part 1:
-------
#define __NO_VERSION__

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/version.h>

char kernel_version[] = UTS_RELEASE;


int init_module(void)
{
printk("<1>Here we are :-)\n");
return 0;
}

Part 2:
-------
#define __NO_VERSION__

#include <linux/kernel.h>
#include <linux/module.h>


void cleanup_module(void)
{
printk("<1>Now we're gone :-(");
}

Compiling works just fine,

root@weyoun:/home/twesthei/C/kernel > make
gcc -D__KERNEL__ -I/usr/src/linux/include -O2 -Wall -Wstrict-prototypes
-fomit-frame-pointer -pipe -fno-strength-reduce -m486 -malign-loops=2
-malign-jumps=2 -malign-functions=2 -DCPU=586 -DMODULE -DEXPORT_SYMTAB
-c skull_init.c -o skull_init.o
gcc -D__KERNEL__ -I/usr/src/linux/include -O2 -Wall -Wstrict-prototypes
-fomit-frame-pointer -pipe -fno-strength-reduce -m486 -malign-loops=2
-malign-jumps=2 -malign-functions=2 -DCPU=586 -DMODULE -DEXPORT_SYMTAB
-c skull_clean.c -o skull_clean.o
ld -r skull_init.o skull_clean.o -o skull.o

but I can't insmod that piece of code because of

root@weyoun:/home/twesthei/C/kernel > insmod skull
./skull.o: unresolved symbol printk

What??? Any help appreciated ;-)


cu
Thorsten

===========================================================
Thorsten Westheider / / (_)__ __ ____ __
Im Schlingen 15 / /__/ / _ \/ // /\ \/ /
32120 Hiddenhausen -- Germany /____/_/_//_/\_,_/ /_/\_\
2.2.1
http://www.physik.uni-bielefeld.de/~twesthei
mailto:twesthei@phya1.physik.uni-bielefeld.de
===========================================================

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:50    [W:0.024 / U:1.884 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site