kernel3: updated to 3.2.21.
[people/teissler/ipfire-2.x.git] / lfs / linux3
CommitLineData
48a6571f
AF
1###############################################################################
2# #
3# IPFire.org - A linux based firewall #
1f6abd53 4# Copyright (C) 2007-2012 IPFire Team <info@ipfire.org> #
48a6571f
AF
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
25include Config
26
83d893a9 27VER = 3.2.21
48a6571f 28
83d893a9 29RPI_PATCHES = linux-3.2-bootc-a1f8d7a
48a6571f
AF
30
31THISAPP = linux-$(VER)
83d893a9 32DL_FILE = linux-$(VER).tar.bz2
48a6571f
AF
33DL_FROM = $(URL_IPFIRE)
34DIR_APP = $(DIR_SRC)/$(THISAPP)
35CFLAGS =
36CXXFLAGS =
37
38PAK_VER = 20
39DEPS = ""
40
48a6571f
AF
41VERSUFIX=ipfire$(KCFG)
42
43ifeq "$(HEADERS)" "1"
44ifeq "$(TOOLS)" "1"
45 TARGET = $(DIR_INFO)/linux-libc-headers-$(VER)-$(VERSUFIX)-tools
46 HEADERS_PREFIX = /tools
47else
48 TARGET = $(DIR_INFO)/linux-libc-headers-$(VER)-$(VERSUFIX)
49 HEADERS_PREFIX = /usr
50endif
51else
52 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
53endif
54
55ifeq "$(MACHINE_TYPE)" "arm"
56 HEADERS_ARCH=arm
57else
58 HEADERS_ARCH=x86
59endif
60
61ifeq "$(KCFG)" ""
62LASTKERNEL=1
63endif
64ifeq "$(KCFG)" "-kirkwood"
65LASTKERNEL=1
66endif
67
68###############################################################################
69# Top-level Rules
70###############################################################################
71objects =$(DL_FILE) \
1f6abd53
AF
72 rpi-patches-$(RPI_PATCHES).patch.xz
73
48a6571f
AF
74
75$(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
1f6abd53
AF
76rpi-patches-$(RPI_PATCHES).patch.xz = $(URL_IPFIRE)/rpi-patches-$(RPI_PATCHES).patch.xz
77
83d893a9
AF
78$(DL_FILE)_MD5 = c8a4ae25eb44f9122f386068e30e7e2e
79rpi-patches-$(RPI_PATCHES).patch.xz_MD5 = c3891a7f38609783358e765d784e5e6e
48a6571f
AF
80
81install : $(TARGET)
82
83check : $(patsubst %,$(DIR_CHK)/%,$(objects))
84
85download :$(patsubst %,$(DIR_DL)/%,$(objects))
86
87md5 : $(subst %,%_MD5,$(objects))
88
89dist:
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)
eaaf33b6 110 @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
48a6571f 111
48a6571f
AF
112 ln -svf linux-$(VER) $(DIR_SRC)/linux
113
48a6571f 114 # Linux Intermediate Queueing Device
1f6abd53 115 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-imq.patch
48a6571f
AF
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
e715467b
AF
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
48a6571f
AF
122
123 # Layer7-patch
71fe6ae5 124 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/netfilter_layer7_2.22_kernel3.0.patch
48a6571f
AF
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
1f6abd53 133# cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.27_ipg-fix-driver-name.patch
48a6571f
AF
134 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.27_mcs7830-fix-driver-name.patch
135
136ifeq "$(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
139endif
140
141ifeq "$(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
146endif
147
148ifeq "$(KCFG)" "-omap"
1f6abd53
AF
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
080ce045 152 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.x-smsc95xx-add_mac_addr_param.patch
48a6571f
AF
153endif
154
1f6abd53 155ifeq "$(KCFG)" "-rpi"
83d893a9 156 # Apply Raspberry Pi kernel patches.
1f6abd53
AF
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
160endif
161
48a6571f
AF
162ifeq "$(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
168else
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
83d893a9 178 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
48a6571f 179
48a6571f
AF
180ifeq "$(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)
184else
185ifeq "$(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)
189else
1f6abd53
AF
190ifeq "$(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)
194else
48a6571f
AF
195ifeq "$(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)
198else
199 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
200 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
201endif
202endif
1f6abd53 203endif
48a6571f
AF
204endif
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
213ifeq "$(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
237endif
238
48a6571f
AF
239ifneq "$(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
243endif
244endif
245
246 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
247 @$(POSTBUILD)