kernel: disable drm by installing /bin/false
[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
0129f6dc 27VER = 4.14.3
7331b247
AF
28RPI_PATCHES = 3.14.79-grsec-ipfire1
29A7M_PATCHES = 3.14.79-grsec-ipfire1
df4eb191 30
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
4bdbf22e 39PAK_VER = 73
acdf0e61 40DEPS = ""
bd9921dd 41
dc7d6b20 42ifeq "$(BUILD_ARCH)" "i586"
ba583892 43 KERNEL_ARCH = i386
fdfddd64 44else
dc7d6b20
MT
45 KERNEL_ARCH = $(BUILD_ARCH)
46endif
47
48ifeq "$(BUILD_ARCH)" "aarch64"
49 HEADERS_ARCH = arm64
50else
51 HEADERS_ARCH = $(BUILD_PLATFORM)
ba583892
MT
52endif
53
fdf0c7c1 54VERSUFIX=ipfire$(KCFG)
b0d0b681 55
991d11d7 56ifeq "$(TOOLCHAIN)" "1"
cc24c14b 57 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)-tools
6c4cc7ea 58 HEADERS_PREFIX = $(TOOLS_DIR)
51f9e7ac
MT
59else
60 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
cc24c14b 61 HEADERS_PREFIX = /usr
51f9e7ac
MT
62endif
63
bc8fe5ff
AF
64ifeq "$(KCFG)" ""
65LASTKERNEL=1
66endif
67ifeq "$(KCFG)" "-kirkwood"
68LASTKERNEL=1
69endif
70
df5e82b3
MT
71###############################################################################
72# Top-level Rules
73###############################################################################
74objects =$(DL_FILE) \
68c2cbed 75 rpi-patches-$(RPI_PATCHES).patch.xz \
2e1fe3c8 76 arm7-multi-patches-$(A7M_PATCHES).patch.xz
e69f1bf2 77
932a34e5
AF
78$(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
79rpi-patches-$(RPI_PATCHES).patch.xz = $(URL_IPFIRE)/rpi-patches-$(RPI_PATCHES).patch.xz
80arm7-multi-patches-$(A7M_PATCHES).patch.xz = $(URL_IPFIRE)/arm7-multi-patches-$(A7M_PATCHES).patch.xz
e69f1bf2 81
0129f6dc 82$(DL_FILE)_MD5 = c24ea351d105e48b401fd34db8163495
7331b247
AF
83rpi-patches-$(RPI_PATCHES).patch.xz_MD5 = a02a7fd54c642c1e3578a00ed22f54f8
84arm7-multi-patches-$(A7M_PATCHES).patch.xz_MD5 = 6c3b11e51caa278dbeacd1e23c2b171b
27a271b2 85
df5e82b3
MT
86install : $(TARGET)
87
88check : $(patsubst %,$(DIR_CHK)/%,$(objects))
89
90download :$(patsubst %,$(DIR_DL)/%,$(objects))
91
92md5 : $(subst %,%_MD5,$(objects))
93
f418a984
AF
94dist:
95 @$(PAK)
df5e82b3
MT
96###############################################################################
97# Downloading, checking, md5sum
98###############################################################################
99
100$(patsubst %,$(DIR_CHK)/%,$(objects)) :
101 @$(CHECK)
102
103$(patsubst %,$(DIR_DL)/%,$(objects)) :
104 @$(LOAD)
105
106$(subst %,%_MD5,$(objects)) :
107 @$(MD5)
108
109###############################################################################
110# Installation Details
111###############################################################################
112
113$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
114 @$(PREBUILD)
fdecb907 115 @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
b0d0b681 116
51f9e7ac 117 ln -svf linux-$(VER) $(DIR_SRC)/linux
3a1019f6 118
3c4d4ed0 119 # Linux Intermediate Queueing Device
2e1fe3c8 120 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14-imq.diff
bd9921dd 121
3a1019f6 122 # Layer7-patch
2e1fe3c8 123 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14-layer7.patch
bb5f0bf8 124
e2b79cd1 125 # DVB Patches
e2b79cd1
AF
126 cd $(DIR_APP) && patch -Np2 < $(DIR_SRC)/src/patches/v4l-dvb_fix_tua6034_pll.patch
127
d33aa452 128 # Wlan Patches
2e1fe3c8 129# cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/backports-4.2.6-1_ath10k_remove_logspam.patch
91648bd1
AF
130 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8-ath_ignore_eeprom_regd.patch
131 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8-iwlwifi-noibss_only_on_radar_chan.patch
2e1fe3c8 132# cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8-rt2x00usb_suppress_queue_warnings.patch
91648bd1 133# cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.39-add_libertas_uap.patch
d33aa452
AF
134
135 # mISDN Patches
136 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/mISDN_hfc-s_add_id.patch
137 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/mISDN-hfcusb-reportl1down.patch
138
40c7cdd3 139 # Add LED trigger
94112e8b 140 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.16-ledtrig_netdev.patch
40c7cdd3 141
fcffac13 142 # Fix igb and e1000e crash
2e1fe3c8 143 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14.1-igb-e1000e_fix_lock_at_update_stats.patch
d52f1169 144
1e67b3c3 145 # cs5535audio spams syslog if no ac97 was present (geos router)
91648bd1 146 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8_cs5535audio_fix_logspam_on_geos.patch
1e67b3c3 147
e583643a 148 # Add PC Engines APU led support
91648bd1 149 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8-apu_leds.patch
9a7a6c52 150
87837787 151 # Fix uevent PHYSDEVDRIVER
91648bd1 152 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-2.6.32.27_mcs7830-fix-driver-name.patch
bd64e2a0 153
bc8fe5ff 154ifeq "$(KCFG)" "-kirkwood"
74194478 155 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.10-mv_cesa_disable_failing_hmac_sha1.patch
21147a00 156 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.22-kirkwood_legacy_boot.patch
8e6fb99d
AF
157endif
158
7284262a 159ifeq "$(KCFG)" "-multi"
7284262a 160 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10-smsc95xx-add_mac_addr_param.patch
9bfde8ed 161
932a34e5
AF
162 # Apply Arm7-multiarch kernel patches.
163 cd $(DIR_APP) && xzcat $(DIR_DL)/arm7-multi-patches-$(A7M_PATCHES).patch.xz | patch -Np1
aa668423 164 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/arm-multi-grsec-compile-fixes.patch
7726e3a6 165
ffeb717f
AF
166 # Install switch api userspace header
167 cd $(DIR_APP) && install -v -m644 include/uapi/linux/switch.h /usr/include/linux/
8602108e 168
fdecb907
AF
169endif
170
171ifeq "$(KCFG)" "-rpi"
172 # Apply Raspberry Pi kernel patches.
173 cd $(DIR_APP) && xzcat $(DIR_DL)/rpi-patches-$(RPI_PATCHES).patch.xz | patch -Np1
ad73e5ec 174 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-3.14.79-rpi-suspend-not-inline.patch
7fbc483a 175endif
8e6fb99d 176
0b4976e2
AF
177 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-3.14.79-amba-fix.patch
178
cee50e12 179ifeq "$(KCFG)" "-headers"
51f9e7ac
MT
180 # Install the header files
181 cd $(DIR_APP) && make ARCH=$(HEADERS_ARCH) INSTALL_HDR_PATH=dest headers_install
182 -mkdir -pv $(BUILDROOT)/$(HEADERS_PREFIX)/include
183 cd $(DIR_APP) && find dest/include \( -name .install -o -name ..install.cmd \) -delete
184 cd $(DIR_APP) && cp -rv dest/include/* $(BUILDROOT)/$(HEADERS_PREFIX)/include
185else
186
aa2049e5
MT
187 # Install ipfire logo
188 cd $(DIR_APP) && cp -vf $(DIR_SRC)/config/kernel/ipfire_logo.ppm \
189 drivers/video/logo/logo_linux_clut224.ppm
190
df5e82b3 191 # Cleanup kernel source
dc7d6b20 192 cp $(DIR_SRC)/config/kernel/kernel.config.$(BUILD_ARCH)-$(VERSUFIX) $(DIR_APP)/.config
6f67c28d
MT
193 cd $(DIR_APP) && make oldconfig
194 cd $(DIR_APP) && make clean
fdecb907 195 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
3a1019f6 196
bc8fe5ff 197ifeq "$(KCFG)" "-kirkwood"
6f67c28d 198 cd $(DIR_APP) && make $(MAKETUNING) uImage modules
8e6fb99d 199 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
bc8fe5ff
AF
200 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX)
201else
7284262a 202ifeq "$(KCFG)" "-multi"
6f67c28d 203 cd $(DIR_APP) && make $(MAKETUNING) zImage modules
7284262a
AF
204 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
205 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/zImage-$(VERSUFIX)
fdecb907
AF
206else
207ifeq "$(KCFG)" "-rpi"
6f67c28d 208 cd $(DIR_APP) && make $(MAKETUNING) zImage modules
74194478
AF
209 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
210 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/kernel.img
92655908 211else
6f67c28d 212 cd $(DIR_APP) && make $(MAKETUNING) bzImage modules
ba583892 213 cd $(DIR_APP) && cp -v arch/$(KERNEL_ARCH)/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
92655908 214endif
3c4d4ed0 215endif
a158cbbb
AF
216endif
217
2b2e03ed
AF
218 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
219 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
6f67c28d 220 cd $(DIR_APP) && make $(MAKETUNING) modules_install
376e42ce 221
dc7d6b20 222ifeq "$(BUILD_PLATFORM)" "arm"
6f67c28d 223 cd $(DIR_APP) && make $(MAKETUNING) dtbs
7284262a
AF
224 cd $(DIR_APP) && for f in $$(find arch/arm/boot/dts/ -name *.dtb); do \
225 mkdir -p /boot/dtb-$(VER)-$(VERSUFIX) ; \
226 install -m 644 $$f /boot/dtb-$(VER)-$(VERSUFIX)/ ; \
227 done
228endif
229
bc8fe5ff
AF
230ifeq "$(LASTKERNEL)" "1"
231 # Only do this once
81e974f3 232 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
d644d86f 233
050479e9
AF
234 # disable drm by install drm to /bin/false because i915 ignore blacklisting
235 echo install drm /bin/false > /etc/modprobe.d/framebuffer.conf
236
aa1dd878 237 # Blacklist old framebuffer modules
e31045ee 238 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video/fbdev/ -name *.ko); do \
ba109afd 239 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
030a57c5 240 done
aa1dd878 241 # Blacklist new drm framebuffer modules
e31045ee 242 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm -name *.ko); do \
ba109afd 243 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
e31045ee 244 done
ba109afd 245 sed -i -e "s|.ko||g" /etc/modprobe.d/framebuffer.conf
e2e106be
AF
246
247 # Blacklist isdn modules
248 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn -name *.ko); do \
ba109afd 249 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/isdn.conf ; \
e2e106be 250 done
ba109afd 251 sed -i -e "s|.ko||g" /etc/modprobe.d/isdn.conf
78a51aaf
AF
252
253 # Disable ipv6 at runtime
ba109afd 254 echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6.conf
26c1cc71 255endif
51f9e7ac 256endif
8885467f 257
22820bf2
AF
258 #force new build of external modules and initrd if the kernel was rebuild
259 -rm -f /usr/src/log/*-kmod-$(VER)-$(VERSUFIX)
260 -rm -f /usr/src/log/linux-initrd-$(VER)-$(VERSUFIX)
261
d644d86f 262 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
df5e82b3 263 @$(POSTBUILD)