]> git.ipfire.org Git - ipfire-2.x.git/blob - lfs/linux
kernel: update to 4.14.71
[ipfire-2.x.git] / lfs / linux
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2018 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 = 4.14.71
28 ARM_PATCHES = 4.14.71-ipfire0
29
30 THISAPP = linux-$(VER)
31 DL_FILE = linux-$(VER).tar.xz
32 DL_FROM = $(URL_IPFIRE)
33 DIR_APP = $(DIR_SRC)/$(THISAPP)
34 CFLAGS =
35 CXXFLAGS =
36
37 PAK_VER = 77
38 DEPS = ""
39
40 HEADERS_ARCH = $(BUILD_PLATFORM)
41 KERNEL_ARCH = $(BUILD_ARCH)
42 KERNEL_TARGET = bzImage
43
44 ifeq "$(BUILD_ARCH)" "i586"
45 KERNEL_ARCH = i386
46 endif
47
48 ifeq "$(BUILD_ARCH)" "aarch64"
49 HEADERS_ARCH = arm64
50 KERNEL_ARCH = arm64
51 KERNEL_TARGET = Image
52 endif
53
54 ifeq "$(BUILD_ARCH)" "armv5tel"
55 KERNEL_ARCH = arm
56 KERNEL_TARGET = zImage
57 endif
58
59 VERSUFIX=ipfire$(KCFG)
60
61 ifeq "$(TOOLCHAIN)" "1"
62 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)-tools
63 HEADERS_PREFIX = $(TOOLS_DIR)
64 else
65 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
66 HEADERS_PREFIX = /usr
67 endif
68
69 ifeq "$(KCFG)" ""
70 LASTKERNEL=1
71 endif
72 ifeq "$(KCFG)" "-multi"
73 LASTKERNEL=1
74 endif
75
76 ###############################################################################
77 # Top-level Rules
78 ###############################################################################
79 objects =$(DL_FILE) \
80 arm-multi-patches-$(ARM_PATCHES).patch.xz
81
82 $(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
83 arm-multi-patches-$(ARM_PATCHES).patch.xz = $(URL_IPFIRE)/arm-multi-patches-$(ARM_PATCHES).patch.xz
84
85 $(DL_FILE)_MD5 = 14b21e5f11e8e195731c89a14794a0fc
86 arm-multi-patches-$(ARM_PATCHES).patch.xz_MD5 = 889a8d49a63bf462067409887f8105bb
87
88
89 install : $(TARGET)
90
91 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
92
93 download :$(patsubst %,$(DIR_DL)/%,$(objects))
94
95 md5 : $(subst %,%_MD5,$(objects))
96
97 dist:
98 @$(PAK)
99 ###############################################################################
100 # Downloading, checking, md5sum
101 ###############################################################################
102
103 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
104 @$(CHECK)
105
106 $(patsubst %,$(DIR_DL)/%,$(objects)) :
107 @$(LOAD)
108
109 $(subst %,%_MD5,$(objects)) :
110 @$(MD5)
111
112 ###############################################################################
113 # Installation Details
114 ###############################################################################
115
116 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
117 @$(PREBUILD)
118 @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
119
120 ln -svf linux-$(VER) $(DIR_SRC)/linux
121
122 # Linux Intermediate Queueing Device
123 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14-imq.diff
124
125 # Layer7-patch
126 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14-layer7.patch
127
128 # DVB Patches
129 cd $(DIR_APP) && patch -Np2 < $(DIR_SRC)/src/patches/v4l-dvb_fix_tua6034_pll.patch
130
131 # Wlan Patches
132 # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/backports-4.2.6-1_ath10k_remove_logspam.patch
133 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8-ath_ignore_eeprom_regd.patch
134 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8-iwlwifi-noibss_only_on_radar_chan.patch
135 # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8-rt2x00usb_suppress_queue_warnings.patch
136 # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.39-add_libertas_uap.patch
137
138 # Add LED trigger
139 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.16-ledtrig_netdev.patch
140
141 # Fix igb and e1000e crash
142 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14.1-igb-e1000e_fix_lock_at_update_stats.patch
143
144 # cs5535audio spams syslog if no ac97 was present (geos router)
145 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8_cs5535audio_fix_logspam_on_geos.patch
146
147 # Add PC Engines APU led support
148 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8-apu_leds.patch
149
150 # Fix uevent PHYSDEVDRIVER
151 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-2.6.32.27_mcs7830-fix-driver-name.patch
152
153 ifeq "$(KCFG)" "-kirkwood"
154 # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.10-mv_cesa_disable_failing_hmac_sha1.patch
155 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14.40-kirkwood-dtb.patch
156 endif
157
158 ifeq "$(KCFG)" "-multi"
159 # Apply Arm-multiarch kernel patches.
160 cd $(DIR_APP) && xzcat $(DIR_DL)/arm-multi-patches-$(ARM_PATCHES).patch.xz | patch -Np1
161 endif
162 ifeq "$(BUILD_ARCH)" "aarch64"
163 # Apply Arm-multiarch kernel patches.
164 cd $(DIR_APP) && xzcat $(DIR_DL)/arm-multi-patches-$(ARM_PATCHES).patch.xz | patch -Np1
165 endif
166 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-3.14.79-amba-fix.patch
167
168 ifeq "$(KCFG)" "-headers"
169 # Install the header files
170 cd $(DIR_APP) && make ARCH=$(HEADERS_ARCH) INSTALL_HDR_PATH=dest headers_install
171 -mkdir -pv $(BUILDROOT)/$(HEADERS_PREFIX)/include
172 cd $(DIR_APP) && find dest/include \( -name .install -o -name ..install.cmd \) -delete
173 cd $(DIR_APP) && cp -rv dest/include/* $(BUILDROOT)/$(HEADERS_PREFIX)/include
174 else
175
176 # Install ipfire logo
177 cd $(DIR_APP) && cp -vf $(DIR_SRC)/config/kernel/ipfire_logo.ppm \
178 drivers/video/logo/logo_linux_clut224.ppm
179
180 # Cleanup kernel source
181 cp $(DIR_SRC)/config/kernel/kernel.config.$(BUILD_ARCH)-$(VERSUFIX) $(DIR_APP)/.config
182 cd $(DIR_APP) && make oldconfig
183 cd $(DIR_APP) && make clean
184 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
185
186 # Build the kernel
187 cd $(DIR_APP) && make $(MAKETUNING) $(KERNEL_TARGET) modules
188
189 # Install the kernel
190 cd $(DIR_APP) && cp -v arch/$(KERNEL_ARCH)/boot/$(KERNEL_TARGET) /boot/vmlinuz-$(VER)-$(VERSUFIX)
191 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
192 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
193 cd $(DIR_APP) && make $(MAKETUNING) modules_install
194
195 ifeq "$(BUILD_PLATFORM)" "arm"
196 cd $(DIR_APP) && make $(MAKETUNING) dtbs
197 mkdir -p /boot/dtb-$(VER)-$(VERSUFIX)
198 cd $(DIR_APP)/arch/$(KERNEL_ARCH)/boot/dts && for f in $$(find -name "*.dtb"); do \
199 cp -v --parents $$f /boot/dtb-$(VER)-$(VERSUFIX)/ ; \
200 chmod 644 /boot/dtb-$(VER)-$(VERSUFIX)/$$f ; \
201 done
202 endif
203
204 ifeq "$(LASTKERNEL)" "1"
205 # Only do this once
206 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
207
208 # disable drm by install drm to /bin/false because i915 ignore blacklisting
209 echo install drm /bin/false > /etc/modprobe.d/framebuffer.conf
210
211 # Blacklist old framebuffer modules
212 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video/fbdev/ -name *.ko); do \
213 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
214 done
215 # Blacklist new drm framebuffer modules
216 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm -name *.ko); do \
217 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
218 done
219 sed -i -e "s|.ko||g" /etc/modprobe.d/framebuffer.conf
220
221 # Disable ipv6 at runtime
222 echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6.conf
223 endif
224 endif
225
226 #force new build of external modules and initrd if the kernel was rebuild
227 -rm -f /usr/src/log/*-kmod-$(VER)-$(VERSUFIX)
228 -rm -f /usr/src/log/linux-initrd-$(VER)-$(VERSUFIX)
229
230 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
231 @$(POSTBUILD)