HinzugefĆ¼gt:
[people/pmueller/ipfire-2.x.git] / lfs / linux
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 ###############################################################################
22
23 ###############################################################################
24 # Definitions
25 ###############################################################################
26
27 include Config
28
29 VER = 2.4.31
30
31 THISAPP = linux-$(VER)
32 DL_FILE = $(THISAPP).tar.gz
33 DL_FROM = $(URL_IPFIRE)
34 DIR_APP = $(DIR_SRC)/$(THISAPP)
35 CFLAGS =
36 CXXFLAGS =
37
38 # Normal build or /tools build.
39 #
40 ifeq "$(ROOT)" ""
41 ifeq "$(LFS_PASS)" "ipfire"
42 ifeq "$(SMP)" ""
43 TARGET = $(DIR_INFO)/$(THISAPP)-ipfire
44 endif
45 ifeq "$(SMP)" "1"
46 TARGET = $(DIR_INFO)/$(THISAPP)-ipfire-smp
47 endif
48 ifeq "$(SMP)" "installer"
49 TARGET = $(DIR_INFO)/$(THISAPP)-ipfire-installer
50 endif
51 else
52 TARGET = $(DIR_INFO)/$(THISAPP)
53 endif
54 else
55 TARGET = $(DIR_INFO)/$(THISAPP)-tools
56 endif
57
58 ###############################################################################
59 # Top-level Rules
60 ###############################################################################
61 objects =$(DL_FILE) \
62 openswan-1.0.10rc2.tar.gz \
63 iptables-1.3.5.tar.bz2 \
64 patch-o-matic-ng-20060206.tar.bz2 \
65 kbc_option_2420.patch \
66 net4801.kernel.patch_2.4.31 \
67 netfilter-layer7-v2.1.tar.gz
68
69 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
70 openswan-1.0.10rc2.tar.gz = $(URL_IPFIRE)/openswan-1.0.10rc2.tar.gz
71 patch-o-matic-ng-20060206.tar.bz2 = $(URL_IPFIRE)/patch-o-matic-ng-20060206.tar.bz2
72 iptables-1.3.5.tar.bz2 = $(URL_IPFIRE)/iptables-1.3.5.tar.bz2
73 kbc_option_2420.patch = $(URL_IPFIRE)/kbc_option_2420.patch
74 net4801.kernel.patch_2.4.31 = $(URL_IPFIRE)/net4801.kernel.patch_2.4.31
75 netfilter-layer7-v2.1.tar.gz = $(URL_IPFIRE)/netfilter-layer7-v2.1.tar.gz
76
77 $(DL_FILE)_MD5 = ea3f99fc82617886059d58d0644dab26
78 openswan-1.0.10rc2.tar.gz_MD5 = 20d51ff963da78f826f4e0f0ebc4bcef
79 patch-o-matic-ng-20060206.tar.bz2_MD5 = eca9893afb753e331caddfe63142b566
80 iptables-1.3.5.tar.bz2_MD5 = 00fb916fa8040ca992a5ace56d905ea5
81 kbc_option_2420.patch_MD5 = 6d37870344f7fcf97ace1fbf43323c60
82 net4801.kernel.patch_2.4.31_MD5 = c7d64e3caedb2f2b10e1c11db7f73a04
83 netfilter-layer7-v2.1.tar.gz_MD5 = 551626a158c2a2cbfd937d27ecc7fac1
84
85 install : $(TARGET)
86
87 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
88
89 download :$(patsubst %,$(DIR_DL)/%,$(objects))
90
91 md5 : $(subst %,%_MD5,$(objects))
92
93 ###############################################################################
94 # Downloading, checking, md5sum
95 ###############################################################################
96
97 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
98 @$(CHECK)
99
100 $(patsubst %,$(DIR_DL)/%,$(objects)) :
101 @$(LOAD)
102
103 $(subst %,%_MD5,$(objects)) :
104 @$(MD5)
105
106 ###############################################################################
107 # Installation Details
108 ###############################################################################
109
110 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
111 @$(PREBUILD)
112 @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
113 cd $(DIR_SRC) && ln -sf linux-$(VER) linux
114 cd $(DIR_APP) && sed -i -e 's/-Werror//' drivers/scsi/aic7xxx/Makefile
115
116 # Openswan
117 cd $(DIR_SRC) && rm -rf openswan-*
118 cd $(DIR_SRC) && tar xfz $(DIR_DL)/openswan-1.0.10.tar.gz
119 cd $(DIR_SRC)/openswan-1.0.10 && patch -Np1 < $(DIR_SRC)/src/patches/openswan-1.0.1-plutoctl.patch
120 cd $(DIR_SRC)/openswan-1.0.10 && patch -Np1 < $(DIR_SRC)/src/patches/openswan-1.0.6-numif.patch
121 cd $(DIR_SRC)/openswan-1.0.10 && sed -i 's+^KERNELSRC.*$$+KERNELSRC=$(ROOT)/usr/src/linux-$(VER)+' Makefile.inc
122 cd $(DIR_SRC)/openswan-1.0.10 && sed -i -e 's/local\/sbin/local\/sbin:\/tools\/bin/' utils/patcher
123 cd $(DIR_SRC)/openswan-1.0.10 && make insert
124
125 # Patch-o-matic
126 cd $(DIR_SRC) && rm -rf iptables-*
127 cd $(DIR_SRC) && tar xfj $(DIR_DL)/iptables-1.3.5.tar.bz2
128 cd $(DIR_SRC) && ln -sf iptables-1.3.5 iptables
129 cd $(DIR_SRC) && rm -rf patch-o-matic*
130 cd $(DIR_SRC) && tar xfj $(DIR_DL)/patch-o-matic-ng-20060206.tar.bz2
131
132 cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ pending
133 cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ base
134 cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ h323-conntrack-nat
135 cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ cuseeme-nat
136 cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ mms-conntrack-nat
137 cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ pptp-conntrack-nat
138 cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ rtsp-conntrack
139 cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ quake3-conntrack-nat
140 cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ sip-conntrack-nat
141 cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ ip_queue_vwmark
142 cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ ipp2p
143 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
144 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
145 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
146 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
147 cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(ROOT)/usr/src/linux/ --iptables-path=$(ROOT)/usr/src/iptables/ TARPIT
148
149 #imq-patch
150 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.4.28-imq2.diff
151
152 #layer7-patch
153 cd $(DIR_SRC) && tar xzf $(DIR_DL)/netfilter-layer7-v2.1.tar.gz
154 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/netfilter-layer7-v2.1/kernel-2.4-layer7-2.1.patch
155
156 # ip_conntrack permissions from 440 to 444
157 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/ip_conntrack_standalone-patch-for-ipfire.patch
158
159 ifeq "$(SMP)" ""
160 # Only do this once on the non-SMP pass
161 cd $(DIR_SRC) && tar czf $(DIR_DL)/iptables-fixed.tar.gz iptables-1.3.5
162 endif
163
164 # Olitec isdn gazel patch
165 cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/linux-2.4.23-olitec-isdn.patch
166
167 # Fix /proc/stat output
168 cd $(DIR_APP) && patch -Np2 < $(DIR_SRC)/src/patches/linux-2.4.26-proc-stat.patch
169
170 # Fix libata-core.c
171 # cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/linux-2.4.26-scsi.patch
172
173 # frandom patch
174 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.4.27-frandom-2.patch
175
176 # Propolice
177 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.4.27-ssp-1.patch
178
179 # Support ppp-2.4.3 multilink behavior (terminate when no channel is connected)
180 # need updated libpcap older than 0.8.3
181 # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/ppp_generic-ppp-2.4.3_multilink.patch
182
183 # R8169 clone D-link GSE-528T
184 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.4.29_r8169clone.patch
185
186 # Cleanup kernel source
187 cd $(DIR_APP) && make mrproper
188 ifeq "$(ROOT)" ""
189 ifeq "$(LFS_PASS)" "ipfire"
190 ifeq "$(SMP)" ""
191 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE) $(DIR_APP)/.config
192 endif
193 ifeq "$(SMP)" "1"
194 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE).smp $(DIR_APP)/.config
195 endif
196 ifeq "$(SMP)" "installer"
197 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE).installer $(DIR_APP)/.config
198 cd $(DIR_APP) && sed -i -e 's/-O2/-Os/g' Makefile
199 endif
200
201 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
202 cd $(DIR_APP) && make CC="$(KGCC)" dep
203 cd $(DIR_APP) && make CC="$(KGCC)" clean
204 if [ "$(MACHINE)" = "i386" -a "$(SMP)" = "" ]; then \
205 cd $(DIR_APP) && make -j 3 CC="$(KGCC)" bzImage; \
206 cd $(DIR_APP) && cp arch/$(MACHINE)/boot/bzImage /boot/vmlinuz-$(VER); \
207 cd $(DIR_APP) && cp System.map /boot/System.map-$(VER); \
208 ln -sf vmlinuz-$(VER) /boot/vmlinuz; \
209 ln -sf System.map-$(VER) /boot/System.map; \
210 cd $(DIR_APP) && make CC="$(KGCC)" modules; \
211 cd $(DIR_APP) && make CC="$(KGCC)" modules_install; \
212 elif [ "$(MACHINE)" = "i386" -a "$(SMP)" = "1" ]; then \
213 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =/EXTRAVERSION\ =\ -smp/' Makefile; \
214 cd $(DIR_APP) && make -j 3 CC="$(KGCC)" bzImage; \
215 cd $(DIR_APP) && cp arch/$(MACHINE)/boot/bzImage /boot/vmlinuz-$(VER)-smp; \
216 cd $(DIR_APP) && cp System.map /boot/System.map-$(VER)-smp; \
217 ln -sf vmlinuz-$(VER)-smp /boot/vmlinuz-smp; \
218 cd $(DIR_APP) && make CC="$(KGCC)" modules; \
219 cd $(DIR_APP) && make CC="$(KGCC)" modules_install; \
220 elif [ "$(MACHINE)" = "i386" -a "$(SMP)" = "installer" ]; then \
221 cd $(DIR_APP) && make -j 3 CC="$(KGCC)" bzImage; \
222 cd $(DIR_APP) && cp arch/$(MACHINE)/boot/bzImage /boot/vmlinuz-installer; \
223 elif [ "$(MACHINE)" = "alpha" ]; then \
224 cd $(DIR_APP) && make -j 3 CC="$(KGCC)" vmlinux; \
225 cd $(DIR_APP) && gzip -9c vmlinux > /boot/vmlinuz-$(VER); \
226 cd $(DIR_APP) && cp System.map /boot/System.map-$(VER); \
227 ln -sf vmlinuz-$(VER) /boot/vmlinuz; \
228 ln -sf System.map-$(VER) /boot/System.map; \
229 cd $(DIR_APP) && make CC="$(KGCC)" modules; \
230 cd $(DIR_APP) && make CC="$(KGCC)" modules_install; \
231 fi
232 # remove symlinked pcmcia directory
233 ifeq "$(SMP)" ""
234 rm -rf /lib/modules/$(VER)/pcmcia
235 find /lib/modules/$(VER)/ -name '*.o' -a -type f | xargs gzip -f9
236
237 # Move these SCSI drivers into same directory for probescsi.sh
238 mv -f /lib/modules/$(VER)/kernel/drivers/scsi/aic7xxx/* /lib/modules/$(VER)/kernel/drivers/scsi
239 rm -rf /lib/modules/$(VER)/kernel/drivers/scsi/aic7xxx
240 mv -f /lib/modules/$(VER)/kernel/drivers/scsi/aacraid/* /lib/modules/$(VER)/kernel/drivers/scsi
241 rm -rf /lib/modules/$(VER)/kernel/drivers/scsi/aacraid
242 mv -f /lib/modules/$(VER)/kernel/drivers/scsi/sym53c8xx_2/* /lib/modules/$(VER)/kernel/drivers/scsi
243 rm -rf /lib/modules/$(VER)/kernel/drivers/scsi/sym53c8xx_2
244 endif
245 ifeq "$(SMP)" "1"
246 rm -rf /lib/modules/$(VER)-smp/pcmcia
247 find /lib/modules/$(VER)-smp/ -name '*.o' -a -type f | xargs gzip -f9
248
249 # Move these SCSI drivers into same directory for probescsi.sh
250 mv -f /lib/modules/$(VER)-smp/kernel/drivers/scsi/aic7xxx/* /lib/modules/$(VER)-smp/kernel/drivers/scsi
251 rm -rf /lib/modules/$(VER)-smp/kernel/drivers/scsi/aic7xxx
252 mv -f /lib/modules/$(VER)-smp/kernel/drivers/scsi/aacraid/* /lib/modules/$(VER)-smp/kernel/drivers/scsi
253 rm -rf /lib/modules/$(VER)-smp/kernel/drivers/scsi/aacraid
254 mv -f /lib/modules/$(VER)-smp/kernel/drivers/scsi/sym53c8xx_2/* /lib/modules/$(VER)-smp/kernel/drivers/scsi
255 rm -rf /lib/modules/$(VER)-smp/kernel/drivers/scsi/sym53c8xx_2
256 endif
257
258 ifeq "$(SMP)" ""
259 # Only do this once on the non-SMP pass
260 cd $(DIR_APP) && make mandocs
261 -mkdir -p /usr/share/man/man9/
262 cd $(DIR_APP) && cp -af Documentation/man/* /usr/share/man/man9/
263 endif
264 else
265 cd $(DIR_APP) && make include/linux/version.h
266 cd $(DIR_APP) && make symlinks
267 cd $(DIR_APP) && cp -HRf include/asm /usr/include
268 cd $(DIR_APP) && cp -Rf include/asm-generic /usr/include
269 cd $(DIR_APP) && cp -Rf include/linux /usr/include
270 touch /usr/include/linux/autoconf.h
271 endif
272 else
273 cd $(DIR_APP) && make include/linux/version.h
274 cd $(DIR_APP) && make symlinks
275 -mkdir -p /tools/include/asm
276 cd $(DIR_APP) && cp -f include/asm/* /tools/include/asm
277 cd $(DIR_APP) && cp -Rf include/asm-generic /tools/include
278 cd $(DIR_APP) && cp -Rf include/linux /tools/include
279 cd $(DIR_APP) && touch /tools/include/linux/autoconf.h
280 endif
281 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables*
282 @$(POSTBUILD)