我在为raspberry pi编译内核模块时遇到了麻烦.我想使用raspberry pi本身编译一个"hello world"内核模块.
我正在使用raspbian wheezy 3.6.11+.
我尝试按照http://elinux.org/RPi_Kernel_Compilation上的说明进行操作.
这是我正在使用的Makefile:
obj-m += hello-1.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
Run Code Online (Sandbox Code Playgroud)
这是hello-1.c的源代码:
/*
* hello-1.c - The simplest kernel module.
*/
#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");
/*
* A non 0 return means init_module failed; module can't be loaded.
*/
return 0;
}
void …Run Code Online (Sandbox Code Playgroud)