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