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