hello.c內容


#include <linux/module.h>
#include <linux/init.h>

MODULE_LICENSE("Dual BSD/GPL");

static int __init  hello_init(void)
{
    printk("Hello world!\n");
    return 0;
}

static void __exit hello_exit(void)
{
    printk("Goodbye, hello world\n");
}

module_init(hello_init);
module_exit(hello_exit);

MakeFile內容


obj-m += hello.o

KERNEL= ~/rpi/modules/lib/modules/`uname -r`/build

all:
    make -C $(KERNEL) M=$(shell pwd) modules
clean:
    make -C $(KERNEL) M=$(shell pwd) clean

results matching ""

    No results matching ""