summaryrefslogtreecommitdiff
blob: d01479c286bcb3399d5a96db8c46d5d89cd4e0d7 (plain)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
	- get rid of warning when linux/device.h doesnt exist
	- touch up the Makefile to let the ebuild handle the module details
	- fix support with io remap stuff in newer kernels
	- dont include headers that dont exist in 2.4.x kernels
	- use module_param() for 2.6.x and MODULE_PARM() for all others
	- dont declare all_devices as static since it is exported

--- svgalib/kernel/svgalib_helper/Makefile
+++ svgalib/kernel/svgalib_helper/Makefile
@@ -25,7 +25,7 @@
 endif
 
 
-CLASS_SIMPLE := $(shell grep class_simple_create $(KDIR)/include/linux/device.h)
+CLASS_SIMPLE := $(shell grep class_simple_create $(KDIR)/include/linux/device.h 2>/dev/null)
 
 ifneq ($(CLASS_SIMPLE),)
   CLASS_CFLAGS = -DCLASS_SIMPLE=1
--- svgalib/kernel/svgalib_helper/Makefile.alt
+++ svgalib/kernel/svgalib_helper/Makefile.alt
@@ -37,7 +37,7 @@
 CFLAGS += -DSVGALIB_HELPER_MAJOR=$(SVGALIB_HELPER_MAJOR)
 
 ifeq (1,$(findstring 1,$(MODVER)))
-	CFLAGS += -DMODVERSIONS -include $(INCLUDEDIR)/linux/modversions.h
+	CFLAGS += -DMODVERSIONS -DCONFIG_MODVERSIONS=1
 endif
 
 TARGET = svgalib_helper
@@ -50,7 +50,8 @@
 	endif
 endif
 
-all: .depend $(OBJS)
+modules: $(OBJS)
+all: .depend modules
 
 $(TARGET).o: $(SRC:.c=.o)
 	$(LD) -r $^ -o $@
@@ -61,8 +62,8 @@
 install: device modules_install
 
 modules_install: $(OBJS)
-	mkdir -p /lib/modules/$(VER)/kernel/misc 
-	install -m 0644 -c $(OBJS) /lib/modules/$(VER)/kernel/misc
+	mkdir -p $(TOPDIR)/lib/modules/$(VER)/kernel/misc
+	install -m 0644 -c $(OBJS) $(TOPDIR)/lib/modules/$(VER)/kernel/misc
 
 device:
 	rm -f /dev/svgalib_helper* /dev/svga_helper* /dev/svga /dev/svga?
--- svgalib/kernel/svgalib_helper/kernel26compat.h
+++ svgalib/kernel/svgalib_helper/kernel26compat.h
@@ -10,7 +10,7 @@
 # define PCI_GET_CLASS pci_find_class
 # define PCI_GET_DEVICE pci_find_device
 
-# if defined (PG_chainlock)
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,3)
 #  define my_io_remap_page_range(vma, start, ofs, len, prot) \
 		io_remap_page_range(vma,start,ofs,len,prot)
 # else
--- svgalib/kernel/svgalib_helper/main.c
+++ svgalib/kernel/svgalib_helper/main.c
@@ -19,13 +19,18 @@
 #include <linux/pci.h>
 #include <linux/devfs_fs_kernel.h>
 #include <linux/mm.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 #include <linux/thread_info.h>
+#endif
 #include <linux/smp.h>
 #include <linux/smp_lock.h>
 
 #include <linux/sched.h>
 #include <linux/wait.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
 #include <linux/syscalls.h>
+#endif
 
 #define __KERNEL_SYSCALLS__
 #include <linux/unistd.h>
@@ -55,7 +55,7 @@
 #include "displaystart.h"
 
 int debug=0;
-static int all_devices=0;
+int all_devices=0;
 int num_devices=0;
 
 static char *sdev_id="svgalib_helper";
@@ -770,10 +770,15 @@
 
 }
 
+#ifdef KERNEL_2_6
+module_param(debug, int, 0);
+module_param(all_devices, int, 0);
+#else
 MODULE_PARM(debug, "i");
-MODULE_PARM_DESC(debug, "Debug output level.");
-
 MODULE_PARM(all_devices, "i");
+#endif
+
+MODULE_PARM_DESC(debug, "Debug output level.");
 MODULE_PARM_DESC(all_devices, "Give access to all PCI devices, regardless of class.");