dhcp: fix build with linux3.x.
[people/teissler/ipfire-2.x.git] / lfs / linux
CommitLineData
df5e82b3 1###############################################################################
df5e82b3 2# #
70df8302 3# IPFire.org - A linux based firewall #
524ba44a 4# Copyright (C) 2007-2012 IPFire Team <info@ipfire.org> #
70df8302
MT
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
903d87f4
AF
27PATCHLEVEL = .59
28VER = 2.6.32.59
df5e82b3
MT
29
30THISAPP = linux-$(VER)
524ba44a 31DL_FILE = $(THISAPP).tar.bz2
a2cb3a33 32DL_FROM = $(URL_IPFIRE)
df5e82b3
MT
33DIR_APP = $(DIR_SRC)/$(THISAPP)
34CFLAGS =
35CXXFLAGS =
36
524ba44a 37PAK_VER = 20
acdf0e61 38DEPS = ""
bd9921dd
MT
39
40# Normal build or XEN build.
df5e82b3 41#
b0d0b681 42
fdf0c7c1 43VERSUFIX=ipfire$(KCFG)
b0d0b681 44
51f9e7ac
MT
45ifeq "$(HEADERS)" "1"
46ifeq "$(TOOLS)" "1"
47 TARGET = $(DIR_INFO)/linux-libc-headers-$(VER)-$(VERSUFIX)-tools
48 HEADERS_PREFIX = /tools
49else
50 TARGET = $(DIR_INFO)/linux-libc-headers-$(VER)-$(VERSUFIX)
51 HEADERS_PREFIX = /usr
52endif
53else
54 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
55endif
56
cc72d5cb 57ifeq "$(MACHINE_TYPE)" "arm"
51f9e7ac
MT
58 HEADERS_ARCH=arm
59else
60 HEADERS_ARCH=x86
61endif
6230f0da 62
bc8fe5ff
AF
63ifeq "$(KCFG)" ""
64LASTKERNEL=1
65endif
66ifeq "$(KCFG)" "-kirkwood"
67LASTKERNEL=1
68endif
69
df5e82b3
MT
70###############################################################################
71# Top-level Rules
72###############################################################################
73objects =$(DL_FILE) \
b0d0b681 74 netfilter-layer7-v2.22.tar.gz \
f418a984 75 patch-2.6.16-nath323-1.3.bz2 \
b0d0b681 76 reiser4-for-2.6.32.patch.bz2 \
ac7cb03f 77 xen-patches-2.6.32-2f.tar.bz2
e69f1bf2 78
64cf4991 79$(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
9b16f056 80netfilter-layer7-v2.22.tar.gz = $(URL_IPFIRE)/netfilter-layer7-v2.22.tar.gz
4ce37908 81patch-2.6.16-nath323-1.3.bz2 = $(URL_IPFIRE)/patch-2.6.16-nath323-1.3.bz2
b0d0b681 82reiser4-for-2.6.32.patch.bz2 = $(URL_IPFIRE)/reiser4-for-2.6.32.patch.bz2
ac7cb03f 83xen-patches-2.6.32-2f.tar.bz2 = $(URL_IPFIRE)/xen-patches-2.6.32-2f.tar.bz2
e69f1bf2 84
903d87f4 85$(DL_FILE)_MD5 = 69c68c4a8eb0f04b051a7dbcff16f6d0
b0d0b681 86netfilter-layer7-v2.22.tar.gz_MD5 = 98dff8a3d5a31885b73341633f69501f
3185932e 87patch-2.6.16-nath323-1.3.bz2_MD5 = f926409ff703a307baf54b57ab75d138
b0d0b681 88reiser4-for-2.6.32.patch.bz2_MD5 = 3246397973d9271eb8e6d7c97c5d2d91
ac7cb03f 89xen-patches-2.6.32-2f.tar.bz2_MD5 = b59d6f89e11accb9d40354418e13f31b
df5e82b3
MT
90
91install : $(TARGET)
92
93check : $(patsubst %,$(DIR_CHK)/%,$(objects))
94
95download :$(patsubst %,$(DIR_DL)/%,$(objects))
96
97md5 : $(subst %,%_MD5,$(objects))
98
f418a984
AF
99dist:
100 @$(PAK)
df5e82b3
MT
101###############################################################################
102# Downloading, checking, md5sum
103###############################################################################
104
105$(patsubst %,$(DIR_CHK)/%,$(objects)) :
106 @$(CHECK)
107
108$(patsubst %,$(DIR_DL)/%,$(objects)) :
109 @$(LOAD)
110
111$(subst %,%_MD5,$(objects)) :
112 @$(MD5)
113
114###############################################################################
115# Installation Details
116###############################################################################
117
118$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
119 @$(PREBUILD)
4cc53b4d 120 @rm -rf $(DIR_APP) $(DIR_SRC)/linux $(DIR_SRC)/linux-*-suse_xen_patches $(DIR_SRC)/xen-* && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
b0d0b681 121
51f9e7ac 122 ln -svf linux-$(VER) $(DIR_SRC)/linux
3a1019f6 123
fdf0c7c1 124ifeq "$(KCFG)" "-xen"
de167abd
AF
125 # Apply gentoo Xen patches
126 mkdir -p $(DIR_SRC)/xen-patches
ac7cb03f 127 cd $(DIR_SRC)/xen-patches && tar jxf $(DIR_DL)/xen-patches-2.6.32-2f.tar.bz2
de167abd 128
9898206e 129 for x in `ls -1 $(DIR_SRC)/xen-patches/*.patch1`; do \
de167abd 130 echo "*********** [Patch: $$x]"; \
9898206e 131 cd $(DIR_APP) && pwd && patch -Np1 < $$x || exit 1; \
de167abd
AF
132 done
133 rm -rf $(DIR_SRC)/xen-patches
0e717101 134
3c4d4ed0 135 # Linux Intermediate Queueing Device
0e717101 136 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.8-xen-imq-test2.patch
3c4d4ed0 137else
bd9921dd 138 # Linux Intermediate Queueing Device
b0d0b681 139 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32-imq-test2.patch
3c4d4ed0 140endif
bd9921dd 141
3c4d4ed0
AF
142 # Not report deprecated syscall 1.23 (for kudzu)
143 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.25.18-not_report_sysctl_1.23.patch
b0d0b681 144
0e717101
AF
145 # Reiser4 (don't check if fail (some patches are already in xen patchset)
146 -cd $(DIR_APP) && bzcat $(DIR_DL)/reiser4-for-2.6.32.patch.bz2 | patch -Np1
a3b414d3 147
4f1b7a27 148 # ipp2p 0.8.2-pomng
b0d0b681 149 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.8-ipp2p-0.8.2-pomng.patch
4f1b7a27 150
3a1019f6 151 # Layer7-patch
b0d0b681
AF
152 cd $(DIR_SRC) && rm -rf $(DIR_SRC)/netfilter-layer7-v2.22
153 cd $(DIR_SRC) && tar xzf $(DIR_DL)/netfilter-layer7-v2.22.tar.gz
154 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/netfilter-layer7-v2.22/kernel-2.6.25-2.6.28-layer7-2.22.patch
df5e82b3 155
f0ed79fb
MT
156 # Add some more LED triggers
157 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.11-netdev-1.patch
158
f17cac4a
AF
159 # Huawei Android Phones (Vodafone V845, T-Mobile Pulse/mini ...)
160 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.15-option_add_huawei_android.patch
161
87837787 162 # Fix uevent PHYSDEVDRIVER
9256a1df 163 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.27_ipg-fix-driver-name.patch
87837787 164 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.27_mcs7830-fix-driver-name.patch
9256a1df 165
903d87f4
AF
166 # Fix mv_cesa
167 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32-crypto-mv_cesa.patch
168
bc8fe5ff 169ifeq "$(KCFG)" "-kirkwood"
c05f6df0 170 # Add dreamplug,guruplug and icy 62x0 support on ARM-kirkwood
5ca1c0b9 171 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.57-arm_kirkwood_setups.patch
8e6fb99d
AF
172endif
173
7fbc483a
AF
174ifeq "$(MACHINE_TYPE)" "arm"
175 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.45_align_ssb_modtable_32bit_boundary.patch
176endif
8e6fb99d 177
51f9e7ac
MT
178ifeq "$(HEADERS)" "1"
179 # Install the header files
180 cd $(DIR_APP) && make ARCH=$(HEADERS_ARCH) INSTALL_HDR_PATH=dest headers_install
181 -mkdir -pv $(BUILDROOT)/$(HEADERS_PREFIX)/include
182 cd $(DIR_APP) && find dest/include \( -name .install -o -name ..install.cmd \) -delete
183 cd $(DIR_APP) && cp -rv dest/include/* $(BUILDROOT)/$(HEADERS_PREFIX)/include
184else
185
aa2049e5
MT
186 # Install ipfire logo
187 cd $(DIR_APP) && cp -vf $(DIR_SRC)/config/kernel/ipfire_logo.ppm \
188 drivers/video/logo/logo_linux_clut224.ppm
189
df5e82b3 190 # Cleanup kernel source
2b2e03ed 191 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config
bd9921dd 192 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
df5e82b3 193 cd $(DIR_APP) && make CC="$(KGCC)" clean
2b2e03ed 194 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-$(VERSUFIX)/' Makefile
3a1019f6 195
fdf0c7c1 196ifeq "$(KCFG)" "-xen"
3c4d4ed0
AF
197 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" vmlinuz
198 cd $(DIR_APP) && cp -v arch/i386/boot/vmlinuz /boot/vmlinuz-$(VER)-$(VERSUFIX)
199else
bc8fe5ff 200ifeq "$(KCFG)" "-kirkwood"
8e6fb99d
AF
201 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" uImage
202 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
bc8fe5ff
AF
203 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX)
204else
205ifeq "$(KCFG)" "-versatile"
206 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" zImage
207 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
92655908 208else
8e6fb99d 209 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
2b2e03ed 210 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
92655908 211endif
bc8fe5ff 212endif
3c4d4ed0 213endif
2b2e03ed
AF
214 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
215 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
216 ln -sf vmlinuz-$(VER)-$(VERSUFIX) /boot/vmlinuz-$(VERSUFIX)
217 ln -sf System.map-$(VER)-$(VERSUFIX) /boot/System.map-$(VERSUFIX)
376e42ce
MT
218 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
219 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
a3b414d3 220 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
376e42ce 221
bc8fe5ff
AF
222ifeq "$(LASTKERNEL)" "1"
223 # Only do this once
81e974f3 224 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
d644d86f 225
efa8b615 226 # Blacklist matroxfb_base
e2e106be 227 echo "blacklist matroxfb_base" >> /etc/modprobe.d/framebuffer
aa1dd878 228 # Blacklist old framebuffer modules
030a57c5
AF
229 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video -name *fb.ko); do \
230 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer ; \
231 done
aa1dd878
AF
232 # Blacklist new drm framebuffer modules
233 for f in $$(ls -1 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm/*/*.ko); do \
234 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer ; \
235 done
6886b70c 236 sed -i -e "s|.ko||g" /etc/modprobe.d/framebuffer
e2e106be
AF
237
238 # Blacklist isdn modules
239 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn -name *.ko); do \
240 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/isdn ; \
241 done
b29c22a4 242 sed -i -e "s|.ko||g" /etc/modprobe.d/isdn
78a51aaf
AF
243
244 # Disable ipv6 at runtime
245 echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6
26c1cc71
AF
246endif
247
248 # Remove mISDN modules
249 rm -rvf /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn/mISDN
250 rm -rvf /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn/hardware/mISDN
030a57c5 251
cc72d5cb 252ifneq "$(MACHINE_TYPE)" "arm"
8885467f
AF
253 # Disable geode_aes modul
254 mv /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/crypto/geode-aes.ko \
255 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/crypto/geode-aes.ko.off
2f5e1d43 256endif
51f9e7ac 257endif
8885467f 258
d644d86f 259 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
df5e82b3 260 @$(POSTBUILD)