[linux] kompilowanie własnych modułów w KNOPPIX'ie

0

chciałem skompilować najprostszy moduł, którego kod pochodzi z książki "linux device drivers" tyle że przy kompilwoaniu dostałem kupę błędów. platforma używana to Knoppix.

kod 'modułu' to:

#define MODULE
#include <linux/module.h>
int init_module(void){printk("<1>Hello,world \n");return 0;}
void cleanup_module(void){printk("<1>Goodbye cruel world \n");}

a błędy to:

In file included from /usr/include/linux/timex.h:58,
from /usr/include/linux/sched.h:11,
from /usr/include/linux/module.h:10,
from hello.c
/usr/include/linux/time.h error: syntax error before "time_t"
/usr/include/linux/time.h error: syntax error before '}' token
/usr/include/linux/time.h error: syntax error before "time_t"
/usr/include/linux/time.h error: field it_interval' has incomplete type /usr/include/linux/time.h:144: error: field it_value' has incomplete type
/usr/include/linux/time.h error: field it_interval' has incomplete type /usr/include/linux/time.h:149: error: field it_value' has incomplete type
In file included from /usr/include/linux/sched.h:11,
from /usr/include/linux/module.h:10,
from hello.c
/usr/include/linux/timex.h error: field `time' has incomplete type
In file included from /usr/include/linux/sched.h:12,
from /usr/include/linux/module.h:10,
from hello.c
/usr/include/linux/jiffies.h error: syntax error before "jiffies_64"
...

i dużo więcej takich linijek dalej.

0

Może coś więcej byś napisał? Jakie masz jądro itp.
Poza tym polecam przeczytać najnowszą wersję LDD (a dokładniej Linux Device Drivers 3, dotyczącej jąder z seri 2.6).

Powinieneś dodać też jeszcze następujące wiersze:
#include <linux/kernel.h>
#include <linux/init.h>

oraz na samym końcu informacje o module (makra MODULE_* oraz module_init() i module_exit()) - bez tego będziesz miał problemy z załadowaniem modułu, nawet jeśli uda ci się go skompilować. Więcej info w w/w pozycji.

Pozdrawiam,
Paweł S.

1 użytkowników online, w tym zalogowanych: 0, gości: 1