]>
Commit | Line | Data |
---|---|---|
cd1a2927 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.63 2006/01/30 12:51:21 franck78 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" | |
48 | ifeq "$(SMP)" "" | |
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 | # make a kernel/iptables diff in build/usr/src to control patch system when DIFFCONTROL = yes | |
65 | DIFFCONTROL = yes | |
66 | ############################################################################### | |
67 | # Top-level Rules | |
68 | ############################################################################### | |
69 | objects =$(DL_FILE) \ | |
70 | openswan-1.0.10.tar.gz \ | |
71 | iptables-1.3.4.tar.bz2 \ | |
72 | patch-o-matic-ng-20050918.tar.bz2 \ | |
73 | patch-o-matic-ng-20051229.tar.bz2 | |
74 | ||
75 | $(DL_FILE) = $(DL_FROM)/$(DL_FILE) | |
76 | openswan-1.0.10.tar.gz = http://www.openswan.org/download/openswan-1.0.10.tar.gz | |
77 | iptables-1.3.4.tar.bz2 = http://www.netfilter.org/projects/iptables/files/iptables-1.3.4.tar.bz2 | |
78 | patch-o-matic-ng-20050918.tar.bz2 = http://ftp.netfilter.org/pub/patch-o-matic-ng/snapshot/patch-o-matic-ng-20050918.tar.bz2 | |
79 | patch-o-matic-ng-20051229.tar.bz2 = http://ftp.netfilter.org/pub/patch-o-matic-ng/snapshot/patch-o-matic-ng-20051229.tar.bz2 | |
80 | ||
81 | $(DL_FILE)_MD5 = ea3f99fc82617886059d58d0644dab26 | |
82 | openswan-1.0.10.tar.gz_MD5 = 3767814e3c080d146a8c7233dc31e0a9 | |
83 | iptables-1.3.4.tar.bz2_MD5 = fdff8abe890807968226b0c374335305 | |
84 | patch-o-matic-ng-20050918.tar.bz2_MD5 = 5af06b5d1430a8ce6f2c6d8ead2f8365 | |
85 | patch-o-matic-ng-20051229.tar.bz2_MD5 = f68169268dbfc30acfeab159be279752 | |
86 | ||
87 | install : $(TARGET) | |
88 | ||
89 | check : $(patsubst %,$(DIR_CHK)/%,$(objects)) | |
90 | ||
91 | download :$(patsubst %,$(DIR_DL)/%,$(objects)) | |
92 | ||
93 | md5 : $(subst %,%_MD5,$(objects)) | |
94 | ||
95 | ############################################################################### | |
96 | # Downloading, checking, md5sum | |
97 | ############################################################################### | |
98 | ||
99 | $(patsubst %,$(DIR_CHK)/%,$(objects)) : | |
100 | @$(CHECK) | |
101 | ||
102 | $(patsubst %,$(DIR_DL)/%,$(objects)) : | |
103 | @$(LOAD) | |
104 | ||
105 | $(subst %,%_MD5,$(objects)) : | |
106 | @$(MD5) | |
107 | ||
108 | ############################################################################### | |
109 | # Installation Details | |
110 | ############################################################################### | |
111 | ||
112 | $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) | |
113 | @$(PREBUILD) | |
114 | @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) | |
115 | cd $(DIR_SRC) && ln -sf linux-$(VER) linux | |
116 | cd $(DIR_APP) && sed -i -e 's/-Werror//' drivers/scsi/aic7xxx/Makefile | |
117 | # fix 2.4.31 invalid assembler code. Patch is included in 2.4.32 kernel source | |
118 | cd $(DIR_SRC) && patch -p0 < $(DIR_SRC)/src/patches/linux-2.4-seg-4.patch | |
119 | ||
120 | # Openswan | |
121 | cd $(DIR_SRC) && rm -rf openswan-* | |
122 | cd $(DIR_SRC) && tar xfz $(DIR_DL)/openswan-1.0.10.tar.gz | |
123 | cd $(DIR_SRC)/openswan-1.0.10 && patch -Np1 < $(DIR_SRC)/src/patches/openswan-1.0.1-plutoctl.patch | |
124 | cd $(DIR_SRC)/openswan-1.0.10 && patch -Np1 < $(DIR_SRC)/src/patches/openswan-1.0.6-numif.patch | |
125 | cd $(DIR_SRC)/openswan-1.0.10 && sed -i 's+^KERNELSRC.*$$+KERNELSRC=$(ROOT)/usr/src/linux-$(VER)+' Makefile.inc | |
126 | cd $(DIR_SRC)/openswan-1.0.10 && sed -i -e 's/local\/sbin/local\/sbin:\/tools\/bin/' utils/patcher | |
127 | cd $(DIR_SRC)/openswan-1.0.10 && make insert | |
128 | ||
129 | # Iptables | |
130 | cd $(DIR_SRC) && rm -rf iptables-* $(DIR_SRC)/iptables | |
131 | cd $(DIR_SRC) && tar xfj $(DIR_DL)/iptables-1.3.4.tar.bz2 | |
132 | cd $(DIR_SRC) && ln -sf iptables-1.3.4 iptables | |
133 | ||
134 | ifeq "$(DIFFCONTROL)" "yes" | |
135 | # optional control of patching system | |
136 | cd $(DIR_APP) && make distclean # After patching, distclean remove .c~ .h~ but add .config.default | |
137 | cd $(DIR_SRC) && rm -rf linux-$(VER)-origin iptables-1.3.4-origin | |
138 | cd $(DIR_SRC) && cp -rf linux-$(VER) linux-$(VER)-origin | |
139 | cd $(DIR_SRC) && cp -rf iptables-1.3.4 iptables-1.3.4-origin | |
140 | endif | |
141 | # Used to revert to old 'string' implementation as it is the only one know by pom for kernel 2.4 | |
142 | cd $(DIR_SRC)/iptables-1.3.4 && patch -Np1 -R < $(DIR_SRC)/src/patches/iptables-1.3.4-old-string.patch | |
143 | ||
144 | # Patch-o-matic | |
145 | cd $(DIR_SRC) && rm -rf patch-o-matic* | |
146 | ||
147 | # Install extensions no more available on later pom snapshots, | |
148 | # 20050918 is the last with old extensions | |
149 | cd $(DIR_SRC) && tar xfj $(DIR_DL)/patch-o-matic-ng-20050918.tar.bz2 | |
150 | cd $(DIR_SRC)/patch-o-matic-ng-20050918/patchlets && \ | |
151 | cp -f $(DIR_SRC)/src/patches/patch-o-matic-ng-20040621_nf-log_2.4.29.patch nf-log/linux-2.4.patch | |
152 | ||
153 | cd $(DIR_SRC)/patch-o-matic-ng-20050918 && ./runme --batch \ | |
154 | --kernel-path=$(ROOT)/usr/src/linux/ \ | |
155 | --iptables-path=$(ROOT)/usr/src/iptables/ \ | |
156 | IPV4OPTSSTRIP NETLINK NETMAP REJECT SAME TARPIT TTL connlimit cuseeme-nat dstlimit \ | |
157 | fuzzy h323-conntrack-nat iprange mms-conntrack-nat mport nf-log nth pool \ | |
158 | pptp-conntrack-nat psd quake3-conntrack-nat quota random raw realm rtsp-conntrack \ | |
159 | set string time u32 | |
160 | ||
161 | # More recent pom-ng snapshot with updates for | |
162 | # ipv4options, osf | |
163 | cd $(DIR_SRC) && rm -rf patch-o-matic* | |
164 | cd $(DIR_SRC) && tar xfj $(DIR_DL)/patch-o-matic-ng-20051229.tar.bz2 | |
165 | ||
166 | cd $(DIR_SRC)/patch-o-matic-ng-20051229 && ./runme --batch \ | |
167 | --kernel-path=$(ROOT)/usr/src/linux/ \ | |
168 | --iptables-path=$(ROOT)/usr/src/iptables/ \ | |
169 | ipv4options osf | |
170 | ||
171 | # This patch changes /proc/net/ip_conntrack to mode 0440 | |
172 | # and messes up the connections.cgi page. So remove it for now. | |
173 | # As of 2.4.27 it's in as standard, use the patch to reverse the change. | |
174 | cd $(DIR_APP) && patch -Np1 -R < $(DIR_SRC)/src/patches/pom-ng_proc-net-conntrack-permissions.patch | |
175 | ||
176 | ||
177 | ifeq "$(DIFFCONTROL)" "yes" | |
178 | # optional control of patching system | |
179 | cd $(DIR_APP) && make distclean # remove .c~ .h~ due to patches | |
180 | cd $(DIR_SRC)/iptables-1.3.4 && make distclean | |
181 | # ignore error on difference as we patch for that | |
182 | -cd $(DIR_SRC) && diff -Nur linux-$(VER)-origin linux-$(VER) > pom-ng.diff | |
183 | -cd $(DIR_SRC) && diff -Nur iptables-1.3.4-origin iptables-1.3.4 >> pom-ng.diff | |
184 | cd $(DIR_SRC) && rm -rf linux-$(VER)-origin iptables-1.3.4-origin | |
185 | endif | |
186 | ||
187 | ifeq "$(SMP)" "" | |
188 | # Only do this once on the non-SMP pass | |
189 | cd $(DIR_SRC) && tar czf $(DIR_DL)/iptables-fixed.tar.gz iptables-1.3.4 | |
190 | endif | |
191 | ||
192 | # Olitec isdn gazel patch | |
193 | cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/linux-2.4.23-olitec-isdn.patch | |
194 | ||
195 | # Fix /proc/stat output | |
196 | cd $(DIR_APP) && patch -Np2 < $(DIR_SRC)/src/patches/linux-2.4.26-proc-stat.patch | |
197 | ||
198 | # Fix libata-core.c | |
199 | # cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/linux-2.4.26-scsi.patch | |
200 | ||
201 | # frandom patch | |
202 | cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.4.27-frandom-2.patch | |
203 | ||
204 | # Propolice | |
205 | cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.4.27-ssp-1.patch | |
206 | ||
207 | # Support ppp-2.4.3 multilink behavior (terminate when no channel is connected) | |
208 | # need updated libpcap older than 0.8.3 | |
209 | # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/ppp_generic-ppp-2.4.3_multilink.patch | |
210 | ||
211 | # R8169 clone D-link GSE-528T | |
212 | cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.4.29_r8169clone.patch | |
213 | ||
214 | # Cleanup kernel source | |
215 | cd $(DIR_APP) && make mrproper | |
216 | ifeq "$(ROOT)" "" | |
217 | ifeq "$(LFS_PASS)" "ipcop" | |
218 | ifeq "$(SMP)" "" | |
219 | cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE) $(DIR_APP)/.config | |
220 | endif | |
221 | ifeq "$(SMP)" "1" | |
222 | cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE).smp $(DIR_APP)/.config | |
223 | endif | |
224 | ifeq "$(SMP)" "installer" | |
225 | cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE).installer $(DIR_APP)/.config | |
226 | cd $(DIR_APP) && sed -i -e 's/-O2/-Os/g' Makefile | |
227 | endif | |
228 | ||
229 | cd $(DIR_APP) && make CC="$(KGCC)" oldconfig | |
230 | cd $(DIR_APP) && make CC="$(KGCC)" dep | |
231 | cd $(DIR_APP) && make CC="$(KGCC)" clean | |
232 | if [ "$(MACHINE)" = "i386" -a "$(SMP)" = "" ]; then \ | |
233 | cd $(DIR_APP) && make -j 3 CC="$(KGCC)" bzImage; \ | |
234 | cd $(DIR_APP) && cp arch/$(MACHINE)/boot/bzImage /boot/vmlinuz-$(VER); \ | |
235 | cd $(DIR_APP) && cp System.map /boot/System.map-$(VER); \ | |
236 | ln -sf vmlinuz-$(VER) /boot/vmlinuz; \ | |
237 | ln -sf System.map-$(VER) /boot/System.map; \ | |
238 | cd $(DIR_APP) && make CC="$(KGCC)" modules; \ | |
239 | cd $(DIR_APP) && make CC="$(KGCC)" modules_install; \ | |
240 | elif [ "$(MACHINE)" = "i386" -a "$(SMP)" = "1" ]; then \ | |
241 | cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =/EXTRAVERSION\ =\ -smp/' Makefile; \ | |
242 | cd $(DIR_APP) && make -j 3 CC="$(KGCC)" bzImage; \ | |
243 | cd $(DIR_APP) && cp arch/$(MACHINE)/boot/bzImage /boot/vmlinuz-$(VER)-smp; \ | |
244 | cd $(DIR_APP) && cp System.map /boot/System.map-$(VER)-smp; \ | |
245 | ln -sf vmlinuz-$(VER)-smp /boot/vmlinuz-smp; \ | |
246 | cd $(DIR_APP) && make CC="$(KGCC)" modules; \ | |
247 | cd $(DIR_APP) && make CC="$(KGCC)" modules_install; \ | |
248 | elif [ "$(MACHINE)" = "i386" -a "$(SMP)" = "installer" ]; then \ | |
249 | cd $(DIR_APP) && make -j 3 CC="$(KGCC)" bzImage; \ | |
250 | cd $(DIR_APP) && cp arch/$(MACHINE)/boot/bzImage /boot/vmlinuz-installer; \ | |
251 | elif [ "$(MACHINE)" = "alpha" ]; then \ | |
252 | cd $(DIR_APP) && make -j 3 CC="$(KGCC)" vmlinux; \ | |
253 | cd $(DIR_APP) && gzip -9c vmlinux > /boot/vmlinuz-$(VER); \ | |
254 | cd $(DIR_APP) && cp System.map /boot/System.map-$(VER); \ | |
255 | ln -sf vmlinuz-$(VER) /boot/vmlinuz; \ | |
256 | ln -sf System.map-$(VER) /boot/System.map; \ | |
257 | cd $(DIR_APP) && make CC="$(KGCC)" modules; \ | |
258 | cd $(DIR_APP) && make CC="$(KGCC)" modules_install; \ | |
259 | fi | |
260 | # remove symlinked pcmcia directory | |
261 | ifeq "$(SMP)" "" | |
262 | rm -rf /lib/modules/$(VER)/pcmcia | |
263 | find /lib/modules/$(VER)/ -name '*.o' -a -type f | xargs gzip -f9 | |
264 | ||
265 | # Move these SCSI drivers into same directory for probescsi.sh | |
266 | mv -f /lib/modules/$(VER)/kernel/drivers/scsi/aic7xxx/* /lib/modules/$(VER)/kernel/drivers/scsi | |
267 | rm -rf /lib/modules/$(VER)/kernel/drivers/scsi/aic7xxx | |
268 | mv -f /lib/modules/$(VER)/kernel/drivers/scsi/aacraid/* /lib/modules/$(VER)/kernel/drivers/scsi | |
269 | rm -rf /lib/modules/$(VER)/kernel/drivers/scsi/aacraid | |
270 | mv -f /lib/modules/$(VER)/kernel/drivers/scsi/sym53c8xx_2/* /lib/modules/$(VER)/kernel/drivers/scsi | |
271 | rm -rf /lib/modules/$(VER)/kernel/drivers/scsi/sym53c8xx_2 | |
272 | endif | |
273 | ifeq "$(SMP)" "1" | |
274 | rm -rf /lib/modules/$(VER)-smp/pcmcia | |
275 | find /lib/modules/$(VER)-smp/ -name '*.o' -a -type f | xargs gzip -f9 | |
276 | ||
277 | # Move these SCSI drivers into same directory for probescsi.sh | |
278 | mv -f /lib/modules/$(VER)-smp/kernel/drivers/scsi/aic7xxx/* /lib/modules/$(VER)-smp/kernel/drivers/scsi | |
279 | rm -rf /lib/modules/$(VER)-smp/kernel/drivers/scsi/aic7xxx | |
280 | mv -f /lib/modules/$(VER)-smp/kernel/drivers/scsi/aacraid/* /lib/modules/$(VER)-smp/kernel/drivers/scsi | |
281 | rm -rf /lib/modules/$(VER)-smp/kernel/drivers/scsi/aacraid | |
282 | mv -f /lib/modules/$(VER)-smp/kernel/drivers/scsi/sym53c8xx_2/* /lib/modules/$(VER)-smp/kernel/drivers/scsi | |
283 | rm -rf /lib/modules/$(VER)-smp/kernel/drivers/scsi/sym53c8xx_2 | |
284 | endif | |
285 | ||
286 | ifeq "$(SMP)" "" | |
287 | # Only do this once on the non-SMP pass | |
288 | cd $(DIR_APP) && make mandocs | |
289 | -mkdir -p /usr/share/man/man9/ | |
290 | cd $(DIR_APP) && cp -af Documentation/man/* /usr/share/man/man9/ | |
291 | endif | |
292 | else | |
293 | cd $(DIR_APP) && make include/linux/version.h | |
294 | cd $(DIR_APP) && make symlinks | |
295 | cd $(DIR_APP) && cp -HRf include/asm /usr/include | |
296 | cd $(DIR_APP) && cp -Rf include/asm-generic /usr/include | |
297 | cd $(DIR_APP) && cp -Rf include/linux /usr/include | |
298 | touch /usr/include/linux/autoconf.h | |
299 | endif | |
300 | else | |
301 | cd $(DIR_APP) && make include/linux/version.h | |
302 | cd $(DIR_APP) && make symlinks | |
303 | -mkdir -p /tools/include/asm | |
304 | cd $(DIR_APP) && cp -f include/asm/* /tools/include/asm | |
305 | cd $(DIR_APP) && cp -Rf include/asm-generic /tools/include | |
306 | cd $(DIR_APP) && cp -Rf include/linux /tools/include | |
307 | cd $(DIR_APP) && touch /tools/include/linux/autoconf.h | |
308 | endif | |
309 | @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* | |
310 | @$(POSTBUILD) |