Prev: DIAM JUGA TETAP DAPAT DUIT
Next: gdm configuration
From: John Rushford on 22 Nov 2009 16:13 Greetings, I'm trying to learn something about loadable device drivers in FreeBSD. I've built the following tutorial example on my AMD64 laptop running FreeBSD 8.0-RC3 and a GENERIC kernel. When I try to load this example, I get the following error: # kldload ./hello_fsm.ko kldload: can't load hello_fsm.ko: Exec format error And in /var/log/messages: Nov 22 14:03:53 jjr-laptop kernel: KLD hello_fsm.ko: depends on kernel - not available or version mismatch Nov 22 14:03:53 jjr-laptop kernel: linker_load_file: Unsupported file type The tutorial built fine, here is the source and makefile. What have I missed? Makefile: # Declare Name of kernel module KMOD = hello_fsm # Enumerate Source files for kernel module SRCS = hello_fsm.c # Include kernel module makefile ..include <bsd.kmod.mk> hello_fsm.c: #include <sys/param.h> #include <sys/module.h> #include <sys/kernel.h> #include <sys/systm.h> /* The function called at load/unload. */ static int event_handler(struct module *module, int event, void *arg) { int e = 0; /* Error, 0 for normal return status */ switch (event) { case MOD_LOAD: uprintf("Hello Free Software Magazine Readers! \n"); break; case MOD_UNLOAD: uprintf("Bye Bye FSM reader, be sure to check http://freesoftwaremagazine.com !\n"); break; default: e = EOPNOTSUPP; /* Error, Operation Not Supported */ break; } return(e); } /* The second argument of DECLARE_MODULE. */ static moduledata_t hello_conf = { "hello_fsm", /* module name */ event_handler, /* event handler */ NULL /* extra data */ }; DECLARE_MODULE(hello_fsm, hello_conf, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
From: Patrick Lamaizière on 23 Nov 2009 07:38 John Rushford : > And in /var/log/messages: > Nov 22 14:03:53 jjr-laptop kernel: KLD hello_fsm.ko: depends on kernel > - not available or version mismatch > Nov 22 14:03:53 jjr-laptop kernel: linker_load_file: Unsupported file > type > > The tutorial built fine, here is the source and makefile. What have I > missed? That works fine here. I think you've built the module with sources not in sync with your kernel.
From: John Rushford on 23 Nov 2009 11:37 On Nov 23, 5:38 am, Patrick Lamaizière <adre...(a)est.invalid> wrote: > John Rushford : > > > And in /var/log/messages: > > Nov 22 14:03:53 jjr-laptop kernel: KLD hello_fsm.ko: depends on kernel > > - not available or version mismatch > > Nov 22 14:03:53 jjr-laptop kernel: linker_load_file: Unsupported file > > type > > > The tutorial built fine, here is the source and makefile. What have I > > missed?t > > That works fine here. I think you've built the module with sources not > in sync with your kernel. Patrick, you were correct. Thanks very much John
|
Pages: 1 Prev: DIAM JUGA TETAP DAPAT DUIT Next: gdm configuration |