Skip to content
Advertisement

Ubuntu compiling kernel module first time

I’m trying to compile a simple kernel module for the first time:

JavaScript

I’ve used obj-m += hello-1.o (that’s the name of the module) but i’m getting an error:

obj−m: command not found

Why is this happening? I tried looking online for a solution, but nothing I found helped..

EDIT: After modifying based on @Mathieu answer , I get the following error :

JavaScript

Advertisement

Answer

The line obj-m += hello-1.o must be put in a file named Makefile

So it will looks like:

JavaScript

To launch the build process, just execute make from your command line.

More resource: https://qnaplus.com/how-to-compile-linux-kernel-module/

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement