kernel-rpi: update rpi patches to 943b563.
[people/teissler/ipfire-2.x.git] / lfs / linux
CommitLineData
df5e82b3 1###############################################################################
df5e82b3 2# #
70df8302 3# IPFire.org - A linux based firewall #
2505d276 4# Copyright (C) 2007-2014 IPFire Team <info@ipfire.org> #
70df8302
MT
5# #
6# This program is free software: you can redistribute it and/or modify #
df5e82b3 7# it under the terms of the GNU General Public License as published by #
70df8302 8# the Free Software Foundation, either version 3 of the License, or #
df5e82b3
MT
9# (at your option) any later version. #
10# #
70df8302 11# This program is distributed in the hope that it will be useful, #
df5e82b3
MT
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 #
70df8302 17# along with this program. If not, see <http://www.gnu.org/licenses/>. #
df5e82b3 18# #
df5e82b3
MT
19###############################################################################
20
21###############################################################################
22# Definitions
23###############################################################################
24
25include Config
26
055ed1ff 27VER = 3.10.27
fdecb907 28
a7cd6a4a 29RPI_PATCHES = linux-3.10.27-grsec-943b563
055ed1ff 30GRS_PATCHES = grsecurity-2.9.1-3.10.27-ipfire1.patch.xz
df5e82b3
MT
31
32THISAPP = linux-$(VER)
79f94395 33DL_FILE = linux-$(VER).tar.xz
a2cb3a33 34DL_FROM = $(URL_IPFIRE)
df5e82b3
MT
35DIR_APP = $(DIR_SRC)/$(THISAPP)
36CFLAGS =
37CXXFLAGS =
38
055ed1ff 39PAK_VER = 32
acdf0e61 40DEPS = ""
bd9921dd 41
fdf0c7c1 42VERSUFIX=ipfire$(KCFG)
b0d0b681 43
51f9e7ac 44ifeq "$(TOOLS)" "1"
cc24c14b 45 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)-tools
51f9e7ac 46 HEADERS_PREFIX = /tools
51f9e7ac
MT
47else
48 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
cc24c14b 49 HEADERS_PREFIX = /usr
51f9e7ac
MT
50endif
51
cc72d5cb 52ifeq "$(MACHINE_TYPE)" "arm"
51f9e7ac
MT
53 HEADERS_ARCH=arm
54else
55 HEADERS_ARCH=x86
56endif
6230f0da 57
bc8fe5ff
AF
58ifeq "$(KCFG)" ""
59LASTKERNEL=1
60endif
61ifeq "$(KCFG)" "-kirkwood"
62LASTKERNEL=1
63endif
64
df5e82b3
MT
65###############################################################################
66# Top-level Rules
67###############################################################################
68objects =$(DL_FILE) \
68c2cbed
AF
69 rpi-patches-$(RPI_PATCHES).patch.xz \
70 $(GRS_PATCHES)
fdecb907 71
e69f1bf2 72
64cf4991 73$(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
fdecb907 74rpi-patches-$(RPI_PATCHES).patch.xz = $(URL_IPFIRE)/rpi-patches-$(RPI_PATCHES).patch.xz
68c2cbed 75$(GRS_PATCHES) = $(URL_IPFIRE)/$(GRS_PATCHES)
e69f1bf2 76
055ed1ff 77$(DL_FILE)_MD5 = 4edaaea57dc940969c54ac249e49f7e7
a7cd6a4a 78rpi-patches-$(RPI_PATCHES).patch.xz_MD5 = 8cf81f48408306d93ccee59b58af2e92
055ed1ff 79$(GRS_PATCHES)_MD5 = a83aad5c389ea9a496ba41608267d3dc
3e5f2ee9 80
df5e82b3
MT
81install : $(TARGET)
82
83check : $(patsubst %,$(DIR_CHK)/%,$(objects))
84
85download :$(patsubst %,$(DIR_DL)/%,$(objects))
86
87md5 : $(subst %,%_MD5,$(objects))
88
f418a984
AF
89dist:
90 @$(PAK)
df5e82b3
MT
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)
fdecb907 110 @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
b0d0b681 111
51f9e7ac 112 ln -svf linux-$(VER) $(DIR_SRC)/linux
3a1019f6 113
3c4d4ed0 114 # Linux Intermediate Queueing Device
be33adfb 115 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/imq_kernel3.10.23.patch
bd9921dd 116
fdecb907 117 # ipp2p 0.8.2-ipfire
bb5f0bf8 118 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10-ipp2p-0.8.2-ipfire.patch
4f1b7a27 119
3a1019f6 120 # Layer7-patch
bb5f0bf8
AF
121 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/netfilter_layer7_2.22_kernel3.10-no_proc_interface.patch
122
123 # Grsecurity-patches
124ifneq "$(KCFG)" "-headers"
68c2cbed 125 cd $(DIR_APP) && xz -c -d $(DIR_DL)/$(GRS_PATCHES) | patch -Np1
bb5f0bf8
AF
126 cd $(DIR_APP) && rm localversion-grsec
127 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.7-disable-compat_vdso.patch
128endif
129
130 # Disable pcspeaker autoload
131 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.30-no-pcspkr-modalias.patch
132
133 # Remove ACPI Blacklist message
134 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6-silence-acpi-blacklist.patch
df5e82b3 135
e2b79cd1
AF
136 # DVB Patches
137 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.9-dvbsky-wot2.patch
138 cd $(DIR_APP) && patch -Np2 < $(DIR_SRC)/src/patches/v4l-dvb_fix_tua6034_pll.patch
139
d33aa452
AF
140 # Wlan Patches
141 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/compat-drivers-3.8.3-ath_ignore_eeprom_regdomain.patch
142
143 # mISDN Patches
144 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/mISDN_hfc-s_add_id.patch
145 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/mISDN-hfcusb-reportl1down.patch
146
40c7cdd3 147 # Add LED trigger
e2b79cd1 148 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.9-ledtrig-netdev-1.patch
40c7cdd3 149
87837787 150 # Fix uevent PHYSDEVDRIVER
4de2df1e 151 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2.33_ipg-fix-driver-name.patch
87837787 152 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.27_mcs7830-fix-driver-name.patch
9256a1df 153
74194478 154
bc8fe5ff 155ifeq "$(KCFG)" "-kirkwood"
c05f6df0 156 # Add dreamplug,guruplug and icy 62x0 support on ARM-kirkwood
74194478
AF
157 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.10-arm_kirkwood_setups.patch
158 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.10-mv_cesa_disable_failing_hmac_sha1.patch
8e6fb99d
AF
159endif
160
7284262a 161ifeq "$(KCFG)" "-multi"
89df55b6 162 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.27-fs-exec-atomic64-operand-requires-impossible-reload.patch
7284262a
AF
163# cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-0001-panda-wlan-fix.patch
164# cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-0002-panda-i2c.patch
165# cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-panda-reboot.patch
166 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10-smsc95xx-add_mac_addr_param.patch
9bfde8ed
SS
167
168 # Patchset for Wandboard.
169 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/dts/0001-imx6qdl-wandboard-dts-backport.patch
170 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/dts/0002-ARM-dts-imx6qdl-wandboard-add-gpio-lines-to-wandboar.patch
171 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/dts/0003-ARM-dts-imx6qdl-wandboard-Add-support-for-i2c1.patch
0c41633e 172 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/dts/0004-ARM-dts-wandboard-add-binding-for-wand-rfkill-driver.patch
f7075c3a 173 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/dts/0005-ARM-dts-imx6qdl-add-pcie-device-node.patch
83d8e3a6 174
0520e6a5 175 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0001-i2c-imx-retry-on-NAK.patch
14ef7de4 176 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0002-i.MX6-Wandboard-add-CKO1-clock-output.patch
d24c586a 177 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0003-thermal-add-imx-thermal-driver-support.patch
0c41633e 178 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0004-ARM-i.MX6-Wandboard-add-wifi-bt-rfkill-driver.patch
2b230b77
SS
179 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0005-Add-IMX6Q-AHCI-support.patch
180 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0006-imx-Add-IMX53-AHCI-support.patch
181 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0007-imx6-enable-sata-clk-if-SATA_AHCI_PLATFORM.patch
182 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0008-ARM-imx6q-update-the-sata-bits-definitions-of-gpr13.patch
183 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0009-ahci_imx-add-ahci-sata-support-on-imx-platforms.patch
184 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0010-ahci_imx-depend-on-CONFIG_MFD_SYSCON.patch
f7075c3a
SS
185 cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0011-add-pcie-designware.patch
186 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0012-pcie-backport-fixes.patch
187 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0013-of-pci-Provide-support-for-parsing-PCI-DT-ranges-pro.patch
188 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0014-ARM-imx6q-Add-PCIe-bits-to-GPR-syscon-definition.patch
189 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0015-PCI-imx6-Add-support-for-i.MX6-PCIe-controller.patch
190 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0016-imx6-pci-tweaks.patch
191 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0017-ARM-imx-Add-LVDS-general-purpose-clocks-to-i.MX6Q.patch
192 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/wandboard/imx/0018-ARM-imx6q-clock-and-Kconfig-update-for-PCIe-support.patch
0520e6a5 193
83d8e3a6
SS
194 # Patchset for Compulab Utilite.
195 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/kernel/utilite/linux-3.10-compulab-utilite-support.patch
fdecb907
AF
196endif
197
198ifeq "$(KCFG)" "-rpi"
199 # Apply Raspberry Pi kernel patches.
200 cd $(DIR_APP) && xzcat $(DIR_DL)/rpi-patches-$(RPI_PATCHES).patch.xz | patch -Np1
7fbc483a 201endif
8e6fb99d 202
cc24c14b 203ifeq "$(KCFG)" "-headers"
51f9e7ac
MT
204 # Install the header files
205 cd $(DIR_APP) && make ARCH=$(HEADERS_ARCH) INSTALL_HDR_PATH=dest headers_install
206 -mkdir -pv $(BUILDROOT)/$(HEADERS_PREFIX)/include
207 cd $(DIR_APP) && find dest/include \( -name .install -o -name ..install.cmd \) -delete
208 cd $(DIR_APP) && cp -rv dest/include/* $(BUILDROOT)/$(HEADERS_PREFIX)/include
209else
210
aa2049e5
MT
211 # Install ipfire logo
212 cd $(DIR_APP) && cp -vf $(DIR_SRC)/config/kernel/ipfire_logo.ppm \
213 drivers/video/logo/logo_linux_clut224.ppm
214
df5e82b3 215 # Cleanup kernel source
2b2e03ed 216 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config
bd9921dd 217 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
df5e82b3 218 cd $(DIR_APP) && make CC="$(KGCC)" clean
fdecb907 219 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
3a1019f6 220
bc8fe5ff 221ifeq "$(KCFG)" "-kirkwood"
b64c3fc8 222 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" uImage modules
8e6fb99d 223 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
bc8fe5ff
AF
224 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX)
225else
7284262a 226ifeq "$(KCFG)" "-multi"
b64c3fc8 227 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" zImage modules
7284262a
AF
228 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
229 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/zImage-$(VERSUFIX)
fdecb907
AF
230else
231ifeq "$(KCFG)" "-rpi"
b64c3fc8 232 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" zImage modules
74194478
AF
233 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
234 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/kernel.img
92655908 235else
b64c3fc8 236 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage modules
2b2e03ed 237 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
1e1cdd58 238 ln -sf vmlinuz-$(VER)-$(VERSUFIX) /boot/vmlinuz-$(VERSUFIX)
92655908 239endif
bc8fe5ff 240endif
3c4d4ed0 241endif
2b2e03ed
AF
242 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
243 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
2b2e03ed 244 ln -sf System.map-$(VER)-$(VERSUFIX) /boot/System.map-$(VERSUFIX)
376e42ce 245 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
a3b414d3 246 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
376e42ce 247
7284262a
AF
248ifeq "$(MACHINE_TYPE)" "arm"
249 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) dtbs
250 cd $(DIR_APP) && for f in $$(find arch/arm/boot/dts/ -name *.dtb); do \
251 mkdir -p /boot/dtb-$(VER)-$(VERSUFIX) ; \
252 install -m 644 $$f /boot/dtb-$(VER)-$(VERSUFIX)/ ; \
253 done
254endif
255
bc8fe5ff
AF
256ifeq "$(LASTKERNEL)" "1"
257 # Only do this once
81e974f3 258 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
d644d86f 259
efa8b615 260 # Blacklist matroxfb_base
ba109afd 261 echo "blacklist matroxfb_base" >> /etc/modprobe.d/framebuffer.conf
aa1dd878 262 # Blacklist old framebuffer modules
030a57c5 263 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video -name *fb.ko); do \
ba109afd 264 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
030a57c5 265 done
aa1dd878
AF
266 # Blacklist new drm framebuffer modules
267 for f in $$(ls -1 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm/*/*.ko); do \
ba109afd 268 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
aa1dd878 269 done
ba109afd 270 sed -i -e "s|.ko||g" /etc/modprobe.d/framebuffer.conf
e2e106be
AF
271
272 # Blacklist isdn modules
273 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn -name *.ko); do \
ba109afd 274 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/isdn.conf ; \
e2e106be 275 done
ba109afd 276 sed -i -e "s|.ko||g" /etc/modprobe.d/isdn.conf
78a51aaf
AF
277
278 # Disable ipv6 at runtime
ba109afd 279 echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6.conf
26c1cc71
AF
280endif
281
bb5f0bf8
AF
282 # Disable geode_aes modul if exist
283 -mv /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/crypto/geode-aes.ko \
8885467f 284 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/crypto/geode-aes.ko.off
51f9e7ac 285endif
8885467f 286
d644d86f 287 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
df5e82b3 288 @$(POSTBUILD)