Hi, I am trying to load my first linux module. As per this link --- http://www.faqs.org/docs/kernel/hello2.html I am getting compilation error please suggest how to resolve it. My linux version is 2.6.31 & also it is UBANTU 9.10 MAKEFILE : WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes INCLUDE := -isystem /lib/modules/`uname -r`/build/include CFLAGS := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE} CC := gcc-3.0 OBJS := ${patsubst %.c, %.o, ${wildcard *.c}} all: ${OBJS} .PHONY: clean clean: rm -rf *.o CODE: /* hello-2.c - Demonstrating the module_init() and module_exit() macros. This is the * preferred over using init_module() and cleanup_module(). */ #include <linux/module.h> // Needed by all modules #include <linux/kernel.h> // Needed for KERN_ALERT #include <linux/init.h> // Needed for the macros static int hello_2_init(void) { printk(KERN_ALERT "Hello, world 2\n"); return 0; } static void hello_2_exit(void) { printk(KERN_ALERT "Goodbye, world 2\n"); } module_init(hello_2_init); module_exit(hello_2_exit); Compilation Error : make all gcc-3.0 -O2 -DMODULE -D__KERNEL__ -W -Wall -Wstrict-prototypes -Wmissing-prototypes -isystem /lib/modules/`uname -r`/build/include -c -o hello-2.o hello-2.c /bin/sh: gcc-3.0: not found make: *** [hello-2.o] Error 127
Loading first module to linux kernel -- Compilation error
Hi The error is "/bin/sh: gcc-3.0: not found" .. that means there is nothing called gcc-3.0 available in your path. Try using gcc instead of gcc-3.0 , if you are building the modules for your computer or if you are trying to build for the ARM , then give the name of the cross-compiler. Regards VECTOR Institute All India education excellence award winner http://www.vectorindia.org