616241ca12a3cfce19377e6928061f63a947e23c
[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 PATCHLEVEL = .42
30 VER = 2.6.16.42
31
32 THISAPP = linux-$(VER)
33 DL_FILE = $(THISAPP).tar.bz2
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-$(VER)-smp
43 else
44 TARGET = $(DIR_INFO)/linux-$(VER)
45 endif
46
47 ###############################################################################
48 # Top-level Rules
49 ###############################################################################
50 objects =$(DL_FILE) \
51 mISDN-CVS-2007-01-26.tar.bz2 \
52 squashfs3.2-r2.tar.gz \
53 iptables-1.3.5.tar.bz2 \
54 patch-o-matic-ng-20061210.tar.bz2 \
55 netfilter-layer7-v2.9.tar.gz \
56 patch-2.6.16-nath323-1.3.bz2
57
58 $(DL_FILE) = $(DL_FROM)/$(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-CVS-2007-01-26.tar.bz2 = $(URL_IPFIRE)/mISDN-CVS-2007-01-26.tar.bz2
65
66 $(DL_FILE)_MD5 = 87e998bb87839b962702815dd5aecc73
67 patch-o-matic-ng-20061210.tar.bz2_MD5 = 76edac76301b45f89e467b41c8cf4393
68 iptables-1.3.5.tar.bz2_MD5 = 00fb916fa8040ca992a5ace56d905ea5
69 netfilter-layer7-v2.9.tar.gz_MD5 = ebf9043a5352ebe6dbd721989ef83dee
70 patch-2.6.16-nath323-1.3.bz2_MD5 = f926409ff703a307baf54b57ab75d138
71 squashfs3.2-r2.tar.gz_MD5 = bf360b92eba9e6d5610196ce2e02fcd1
72 mISDN-CVS-2007-01-26.tar.bz2_MD5 = 844c70dc851faffcae7549fd738c7b49
73
74 install : $(TARGET)
75
76 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
77
78 download :$(patsubst %,$(DIR_DL)/%,$(objects))
79
80 md5 : $(subst %,%_MD5,$(objects))
81
82 ###############################################################################
83 # Downloading, checking, md5sum
84 ###############################################################################
85
86 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
87 @$(CHECK)
88
89 $(patsubst %,$(DIR_DL)/%,$(objects)) :
90 @$(LOAD)
91
92 $(subst %,%_MD5,$(objects)) :
93 @$(MD5)
94
95 ###############################################################################
96 # Installation Details
97 ###############################################################################
98
99 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
100 @$(PREBUILD)
101 @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
102 ln -s linux-$(VER) /usr/src/linux
103
104 # Openswan 2
105 cd $(DIR_SRC) && rm -rf openswan-*
106 cd $(DIR_SRC) && tar xfvz $(DIR_DL)/openswan-2.4.8rc1.tar.gz
107 #cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/openswan26_netkey.patch
108 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/openswan-2.4.8rc1.kernel-2.6-natt.patch
109 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/openswan-2.4.8rc1.kernel-2.6-klips.patch
110
111
112 cd $(DIR_SRC)/openswan-* && sed -i -e 's/INC_USRLOCAL=\/usr\/local/INC_USRLOCAL=\/usr/' Makefile.inc
113
114 # H323 conntrack
115 cd $(DIR_APP) && bunzip2 -cd $(DIR_DL)/patch-2.6.16-nath323-1.3.bz2 | patch -Np1
116
117 # Reiser4
118 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/reiser4-for-2.6.16-5.patch
119
120 # SquashFS
121 cd $(DIR_SRC) && rm -rf squashfs*
122 cd $(DIR_SRC) && tar xfz $(DIR_DL)/squashfs3.2-r2.tar.gz
123 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/squashfs3.2-r2/kernel-patches/linux-2.6.16/squashfs3.2-patch
124
125 # Patch-o-matic
126 cd $(DIR_SRC) && rm -rf iptables-* patch-o-matic*
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) && tar xfj $(DIR_DL)/patch-o-matic-ng-20061210.tar.bz2
130 cd $(DIR_SRC)/patch-o-matic-ng* && \
131 ./runme --batch --kernel-path=$(ROOT)/usr/src/$(THISAPP)/ \
132 --iptables-path=$(ROOT)/usr/src/iptables/ \
133 sip-conntrack-nat rtsp-conntrack-nat \
134 mms-conntrack-nat
135
136 # Layer7-patch
137 cd $(DIR_SRC) && rm -rf $(DIR_SRC)/netfilter-layer7-v2.9
138 cd $(DIR_SRC) && tar xzf $(DIR_DL)/netfilter-layer7-v2.9.tar.gz
139 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
140
141 # Linux Intermediate Queueing Device
142 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.16-imq2.diff
143
144 # ip_conntrack permissions from 440 to 444
145 cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/ip_conntrack_standalone-patch-for-ipfire.patch
146
147 # mISDN
148 cd $(DIR_SRC) && rm -rf mISDN-*
149 cd $(DIR_SRC) && tar xfj $(DIR_DL)/mISDN-CVS-2007-01-26.tar.bz2
150 cd $(DIR_SRC)/mISDN-CVS-2007-01-26 && yes 'yes' | ./std2kern -k /usr/src/linux
151
152 ifeq "$(SMP)" ""
153 # Only do this once on the non-SMP pass
154 cd $(DIR_SRC) && tar czf $(DIR_DL)/iptables-fixed.tar.gz iptables-1.3.5
155 endif
156
157 # Bootsplash
158 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/bootsplash-3.1.6-2.6.15.diff
159
160 # Cleanup kernel source
161 cd $(DIR_APP) && make mrproper
162
163 ifeq "$(SMP)" ""
164 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE) $(DIR_APP)/.config
165 endif
166 ifeq "$(SMP)" "1"
167 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE).smp $(DIR_APP)/.config
168 endif
169
170 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
171 cd $(DIR_APP) && make CC="$(KGCC)" clean
172
173 ifeq "$(SMP)" "1"
174 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-ipfire-smp/' Makefile
175 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
176 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-ipfire-smp
177 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-ipfire-smp
178 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-ipfire
179 ln -sf vmlinuz-$(VER)-ipfire-smp /boot/vmlinuz-ipfire-smp
180 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
181 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
182 mkdir -p /usr/src/openswan-2.4.8rc1/modobj26/null
183 cd $(DIR_SRC)/openswan-* && make KERNELSRC=/usr/src/$(THISAPP) CC=$(CC) module
184 cd $(DIR_SRC)/openswan-* && make KERNELSRC=/usr/src/$(THISAPP) CC=$(CC) minstall
185 else
186 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-ipfire/' Makefile
187 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
188 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-ipfire
189 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-ipfire
190 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-ipfire
191 ln -sf vmlinuz-$(VER)-ipfire /boot/vmlinuz-ipfire
192 ln -sf System.map-$(VER)-ipfire /boot/System.map-ipfire
193 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
194 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
195 mkdir -p /usr/src/openswan-2.4.8rc1/modobj26/null
196 cd $(DIR_SRC)/openswan-* && make KERNELSRC=/usr/src/$(THISAPP) CC=$(CC) module
197 cd $(DIR_SRC)/openswan-* && make KERNELSRC=/usr/src/$(THISAPP) CC=$(CC) minstall
198 endif
199
200 # remove symlinked pcmcia directory
201 -rm -rf /lib/modules/$(VER)-ipfire{,-smp}/pcmcia
202
203 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/mISDN-* $(DIR_SRC)/netfilter-layer7-*
204 @$(POSTBUILD)