]> git.ipfire.org Git - ipfire-2.x.git/blame_incremental - lfs/linux
kernel: update to 5.10.55
[ipfire-2.x.git] / lfs / linux
... / ...
CommitLineData
1###############################################################################
2# #
3# IPFire.org - A linux based firewall #
4# Copyright (C) 2007-2021 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
25include Config
26
27VER = 5.10.55
28ARM_PATCHES = 5.10.55-ipfire0
29
30THISAPP = linux-$(VER)
31DL_FILE = linux-$(VER).tar.xz
32DL_FROM = $(URL_IPFIRE)
33DIR_APP = $(DIR_SRC)/$(THISAPP)
34CFLAGS =
35CXXFLAGS =
36
37HEADERS_ARCH = $(BUILD_PLATFORM)
38KERNEL_ARCH = $(BUILD_ARCH)
39KERNEL_TARGET = bzImage
40
41ifeq "$(BUILD_ARCH)" "i586"
42 KERNEL_ARCH = i386
43endif
44
45ifeq "$(BUILD_ARCH)" "aarch64"
46 HEADERS_ARCH = arm64
47 KERNEL_ARCH = arm64
48 KERNEL_TARGET = Image
49endif
50
51ifeq "$(BUILD_ARCH)" "armv6l"
52 KERNEL_ARCH = arm
53 KERNEL_TARGET = zImage
54endif
55
56VERSUFIX=ipfire$(KCFG)
57
58ifeq "$(TOOLCHAIN)" "1"
59 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)-tools
60 HEADERS_PREFIX = $(TOOLS_DIR)
61 EXTRAMAKE = CROSS_COMPILE=$(CROSSTARGET)-
62else
63 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
64 HEADERS_PREFIX = /usr
65endif
66
67ifeq "$(KCFG)" ""
68LASTKERNEL=1
69endif
70
71###############################################################################
72# Top-level Rules
73###############################################################################
74objects =$(DL_FILE) \
75 arm-multi-patches-$(ARM_PATCHES).patch.xz
76
77$(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
78arm-multi-patches-$(ARM_PATCHES).patch.xz = $(URL_IPFIRE)/arm-multi-patches-$(ARM_PATCHES).patch.xz
79
80$(DL_FILE)_MD5 = 10d3f47caac28cf126e6d98ad977b2bb
81arm-multi-patches-$(ARM_PATCHES).patch.xz_MD5 = 8344fdeb190912cf32482dc6d51fba31
82
83install : $(TARGET)
84
85check : $(patsubst %,$(DIR_CHK)/%,$(objects))
86
87download :$(patsubst %,$(DIR_DL)/%,$(objects))
88
89md5 : $(subst %,%_MD5,$(objects))
90
91dist:
92 @$(PAK)
93###############################################################################
94# Downloading, checking, md5sum
95###############################################################################
96
97$(patsubst %,$(DIR_CHK)/%,$(objects)) :
98 @$(CHECK)
99
100$(patsubst %,$(DIR_DL)/%,$(objects)) :
101 @$(LOAD)
102
103$(subst %,%_MD5,$(objects)) :
104 @$(MD5)
105
106###############################################################################
107# Installation Details
108###############################################################################
109
110$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
111 @$(PREBUILD)
112 @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
113
114 ln -svf linux-$(VER) $(DIR_SRC)/linux
115
116 # Layer7-patch
117 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-5.10-layer7.patch
118
119 # DVB Patches
120 cd $(DIR_APP) && patch -Np2 < $(DIR_SRC)/src/patches/v4l-dvb_fix_tua6034_pll.patch
121
122 # Wlan Patches
123 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14_ath_user_regd.patch
124 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8-iwlwifi-noibss_only_on_radar_chan.patch
125
126 # Fix apu1 led detection with newer bios versions
127 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-5.10.16-apu1-led-new-bios.patch
128
129 # Fix igb and e1000e crash
130 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14.1-igb-e1000e_fix_lock_at_update_stats.patch
131
132 # cs5535audio spams syslog if no ac97 was present (geos router)
133 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8_cs5535audio_fix_logspam_on_geos.patch
134
135 # Fix uevent PHYSDEVDRIVER
136 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-2.6.32.27_mcs7830-fix-driver-name.patch
137
138 # fix Boot with enabled usercopy hardening
139 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-5.9-crypto_testmgr_allocate_buffers_with____GFP_COMP.patch
140
141 # fix gcc plugins with gcc11
142 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-5.10.45-fix_gcc_plugins_with_gcc11.patch
143
144ifeq "$(BUILD_ARCH)" "armv6l"
145 # Apply Arm-multiarch kernel patches.
146 cd $(DIR_APP) && xzcat $(DIR_DL)/arm-multi-patches-$(ARM_PATCHES).patch.xz | patch -Np1
147endif
148ifeq "$(BUILD_ARCH)" "aarch64"
149 # Apply Arm-multiarch kernel patches.
150 cd $(DIR_APP) && xzcat $(DIR_DL)/arm-multi-patches-$(ARM_PATCHES).patch.xz | patch -Np1
151endif
152 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-3.14.79-amba-fix.patch
153
154ifeq "$(KCFG)" "-headers"
155 # Install the header files
156 cd $(DIR_APP) && make ARCH=$(HEADERS_ARCH) $(EXTRAMAKE) headers
157 -mkdir -pv $(BUILDROOT)/$(HEADERS_PREFIX)/include
158 cd $(DIR_APP) && find usr/include -name '.*' -delete
159 cd $(DIR_APP) && rm usr/include/Makefile
160 cd $(DIR_APP) && cp -rv usr/include/* $(BUILDROOT)/$(HEADERS_PREFIX)/include
161else
162
163 # Install ipfire logo
164 cd $(DIR_APP) && cp -vf $(DIR_SRC)/config/kernel/ipfire_logo.ppm \
165 drivers/video/logo/logo_linux_clut224.ppm
166
167 # Cleanup kernel source
168 cp $(DIR_SRC)/config/kernel/kernel.config.$(BUILD_ARCH)-$(VERSUFIX) $(DIR_APP)/.config
169 cd $(DIR_APP) && make oldconfig
170 cd $(DIR_APP) && make clean
171 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
172
173 # Copy Module signing key configuration
174 cp -f $(DIR_SRC)/config/kernel/x509.genkey $(DIR_APP)/certs/x509.genkey
175
176 # Remove modules folder if exists
177 rm -rf /lib/modules/$(VER)-$(VERSUFIX)
178
179 # Build the kernel
180 cd $(DIR_APP) && make $(MAKETUNING) $(KERNEL_TARGET) modules
181
182 # Install the kernel
183 cd $(DIR_APP) && cp -v arch/$(KERNEL_ARCH)/boot/$(KERNEL_TARGET) /boot/vmlinuz-$(VER)-$(VERSUFIX)
184 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
185 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
186 cd $(DIR_APP) && make $(MAKETUNING) modules_install
187
188ifeq "$(BUILD_PLATFORM)" "arm"
189 cd $(DIR_APP) && make $(MAKETUNING) dtbs
190 mkdir -p /boot/dtb-$(VER)-$(VERSUFIX)
191 cd $(DIR_APP)/arch/$(KERNEL_ARCH)/boot/dts && for f in $$(find -name "*.dtb"); do \
192 cp -v --parents $$f /boot/dtb-$(VER)-$(VERSUFIX)/ ; \
193 chmod 644 /boot/dtb-$(VER)-$(VERSUFIX)/$$f ; \
194 done
195endif
196
197 # Recreate source and build links
198 rm -rf /lib/modules/$(VER)-$(VERSUFIX)/{build,source}
199 mkdir -p /lib/modules/$(VER)-$(VERSUFIX)/build
200 ln -sf build /lib/modules/$(VER)-$(VERSUFIX)/source
201
202 # Create dirs for extra modules
203 mkdir -p /lib/modules/$(VER)-$(VERSUFIX)/extra
204
205 cd $(DIR_APP) && cp --parents $$(find -type f -name "Makefile*" -o -name "Kconfig*") \
206 /lib/modules/$(VER)-$(VERSUFIX)/build
207 cd $(DIR_APP) && cp Module.symvers System.map /lib/modules/$(VER)-$(VERSUFIX)/build
208 rm -rf /lib/modules/$(VER)-$(VERSUFIX)/build/{Documentation,scripts,include}
209
210 cd $(DIR_APP) && cp .config /lib/modules/$(VER)-$(VERSUFIX)/build
211 cd $(DIR_APP) && cp -a scripts /lib/modules/$(VER)-$(VERSUFIX)/build
212 find /lib/modules/$(VER)-$(VERSUFIX)/build/scripts -name "*.o" -exec rm -vf {} \;
213
214 cd $(DIR_APP) && cp -a --parents arch/$(HEADERS_ARCH)/include /lib/modules/$(VER)-$(VERSUFIX)/build
215 cd $(DIR_APP) && cp -a include /lib/modules/$(VER)-$(VERSUFIX)/build/include
216
217 # Copy module signing key for off tree modules
218 cd $(DIR_APP) && cp -f certs/signing_key.* /lib/modules/$(VER)-$(VERSUFIX)/build/certs/
219
220 # Install objtool
221 cd $(DIR_APP) && cp -a tools/objtool/objtool \
222 /lib/modules/$(VER)-$(VERSUFIX)/build/tools/objtool/ || :
223 cd $(DIR_APP) && cp -a --parents tools/build/{Build,Build.include,fixdep.c} \
224 tools/scripts/utilities.mak /lib/modules/$(VER)-$(VERSUFIX)/build
225
226 # Make sure we can build external modules
227 touch -r /lib/modules/$(VER)-$(VERSUFIX)/build/Makefile \
228 /lib/modules/$(VER)-$(VERSUFIX)/build/include/generated/uapi/linux/version.h
229 touch -r /lib/modules/$(VER)-$(VERSUFIX)/build/.config \
230 /lib/modules/$(VER)-$(VERSUFIX)/build/autoconf.h
231 cp /lib/modules/$(VER)-$(VERSUFIX)/build/.config \
232 /lib/modules/$(VER)-$(VERSUFIX)/build/include/config/auto.conf
233
234 # Fix permissions
235 find /lib/modules/$(VER)-$(VERSUFIX) -name "modules.order" \
236 -exec chmod 644 {} \;
237
238 find /lib/modules/$(VER)-$(VERSUFIX) -name ".*.cmd" -exec rm -f {} \;
239
240ifeq "$(LASTKERNEL)" "1"
241 # Only do this once
242 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
243
244 # disable drm by install drm to /bin/false because i915 ignore blacklisting
245 echo install drm /bin/false > /etc/modprobe.d/framebuffer.conf
246
247 # Blacklist old framebuffer modules
248 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video/fbdev/ -name *.ko.xz); do \
249 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
250 done
251 # Blacklist new drm framebuffer modules
252 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm -name *.ko.xz); do \
253 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
254 done
255 sed -i -e "s|.ko.xz||g" /etc/modprobe.d/framebuffer.conf
256
257 # Disable ipv6 at runtime
258 echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6.conf
259endif
260endif
261
262 #force new build of external modules and initrd if the kernel was rebuild
263 -rm -f /usr/src/log/*-kmod-$(VER)-$(VERSUFIX)
264 -rm -f /usr/src/log/linux-initrd-$(VER)-$(VERSUFIX)
265
266 @rm -rf $(DIR_APP) $(DIR_SRC)/linux
267 @$(POSTBUILD)