Skip to content
This repository was archived by the owner on May 16, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions tools/linux/Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
obj-m += module.o
KDIR ?= /
KVER ?= $(shell uname -r)
KDIR ?= /lib/modules/$(KVER)/build
PREFIX ?= /

# Example
# Make module for currently running kernel:
# make
#
# Make module for other kernel installed locally.
# make KVER=3.10.0-862.14.4.el7.x86_64
#
# Make module for kernel which is not installed, but are installed kernel headers from kernel-devel
# make KVER=3.10.0-862.14.4.el7.x86_64 KDIR=/usr/src/kernels/3.10.0-862.14.4.el7.x86_64
#
# Make module for custom kernel source
# make KVER=6.1.0-orion KDIR=/home/example/src/kernel-6.1.0
#

-include version.mk

all: dwarf

dwarf: module.c
$(MAKE) -C $(KDIR)/lib/modules/$(KVER)/build CONFIG_DEBUG_INFO=y M="$(PWD)" modules
$(MAKE) V=1 -C $(KDIR) CONFIG_DEBUG_INFO=y M="$(PWD)" modules
dwarfdump -di module.ko > module.dwarf
$(MAKE) -C $(KDIR)/lib/modules/$(KVER)/build M="$(PWD)" clean

clean:
$(MAKE) -C $(KDIR)/lib/modules/$(KVER)/build M="$(PWD)" clean
Expand Down