]>
Commit | Line | Data |
---|---|---|
df5e82b3 MT |
1 | ############################################################################### |
2 | # This file is part of the IPCop Firewall. # | |
3 | # # | |
4 | # IPCop is free software; you can redistribute it and/or modify # | |
5 | # it under the terms of the GNU General Public License as published by # | |
6 | # the Free Software Foundation; either version 2 of the License, or # | |
7 | # (at your option) any later version. # | |
8 | # # | |
9 | # IPCop is distributed in the hope that it will be useful, # | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
12 | # GNU General Public License for more details. # | |
13 | # # | |
14 | # You should have received a copy of the GNU General Public License # | |
15 | # along with IPCop; if not, write to the Free Software # | |
16 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # | |
17 | # # | |
18 | # Makefiles are based on LFSMake, which is # | |
19 | # Copyright (C) 2002 Rod Roard <rod@sunsetsystems.com> # | |
20 | # # | |
21 | # Modifications by: # | |
22 | # ??-12-2003 Mark Wormgoor < mark@wormgoor.com> # | |
23 | # - Modified Makefile for IPCop build # | |
24 | # # | |
25 | # $Id: linux,v 1.42.2.57 2005/07/28 07:01:27 gespinasse Exp $ | |
26 | # # | |
27 | ############################################################################### | |
28 | ||
29 | ############################################################################### | |
30 | # Definitions | |
31 | ############################################################################### | |
32 | ||
33 | include Config | |
34 | ||
35 | VER = 2.4.31 | |
36 | ||
37 | THISAPP = linux-$(VER) | |
38 | DL_FILE = $(THISAPP).tar.gz | |
39 | DL_FROM = $(URL_KERNEL)/linux/kernel/v2.4 | |
40 | DIR_APP = $(DIR_SRC)/$(THISAPP) | |
41 | CFLAGS = | |
42 | CXXFLAGS = | |
43 | ||
44 | # Normal build or /tools build. | |
45 | # | |
46 | ifeq "$(ROOT)" "" | |
47 | ifeq "$(LFS_PASS)" "ipcop" | |
ac1cfefa | 48 | ifeq "$(SMP)" "" |
df5e82b3 MT |
49 | TARGET = $(DIR_INFO)/$(THISAPP)-ipcop |
50 | endif | |
51 | ifeq "$(SMP)" "1" | |
52 | TARGET = $(DIR_INFO)/$(THISAPP)-ipcop-smp | |
53 | endif | |
54 | ifeq "$(SMP)" "installer" | |
55 | TARGET = $(DIR_INFO)/$(THISAPP)-ipcop-installer | |
56 | endif | |
57 | else | |
58 | TARGET = $(DIR_INFO)/$(THISAPP) | |
59 | endif | |
60 | else | |
61 | TARGET = $(DIR_INFO)/$(THISAPP)-tools | |
62 | endif | |
63 | ||
64 | ############################################################################### | |
65 | # Top-level Rules | |
66 | ############################################################################### | |
67 | objects =$(DL_FILE) \ | |
68 | openswan-1.0.10rc2.tar.gz \ | |
69 | iptables-1.3.5.tar.bz2 \ | |
70 | patch-o-matic-ng-20060206.tar.bz2 \ | |
71 | kbc_option_2420.patch \ | |
72 | net4801.kernel.patch_2.4.31 \ | |
73 | netfilter-layer7-v2.1.tar.gz | |
74 | ||
75 | $(DL_FILE) = $(DL_FROM)/$(DL_FILE) | |
ac1cfefa | 76 | openswan-1.0.10rc2.tar.gz = http://www.openswan.org/download/openswan-1.0.10rc2.tar.gz |
df5e82b3 MT |
77 | patch-o-matic-ng-20060206.tar.bz2 = ftp://ftp.netfilter.org/pub/patch-o-matic-ng/snapshot/patch-o-matic-ng-20060206.tar.bz2 |
78 | iptables-1.3.5.tar.bz2 = http://www.netfilter.org/files/iptables-1.3.5.tar.bz2 | |
ac1cfefa MT |
79 | kbc_option_2420.patch = http://developer.osdl.org/rddunlap/patches/kbc_option_2420.patch |
80 | net4801.kernel.patch_2.4.31 = http://www.sk-tech.net/support/net4801.kernel.patch_2.4.31 | |
81 | netfilter-layer7-v2.1.tar.gz = http://belnet.dl.sourceforge.net/sourceforge/l7-filter/netfilter-layer7-v2.1.tar.gz | |
df5e82b3 MT |
82 | |
83 | $(DL_FILE)_MD5 = ea3f99fc82617886059d58d0644dab26 | |
84 | openswan-1.0.10rc2.tar.gz_MD5 = 20d51ff963da78f826f4e0f0ebc4bcef | |
85 | patch-o-matic-ng-20060206.tar.bz2_MD5 = eca9893afb753e331caddfe63142b566 | |
86 | iptables-1.3.5.tar.bz2_MD5 = 00fb916fa8040ca992a5ace56d905ea5 | |
ac1cfefa MT |
87 | kbc_option_2420.patch_MD5 = 6d37870344f7fcf97ace1fbf43323c60 |
88 | net4801.kernel.patch_2.4.31_MD5 = c7d64e3caedb2f2b10e1c11db7f73a04 | |
df5e82b3 MT |
89 | netfilter-layer7-v2.1.tar.gz_MD5 = 551626a158c2a2cbfd937d27ecc7fac1 |
90 | ||
91 | install : $(TARGET) | |
92 | ||
93 | check : $(patsubst %,$(DIR_CHK)/%,$(objects)) | |
94 | ||
95 | download :$(patsubst %,$(DIR_DL)/%,$(objects)) | |
96 | ||
97 | md5 : $(subst %,%_MD5,$(objects)) | |
98 | ||
99 | ############################################################################### | |
100 | # Downloading, checking, md5sum | |
101 | ############################################################################### | |
102 | ||
103 | $(patsubst %,$(DIR_CHK)/%,$(objects)) : | |
104 | @$(CHECK) | |
105 | ||
106 | $(patsubst %,$(DIR_DL)/%,$(objects)) : | |
107 | @$(LOAD) | |
108 | ||
109 | $(subst %,%_MD5,$(objects)) : | |
110 | @$(MD5) | |
111 | ||
112 | ############################################################################### | |
113 | # Installation Details | |
114 | ############################################################################### | |
115 | ||
116 | $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) | |
117 | @$(PREBUILD) | |
118 | @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) | |
119 | cd $(DIR_SRC) && ln -sf linux-$(VER) linux | |
120 | cd $(DIR_APP) && sed -i -e 's/-Werror//' drivers/scsi/aic7xxx/Makefile | |
121 | ||
122 | # Openswan | |
123 | cd $(DIR_SRC) && rm -rf openswan-* | |
124 | cd $(DIR_SRC) && tar xfz $(DIR_DL)/openswan-1.0.10rc2.tar.gz | |
125 | cd $(DIR_SRC)/openswan-1.0.10rc2 && patch -Np1 < $(DIR_SRC)/src/patches/openswan-1.0.1-plutoctl.patch | |
126 | cd $(DIR_SRC)/openswan-1.0.10rc2 && patch -Np1 < $(DIR_SRC)/src/patches/openswan-1.0.6-numif.patch | |
127 | cd $(DIR_SRC)/openswan-1.0.10rc2 && sed -i 's+^KERNELSRC.*$$+KERNELSRC=$(ROOT)/usr/src/linux-$(VER)+' Makefile.inc | |
128 | cd $(DIR_SRC)/openswan-1.0.10rc2 && sed -i -e 's/local\/sbin/local\/sbin:\/tools\/bin/' utils/patcher | |
129 | cd $(DIR_SRC)/openswan-1.0.10rc2 && make insert | |
ac1cfefa | 130 | |
df5e82b3 MT |
131 | # Patch-o-matic |
132 | cd $(DIR_SRC) && rm -rf iptables-* | |
133 | cd $(DIR_SRC) && tar xfj $(DIR_DL)/iptables-1.3.5.tar.bz2 | |
134 | cd $(DIR_SRC) && ln -sf iptables-1.3.5 iptables | |
135 | cd $(DIR_SRC) && rm -rf patch-o-matic* | |
136 | cd $(DIR_SRC) && tar xfj $(DIR_DL)/patch-o-matic-ng-20060206.tar.bz2 | |
ac1cfefa | 137 | |
df5e82b3 MT |
138 | cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ pending |
139 | cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ base | |
140 | cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ h323-conntrack-nat | |
141 | cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ cuseeme-nat | |
142 | cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ mms-conntrack-nat | |
143 | cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ pptp-conntrack-nat | |
144 | cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ rtsp-conntrack | |
145 | cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ quake3-conntrack-nat | |
146 | cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ sip-conntrack-nat | |
147 | cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ ip_queue_vwmark | |
148 | cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ ipp2p | |
149 | cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ ipsec-01-output-hooks | |
150 | cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ ipsec-02-input-hooks | |
151 | cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ ipsec-03-policy-lookup | |
152 | cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ ipsec-04-policy-checks | |
153 | cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ TARPIT | |
154 | ||
155 | #imq-patch | |
156 | cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.4.28-imq2.diff | |
157 | ||
158 | #layer7-patch | |
159 | cd $(DIR_SRC) && tar xzf $(DIR_DL)/netfilter-layer7-v2.1.tar.gz | |
160 | cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/netfilter-layer7-v2.1/kernel-2.4-layer7-2.1.patch | |
161 | ||
df5e82b3 MT |
162 | ifeq "$(SMP)" "" |
163 | # Only do this once on the non-SMP pass | |
ac1cfefa | 164 | cd $(DIR_SRC) && tar czf $(DIR_DL)/iptables-fixed.tar.gz iptables-1.3.5 |
df5e82b3 MT |
165 | endif |
166 | ||
167 | # Olitec isdn gazel patch | |
168 | cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/linux-2.4.23-olitec-isdn.patch | |
169 | ||
170 | # Fix /proc/stat output | |
171 | cd $(DIR_APP) && patch -Np2 < $(DIR_SRC)/src/patches/linux-2.4.26-proc-stat.patch | |
172 | ||
173 | # Fix libata-core.c | |
174 | # cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/linux-2.4.26-scsi.patch | |
175 | ||
176 | # frandom patch | |
177 | cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.4.27-frandom-2.patch | |
178 | ||
179 | # Propolice | |
180 | cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.4.27-ssp-1.patch | |
181 | ||
182 | # Support ppp-2.4.3 multilink behavior (terminate when no channel is connected) | |
183 | # need updated libpcap older than 0.8.3 | |
184 | # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/ppp_generic-ppp-2.4.3_multilink.patch | |
185 | ||
186 | # R8169 clone D-link GSE-528T | |
187 | cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.4.29_r8169clone.patch | |
188 | ||
189 | # Cleanup kernel source | |
190 | cd $(DIR_APP) && make mrproper | |
191 | ifeq "$(ROOT)" "" | |
192 | ifeq "$(LFS_PASS)" "ipcop" | |
193 | ifeq "$(SMP)" "" | |
194 | cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE) $(DIR_APP)/.config | |
195 | endif | |
196 | ifeq "$(SMP)" "1" | |
197 | cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE).smp $(DIR_APP)/.config | |
198 | endif | |
199 | ifeq "$(SMP)" "installer" | |
200 | cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE).installer $(DIR_APP)/.config | |
201 | cd $(DIR_APP) && sed -i -e 's/-O2/-Os/g' Makefile | |
202 | endif | |
203 | ||
204 | cd $(DIR_APP) && make CC="$(KGCC)" oldconfig | |
205 | cd $(DIR_APP) && make CC="$(KGCC)" dep | |
206 | cd $(DIR_APP) && make CC="$(KGCC)" clean | |
ac1cfefa | 207 | if [ "$(MACHINE)" = "i386" -a "$(SMP)" = "" ]; then \ |
df5e82b3 MT |
208 | cd $(DIR_APP) && make -j 3 CC="$(KGCC)" bzImage; \ |
209 | cd $(DIR_APP) && cp arch/$(MACHINE)/boot/bzImage /boot/vmlinuz-$(VER); \ | |
210 | cd $(DIR_APP) && cp System.map /boot/System.map-$(VER); \ | |
211 | ln -sf vmlinuz-$(VER) /boot/vmlinuz; \ | |
212 | ln -sf System.map-$(VER) /boot/System.map; \ | |
213 | cd $(DIR_APP) && make CC="$(KGCC)" modules; \ | |
214 | cd $(DIR_APP) && make CC="$(KGCC)" modules_install; \ | |
ac1cfefa MT |
215 | elif [ "$(MACHINE)" = "i386" -a "$(SMP)" = "1" ]; then \ |
216 | cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =/EXTRAVERSION\ =\ -smp/' Makefile; \ | |
df5e82b3 | 217 | cd $(DIR_APP) && make -j 3 CC="$(KGCC)" bzImage; \ |
ac1cfefa MT |
218 | cd $(DIR_APP) && cp arch/$(MACHINE)/boot/bzImage /boot/vmlinuz-$(VER)-smp; \ |
219 | cd $(DIR_APP) && cp System.map /boot/System.map-$(VER)-smp; \ | |
220 | ln -sf vmlinuz-$(VER)-smp /boot/vmlinuz-smp; \ | |
df5e82b3 MT |
221 | cd $(DIR_APP) && make CC="$(KGCC)" modules; \ |
222 | cd $(DIR_APP) && make CC="$(KGCC)" modules_install; \ | |
ac1cfefa | 223 | elif [ "$(MACHINE)" = "i386" -a "$(SMP)" = "installer" ]; then \ |
df5e82b3 MT |
224 | cd $(DIR_APP) && make -j 3 CC="$(KGCC)" bzImage; \ |
225 | cd $(DIR_APP) && cp arch/$(MACHINE)/boot/bzImage /boot/vmlinuz-installer; \ | |
226 | elif [ "$(MACHINE)" = "alpha" ]; then \ | |
227 | cd $(DIR_APP) && make -j 3 CC="$(KGCC)" vmlinux; \ | |
228 | cd $(DIR_APP) && gzip -9c vmlinux > /boot/vmlinuz-$(VER); \ | |
229 | cd $(DIR_APP) && cp System.map /boot/System.map-$(VER); \ | |
230 | ln -sf vmlinuz-$(VER) /boot/vmlinuz; \ | |
231 | ln -sf System.map-$(VER) /boot/System.map; \ | |
232 | cd $(DIR_APP) && make CC="$(KGCC)" modules; \ | |
233 | cd $(DIR_APP) && make CC="$(KGCC)" modules_install; \ | |
234 | fi | |
235 | # remove symlinked pcmcia directory | |
236 | ifeq "$(SMP)" "" | |
237 | rm -rf /lib/modules/$(VER)/pcmcia | |
238 | find /lib/modules/$(VER)/ -name '*.o' -a -type f | xargs gzip -f9 | |
239 | ||
240 | # Move these SCSI drivers into same directory for probescsi.sh | |
241 | mv -f /lib/modules/$(VER)/kernel/drivers/scsi/aic7xxx/* /lib/modules/$(VER)/kernel/drivers/scsi | |
242 | rm -rf /lib/modules/$(VER)/kernel/drivers/scsi/aic7xxx | |
243 | mv -f /lib/modules/$(VER)/kernel/drivers/scsi/aacraid/* /lib/modules/$(VER)/kernel/drivers/scsi | |
244 | rm -rf /lib/modules/$(VER)/kernel/drivers/scsi/aacraid | |
245 | mv -f /lib/modules/$(VER)/kernel/drivers/scsi/sym53c8xx_2/* /lib/modules/$(VER)/kernel/drivers/scsi | |
246 | rm -rf /lib/modules/$(VER)/kernel/drivers/scsi/sym53c8xx_2 | |
247 | endif | |
248 | ifeq "$(SMP)" "1" | |
249 | rm -rf /lib/modules/$(VER)-smp/pcmcia | |
250 | find /lib/modules/$(VER)-smp/ -name '*.o' -a -type f | xargs gzip -f9 | |
251 | ||
252 | # Move these SCSI drivers into same directory for probescsi.sh | |
253 | mv -f /lib/modules/$(VER)-smp/kernel/drivers/scsi/aic7xxx/* /lib/modules/$(VER)-smp/kernel/drivers/scsi | |
254 | rm -rf /lib/modules/$(VER)-smp/kernel/drivers/scsi/aic7xxx | |
255 | mv -f /lib/modules/$(VER)-smp/kernel/drivers/scsi/aacraid/* /lib/modules/$(VER)-smp/kernel/drivers/scsi | |
256 | rm -rf /lib/modules/$(VER)-smp/kernel/drivers/scsi/aacraid | |
257 | mv -f /lib/modules/$(VER)-smp/kernel/drivers/scsi/sym53c8xx_2/* /lib/modules/$(VER)-smp/kernel/drivers/scsi | |
258 | rm -rf /lib/modules/$(VER)-smp/kernel/drivers/scsi/sym53c8xx_2 | |
259 | endif | |
260 | ||
261 | ifeq "$(SMP)" "" | |
262 | # Only do this once on the non-SMP pass | |
263 | cd $(DIR_APP) && make mandocs | |
264 | -mkdir -p /usr/share/man/man9/ | |
265 | cd $(DIR_APP) && cp -af Documentation/man/* /usr/share/man/man9/ | |
266 | endif | |
267 | else | |
268 | cd $(DIR_APP) && make include/linux/version.h | |
269 | cd $(DIR_APP) && make symlinks | |
270 | cd $(DIR_APP) && cp -HRf include/asm /usr/include | |
271 | cd $(DIR_APP) && cp -Rf include/asm-generic /usr/include | |
272 | cd $(DIR_APP) && cp -Rf include/linux /usr/include | |
273 | touch /usr/include/linux/autoconf.h | |
274 | endif | |
275 | else | |
276 | cd $(DIR_APP) && make include/linux/version.h | |
277 | cd $(DIR_APP) && make symlinks | |
278 | -mkdir -p /tools/include/asm | |
279 | cd $(DIR_APP) && cp -f include/asm/* /tools/include/asm | |
280 | cd $(DIR_APP) && cp -Rf include/asm-generic /tools/include | |
281 | cd $(DIR_APP) && cp -Rf include/linux /tools/include | |
282 | cd $(DIR_APP) && touch /tools/include/linux/autoconf.h | |
283 | endif | |
284 | @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* | |
285 | @$(POSTBUILD) |