aboutsummaryrefslogtreecommitdiff
path: root/linux/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'linux/makefile')
-rw-r--r--linux/makefile28
1 files changed, 28 insertions, 0 deletions
diff --git a/linux/makefile b/linux/makefile
new file mode 100644
index 0000000..f293cc1
--- /dev/null
+++ b/linux/makefile
@@ -0,0 +1,28 @@
+MODDIR := /lib/modules/$(shell uname -r)
+
+INCLUDE := -isystem $(MODDIR)/build/include -isystem ../inc
+CFLAGS := -O2 -D__KERNEL__ -DMODULE -Wall $(INCLUDE)
+ifneq (,$(wildcard $(MODDIR)/build/include/linux/modversions.h))
+CFLAGS += -DMODVERSIONS
+endif
+
+CC ?= gcc
+
+chudisk.o: chudisk.c lnxabs.h ch375lnx.h
+
+.PHONY: clean install uninstall test
+clean:
+ rm -rf *.o
+
+install: chudisk.o
+ install -m0644 chudisk.o $(MODDIR)/block
+ depmod -A
+
+uninstall:
+ rm -f $(MODDIR)/block/chudisk.o
+
+test: chudisk.o
+ if lsmod | grep chudisk; then rmmod chudisk; fi
+ dmesg -n 8
+ dmesg -c > /dev/null
+ insmod chudisk.o force=1