Answer the question
In order to leave comments, you need to log in
Why does the simplest linux kernel module break with an Invalid parameters error when loading insmod?
I'm trying to build and load the simplest hello world module for the linux kernel into the kernel. Compilation succeeds, but here insmod constantly breaks down with an error message:
$ sudo insmod hello.ko
insmod: ERROR: could not insert module hello.ko: Invalid parameters
$ uname -r
3.16.0-4-amd64
linux-headers-3.16.0-4-all
linux-headers-3.16.0-4-all-amd64
linux-headers-3.16.0-4-amd64
linux-headers-3.16.0-4-common
linux-headers- amd64
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
int init_module(void)
{
printk(KERN_INFO "Hello world 1.\n");
return 0;
}
void cleanup_module(void)
{
printk(KERN_INFO "Goodbye world 1.\n");
}
MODULE_LICENSE("GPL");
obj-m += hello.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
make -C /lib/modules/3.16.0-4-amd64/build M=/home/user/c.driver/driver-1 modules
make[1]: Entering directory '/usr/src/linux-headers-3.16 .0-4-amd64'
Makefile:10: *** mixed implicit and normal rules: deprecated syntax
make[1]: Entering directory `/usr/src/linux-headers-3.16.0-4-amd64'
CC [M ] /home/user/c.driver/driver-1/hello.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/user/c.driver/driver-1/hello.mod.o
LD [M] / home/user/c.driver/driver-1/hello.ko
make[1]: Leaving directory '/usr/src/linux-headers-3.16.0-4-amd64'
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question