Skip to content

Instantly share code, notes, and snippets.

@flaneur2020
Created December 9, 2012 03:22
Show Gist options
  • Save flaneur2020/4243198 to your computer and use it in GitHub Desktop.
Save flaneur2020/4243198 to your computer and use it in GitHub Desktop.
a Makefile sample for kernel module
MOD = sample
KPATH :=/lib/modules/$(shell uname -r)/build
PWD :=$(shell pwd)
obj-m = $(MOD).o
all:
$(MAKE) -C $(KPATH) M=$(PWD) modules
clean:
$(MAKE) -C $(KPATH) M=$(PWD) clean
insmod: all
sudo rmmod $(MOD).ko; true
sudo insmod $(MOD).ko
log:
tail -f /var/log/messages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment