Kernel update (2.6.32.18).
[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 = .18
28 VER = 2.6.32.18
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 PROG = linux-xen
38 PAK_VER = 11
39 DEPS = ""
40
41 # Normal build or XEN build.
42 #
43
44 ifeq "$(XEN)" "1"
45 VERSUFIX=ipfire-xen
46 else
47 VERSUFIX=ipfire
48 endif
49
50 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
51
52 ###############################################################################
53 # Top-level Rules
54 ###############################################################################
55 objects =$(DL_FILE) \
56 netfilter-layer7-v2.22.tar.gz \
57 patch-2.6.16-nath323-1.3.bz2 \
58 reiser4-for-2.6.32.patch.bz2 \
59 squashfs-lzma-linux-2.6.32-kernel-patches.tar.bz2 \
60 xen-patches-2.6.32-2a.tar.bz2
61
62 $(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
63 netfilter-layer7-v2.22.tar.gz = $(URL_IPFIRE)/netfilter-layer7-v2.22.tar.gz
64 patch-2.6.16-nath323-1.3.bz2 = $(URL_IPFIRE)/patch-2.6.16-nath323-1.3.bz2
65 reiser4-for-2.6.32.patch.bz2 = $(URL_IPFIRE)/reiser4-for-2.6.32.patch.bz2
66 squashfs-lzma-linux-2.6.32-kernel-patches.tar.bz2 = $(URL_IPFIRE)/squashfs-lzma-linux-2.6.32-kernel-patches.tar.bz2
67 xen-patches-2.6.32-2a.tar.bz2 = $(URL_IPFIRE)/xen-patches-2.6.32-2a.tar.bz2
68
69 $(DL_FILE)_MD5 = 8c8b82d4bf607ddb233deaf7f1c44f0f
70 netfilter-layer7-v2.22.tar.gz_MD5 = 98dff8a3d5a31885b73341633f69501f
71 patch-2.6.16-nath323-1.3.bz2_MD5 = f926409ff703a307baf54b57ab75d138
72 reiser4-for-2.6.32.patch.bz2_MD5 = 3246397973d9271eb8e6d7c97c5d2d91
73 squashfs-lzma-linux-2.6.32-kernel-patches.tar.bz2_MD5 = d2a84311081023c7ffd28cdca67c45d4
74 xen-patches-2.6.32-2a.tar.bz2_MD5 = bccb78b9712cb538c6ddadff1dae0ddc
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 dist:
85 @$(PAK)
86 ###############################################################################
87 # Downloading, checking, md5sum
88 ###############################################################################
89
90 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
91 @$(CHECK)
92
93 $(patsubst %,$(DIR_DL)/%,$(objects)) :
94 @$(LOAD)
95
96 $(subst %,%_MD5,$(objects)) :
97 @$(MD5)
98
99 ###############################################################################
100 # Installation Details
101 ###############################################################################
102
103 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
104 @$(PREBUILD)
105 @rm -rf $(DIR_APP) $(DIR_SRC)/linux $(DIR_SRC)/linux-*-suse_xen_patches $(DIR_SRC)/xen-* && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
106
107 ln -s linux-$(VER) /usr/src/linux
108
109 ifeq "$(XEN)" "1"
110 # Apply gentoo Xen patches
111 mkdir -p $(DIR_SRC)/xen-patches
112 cd $(DIR_SRC)/xen-patches && tar jxf $(DIR_DL)/xen-patches-2.6.32-2a.tar.bz2
113
114 for x in `ls -1 $(DIR_SRC)/xen-patches/*.patch1`; do \
115 echo "*********** [Patch: $$x]"; \
116 cd $(DIR_APP) && pwd && patch -Np1 < $$x || exit 1; \
117 done
118 rm -rf $(DIR_SRC)/xen-patches
119
120 # Linux Intermediate Queueing Device
121 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.8-xen-imq-test2.patch
122 else
123 # Linux Intermediate Queueing Device
124 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32-imq-test2.patch
125 endif
126
127 # Not report deprecated syscall 1.23 (for kudzu)
128 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.25.18-not_report_sysctl_1.23.patch
129
130 # Reiser4 (don't check if fail (some patches are already in xen patchset)
131 -cd $(DIR_APP) && bzcat $(DIR_DL)/reiser4-for-2.6.32.patch.bz2 | patch -Np1
132
133 # ipp2p 0.8.2-pomng
134 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.8-ipp2p-0.8.2-pomng.patch
135
136 # Layer7-patch
137 cd $(DIR_SRC) && rm -rf $(DIR_SRC)/netfilter-layer7-v2.22
138 cd $(DIR_SRC) && tar xzf $(DIR_DL)/netfilter-layer7-v2.22.tar.gz
139 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/netfilter-layer7-v2.22/kernel-2.6.25-2.6.28-layer7-2.22.patch
140
141 # Squashfs LZMA support
142 cd $(DIR_APP) && bzcat $(DIR_DL)/squashfs-lzma-linux-2.6.32-kernel-patches.tar.bz2 | patch -Np1
143
144 # Add some more LED triggers
145 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.11-netdev-1.patch
146
147 # Huawei (Vodafone) K3765 & K4505 Usbids
148 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.11-option_add_vodafone_usbids.patch
149
150 # Huawei Android Phones (Vodafone V845, T-Mobile Pulse/mini ...)
151 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.15-option_add_huawei_android.patch
152
153 # Cleanup kernel source
154
155 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config
156 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
157 cd $(DIR_APP) && make CC="$(KGCC)" clean
158 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-$(VERSUFIX)/' Makefile
159
160 ifeq "$(XEN)" "1"
161 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" vmlinuz
162 cd $(DIR_APP) && cp -v arch/i386/boot/vmlinuz /boot/vmlinuz-$(VER)-$(VERSUFIX)
163 else
164 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
165 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
166 endif
167 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
168 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
169 ln -sf vmlinuz-$(VER)-$(VERSUFIX) /boot/vmlinuz-$(VERSUFIX)
170 ln -sf System.map-$(VER)-$(VERSUFIX) /boot/System.map-$(VERSUFIX)
171 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
172 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
173 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
174
175 ifeq "$(XEN)" ""
176 # Only do this once on the non-XEN pass
177 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
178 endif
179
180 # Rename ide-cd module to match with old kernel
181 mv /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/ide/ide-cd_mod.ko \
182 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/ide/ide-cd.ko
183 mv /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/ide/ide-gd_mod.ko \
184 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/ide/ide-disk.ko
185
186 # Remove mISDN modules
187 rm -rvf /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn/mISDN
188 rm -rvf /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn/hardware/mISDN
189
190 ifneq "$(XEN)" "1"
191 # Blacklist matroxfb_base
192 echo "blacklist matroxfb_base" >> /etc/modprobe.d/framebuffer
193 # Blacklist old framebuffer modules
194 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video -name *fb.ko); do \
195 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer ; \
196 done
197 # Blacklist new drm framebuffer modules
198 for f in $$(ls -1 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm/*/*.ko); do \
199 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer ; \
200 done
201 sed -i -e "s|.ko||g" /etc/modprobe.d/framebuffer
202
203 # Blacklist isdn modules
204 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn -name *.ko); do \
205 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/isdn ; \
206 done
207 sed -i -e "s|.ko||g" /etc/modprobe.d/isdn
208 endif
209
210 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
211 @$(POSTBUILD)