kernel: update to 3.10.27.
[people/teissler/ipfire-2.x.git] / lfs / linux
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2014 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.10.27
28
29 RPI_PATCHES = linux-3.10.10-grsec-c1af7c6
30 GRS_PATCHES = grsecurity-2.9.1-3.10.27-ipfire1.patch.xz
31
32 THISAPP = linux-$(VER)
33 DL_FILE = linux-$(VER).tar.xz
34 DL_FROM = $(URL_IPFIRE)
35 DIR_APP = $(DIR_SRC)/$(THISAPP)
36 CFLAGS =
37 CXXFLAGS =
38
39 PAK_VER = 32
40 DEPS = ""
41
42 VERSUFIX=ipfire$(KCFG)
43
44 ifeq "$(TOOLS)" "1"
45 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)-tools
46 HEADERS_PREFIX = /tools
47 else
48 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
49 HEADERS_PREFIX = /usr
50 endif
51
52 ifeq "$(MACHINE_TYPE)" "arm"
53 HEADERS_ARCH=arm
54 else
55 HEADERS_ARCH=x86
56 endif
57
58 ifeq "$(KCFG)" ""
59 LASTKERNEL=1
60 endif
61 ifeq "$(KCFG)" "-kirkwood"
62 LASTKERNEL=1
63 endif
64
65 ###############################################################################
66 # Top-level Rules
67 ###############################################################################
68 objects =$(DL_FILE) \
69 rpi-patches-$(RPI_PATCHES).patch.xz \
70 $(GRS_PATCHES)
71
72
73 $(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
74 rpi-patches-$(RPI_PATCHES).patch.xz = $(URL_IPFIRE)/rpi-patches-$(RPI_PATCHES).patch.xz
75 $(GRS_PATCHES) = $(URL_IPFIRE)/$(GRS_PATCHES)
76
77 $(DL_FILE)_MD5 = 4edaaea57dc940969c54ac249e49f7e7
78 rpi-patches-$(RPI_PATCHES).patch.xz_MD5 = f55981853573236069db5ad9fb7a4bd9
79 $(GRS_PATCHES)_MD5 = a83aad5c389ea9a496ba41608267d3dc
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/imq_kernel3.10.23.patch
116
117 # ipp2p 0.8.2-ipfire
118 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10-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.10-no_proc_interface.patch
122
123 # Grsecurity-patches
124 ifneq "$(KCFG)" "-headers"
125 #ifneq "$(KCFG)" "-rpi"
126 cd $(DIR_APP) && xz -c -d $(DIR_DL)/$(GRS_PATCHES) | patch -Np1
127 cd $(DIR_APP) && rm localversion-grsec
128 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.7-disable-compat_vdso.patch
129 #endif
130 endif
131
132 # Disable pcspeaker autoload
133 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.30-no-pcspkr-modalias.patch
134
135 # Remove ACPI Blacklist message
136 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6-silence-acpi-blacklist.patch
137
138 # DVB Patches
139 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.9-dvbsky-wot2.patch
140 cd $(DIR_APP) && patch -Np2 < $(DIR_SRC)/src/patches/v4l-dvb_fix_tua6034_pll.patch
141
142 # Wlan Patches
143 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/compat-drivers-3.8.3-ath_ignore_eeprom_regdomain.patch
144
145 # mISDN Patches
146 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/mISDN_hfc-s_add_id.patch
147 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/mISDN-hfcusb-reportl1down.patch
148
149 # Add LED trigger
150 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.9-ledtrig-netdev-1.patch
151
152 # Fix uevent PHYSDEVDRIVER
153 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2.33_ipg-fix-driver-name.patch
154 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.27_mcs7830-fix-driver-name.patch
155
156
157 ifeq "$(KCFG)" "-kirkwood"
158 # Add dreamplug,guruplug and icy 62x0 support on ARM-kirkwood
159 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.10-arm_kirkwood_setups.patch
160 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.10-mv_cesa_disable_failing_hmac_sha1.patch
161 endif
162
163 ifeq "$(KCFG)" "-multi"
164 # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-0001-panda-wlan-fix.patch
165 # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-0002-panda-i2c.patch
166 # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-panda-reboot.patch
167 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10-smsc95xx-add_mac_addr_param.patch
168
169 # Patchset for Wandboard.
170 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/dts/0001-imx6qdl-wandboard-dts-backport.patch
171 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/dts/0002-ARM-dts-imx6qdl-wandboard-add-gpio-lines-to-wandboar.patch
172 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/dts/0003-ARM-dts-imx6qdl-wandboard-Add-support-for-i2c1.patch
173 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/dts/0004-ARM-dts-wandboard-add-binding-for-wand-rfkill-driver.patch
174 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/dts/0005-ARM-dts-imx6qdl-add-pcie-device-node.patch
175
176 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0001-i2c-imx-retry-on-NAK.patch
177 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0002-i.MX6-Wandboard-add-CKO1-clock-output.patch
178 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0003-thermal-add-imx-thermal-driver-support.patch
179 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0004-ARM-i.MX6-Wandboard-add-wifi-bt-rfkill-driver.patch
180 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0005-Add-IMX6Q-AHCI-support.patch
181 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0006-imx-Add-IMX53-AHCI-support.patch
182 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0007-imx6-enable-sata-clk-if-SATA_AHCI_PLATFORM.patch
183 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0008-ARM-imx6q-update-the-sata-bits-definitions-of-gpr13.patch
184 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0009-ahci_imx-add-ahci-sata-support-on-imx-platforms.patch
185 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0010-ahci_imx-depend-on-CONFIG_MFD_SYSCON.patch
186 cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0011-add-pcie-designware.patch
187 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0012-pcie-backport-fixes.patch
188 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0013-of-pci-Provide-support-for-parsing-PCI-DT-ranges-pro.patch
189 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0014-ARM-imx6q-Add-PCIe-bits-to-GPR-syscon-definition.patch
190 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0015-PCI-imx6-Add-support-for-i.MX6-PCIe-controller.patch
191 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0016-imx6-pci-tweaks.patch
192 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0017-ARM-imx-Add-LVDS-general-purpose-clocks-to-i.MX6Q.patch
193 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0018-ARM-imx6q-clock-and-Kconfig-update-for-PCIe-support.patch
194
195 # Patchset for Compulab Utilite.
196 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/utilite/linux-3.10-compulab-utilite-support.patch
197 endif
198
199 ifeq "$(KCFG)" "-rpi"
200 # Apply Raspberry Pi kernel patches.
201 cd $(DIR_APP) && xzcat $(DIR_DL)/rpi-patches-$(RPI_PATCHES).patch.xz | patch -Np1
202 endif
203
204 ifeq "$(KCFG)" "-headers"
205 # Install the header files
206 cd $(DIR_APP) && make ARCH=$(HEADERS_ARCH) INSTALL_HDR_PATH=dest headers_install
207 -mkdir -pv $(BUILDROOT)/$(HEADERS_PREFIX)/include
208 cd $(DIR_APP) && find dest/include \( -name .install -o -name ..install.cmd \) -delete
209 cd $(DIR_APP) && cp -rv dest/include/* $(BUILDROOT)/$(HEADERS_PREFIX)/include
210 else
211
212 # Install ipfire logo
213 cd $(DIR_APP) && cp -vf $(DIR_SRC)/config/kernel/ipfire_logo.ppm \
214 drivers/video/logo/logo_linux_clut224.ppm
215
216 # Cleanup kernel source
217 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config
218 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
219 cd $(DIR_APP) && make CC="$(KGCC)" clean
220 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
221
222 ifeq "$(KCFG)" "-kirkwood"
223 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" uImage modules
224 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
225 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX)
226 else
227 ifeq "$(KCFG)" "-multi"
228 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" zImage modules
229 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
230 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/zImage-$(VERSUFIX)
231 else
232 ifeq "$(KCFG)" "-rpi"
233 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" zImage modules
234 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
235 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/kernel.img
236 else
237 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage modules
238 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
239 ln -sf vmlinuz-$(VER)-$(VERSUFIX) /boot/vmlinuz-$(VERSUFIX)
240 endif
241 endif
242 endif
243 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
244 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
245 ln -sf System.map-$(VER)-$(VERSUFIX) /boot/System.map-$(VERSUFIX)
246 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
247 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
248
249 ifeq "$(MACHINE_TYPE)" "arm"
250 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) dtbs
251 cd $(DIR_APP) && for f in $$(find arch/arm/boot/dts/ -name *.dtb); do \
252 mkdir -p /boot/dtb-$(VER)-$(VERSUFIX) ; \
253 install -m 644 $$f /boot/dtb-$(VER)-$(VERSUFIX)/ ; \
254 done
255 endif
256
257 ifeq "$(LASTKERNEL)" "1"
258 # Only do this once
259 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
260
261 # Blacklist matroxfb_base
262 echo "blacklist matroxfb_base" >> /etc/modprobe.d/framebuffer.conf
263 # Blacklist old framebuffer modules
264 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video -name *fb.ko); do \
265 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
266 done
267 # Blacklist new drm framebuffer modules
268 for f in $$(ls -1 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm/*/*.ko); do \
269 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
270 done
271 sed -i -e "s|.ko||g" /etc/modprobe.d/framebuffer.conf
272
273 # Blacklist isdn modules
274 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn -name *.ko); do \
275 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/isdn.conf ; \
276 done
277 sed -i -e "s|.ko||g" /etc/modprobe.d/isdn.conf
278
279 # Disable ipv6 at runtime
280 echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6.conf
281 endif
282
283 # Disable geode_aes modul if exist
284 -mv /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/crypto/geode-aes.ko \
285 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/crypto/geode-aes.ko.off
286 endif
287
288 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
289 @$(POSTBUILD)