# Compiling single kernel module — Liran Tal

How to compile a Linux kernel module without needing to resort to a full Linux kernel compilation process

Canonical: https://lirantal.com/blog/2007-02-04

![Cover artwork for Compiling single kernel module](/_astro/photo-1468956398224-6d6f66e22c35.BePqp3CW_Zj88Tk.jpg)

We sometimes find ourselves in the need to compile just one module, and not the entire set of modules under the tree.

The Makefile that is present in the dir of the module you wish to compile should read `obj-m := module.o` Run `make -C /usr/src/linux-headers-2.6.XX-YY-ZZZ/ SUBDIRS=$PWD modules`

Compiliation should be successful and you should see the binary objects in the current dir now.

Reference: [http://lwn.net/Articles/21835/](http://lwn.net/Articles/21835/)

## More writing

[All writing](/blog)

*   Nov 14, 2026

    ### [Every Security Weakness Matters When Vulnerability Chaining is King](/blog/every-security-weakness-matters-vulnerability-chaining)

*   Sep 5, 2026

    ### [Self-Hosting Hermes Agent with Matrix E2EE on Proxmox](/blog/self-host-hermes-agent-matrix-e2ee-proxmox)

*   Aug 2, 2026

    ### [The Practical Second Brain: Building an LLM-Operated Markdown Knowledge Graph](/blog/practical-second-brain-llm-markdown-knowledge-graph)


* * *

Liran Tal is the author of the book [Node.js Secure Coding: Defending Against Command Injection Vulnerabilities](https://www.nodejs-security.com/)

[Start Building Secure Node.js Applications](https://www.nodejs-security.com/)

 [![](/_astro/nodejs-secure-coding-book-3d-style.DiTWpzFs_Z3c7s1.png)](https://www.nodejs-security.com/)
