Kernel Update auf 2.6.16.55.
[people/pmueller/ipfire-2.x.git] / lfs / linux
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
5 # #
6 # This program is free software: you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation, either version 3 of the License, or #
9 # (at your option) any later version. #
10 # #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
18 # #
19 ###############################################################################
20
21 ###############################################################################
22 # Definitions
23 ###############################################################################
24
25 include Config
26
27 PATCHLEVEL = .55
28 VER = 2.6.16.55
29
30 THISAPP = linux-$(VER)
31 DL_FILE = $(THISAPP).tar.bz2
32 DL_FROM = $(URL_IPFIRE)
33 DIR_APP = $(DIR_SRC)/$(THISAPP)
34 CFLAGS =
35 CXXFLAGS =
36
37 # Normal build or SMP build.
38 #
39 ifeq "$(SMP)" "1"
40 TARGET = $(DIR_INFO)/linux-$(VER)-smp
41 else
42 TARGET = $(DIR_INFO)/linux-$(VER)
43 endif
44
45
46 ###############################################################################
47 # Top-level Rules
48 ###############################################################################
49 objects =$(DL_FILE) \
50 mISDN-1_1_5.tar.gz \
51 squashfs3.2-r2.tar.gz \
52 iptables-1.3.5.tar.bz2 \
53 patch-o-matic-ng-20061210.tar.bz2 \
54 netfilter-layer7-v2.9.tar.gz \
55 patch-2.6.16-nath323-1.3.bz2 \
56 openswan-2.4.9.tar.gz
57
58 $(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
59 patch-o-matic-ng-20061210.tar.bz2 = $(URL_IPFIRE)/patch-o-matic-ng-20061210.tar.bz2
60 iptables-1.3.5.tar.bz2 = $(URL_IPFIRE)/iptables-1.3.5.tar.bz2
61 netfilter-layer7-v2.9.tar.gz = $(URL_IPFIRE)/netfilter-layer7-v2.9.tar.gz
62 patch-2.6.16-nath323-1.3.bz2 = $(URL_IPFIRE)/patch-2.6.16-nath323-1.3.bz2
63 squashfs3.2-r2.tar.gz = $(URL_IPFIRE)/squashfs3.2-r2.tar.gz
64 mISDN-1_1_5.tar.gz = $(URL_IPFIRE)/mISDN-1_1_5.tar.gz
65 openswan-2.4.9.tar.gz = $(URL_IPFIRE)/openswan-2.4.9.tar.gz
66
67 $(DL_FILE)_MD5 = 9885a7f67480b5a75ed80c06b1906874
68 patch-o-matic-ng-20061210.tar.bz2_MD5 = 76edac76301b45f89e467b41c8cf4393
69 iptables-1.3.5.tar.bz2_MD5 = 00fb916fa8040ca992a5ace56d905ea5
70 netfilter-layer7-v2.9.tar.gz_MD5 = ebf9043a5352ebe6dbd721989ef83dee
71 patch-2.6.16-nath323-1.3.bz2_MD5 = f926409ff703a307baf54b57ab75d138
72 squashfs3.2-r2.tar.gz_MD5 = bf360b92eba9e6d5610196ce2e02fcd1
73 mISDN-1_1_5.tar.gz_MD5 = 93b1cff7817b82638a0475c2b7b7f1b6
74 openswan-2.4.9.tar.gz_MD5 = 845f12d80d443cfa1a52f2b53b987bee
75
76 install : $(TARGET)
77
78 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
79
80 download :$(patsubst %,$(DIR_DL)/%,$(objects))
81
82 md5 : $(subst %,%_MD5,$(objects))
83
84 ###############################################################################
85 # Downloading, checking, md5sum
86 ###############################################################################
87
88 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
89 @$(CHECK)
90
91 $(patsubst %,$(DIR_DL)/%,$(objects)) :
92 @$(LOAD)
93
94 $(subst %,%_MD5,$(objects)) :
95 @$(MD5)
96
97 ###############################################################################
98 # Installation Details
99 ###############################################################################
100
101 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
102 @$(PREBUILD)
103 @rm -rf $(DIR_APP) $(DIR_SRC)/linux $(DIR_SRC)/xen-* && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
104 ln -s linux-$(VER) /usr/src/linux
105
106 # An UTF8 patch from LFS
107 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.16.27-utf8_input-1.patch
108
109 # Openswan 2
110 cd $(DIR_SRC) && rm -rf openswan-*
111 cd $(DIR_SRC) && tar xfz $(DIR_DL)/openswan-2.4.9.tar.gz
112 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/openswan-2.4.9.kernel-2.6-klips.patch
113 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/openswan-2.4.9.kernel-2.6-natt.patch
114
115 cd $(DIR_SRC)/openswan-* && sed -i -e 's/INC_USRLOCAL=\/usr\/local/INC_USRLOCAL=\/usr/' Makefile.inc
116
117 # H323 conntrack
118 cd $(DIR_APP) && bunzip2 -cd $(DIR_DL)/patch-2.6.16-nath323-1.3.bz2 | patch -Np1
119
120 # Reiser4
121 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/reiser4-for-2.6.16-5.patch
122
123 # SquashFS
124 cd $(DIR_SRC) && rm -rf squashfs*
125 cd $(DIR_SRC) && tar xfz $(DIR_DL)/squashfs3.2-r2.tar.gz
126 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/squashfs3.2-r2/kernel-patches/linux-2.6.16/squashfs3.2-patch
127
128 # ip_conntrack permissions from 440 to 444
129 cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/ip_conntrack_standalone-patch-for-ipfire.patch
130
131 # Some VIA patches
132 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/padlock-prereq-2.6.16.diff
133 cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/epia_dma.patch
134
135 # Patch-o-matic
136 cd $(DIR_SRC) && rm -rf iptables-* patch-o-matic*
137 cd $(DIR_SRC) && tar xfj $(DIR_DL)/iptables-1.3.5.tar.bz2
138 cd $(DIR_SRC) && ln -sf iptables-1.3.5 iptables
139 cd $(DIR_SRC) && tar xfj $(DIR_DL)/patch-o-matic-ng-20061210.tar.bz2
140 cd $(DIR_SRC)/patch-o-matic-ng* && \
141 ./runme --batch --kernel-path=$(ROOT)/usr/src/$(THISAPP)/ \
142 --iptables-path=$(ROOT)/usr/src/iptables/ \
143 sip-conntrack-nat rtsp-conntrack-nat \
144 mms-conntrack-nat
145
146 # Layer7-patch
147 cd $(DIR_SRC) && rm -rf $(DIR_SRC)/netfilter-layer7-v2.9
148 cd $(DIR_SRC) && tar xzf $(DIR_DL)/netfilter-layer7-v2.9.tar.gz
149 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/netfilter-layer7-v2.9/for_older_kernels/kernel-2.6.13-2.6.16-layer7-2.2.patch
150
151 # Linux Intermediate Queueing Device
152 ifeq "$(XEN)" ""
153 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.16-imq2.diff
154 endif
155
156 # mISDN
157 cd $(DIR_SRC) && rm -rf mISDN-*
158 cd $(DIR_SRC) && tar xfz $(DIR_DL)/mISDN-1_1_5.tar.gz
159 cd $(DIR_SRC)/mISDN-1_1_5 && yes 'yes' | ./std2kern -k /usr/src/linux
160
161 cd $(DIR_APP)/drivers/isdn/hardware/mISDN && patch -Np0 < $(DIR_SRC)/src/patches/mISDN-avmfritz.patch
162
163 ifeq "$(SMP)" ""
164 # Only do this once on the non-SMP pass
165 cd $(DIR_SRC) && tar czf $(DIR_DL)/iptables-fixed.tar.gz iptables-1.3.5
166 endif
167
168 # Cleanup kernel source
169 cd $(DIR_APP) && make mrproper
170
171 ifeq "$(SMP)" "1"
172 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE).smp $(DIR_APP)/.config
173 else
174 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE) $(DIR_APP)/.config
175 endif
176
177 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
178 cd $(DIR_APP) && make CC="$(KGCC)" clean
179
180 ifeq "$(SMP)" "1"
181 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-ipfire-smp/' Makefile
182 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
183 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-ipfire-smp
184 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-ipfire-smp
185 ln -sf vmlinuz-$(VER)-ipfire-smp /boot/vmlinuz-ipfire-smp
186 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
187 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
188 else
189 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-ipfire/' Makefile
190 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
191 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-ipfire
192 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-ipfire
193 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-ipfire
194 ln -sf vmlinuz-$(VER)-ipfire /boot/vmlinuz-ipfire
195 ln -sf System.map-$(VER)-ipfire /boot/System.map-ipfire
196 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
197 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
198 endif
199
200 ifeq "$(SMP)" ""
201 # Only do this once on the non-SMP pass
202 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
203 endif
204
205 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/mISDN-* $(DIR_SRC)/netfilter-layer7-*
206 @$(POSTBUILD)