Samstag, 12. August 2017

Developing a kernel module on Archlinux with Eclipse

In this blog post I will try to write down everything on how to setup an environment for developing kernel drivers on Archlinux.

In my case I've wanted to use the current git version of the kernel to develop so I've downloaded linux-git from AUR:
$ git clone
and then build the kernel
$ nice -n19 makepkg

Now start Eclipse and create your project.

Go to Project -> Properties -> C/C++ General -> Preprocessor Include -> GNU C and delete all entries in CDT Managed Build Setting entries.

Select CDT User Settings Entries and then click Add...
Select Include Directory and File System Path
Select Contains system headers and select the <path to abs package>/pkg/linux-git-headers/usr/lib/modules/<linux version>/build/include/

Repeat the above steps for the <path to abs package>/pkg/linux-git-headers/usr/lib/modules/<linux version>/build/arch/x86/include/ directory

And one more time for <path to abs package>//pkg/linux-git-headers/usr/lib/modules/<linux version>/build/arch/x86/include/.

Now click Add... again and select Preprocessor Macro File and File System Path and add <path to abs package>/pkg/linux-git-headers/usr/lib/modules/<linux version>/build/include/linux/kconfig.h

 Now go to Paths and Symbols, select #Symbols and add a symbol named __KERNEL__ and give it a value of 1.

Keine Kommentare:

Kommentar veröffentlichen