[ daxx @ 01.04.2007. 15:43 ] @
Ćao... Pokušavam da kompajliram ovaj jednostavan modul (kod je iz knjige Linux Device Drivers): Code: #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); Međutim, gcc se nešto ljuti: Citat: root@1[Desktop]# gcc hello.c In file included from /usr/include/linux/sched.h:16, from /usr/include/linux/module.h:9, from hello.c:2: /usr/include/linux/signal.h:2:2: warning: #warning "You should include <signal.h>. This time I will do it for you." In file included from /usr/include/linux/resource.h:4, from /usr/include/linux/sched.h:79, from /usr/include/linux/module.h:9, from hello.c:2: /usr/include/linux/time.h:9: error: redefinition of 'struct timespec' /usr/include/linux/time.h:15: error: redefinition of 'struct timeval' /usr/include/linux/time.h:20: error: redefinition of 'struct timezone' /usr/include/linux/time.h:47: error: redefinition of 'struct itimerval' In file included from hello.c:2: /usr/include/linux/module.h:41: error: field 'attr' has incomplete type /usr/include/linux/module.h:49: error: field 'kobj' has incomplete type hello.c: In function 'hello_init': hello.c:7: error: 'KERN_ALERT' undeclared (first use in this function) hello.c:7: error: (Each undeclared identifier is reported only once hello.c:7: error: for each function it appears in.) hello.c:7: error: syntax error before string constant hello.c: In function 'hello_exit': hello.c:12: error: 'KERN_ALERT' undeclared (first use in this function) hello.c:12: error: syntax error before string constant Šta nije u redu? Pretpostavljam da nisam lepo postavio hedere ili nešto slično, ali prilično sam nov u Linux svetu i nisam baš suviše vešt... Inače, koristim SimplzMEPIS 6.0, a verzija kernela je 2.6.15-26-386. Hvala unapred. Dare EDIT: Čini mi se da u knjizi piše da sami hederi nisu dovoljni, već da mi treba ispravno konfigurisan kernel tree. O čem' se radi? [Ovu poruku je menjao daxx dana 01.04.2007. u 18:54 GMT+1] |