# 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

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)

*   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)

*   Aug 1, 2026

    ### [Building a Second Brain with LLMs and AI Agents](/blog/building-second-brain-llms-ai-agents)


* * *

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/)
