Updated Kernel (2.6.32.10).
[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 = .10
28 VER = 2.6.32.10
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 = 8
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 linux-$(VER)-suse_xen_patches-1.tar.bz2
61
62 $(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
63 netfilter-layer7-v2.22.tar.gz = $(URL_IPFIRE)/netfilter-layer7-v2.21.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 linux-$(VER)-suse_xen_patches-1.tar.bz2 = $(URL_IPFIRE)/linux-$(VER)-suse_xen_patches-1.tar.bz2
68
69
70 $(DL_FILE)_MD5 = 5d996507ad482a3a8c8e6b2d48e7994b
71 netfilter-layer7-v2.22.tar.gz_MD5 = 98dff8a3d5a31885b73341633f69501f
72 patch-2.6.16-nath323-1.3.bz2_MD5 = f926409ff703a307baf54b57ab75d138
73 reiser4-for-2.6.32.patch.bz2_MD5 = 3246397973d9271eb8e6d7c97c5d2d91
74 squashfs-lzma-linux-2.6.32-kernel-patches.tar.bz2_MD5 = d2a84311081023c7ffd28cdca67c45d4
75 linux-$(VER)-suse_xen_patches-1.tar.bz2_MD5 = 96b0dc50256ced7c5c2b6d03a7f2d386
76
77 install : $(TARGET)
78
79 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
80
81 download :$(patsubst %,$(DIR_DL)/%,$(objects))
82
83 md5 : $(subst %,%_MD5,$(objects))
84
85 dist:
86 @$(PAK)
87 ###############################################################################
88 # Downloading, checking, md5sum
89 ###############################################################################
90
91 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
92 @$(CHECK)
93
94 $(patsubst %,$(DIR_DL)/%,$(objects)) :
95 @$(LOAD)
96
97 $(subst %,%_MD5,$(objects)) :
98 @$(MD5)
99
100 ###############################################################################
101 # Installation Details
102 ###############################################################################
103
104 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
105 @$(PREBUILD)
106 @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)
107
108 ln -s linux-$(VER) /usr/src/linux
109
110 ifeq "$(XEN)" "1"
111 # Apply Xen patches (provided by SuSE)
112 cd $(DIR_SRC) && tar jxf $(DIR_DL)/linux-$(VER)-suse_xen_patches-1.tar.bz2
113 cp -f $(DIR_SRC)/src/patches/suse_xen_series.conf $(DIR_SRC)/linux-$(VER)-suse_xen_patches/series.conf
114 cd $(DIR_SRC)/linux-$(VER)-suse_xen_patches && \
115 for x in $$( ./guards $$( ./arch-symbols) < ./series.conf); do \
116 echo "*********** [Patch: $$x]"; \
117 patch -d $(DIR_APP) -p1 < $$x || break; \
118 done
119 rm -rf $(DIR_SRC)/linux-*-suse_xen_patches
120
121 # Fix strange patchset errors
122 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.8-xen-patch-fixes.patch
123
124 # Linux Intermediate Queueing Device
125 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.8-xen-imq-test2.patch
126 else
127 # Linux Intermediate Queueing Device
128 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32-imq-test2.patch
129 endif
130
131 # Add patch to fix ath5k "no txbuf available"
132 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32-ath5k_fix_setup_for_CAB_queue.patch
133
134 # Not report deprecated syscall 1.23 (for kudzu)
135 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.25.18-not_report_sysctl_1.23.patch
136
137 # Reiser4 (don't check if fail (some patches are already in xen patchset)
138 -cd $(DIR_APP) && bzcat $(DIR_DL)/reiser4-for-2.6.32.patch.bz2 | patch -Np1
139
140 # ipp2p 0.8.2-pomng
141 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.8-ipp2p-0.8.2-pomng.patch
142
143 # Layer7-patch
144 cd $(DIR_SRC) && rm -rf $(DIR_SRC)/netfilter-layer7-v2.22
145 cd $(DIR_SRC) && tar xzf $(DIR_DL)/netfilter-layer7-v2.22.tar.gz
146 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/netfilter-layer7-v2.22/kernel-2.6.25-2.6.28-layer7-2.22.patch
147
148 # Squashfs LZMA support
149 cd $(DIR_APP) && bzcat $(DIR_DL)/squashfs-lzma-linux-2.6.32-kernel-patches.tar.bz2 | patch -Np1
150
151 # Cleanup kernel source
152
153 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config
154 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
155 cd $(DIR_APP) && make CC="$(KGCC)" clean
156 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-$(VERSUFIX)/' Makefile
157
158 ifeq "$(XEN)" "1"
159 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" vmlinuz
160 cd $(DIR_APP) && cp -v arch/i386/boot/vmlinuz /boot/vmlinuz-$(VER)-$(VERSUFIX)
161 else
162 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
163 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
164 endif
165 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
166 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
167 ln -sf vmlinuz-$(VER)-$(VERSUFIX) /boot/vmlinuz-$(VERSUFIX)
168 ln -sf System.map-$(VER)-$(VERSUFIX) /boot/System.map-$(VERSUFIX)
169 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
170 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
171 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
172
173 ifeq "$(XEN)" ""
174 # Only do this once on the non-XEN pass
175 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
176 endif
177
178 # Rename ide-cd module to match with old kernel
179 mv /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/ide/ide-cd_mod.ko \
180 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/ide/ide-cd.ko
181 mv /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/ide/ide-gd_mod.ko \
182 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/ide/ide-disk.ko
183
184 # # Remove mISDN modules
185 # rm -rvf /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn/mISDN
186 # rm -rvf /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn/hardware/mISDN
187
188 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
189 @$(POSTBUILD)