Makefile
1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Build loadable kernel module outside of kernel tree
TARGET := bbrdb
#WARN := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
WARN :=
INCLUDE := -isystem /lib/modules/`uname -r`/build/include
CFLAGS := -O2 -DMODULE -DMODVERSIONS -D__KERNEL__ $(WARN) $(INCLUDE)
MODMAP := /lib/modules/`uname -r`/modules.usbmap
$(TARGET).o: $(TARGET).c
.PHONY: clean
default: $(TARGET).o
install: default
cp -f $(TARGET).o /lib/modules/`uname -r`/kernel/drivers/usb
@if grep bbrdb $(MODMAP) > /dev/null; then \
echo bbrdb spec already in modules.usbmap; \
else \
echo Adding bbrdb spec to $(MODMAP); \
cat modules.usbmap.append >> $(MODMAP); \
fi
/sbin/depmod -a
@if [ -c /dev/usb/bbrdb0 ]; then \
echo /dev entries already exist; \
else \
echo Creating /dev entries; \
mknod /dev/usb/bbrdb0 c 180 160; \
mknod /dev/usb/bbrdb1 c 180 161; \
mknod /dev/usb/bbrdb2 c 180 162; \
mknod /dev/usb/bbrdb3 c 180 163; \
mknod /dev/usb/bbrdb4 c 180 164; \
mknod /dev/usb/bbrdb5 c 180 165; \
mknod /dev/usb/bbrdb6 c 180 166; \
mknod /dev/usb/bbrdb7 c 180 167; \
chmod 666 /dev/usb/bbrdb?; \
fi
-/sbin/rmmod bbrdb
/sbin/insmod bbrdb
install_devkit:
test "" != "$(DEVKIT)"
mkdir -p $(DEVKIT)/modules
cp $(TARGET).c $(DEVKIT)/modules
cp Makefile $(DEVKIT)/modules
cp modules.usbmap.append $(DEVKIT)/modules
clean clobber:
-rm -f $(TARGET).o