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 pkg-config libncurses5-dev qt4-dev-tools

Debian (ab 7)

cd
wget -O - https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.13.2.tar.xz | tar xJ
sudo ln -s ~/linux-3.13.2 /usr/src/linux
cd /usr/src/linux
make help
make localmodconfig

oder

make localyesconfig

oder

make olddefconfig
grep -c '^processor' /proc/cpuinfo
make -j 8 all
sudo make modules_install install

ausgewählte Optionen für Kernel .config

  • CONFIG_KERNEL_XZ=y

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.1506926366.txt.gz · Zuletzt geändert: 2017/10/02 06:39 von ingo_wichmann