]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - lfs/linux
74e92c6ac723fe12c792d1bd68291a77db8aacc3
[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.6.16
30 PATCHLEVEL = 2.6.16.27
31
32 THISAPP = linux-$(VER)
33 DL_FILE = $(THISAPP).tar.gz
34 DL_FROM = $(URL_IPFIRE)
35 DIR_APP = $(DIR_SRC)/$(THISAPP)
36 CFLAGS =
37 CXXFLAGS =
38
39 # Normal build or SMP build.
40 #
41 ifeq "$(SMP)" "1"
42 TARGET = $(DIR_INFO)/linux-$(PATCHLEVEL)-ipfire-smp
43 else
44 TARGET = $(DIR_INFO)/linux-$(PATCHLEVEL)-ipfire
45 endif
46
47 ###############################################################################
48 # Top-level Rules
49 ###############################################################################
50 objects =$(DL_FILE) \
51 openswan-2.4.7.kernel-2.6-natt.patch.gz \
52 openswan-2.4.7.kernel-2.6-klips.patch.gz \
53 iptables-1.3.5.tar.bz2 \
54 patch-o-matic-ng-20061210.tar.bz2 \
55 kbc_option_2420.patch \
56 net4801.kernel.patch_2.4.31 \
57 netfilter-layer7-v2.6.tar.gz \
58 patch-$(PATCHLEVEL).gz
59
60 $(DL_FILE) = $(DL_FROM)/$(DL_FILE)
61 patch-$(PATCHLEVEL).gz = $(DL_FROM)/patch-$(PATCHLEVEL).gz
62 openswan-2.4.7.kernel-2.6-natt.patch.gz = $(URL_IPFIRE)/openswan-2.4.7.kernel-2.6-natt.patch.gz
63 openswan-2.4.7.kernel-2.6-klips.patch.gz = $(URL_IPFIRE)/openswan-2.4.7.kernel-2.6-klips.patch.gz
64 patch-o-matic-ng-20061210.tar.bz2 = $(URL_IPFIRE)/patch-o-matic-ng-20061210.tar.bz2
65 iptables-1.3.5.tar.bz2 = $(URL_IPFIRE)/iptables-1.3.5.tar.bz2
66 kbc_option_2420.patch = $(URL_IPFIRE)/kbc_option_2420.patch
67 net4801.kernel.patch_2.4.31 = $(URL_IPFIRE)/net4801.kernel.patch_2.4.31
68 netfilter-layer7-v2.6.tar.gz = $(URL_IPFIRE)/netfilter-layer7-v2.6.tar.gz
69
70 $(DL_FILE)_MD5 = 50695965725367f39007023feac5e256
71 patch-$(PATCHLEVEL).gz_MD5 = 4b09dd018286850c20c0f051ced7b583
72 openswan-2.4.7.kernel-2.6-natt.patch.gz_MD5 = 980d8bbdb29a761b7f5aa852f373df62
73 openswan-2.4.7.kernel-2.6-klips.patch.gz_MD5 = 5df0ffa2453488a407a23fc4ea4af879
74 patch-o-matic-ng-20061210.tar.bz2_MD5 = 76edac76301b45f89e467b41c8cf4393
75 iptables-1.3.5.tar.bz2_MD5 = 00fb916fa8040ca992a5ace56d905ea5
76 kbc_option_2420.patch_MD5 = 6d37870344f7fcf97ace1fbf43323c60
77 net4801.kernel.patch_2.4.31_MD5 = c7d64e3caedb2f2b10e1c11db7f73a04
78 netfilter-layer7-v2.6.tar.gz_MD5 = 58135cd1aafaf4ae2fa478159206f064
79
80 install : $(TARGET)
81
82 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
83
84 download :$(patsubst %,$(DIR_DL)/%,$(objects))
85
86 md5 : $(subst %,%_MD5,$(objects))
87
88 ###############################################################################
89 # Downloading, checking, md5sum
90 ###############################################################################
91
92 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
93 @$(CHECK)
94
95 $(patsubst %,$(DIR_DL)/%,$(objects)) :
96 @$(LOAD)
97
98 $(subst %,%_MD5,$(objects)) :
99 @$(MD5)
100
101 ###############################################################################
102 # Installation Details
103 ###############################################################################
104
105 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
106 @$(PREBUILD)
107 @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
108 ln -s linux-$(VER) /usr/src/linux
109
110 # Update kernel to latest patchlevel
111 cd $(DIR_APP) && zcat $(DIR_DL)/patch-$(PATCHLEVEL).gz | patch -p1
112 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.16.27-utf8_input-1.patch
113 # Remove patch level in EXTRAVERSION.
114 # We want to avoid the need to supply a full kernel
115 # (installed in a different place) if only one part could be updated
116 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =/' Makefile
117 cd $(DIR_APP) && sed -i -e 's/-Werror//' drivers/scsi/aic7xxx/Makefile
118 cd $(DIR_APP) && sed -i -e 's/gettext//' scripts/kconfig/lkc.h
119
120 # Openswan 2
121 cd $(DIR_SRC) && rm -rf openswan-*
122 cd $(DIR_SRC) && tar xfz $(DIR_DL)/openswan-2.4.7.tar.gz
123 cd $(DIR_APP) && gzip -dc $(DIR_DL)/openswan-2.4.7.kernel-2.6-natt.patch.gz | patch -Np1
124 cd $(DIR_APP) && gzip -dc $(DIR_DL)/openswan-2.4.7.kernel-2.6-klips.patch.gz | patch -Np1
125 cd $(DIR_SRC)/openswan-* && sed -i -e 's/INC_USRLOCAL=\/usr\/local/INC_USRLOCAL=\/usr/' Makefile.inc
126
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-20061210.tar.bz2
133
134 cd $(DIR_SRC)/patch-o-matic-ng* && \
135 ./runme --batch --kernel-path=$(ROOT)/usr/src/$(THISAPP)/ --iptables-path=$(ROOT)/usr/src/iptables/ \
136 TARPIT h323-conntrack-nat cuseeme-nat \
137 sip-conntrack-nat
138 # rtsp-conntrack-nat quake3-conntrack-nat mms-conntrack-nat
139
140 # cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ pending
141 # cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ base
142 # cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ mms-conntrack-nat
143 # cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ pptp-conntrack-nat
144 # cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ rtsp-conntrack
145 # cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ quake3-conntrack-nat
146 # cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ ip_queue_vwmark
147 # cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ ipp2p
148 # cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ ipsec-01-output-hooks
149 # cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ ipsec-02-input-hooks
150 # cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ ipsec-03-policy-lookup
151 # cd $(DIR_SRC)/patch-o-matic* && yes 'y' | ./runme --kernel-path=$(DIR_APP) --iptables-path=$(ROOT)/usr/src/iptables/ ipsec-04-policy-checks
152
153 # Layer7-patch
154 cd $(DIR_SRC) && tar xzf $(DIR_DL)/netfilter-layer7-v2.6.tar.gz
155 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/netfilter-layer7-v2.6/for_older_kernels/kernel-2.6.13-2.6.16-layer7-2.2.patch
156
157 # ip_conntrack permissions from 440 to 444
158 # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/ip_conntrack_standalone-patch-for-ipfire.patch
159
160 ifeq "$(SMP)" ""
161 # Only do this once on the non-SMP pass
162 cd $(DIR_SRC) && tar czf $(DIR_DL)/iptables-fixed.tar.gz iptables-1.3.5
163 endif
164
165 # Bootsplash
166 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/bootsplash-3.1.6-2.6.15.diff
167
168 # Cleanup kernel source
169 cd $(DIR_APP) && make mrproper
170
171 ifeq "$(SMP)" ""
172 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE) $(DIR_APP)/.config
173 endif
174 ifeq "$(SMP)" "1"
175 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE).smp $(DIR_APP)/.config
176 endif
177
178 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
179 cd $(DIR_APP) && make CC="$(KGCC)" clean
180 if [ "$(SMP)" = "" ]; then \
181 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage; \
182 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER); \
183 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER); \
184 cd $(DIR_APP) && cp -v .config /boot/config-$(VER); \
185 ln -sf vmlinuz-$(VER) /boot/vmlinuz; \
186 ln -sf System.map-$(VER) /boot/System.map; \
187 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules; \
188 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install; \
189 cd $(DIR_SRC)/openswan-* && make KERNELSRC=/usr/src/$(THISAPP) CC=$(CC) module; \
190 cd $(DIR_SRC)/openswan-* && make KERNELSRC=/usr/src/$(THISAPP) CC=$(CC) minstall; \
191 elif [ "$(SMP)" = "1" ]; then \
192 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =/EXTRAVERSION\ =\ -smp/' Makefile; \
193 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage; \
194 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-smp; \
195 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-smp; \
196 cd $(DIR_APP) && cp -v .config /boot/config-$(VER); \
197 ln -sf vmlinuz-$(VER)-smp /boot/vmlinuz-smp; \
198 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules; \
199 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install; \
200 cd $(DIR_SRC)/openswan-* && make KERNELSRC=/usr/src/$(THISAPP) CC=$(CC) module; \
201 cd $(DIR_SRC)/openswan-* && make KERNELSRC=/usr/src/$(THISAPP) CC=$(CC) minstall; \
202 fi
203
204 # remove symlinked pcmcia directory
205 ifeq "$(SMP)" ""
206 rm -rf /lib/modules/$(VER)/pcmcia
207 endif
208 ifeq "$(SMP)" "1"
209 rm -rf /lib/modules/$(VER)-smp/pcmcia
210 endif
211 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables*
212 @$(POSTBUILD)