Updated kernel to 2.6.27.21
[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 = .21
28 VER = 2.6.27.21
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 # Normal build or SMP build.
38 #
39 ifeq "$(SMP)" "1"
40 TARGET = $(DIR_INFO)/linux-$(VER)-smp
41 else
42 TARGET = $(DIR_INFO)/linux-$(VER)
43 endif
44
45 ###############################################################################
46 # Top-level Rules
47 ###############################################################################
48 objects =$(DL_FILE) \
49 mISDN-20090322.tar.gz \
50 squashfs3.4.tar.gz \
51 netfilter-layer7-v2.21.tar.gz \
52 patch-2.6.16-nath323-1.3.bz2 \
53 reiser4-for-2.6.27.19.patch.bz2
54
55 $(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
56 netfilter-layer7-v2.21.tar.gz = $(URL_IPFIRE)/netfilter-layer7-v2.21.tar.gz
57 patch-2.6.16-nath323-1.3.bz2 = $(URL_IPFIRE)/patch-2.6.16-nath323-1.3.bz2
58 squashfs3.4.tar.gz = $(URL_IPFIRE)/squashfs3.4.tar.gz
59 mISDN-20090322.tar.gz = $(URL_IPFIRE)/mISDN-20090322.tar.gz
60 reiser4-for-2.6.27.19.patch.bz2 = $(URL_IPFIRE)/reiser4-for-2.6.27.19.patch.bz2
61
62 $(DL_FILE)_MD5 = 2912af7938fae1a3f2a9a6bcf8c0009f
63 netfilter-layer7-v2.21.tar.gz_MD5 = 838422e7d9a06b42e682e9064e5210b5
64 patch-2.6.16-nath323-1.3.bz2_MD5 = f926409ff703a307baf54b57ab75d138
65 squashfs3.4.tar.gz_MD5 = 2a4d2995ad5aa6840c95a95ffa6b1da6
66 mISDN-20090322.tar.gz_MD5 = 8495c13ef09dacf4a5e42b93da2ac3fc
67 reiser4-for-2.6.27.19.patch.bz2_MD5 = 22988387f64f299489b90b484b2642cc
68
69 install : $(TARGET)
70
71 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
72
73 download :$(patsubst %,$(DIR_DL)/%,$(objects))
74
75 md5 : $(subst %,%_MD5,$(objects))
76
77 dist:
78 @$(PAK)
79 ###############################################################################
80 # Downloading, checking, md5sum
81 ###############################################################################
82
83 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
84 @$(CHECK)
85
86 $(patsubst %,$(DIR_DL)/%,$(objects)) :
87 @$(LOAD)
88
89 $(subst %,%_MD5,$(objects)) :
90 @$(MD5)
91
92 ###############################################################################
93 # Installation Details
94 ###############################################################################
95
96 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
97 @$(PREBUILD)
98 @rm -rf $(DIR_APP) $(DIR_SRC)/linux $(DIR_SRC)/xen-* && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
99 ln -s linux-$(VER) /usr/src/linux
100
101 # Not report deprecated syscall 1.23 (for kudzu)
102 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.25.18-not_report_sysctl_1.23.patch
103
104 # Fix crash on Twinhead H12Y notebooks
105 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-h12y-mmio-quirks.patch
106
107 # Openswan
108 #cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/openswan-2.4.x.kernel-2.6.23-natt.patch
109
110 # Reiser4
111 cd $(DIR_APP) && bzip2 -d -c $(DIR_DL)/reiser4-for-2.6.27.19.patch.bz2 | patch -Np1
112
113 # SquashFS
114 cd $(DIR_SRC) && rm -rf squashfs*
115 cd $(DIR_SRC) && tar xfz $(DIR_DL)/squashfs3.4.tar.gz
116 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/squashfs3.4/kernel-patches/linux-2.6.27-rc4/squashfs3.4-patch
117
118 # ip_conntrack permissions from 440 to 444
119 # cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/ip_conntrack_standalone-patch-for-ipfire.patch
120
121 # ipp2p 0.8.2-pomng
122 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.27.19-ipp2p-0.8.2-pomng.patch
123
124 # Layer7-patch
125 cd $(DIR_SRC) && rm -rf $(DIR_SRC)/netfilter-layer7-v2.21
126 cd $(DIR_SRC) && tar xzf $(DIR_DL)/netfilter-layer7-v2.21.tar.gz
127 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/netfilter-layer7-v2.21/kernel-2.6.25-2.6.28-layer7-2.21.patch
128
129 # Linux Intermediate Queueing Device
130 ifeq "$(XEN)" ""
131 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.27-imq.patch
132 endif
133
134 # mISDN
135 cd $(DIR_SRC) && rm -rf mISDN-* && mkdir mISDN-socket
136 cd $(DIR_SRC)/mISDN-socket && tar xfz $(DIR_DL)/mISDN-20090322.tar.gz
137 cd $(DIR_SRC)/mISDN-socket && yes 'yes' | ./std2kern -k /usr/src/linux
138
139 # Cleanup kernel source
140 cd $(DIR_APP) && make mrproper
141
142 ifeq "$(SMP)" "1"
143 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE).smp $(DIR_APP)/.config
144 else
145 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE) $(DIR_APP)/.config
146 endif
147
148 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
149 cd $(DIR_APP) && make CC="$(KGCC)" clean
150
151 ifeq "$(SMP)" "1"
152 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-ipfire-smp/' Makefile
153 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
154 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-ipfire-smp
155 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-ipfire-smp
156 ln -sf vmlinuz-$(VER)-ipfire-smp /boot/vmlinuz-ipfire-smp
157 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
158 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
159 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
160 else
161 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-ipfire/' Makefile
162 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
163 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-ipfire
164 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-ipfire
165 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-ipfire
166 ln -sf vmlinuz-$(VER)-ipfire /boot/vmlinuz-ipfire
167 ln -sf System.map-$(VER)-ipfire /boot/System.map-ipfire
168 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
169 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
170 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
171 endif
172
173 ifeq "$(SMP)" ""
174 # Only do this once on the non-SMP 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)-ipfire/kernel/drivers/ide/ide-cd_mod.ko \
180 /lib/modules/$(VER)-ipfire/kernel/drivers/ide/ide-cd.ko
181
182 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/mISDN-* $(DIR_SRC)/netfilter-layer7-*
183 @$(POSTBUILD)