[SOLVED]Dodawanie modułu do jądra linuksa
: 30 mar 2013, 18:59
Witam, mam takie pytanie. Otóż stworzyłem plik o rozszerzeniu .c, który po kompilacji miałby mi dać możliwy do dodania do jądra moduł linuksa (o rozszerzeniu .o jeżeli się nie mylę). Próbowałem poleceń ze strony http://home.agh.edu.pl/~kozlak/PS2010/t ... dulow.html jednak niestety nie powodzi mi się załadowanie tym sposobem. Również próby kompilacji kompilatorem gcc lecz dostałem błędy tego typu:
Kod modułu to:
Proszę o pomoc lub ewentualne wsparcie w formie literatury lub strony gdzie można na ten temat doczytać.
Kod: Zaznacz cały
trivial.c:1:9: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before â<â token
trivial.c:13:1: warning: data definition has no type or storage class [enabled by default]
trivial.c:13:1: warning: parameter names (without types) in function declaration [enabled by default]
trivial.c:14:1: warning: data definition has no type or storage class [enabled by default]
trivial.c:14:1: warning: parameter names (without types) in function declaration [enabled by default]
Kod: Zaznacz cały
include <linux/module.h>
MODULE_LICENSE("GPL")
static int trivial_init(void) {
printk("<1>Hello world! I'ma a trivial module!\n");
return;
}
static void trivial_exit(void) {
printk("<1>Oh no, why are you doing this to me? Argh!\n");
}
module_init(trivial_init);
module_exit(trivial_exit);