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