kernel3: updated to 3.2.21.
[people/teissler/ipfire-2.x.git] / lfs / linux3
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2012 IPFire Team <info@ipfire.org> #
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 VER = 3.2.21
28
29 RPI_PATCHES = linux-3.2-bootc-a1f8d7a
30
31 THISAPP = linux-$(VER)
32 DL_FILE = linux-$(VER).tar.bz2
33 DL_FROM = $(URL_IPFIRE)
34 DIR_APP = $(DIR_SRC)/$(THISAPP)
35 CFLAGS =
36 CXXFLAGS =
37
38 PAK_VER = 20
39 DEPS = ""
40
41 VERSUFIX=ipfire$(KCFG)
42
43 ifeq "$(HEADERS)" "1"
44 ifeq "$(TOOLS)" "1"
45 TARGET = $(DIR_INFO)/linux-libc-headers-$(VER)-$(VERSUFIX)-tools
46 HEADERS_PREFIX = /tools
47 else
48 TARGET = $(DIR_INFO)/linux-libc-headers-$(VER)-$(VERSUFIX)
49 HEADERS_PREFIX = /usr
50 endif
51 else
52 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
53 endif
54
55 ifeq "$(MACHINE_TYPE)" "arm"
56 HEADERS_ARCH=arm
57 else
58 HEADERS_ARCH=x86
59 endif
60
61 ifeq "$(KCFG)" ""
62 LASTKERNEL=1
63 endif
64 ifeq "$(KCFG)" "-kirkwood"
65 LASTKERNEL=1
66 endif
67
68 ###############################################################################
69 # Top-level Rules
70 ###############################################################################
71 objects =$(DL_FILE) \
72 rpi-patches-$(RPI_PATCHES).patch.xz
73
74
75 $(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
76 rpi-patches-$(RPI_PATCHES).patch.xz = $(URL_IPFIRE)/rpi-patches-$(RPI_PATCHES).patch.xz
77
78 $(DL_FILE)_MD5 = c8a4ae25eb44f9122f386068e30e7e2e
79 rpi-patches-$(RPI_PATCHES).patch.xz_MD5 = c3891a7f38609783358e765d784e5e6e
80
81 install : $(TARGET)
82
83 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
84
85 download :$(patsubst %,$(DIR_DL)/%,$(objects))
86
87 md5 : $(subst %,%_MD5,$(objects))
88
89 dist:
90 @$(PAK)
91 ###############################################################################
92 # Downloading, checking, md5sum
93 ###############################################################################
94
95 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
96 @$(CHECK)
97
98 $(patsubst %,$(DIR_DL)/%,$(objects)) :
99 @$(LOAD)
100
101 $(subst %,%_MD5,$(objects)) :
102 @$(MD5)
103
104 ###############################################################################
105 # Installation Details
106 ###############################################################################
107
108 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
109 @$(PREBUILD)
110 @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
111
112 ln -svf linux-$(VER) $(DIR_SRC)/linux
113
114 # Linux Intermediate Queueing Device
115 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-imq.patch
116
117 # Not report deprecated syscall 1.23 (for kudzu)
118 # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.25.18-not_report_sysctl_1.23.patch
119
120 # ipp2p 0.8.2-ipfire
121 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.0-ipp2p-0.8.2-ipfire.patch
122
123 # Layer7-patch
124 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/netfilter_layer7_2.22_kernel3.0.patch
125
126 # Add some more LED triggers
127 # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.11-netdev-1.patch
128
129 # Huawei Android Phones (Vodafone V845, T-Mobile Pulse/mini ...)
130 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.15-option_add_huawei_android.patch
131
132 # Fix uevent PHYSDEVDRIVER
133 # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.27_ipg-fix-driver-name.patch
134 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.27_mcs7830-fix-driver-name.patch
135
136 ifeq "$(KCFG)" "-kirkwood"
137 # Add dreamplug,guruplug and icy 62x0 support on ARM-kirkwood
138 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.45-arm_kirkwood_setups.patch
139 endif
140
141 ifeq "$(MACHINE_TYPE)" "arm"
142 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.45_align_ssb_modtable_32bit_boundary.patch
143
144 # Reverse some asm optimizations that are incompatible with older gcc
145 cd $(DIR_APP) && patch -p1 -R < $(DIR_SRC)/src/patches/linux-2.6-arm-asm-constraint.patch
146 endif
147
148 ifeq "$(KCFG)" "-omap"
149 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-0001-panda-wlan-fix.patch
150 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-0002-panda-i2c.patch
151 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-panda-reboot.patch
152 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.x-smsc95xx-add_mac_addr_param.patch
153 endif
154
155 ifeq "$(KCFG)" "-rpi"
156 # Apply Raspberry Pi kernel patches.
157 cd $(DIR_APP) && xzcat $(DIR_DL)/rpi-patches-$(RPI_PATCHES).patch.xz | patch -Np1
158 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-bcm2835-alsamixer.patch
159 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-bcm2835-limit_volume.patch
160 endif
161
162 ifeq "$(HEADERS)" "1"
163 # Install the header files
164 cd $(DIR_APP) && make ARCH=$(HEADERS_ARCH) INSTALL_HDR_PATH=dest headers_install
165 -mkdir -pv $(BUILDROOT)/$(HEADERS_PREFIX)/include
166 cd $(DIR_APP) && find dest/include \( -name .install -o -name ..install.cmd \) -delete
167 cd $(DIR_APP) && cp -rv dest/include/* $(BUILDROOT)/$(HEADERS_PREFIX)/include
168 else
169
170 # Install ipfire logo
171 cd $(DIR_APP) && cp -vf $(DIR_SRC)/config/kernel/ipfire_logo.ppm \
172 drivers/video/logo/logo_linux_clut224.ppm
173
174 # Cleanup kernel source
175 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config
176 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
177 cd $(DIR_APP) && make CC="$(KGCC)" clean
178 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
179
180 ifeq "$(KCFG)" "-kirkwood"
181 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" uImage
182 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
183 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX)
184 else
185 ifeq "$(KCFG)" "-omap"
186 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" uImage
187 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
188 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX)
189 else
190 ifeq "$(KCFG)" "-rpi"
191 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" zImage
192 cd /boot && cat first32k.bin $(DIR_APP)/arch/arm/boot/Image > kernel.img
193 cd $(DIR_APP) && cp -v /boot/kernel.img /boot/vmlinuz-$(VER)-$(VERSUFIX)
194 else
195 ifeq "$(KCFG)" "-versatile"
196 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" zImage
197 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
198 else
199 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
200 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
201 endif
202 endif
203 endif
204 endif
205 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
206 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
207 ln -sf vmlinuz-$(VER)-$(VERSUFIX) /boot/vmlinuz-$(VERSUFIX)
208 ln -sf System.map-$(VER)-$(VERSUFIX) /boot/System.map-$(VERSUFIX)
209 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
210 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
211 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
212
213 ifeq "$(LASTKERNEL)" "1"
214 # Only do this once
215 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
216
217 # Blacklist matroxfb_base
218 echo "blacklist matroxfb_base" >> /etc/modprobe.d/framebuffer
219 # Blacklist old framebuffer modules
220 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video -name *fb.ko); do \
221 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer ; \
222 done
223 # Blacklist new drm framebuffer modules
224 for f in $$(ls -1 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm/*/*.ko); do \
225 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer ; \
226 done
227 sed -i -e "s|.ko||g" /etc/modprobe.d/framebuffer
228
229 # Blacklist isdn modules
230 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn -name *.ko); do \
231 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/isdn ; \
232 done
233 sed -i -e "s|.ko||g" /etc/modprobe.d/isdn
234
235 # Disable ipv6 at runtime
236 echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6
237 endif
238
239 ifneq "$(MACHINE_TYPE)" "arm"
240 # Disable geode_aes modul
241 mv /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/crypto/geode-aes.ko \
242 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/crypto/geode-aes.ko.off
243 endif
244 endif
245
246 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
247 @$(POSTBUILD)