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