Fix mISDN build
[people/pmueller/ipfire-2.x.git] / lfs / linux
CommitLineData
df5e82b3 1###############################################################################
df5e82b3 2# #
70df8302
MT
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 #
df5e82b3 7# it under the terms of the GNU General Public License as published by #
70df8302 8# the Free Software Foundation, either version 3 of the License, or #
df5e82b3
MT
9# (at your option) any later version. #
10# #
70df8302 11# This program is distributed in the hope that it will be useful, #
df5e82b3
MT
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 #
70df8302 17# along with this program. If not, see <http://www.gnu.org/licenses/>. #
df5e82b3 18# #
df5e82b3
MT
19###############################################################################
20
21###############################################################################
22# Definitions
23###############################################################################
24
25include Config
26
6f876896
AF
27PATCHLEVEL = .21
28VER = 2.6.27.21
df5e82b3
MT
29
30THISAPP = linux-$(VER)
376e42ce 31DL_FILE = $(THISAPP).tar.bz2
a2cb3a33 32DL_FROM = $(URL_IPFIRE)
df5e82b3
MT
33DIR_APP = $(DIR_SRC)/$(THISAPP)
34CFLAGS =
35CXXFLAGS =
36
bd9921dd
MT
37ifeq "$(firstword $(MAKEFILES))" "linux-xen"
38 XEN=1
39endif
40
41# Normal build or XEN build.
df5e82b3 42#
bd9921dd
MT
43ifeq "$(XEN)" "1"
44 TARGET = $(DIR_INFO)/linux-$(VER)-xen
3a1019f6 45else
376e42ce 46 TARGET = $(DIR_INFO)/linux-$(VER)
df5e82b3 47endif
6230f0da 48
df5e82b3
MT
49###############################################################################
50# Top-level Rules
51###############################################################################
52objects =$(DL_FILE) \
9c534116 53 squashfs3.4.tar.gz \
d1fd2b03 54 netfilter-layer7-v2.21.tar.gz \
f418a984 55 patch-2.6.16-nath323-1.3.bz2 \
a3b414d3 56 reiser4-for-2.6.27.19.patch.bz2
38f05351 57
64cf4991 58$(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
d1fd2b03 59netfilter-layer7-v2.21.tar.gz = $(URL_IPFIRE)/netfilter-layer7-v2.21.tar.gz
4ce37908 60patch-2.6.16-nath323-1.3.bz2 = $(URL_IPFIRE)/patch-2.6.16-nath323-1.3.bz2
9c534116 61squashfs3.4.tar.gz = $(URL_IPFIRE)/squashfs3.4.tar.gz
a3b414d3 62reiser4-for-2.6.27.19.patch.bz2 = $(URL_IPFIRE)/reiser4-for-2.6.27.19.patch.bz2
4ce37908 63
6f876896 64$(DL_FILE)_MD5 = 2912af7938fae1a3f2a9a6bcf8c0009f
d1fd2b03 65netfilter-layer7-v2.21.tar.gz_MD5 = 838422e7d9a06b42e682e9064e5210b5
3185932e 66patch-2.6.16-nath323-1.3.bz2_MD5 = f926409ff703a307baf54b57ab75d138
9c534116 67squashfs3.4.tar.gz_MD5 = 2a4d2995ad5aa6840c95a95ffa6b1da6
a3b414d3 68reiser4-for-2.6.27.19.patch.bz2_MD5 = 22988387f64f299489b90b484b2642cc
df5e82b3
MT
69
70install : $(TARGET)
71
72check : $(patsubst %,$(DIR_CHK)/%,$(objects))
73
74download :$(patsubst %,$(DIR_DL)/%,$(objects))
75
76md5 : $(subst %,%_MD5,$(objects))
77
f418a984
AF
78dist:
79 @$(PAK)
df5e82b3
MT
80###############################################################################
81# Downloading, checking, md5sum
82###############################################################################
83
84$(patsubst %,$(DIR_CHK)/%,$(objects)) :
85 @$(CHECK)
86
87$(patsubst %,$(DIR_DL)/%,$(objects)) :
88 @$(LOAD)
89
90$(subst %,%_MD5,$(objects)) :
91 @$(MD5)
92
93###############################################################################
94# Installation Details
95###############################################################################
96
97$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
98 @$(PREBUILD)
f418a984 99 @rm -rf $(DIR_APP) $(DIR_SRC)/linux $(DIR_SRC)/xen-* && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
8eec2184 100 ln -s linux-$(VER) /usr/src/linux
3a1019f6 101
bd9921dd
MT
102 # Linux Intermediate Queueing Device
103 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.27-imq.patch
104
105 # Xen
106ifeq "$(XEN)" "1"
107 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60000_add-console-use-vt.patch1
108 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60001_linux-2.6.19-rc1-kexec-move_segment_code-i386.patch1
109 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60002_linux-2.6.19-rc1-kexec-move_segment_code-x86_64.patch1
110 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60003_ipv6-no-autoconf.patch1
111 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60004_pci-reassign-resources.patch1
112 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60005_sfc-driverlink.patch1
113 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60006_sfc-resource-driver.patch1
114 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60007_sfc-driverlink-conditional.patch1
115 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60008_xen3-auto-xen-arch.patch1
116 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60009_xen3-auto-xen-drivers.patch1
117 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60010_xen3-auto-include-xen-interface.patch1
118 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60011_xen3-auto-xen-kconfig.patch1
119 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/xen_aio.diff
120 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/skbuff-xen-imq.diff
121 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60012_xen3-auto-common.patch1
122 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60013_xen3-auto-arch-x86.patch1
123 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60014_xen3-auto-arch-i386.patch1
124 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60015_xen3-auto-arch-x86_64.patch1
125 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60016_xen3-fixup-xen.patch1
126 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60017_735-balloon-exit.patch1
127 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60018_737-kexec-free.patch1
128 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60019_740-blkback-resource-leak.patch1
129 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60020_746-pirq-status-page.patch1
130 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60021_747-x86-undo-mfn-limit.patch1
131 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60022_748-x86-ioapic-cleanup.patch1
132 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60023_xen3-fixup-kconfig.patch1
133 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60024_xen3-fixup-common.patch1
134 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60025_xen3-fixup-arch-x86.patch1
135 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60026_xen3-fixup-sfc.patch1
136 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60027_xen3-patch-2.6.18.patch1
137 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60028_xen3-patch-2.6.19.patch1
138 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60029_xen3-patch-2.6.20.patch1
139 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60030_xen3-patch-2.6.21.patch1
140 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60031_xen3-patch-2.6.22.patch1
141 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60032_xen3-patch-2.6.23.patch1
142 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60033_xen3-patch-2.6.24.patch1
143 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60034_xen3-patch-2.6.25.patch1
144 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60035_xen3-patch-2.6.26.patch1
145 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60036_xen3-patch-2.6.27.patch1
146 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60037_xen3-patch-2.6.27.1-2.patch1
147 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60038_xen3-patch-2.6.27.3-4.patch1
148 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60039_xen3-patch-2.6.27.4-5.patch1
149 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60040_xen3-patch-2.6.27.5-6.patch1
150 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60041_xen3-panic-on-io-nmi.patch1
151 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60042_xen-balloon-max-target.patch1
152 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60043_xen-blkback-cdrom.patch1
153 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60044_xen-blktap-write-barriers.patch1
154 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60045_xen-scsifront-block-timeout-update.patch1
155 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60046_xen-op-packet.patch1
156 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60047_xen-blkfront-cdrom.patch1
157 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60048_xen-sections.patch1
158 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60049_xen-kconfig-compat-3.2.0.patch1
159 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60050_xen-cpufreq-report.patch1
160 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60051_xen-rt2860-build.patch1
161 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60052_xen-sysdev-suspend.patch1
162 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60053_xen-ipi-per-cpu-irq.patch1
163 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60054_xen-virq-per-cpu-irq.patch1
164 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60055_xen-configurable-guest-devices.patch1
165 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60056_xen-netback-nr-irqs.patch1
166 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60057_xen-netback-notify-multi.patch1
167 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60058_xen-x86-panic-no-reboot.patch1
168 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60059_xen-x86-dcr-fallback.patch1
169 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60060_xen-x86-consistent-nmi.patch1
170 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60061_xen-x86-no-lapic.patch1
171 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60062_xen-x86-pmd-handling.patch1
172 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60063_xen-x86-bigmem.patch1
173 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60064_xen-x86-machphys-prediction.patch1
174 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60065_xen-x86-no-lazy-tlb.patch1
175 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60066_xen-x86-exit-mmap.patch1
176 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60067_xen-i386-panic-on-oops.patch1
177 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60068_xen-x86_64-pgd-pin.patch1
178 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60069_xen-x86_64-pgd-alloc-order.patch1
179 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/60070_xen-x86_64-dump-user-pgt.patch1
180endif
181
f418a984
AF
182 # Not report deprecated syscall 1.23 (for kudzu)
183 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.25.18-not_report_sysctl_1.23.patch
184
45ff5fa6 185 # Openswan
e4766bc5 186 #cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/openswan-2.4.x.kernel-2.6.23-natt.patch
ac1cfefa 187
44254afd 188 # Reiser4
a3b414d3 189 cd $(DIR_APP) && bzip2 -d -c $(DIR_DL)/reiser4-for-2.6.27.19.patch.bz2 | patch -Np1
f418a984 190
3185932e
MT
191 # SquashFS
192 cd $(DIR_SRC) && rm -rf squashfs*
9c534116 193 cd $(DIR_SRC) && tar xfz $(DIR_DL)/squashfs3.4.tar.gz
a3b414d3
AF
194 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/squashfs3.4/kernel-patches/linux-2.6.27-rc4/squashfs3.4-patch
195
196 # ip_conntrack permissions from 440 to 444
197# cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/ip_conntrack_standalone-patch-for-ipfire.patch
89069053 198
4f1b7a27 199 # ipp2p 0.8.2-pomng
a3b414d3 200 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.27.19-ipp2p-0.8.2-pomng.patch
4f1b7a27 201
3a1019f6 202 # Layer7-patch
d1fd2b03
AF
203 cd $(DIR_SRC) && rm -rf $(DIR_SRC)/netfilter-layer7-v2.21
204 cd $(DIR_SRC) && tar xzf $(DIR_DL)/netfilter-layer7-v2.21.tar.gz
205 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/netfilter-layer7-v2.21/kernel-2.6.25-2.6.28-layer7-2.21.patch
df5e82b3 206
df5e82b3
MT
207 # Cleanup kernel source
208 cd $(DIR_APP) && make mrproper
3a1019f6 209
bd9921dd
MT
210ifeq "$(XEN)" "1"
211 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-xen $(DIR_APP)/.config
6230f0da
MT
212else
213 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE) $(DIR_APP)/.config
bd9921dd 214 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
df5e82b3 215endif
df5e82b3 216
df5e82b3 217 cd $(DIR_APP) && make CC="$(KGCC)" clean
3a1019f6 218
bd9921dd
MT
219ifeq "$(XEN)" "1"
220 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-ipfire-xen/' Makefile
221 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)"
222 cd $(DIR_APP) && cp -v vmlinux /boot/vmlinuz-$(VER)-ipfire-xen
223 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-ipfire-xen
224 ln -sf vmlinuz-$(VER)-ipfire-xen /boot/vmlinuz-ipfire-xen
376e42ce
MT
225 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
226 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
a3b414d3 227 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
376e42ce
MT
228else
229 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-ipfire/' Makefile
872e5216
MT
230 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
231 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-ipfire
376e42ce
MT
232 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-ipfire
233 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-ipfire
89069053 234 ln -sf vmlinuz-$(VER)-ipfire /boot/vmlinuz-ipfire
63817c2a 235 ln -sf System.map-$(VER)-ipfire /boot/System.map-ipfire
376e42ce
MT
236 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
237 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
a3b414d3 238 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
df5e82b3 239endif
376e42ce 240
bd9921dd
MT
241ifeq "$(XEN)" ""
242 # Only do this once on the non-XEN pass
81e974f3 243 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
ee78a5ef
MT
244endif
245
bd9921dd
MT
246ifeq "$(XEN)" "1"
247 # Rename ide-cd module to match with old kernel
248 mv /lib/modules/$(VER)-ipfire-xen/kernel/drivers/ide/ide-cd_mod.ko \
249 /lib/modules/$(VER)-ipfire-xen/kernel/drivers/ide/ide-cd.ko
250
251 # Remove mISDN modules
252 rm -rvf /lib/modules/$(VER)-ipfire-xen/kernel/drivers/isdn/mISDN
253 rm -rvf /lib/modules/$(VER)-ipfire-xen/kernel/drivers/isdn/hardware/mISDN
254else
f418a984
AF
255 # Rename ide-cd module to match with old kernel
256 mv /lib/modules/$(VER)-ipfire/kernel/drivers/ide/ide-cd_mod.ko \
257 /lib/modules/$(VER)-ipfire/kernel/drivers/ide/ide-cd.ko
258
d644d86f 259 # Remove mISDN modules
bd9921dd
MT
260 rm -rvf /lib/modules/$(VER)-ipfire/kernel/drivers/isdn/mISDN
261 rm -rvf /lib/modules/$(VER)-ipfire/kernel/drivers/isdn/hardware/mISDN
262endif
d644d86f
AF
263
264 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
df5e82b3 265 @$(POSTBUILD)