]> git.ipfire.org Git - ipfire-2.x.git/blame - lfs/linux
cyrus-imapd: move initscript to src/initscripts/packages and use new macro
[ipfire-2.x.git] / lfs / linux
CommitLineData
df5e82b3 1###############################################################################
df5e82b3 2# #
70df8302 3# IPFire.org - A linux based firewall #
ba957627 4# Copyright (C) 2007-2017 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
7331b247
AF
27VER = 3.14.79
28RPI_PATCHES = 3.14.79-grsec-ipfire1
29A7M_PATCHES = 3.14.79-grsec-ipfire1
30GRS_PATCHES = grsecurity-3.1ipfire-3.14.79-v1.patch.xz
fdecb907 31
df5e82b3
MT
32
33THISAPP = linux-$(VER)
79f94395 34DL_FILE = linux-$(VER).tar.xz
a2cb3a33 35DL_FROM = $(URL_IPFIRE)
df5e82b3
MT
36DIR_APP = $(DIR_SRC)/$(THISAPP)
37CFLAGS =
38CXXFLAGS =
39
4bdbf22e 40PAK_VER = 73
acdf0e61 41DEPS = ""
bd9921dd 42
ba583892
MT
43KERNEL_ARCH = $(MACHINE)
44
45ifeq "$(MACHINE)" "i586"
46 KERNEL_ARCH = i386
47endif
48
fdf0c7c1 49VERSUFIX=ipfire$(KCFG)
b0d0b681 50
51f9e7ac 51ifeq "$(TOOLS)" "1"
cc24c14b 52 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)-tools
51f9e7ac 53 HEADERS_PREFIX = /tools
51f9e7ac
MT
54else
55 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
cc24c14b 56 HEADERS_PREFIX = /usr
51f9e7ac
MT
57endif
58
cc72d5cb 59ifeq "$(MACHINE_TYPE)" "arm"
51f9e7ac
MT
60 HEADERS_ARCH=arm
61else
62 HEADERS_ARCH=x86
63endif
6230f0da 64
bc8fe5ff
AF
65ifeq "$(KCFG)" ""
66LASTKERNEL=1
67endif
68ifeq "$(KCFG)" "-kirkwood"
69LASTKERNEL=1
70endif
71
df5e82b3
MT
72###############################################################################
73# Top-level Rules
74###############################################################################
75objects =$(DL_FILE) \
68c2cbed 76 rpi-patches-$(RPI_PATCHES).patch.xz \
932a34e5 77 arm7-multi-patches-$(A7M_PATCHES).patch.xz \
68c2cbed 78 $(GRS_PATCHES)
fdecb907 79
e69f1bf2 80
932a34e5
AF
81$(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
82rpi-patches-$(RPI_PATCHES).patch.xz = $(URL_IPFIRE)/rpi-patches-$(RPI_PATCHES).patch.xz
83arm7-multi-patches-$(A7M_PATCHES).patch.xz = $(URL_IPFIRE)/arm7-multi-patches-$(A7M_PATCHES).patch.xz
84$(GRS_PATCHES) = $(URL_IPFIRE)/$(GRS_PATCHES)
e69f1bf2 85
7331b247
AF
86$(DL_FILE)_MD5 = ec5b09d8ad2ebf92e6f51a727a338559
87rpi-patches-$(RPI_PATCHES).patch.xz_MD5 = a02a7fd54c642c1e3578a00ed22f54f8
88arm7-multi-patches-$(A7M_PATCHES).patch.xz_MD5 = 6c3b11e51caa278dbeacd1e23c2b171b
89$(GRS_PATCHES)_MD5 = 7fe448b53558082395f68c5db94af1a7
3e5f2ee9 90
df5e82b3
MT
91install : $(TARGET)
92
93check : $(patsubst %,$(DIR_CHK)/%,$(objects))
94
95download :$(patsubst %,$(DIR_DL)/%,$(objects))
96
97md5 : $(subst %,%_MD5,$(objects))
98
f418a984
AF
99dist:
100 @$(PAK)
df5e82b3
MT
101###############################################################################
102# Downloading, checking, md5sum
103###############################################################################
104
105$(patsubst %,$(DIR_CHK)/%,$(objects)) :
106 @$(CHECK)
107
108$(patsubst %,$(DIR_DL)/%,$(objects)) :
109 @$(LOAD)
110
111$(subst %,%_MD5,$(objects)) :
112 @$(MD5)
113
114###############################################################################
115# Installation Details
116###############################################################################
117
118$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
119 @$(PREBUILD)
fdecb907 120 @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
b0d0b681 121
51f9e7ac 122 ln -svf linux-$(VER) $(DIR_SRC)/linux
3a1019f6 123
3c4d4ed0 124 # Linux Intermediate Queueing Device
9d3616dc 125 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.22-imq.patch
bd9921dd 126
3a1019f6 127 # Layer7-patch
9d3616dc 128 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14-layer7-filter.patch
e898660a 129
e40740b2 130ifneq "$(KCFG)" "-headers"
bb5f0bf8 131 # Grsecurity-patches
68c2cbed 132 cd $(DIR_APP) && xz -c -d $(DIR_DL)/$(GRS_PATCHES) | patch -Np1
bb5f0bf8
AF
133 cd $(DIR_APP) && rm localversion-grsec
134 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.7-disable-compat_vdso.patch
e40740b2 135endif
bb5f0bf8 136
e2b79cd1 137 # DVB Patches
9d3616dc 138 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.22-dvbsky.patch
e2b79cd1
AF
139 cd $(DIR_APP) && patch -Np2 < $(DIR_SRC)/src/patches/v4l-dvb_fix_tua6034_pll.patch
140
d33aa452
AF
141 # Wlan Patches
142 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/compat-drivers-3.8.3-ath_ignore_eeprom_regdomain.patch
9d3616dc 143 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.22-iwlwifi-noibss_only_on_radar_chan.patch
89f0807f 144 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.37-rt2800usb_add_dlink_dwa137_usbid.patch
085d9975 145 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.55-rt2800usb-change_queue_warn_to_debug.patch
32787fb0
AF
146 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.25_rt2x00_fix_bss_bcn_num.patch
147 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.25-rt5592_no_special_txop_init.patch
74fd06be 148 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.39-add_libertas_uap.patch
d33aa452
AF
149
150 # mISDN Patches
151 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/mISDN_hfc-s_add_id.patch
152 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/mISDN-hfcusb-reportl1down.patch
153
40c7cdd3 154 # Add LED trigger
817317ed 155 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.22-ledtrig_netdev.patch
40c7cdd3 156
1e67b3c3
AF
157 # cs5535audio spams syslog if no ac97 was present (geos router)
158 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.30_cs5535audio_fix_logspam_on_geos.patch
159
e583643a 160 # Add PC Engines APU led support
4d4f36ef 161 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14-apu_leds.patch
e583643a 162
9a7a6c52
AF
163 # Add APU2 SoC ID to k10temp
164 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.65-k10temp_add_16H_M30H_id.patch
165
87837787 166 # Fix uevent PHYSDEVDRIVER
4de2df1e 167 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2.33_ipg-fix-driver-name.patch
87837787 168 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.27_mcs7830-fix-driver-name.patch
9256a1df 169
30bf8c66
AF
170 # r8169 L23 patch
171 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.32-r8169_disable_L23.patch
172
c9ab30c5
AF
173 # update the queued trim blacklist from kernel 4.2rc1
174 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.43_new_qtrim_blacklist.patch
175
ba957627
AF
176 # remove eMMC EXT_CSD revision check to use newer eMMC modules
177 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.79_mmc_remove_EXT_CSD_revision_check.patch
178
a7b0967d
MT
179 # Hyper-V patches
180 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0001-Drivers-net-hyperv-Get-rid-of-the-rndis_filter_packe.patch
181 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0002-Drivers-net-hyperv-Cleanup-the-receive-path.patch
182 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0003-Drivers-net-hyperv-Cleanup-the-netvsc-receive-callba.patch
183 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0004-hyperv-Add-latest-NetVSP-versions-to-auto-negotiatio.patch
184 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0005-Drivers-net-hyperv-Enable-scatter-gather-I-O.patch
185 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0006-Drivers-net-hyperv-Cleanup-the-send-path.patch
186 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0007-Drivers-net-hyperv-Enable-offloads-on-the-host.patch
187 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0008-Drivers-net-hyperv-Enable-receive-side-IP-checksum-o.patch
188 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0009-Drivers-net-hyperv-Enable-send-side-checksum-offload.patch
189 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0010-Drivers-net-hyperv-Enable-large-send-offload.patch
190 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0011-hyperv-Change-the-receive-buffer-size-for-legacy-hos.patch
191 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0012-Drivers-net-hyperv-Allocate-memory-for-all-possible-.patch
192 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0013-Drivers-net-hyperv-Negotiate-suitable-ndis-version-f.patch
193 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0014-Drivers-net-hyperv-Address-UDP-checksum-issues.patch
194 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0015-hyperv-Properly-handle-checksum-offload.patch
195 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0016-hyperv-Add-support-for-virtual-Receive-Side-Scaling-.patch
196 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0017-hyperv-Remove-recv_pkt_list-and-lock.patch
197 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0018-hyperv-Simplify-the-send_completion-variables.patch
198 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0019-hyperv-Enable-sendbuf-mechanism-on-the-send-path.patch
199 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0020-Add-support-for-netvsc-build-without-CONFIG_SYSFS-fl.patch
200 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0021-hyperv-Add-hash-value-into-RNDIS-Per-packet-info.patch
201 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0022-hyperv-fix-apparent-cut-n-paste-error-in-send-path-t.patch
202 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0023-hyperv-Fix-error-return-code-in-netvsc_init_buf.patch
203 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0024-hyperv-Fix-a-bug-in-netvsc_send.patch
204 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0025-Drivers-hv-vmbus-Support-per-channel-driver-state.patch
0c29a8ab 205 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-hyperv_Mark_the_Hyoer-V_TSC_as_unstable.patch
5b3bd19f 206
ed7a7f77
AF
207ifneq "$(KCFG)" "-headers"
208 # fix AES-NI 192 and 256 bits / grsec is needed for this patch version
209 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0100-crypto-aesni-Add-support-for-192-256-bit-keys-to-AES.patch
210endif
211
4bdbf22e
AF
212 # fix CVE-2016-5195 (Dirty COW)
213 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/0110-mm-remove-gup_flags-FOLL_WRITE-games-from-__get_user.patch
214
bd64e2a0
AF
215 # fix empty symbol crc's
216 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-genksyms_fix_typeof_handling.patch
217
bc8fe5ff 218ifeq "$(KCFG)" "-kirkwood"
74194478 219 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.10-mv_cesa_disable_failing_hmac_sha1.patch
21147a00 220 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.22-kirkwood_legacy_boot.patch
8e6fb99d
AF
221endif
222
7284262a 223ifeq "$(KCFG)" "-multi"
7284262a 224 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10-smsc95xx-add_mac_addr_param.patch
9bfde8ed 225
932a34e5
AF
226 # Apply Arm7-multiarch kernel patches.
227 cd $(DIR_APP) && xzcat $(DIR_DL)/arm7-multi-patches-$(A7M_PATCHES).patch.xz | patch -Np1
aa668423 228 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/arm-multi-grsec-compile-fixes.patch
7726e3a6 229
ffeb717f
AF
230 # Install switch api userspace header
231 cd $(DIR_APP) && install -v -m644 include/uapi/linux/switch.h /usr/include/linux/
8602108e 232
fdecb907
AF
233endif
234
235ifeq "$(KCFG)" "-rpi"
236 # Apply Raspberry Pi kernel patches.
237 cd $(DIR_APP) && xzcat $(DIR_DL)/rpi-patches-$(RPI_PATCHES).patch.xz | patch -Np1
7fbc483a 238endif
8e6fb99d 239
cee50e12 240ifeq "$(KCFG)" "-headers"
51f9e7ac
MT
241 # Install the header files
242 cd $(DIR_APP) && make ARCH=$(HEADERS_ARCH) INSTALL_HDR_PATH=dest headers_install
243 -mkdir -pv $(BUILDROOT)/$(HEADERS_PREFIX)/include
244 cd $(DIR_APP) && find dest/include \( -name .install -o -name ..install.cmd \) -delete
245 cd $(DIR_APP) && cp -rv dest/include/* $(BUILDROOT)/$(HEADERS_PREFIX)/include
246else
247
aa2049e5
MT
248 # Install ipfire logo
249 cd $(DIR_APP) && cp -vf $(DIR_SRC)/config/kernel/ipfire_logo.ppm \
250 drivers/video/logo/logo_linux_clut224.ppm
251
df5e82b3 252 # Cleanup kernel source
2b2e03ed 253 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config
6f67c28d
MT
254 cd $(DIR_APP) && make oldconfig
255 cd $(DIR_APP) && make clean
fdecb907 256 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
3a1019f6 257
bc8fe5ff 258ifeq "$(KCFG)" "-kirkwood"
6f67c28d 259 cd $(DIR_APP) && make $(MAKETUNING) uImage modules
8e6fb99d 260 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
bc8fe5ff
AF
261 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX)
262else
7284262a 263ifeq "$(KCFG)" "-multi"
6f67c28d 264 cd $(DIR_APP) && make $(MAKETUNING) zImage modules
7284262a
AF
265 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
266 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/zImage-$(VERSUFIX)
fdecb907
AF
267else
268ifeq "$(KCFG)" "-rpi"
6f67c28d 269 cd $(DIR_APP) && make $(MAKETUNING) zImage modules
74194478
AF
270 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
271 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/kernel.img
92655908 272else
6f67c28d 273 cd $(DIR_APP) && make $(MAKETUNING) bzImage modules
ba583892 274 cd $(DIR_APP) && cp -v arch/$(KERNEL_ARCH)/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
92655908 275endif
3c4d4ed0 276endif
a158cbbb
AF
277endif
278
2b2e03ed
AF
279 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
280 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
6f67c28d
MT
281 cd $(DIR_APP) && make $(MAKETUNING) modules_install
282 cd $(DIR_APP) && make $(MAKETUNING) firmware_install
376e42ce 283
7284262a 284ifeq "$(MACHINE_TYPE)" "arm"
6f67c28d 285 cd $(DIR_APP) && make $(MAKETUNING) dtbs
7284262a
AF
286 cd $(DIR_APP) && for f in $$(find arch/arm/boot/dts/ -name *.dtb); do \
287 mkdir -p /boot/dtb-$(VER)-$(VERSUFIX) ; \
288 install -m 644 $$f /boot/dtb-$(VER)-$(VERSUFIX)/ ; \
289 done
290endif
291
bc8fe5ff
AF
292ifeq "$(LASTKERNEL)" "1"
293 # Only do this once
81e974f3 294 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
d644d86f 295
efa8b615 296 # Blacklist matroxfb_base
ba109afd 297 echo "blacklist matroxfb_base" >> /etc/modprobe.d/framebuffer.conf
aa1dd878 298 # Blacklist old framebuffer modules
030a57c5 299 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video -name *fb.ko); do \
ba109afd 300 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
030a57c5 301 done
aa1dd878
AF
302 # Blacklist new drm framebuffer modules
303 for f in $$(ls -1 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm/*/*.ko); do \
ba109afd 304 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
aa1dd878 305 done
ba109afd 306 sed -i -e "s|.ko||g" /etc/modprobe.d/framebuffer.conf
e2e106be
AF
307
308 # Blacklist isdn modules
309 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn -name *.ko); do \
ba109afd 310 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/isdn.conf ; \
e2e106be 311 done
ba109afd 312 sed -i -e "s|.ko||g" /etc/modprobe.d/isdn.conf
78a51aaf
AF
313
314 # Disable ipv6 at runtime
ba109afd 315 echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6.conf
26c1cc71 316endif
51f9e7ac 317endif
8885467f 318
22820bf2
AF
319 #force new build of external modules and initrd if the kernel was rebuild
320 -rm -f /usr/src/log/*-kmod-$(VER)-$(VERSUFIX)
321 -rm -f /usr/src/log/linux-initrd-$(VER)-$(VERSUFIX)
322
d644d86f 323 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
df5e82b3 324 @$(POSTBUILD)