Linuxhotel Wiki

Wie ging das nochmal?

Benutzer-Werkzeuge

Webseiten-Werkzeuge


lpi2:kernel_kompilieren

Dies ist eine alte Version des Dokuments!


Kernel kompilieren

Pakete: build-essential

Debian 7

cd
wget -O - https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.13.2.tar.xz | tar xJ
ln -s ~/linux-3.13.2 /usr/src/linux
grep -c '^processor' /proc/cpuinfo
make help
make localmodconfig

oder

make localyesconfig
make make all
sudo make -j 8 modules_install install

Doku

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.1392111459.txt.gz · Zuletzt geändert: 2014/02/11 09:37 von ingo_wichmann