Kernel module error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I've a problem insmoding the hello-? Modules in the "Linux kernel
programming guide" by Peter Jay,

On CentOS(2.6.9-34), I compiled the code successfully, but I had the
error "No module found in object"

On Knoppix (Linux Knoppix 2.6.12 #2 SMP Tue Aug 9 23:20:52 CEST 2005
i686 GNU/Linux), 
I also compiled the code successfully, I got the error "insmod: error
inserting './hello-4.o': -1 Invalid module format"

These are the files I use

################################################################

/* hello 4.c   Demonstrates module documentation. */ 
#include <linux/module.h> 
#include <linux/kernel.h> 
#include <linux/init.h> 

int init_hello_3(void); 
void cleanup_hello_3(void); 

static int init_hello_4(void) { printk(KERN_ALERT "Hello, world 4\n");
return 0; } 
static void cleanup_hello_4(void) { printk(KERN_ALERT "Goodbye, world
4\n"); } 

module_init(init_hello_4); 
module_exit(cleanup_hello_4); 

################################################################

TARGET  := hello-4
WARN    := -W  -Wall  -Wstrict-prototypes  -Wmissing-prototypes
INCLUDE := -isystem /lib/modules/`uname -r`/build/include -isystem
/KNOPPIX/usr/src/linux-2.6.12/include/asm-i386/mach-default
CFLAGS  := -O2  -DMODULE  -D__KERNEL__ ${WARN} ${INCLUDE}
CC      := gcc

${TARGET}.o:	${TARGET}.c

.PHONY:	clean 

clean: 
	rm -rf ${TARGET}.o

################################################################

I was able to compile and insmod the above module on Knoppix (kernel
version is 2.4.21)!

Please advise.

Regards,
Ali Yakout


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux