kernel: update to 3.2.28.
[people/teissler/ipfire-2.x.git] / lfs / linux
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.28
28
29 RPI_PATCHES = linux-3.2-bootc-f23da7f
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 = d387130f084f48fae7b2d1756f6c9257
79 rpi-patches-$(RPI_PATCHES).patch.xz_MD5 = 5651c6411bb1cbdbfe4b2908c117aaf3
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 # ipp2p 0.8.2-ipfire
118 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.0-ipp2p-0.8.2-ipfire.patch
119
120 # Layer7-patch
121 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/netfilter_layer7_2.22_kernel3.0.patch
122
123 # Add some more LED triggers
124 # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.11-netdev-1.patch
125
126 # Huawei Android Phones (Vodafone V845, T-Mobile Pulse/mini ...)
127 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.15-option_add_huawei_android.patch
128
129 # Fix uevent PHYSDEVDRIVER
130 # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.27_ipg-fix-driver-name.patch
131 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.27_mcs7830-fix-driver-name.patch
132
133 ifeq "$(KCFG)" "-kirkwood"
134 # Add dreamplug,guruplug and icy 62x0 support on ARM-kirkwood
135 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2.25-arm_kirkwood_setups.patch
136 endif
137
138 ifeq "$(MACHINE_TYPE)" "arm"
139 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.45_align_ssb_modtable_32bit_boundary.patch
140
141 # Reverse some asm optimizations that are incompatible with older gcc
142 cd $(DIR_APP) && patch -p1 -R < $(DIR_SRC)/src/patches/linux-2.6-arm-asm-constraint.patch
143 endif
144
145 ifeq "$(KCFG)" "-omap"
146 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-0001-panda-wlan-fix.patch
147 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-0002-panda-i2c.patch
148 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-panda-reboot.patch
149 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.x-smsc95xx-add_mac_addr_param.patch
150 endif
151
152 ifeq "$(KCFG)" "-rpi"
153 # Apply Raspberry Pi kernel patches.
154 cd $(DIR_APP) && xzcat $(DIR_DL)/rpi-patches-$(RPI_PATCHES).patch.xz | patch -Np1
155 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-bcm2835-alsamixer.patch
156 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-bcm2835-limit_volume.patch
157 endif
158
159 ifeq "$(HEADERS)" "1"
160 # Install the header files
161 cd $(DIR_APP) && make ARCH=$(HEADERS_ARCH) INSTALL_HDR_PATH=dest headers_install
162 -mkdir -pv $(BUILDROOT)/$(HEADERS_PREFIX)/include
163 cd $(DIR_APP) && find dest/include \( -name .install -o -name ..install.cmd \) -delete
164 cd $(DIR_APP) && cp -rv dest/include/* $(BUILDROOT)/$(HEADERS_PREFIX)/include
165 else
166
167 # Install ipfire logo
168 cd $(DIR_APP) && cp -vf $(DIR_SRC)/config/kernel/ipfire_logo.ppm \
169 drivers/video/logo/logo_linux_clut224.ppm
170
171 # Cleanup kernel source
172 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config
173 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
174 cd $(DIR_APP) && make CC="$(KGCC)" clean
175 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
176
177 ifeq "$(KCFG)" "-kirkwood"
178 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" uImage
179 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
180 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX)
181 else
182 ifeq "$(KCFG)" "-omap"
183 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" uImage
184 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
185 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX)
186 else
187 ifeq "$(KCFG)" "-rpi"
188 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" zImage
189 cd /boot && cat first32k.bin $(DIR_APP)/arch/arm/boot/Image > kernel.img
190 cd $(DIR_APP) && cp -v /boot/kernel.img /boot/vmlinuz-$(VER)-$(VERSUFIX)
191 else
192 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
193 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
194 endif
195 endif
196 endif
197 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
198 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
199 ln -sf vmlinuz-$(VER)-$(VERSUFIX) /boot/vmlinuz-$(VERSUFIX)
200 ln -sf System.map-$(VER)-$(VERSUFIX) /boot/System.map-$(VERSUFIX)
201 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
202 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
203 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
204
205 ifeq "$(LASTKERNEL)" "1"
206 # Only do this once
207 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
208
209 # Blacklist matroxfb_base
210 echo "blacklist matroxfb_base" >> /etc/modprobe.d/framebuffer
211 # Blacklist old framebuffer modules
212 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video -name *fb.ko); do \
213 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer ; \
214 done
215 # Blacklist new drm framebuffer modules
216 for f in $$(ls -1 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm/*/*.ko); do \
217 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer ; \
218 done
219 sed -i -e "s|.ko||g" /etc/modprobe.d/framebuffer
220
221 # Blacklist isdn modules
222 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn -name *.ko); do \
223 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/isdn ; \
224 done
225 sed -i -e "s|.ko||g" /etc/modprobe.d/isdn
226
227 # Disable ipv6 at runtime
228 echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6
229 endif
230
231 ifneq "$(MACHINE_TYPE)" "arm"
232 # Disable geode_aes modul
233 mv /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/crypto/geode-aes.ko \
234 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/crypto/geode-aes.ko.off
235 endif
236 endif
237
238 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
239 @$(POSTBUILD)