user625070
user625070

Reputation:

Attaching a compilation flag to a Linux kernel build

What is the best practice for adding a compilation flag when building the Linux kernel? I'm interested to know this both generally because I encounter the same issue from time to time and specifically for enabling kenter, kdebug and kleave traces in http://lxr.free-electrons.com/source/security/keys/internal.h.

When you compile a module you can use CFLAGS_MODULE but that doesn't seem to inject into subtree builds when you compile the whole kernel.

Currently I just add a define directly to the source file, which is not a very lean solution.

Upvotes: 1

Views: 2727

Answers (1)

user625070
user625070

Reputation:

It was quite easy and actually I had used this previously but just had forgotten it. You can just use make CFLAGS_KERNEL="<flags>".

Upvotes: 2

Related Questions