lpi2:kernel_kompilieren
Dies ist eine alte Version des Dokuments!
Eigenes Kernel-Modul schreiben
Keine Angst, nur ein ganz einfaches „Hello World“ Beispiel …
Debian
cd aptitude install linux-source-xxx tar xjf /usr/src/linux-source-xxx mkdir hello vi hello.c
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
static int hello_init(void)
{
printk(KERN_ALERT "Hello World!\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Good bye world!\n");
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("me");
vi Makefile
obj-m := hello.o
make -C ../linux-source-2.6.18/ SUBDIRS=$PWD modules
lpi2/kernel_kompilieren.1391974469.txt.gz · Zuletzt geändert: 2014/02/09 19:34 von ingo_wichmann
