http://tldp.org/LDP/lkmpg/2.6/html/lkmpg.html#AEN128. However, the HelloWorld module is successfully built, but insmod failed.
> insmod hello-1.ko
insmod: error inserting 'hello-1.ko: -1 Invalid module format
After googling some time, Max figured out his Debian may have installed incorrect kernel header.
Check the running kernel by
>uname -r
2.6.26-2-686
First remove incorrect kernel header package by 'apt-get remove'
Install the following three packages:
- linux-headers-2.6.26-2-common
- linux-kbuild-2.6.26
- linux-headers-2.6.26-2-686
>dpkg-query --show | grep -i linux-
linux-headers-2.6.26-2-686 2.6.26-21
linux-headers-2.6.26-2-common 2.6.26-21
linux-kbuild-2.6.26 2.6.26-3
Now the hello-1.c can be build and loaded.
Reference:
No comments:
Post a Comment