]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - lfs/linux
switch arm 32 bit arch from armv5tel to armv6l
[people/pmueller/ipfire-2.x.git] / lfs / linux
CommitLineData
df5e82b3 1###############################################################################
df5e82b3 2# #
70df8302 3# IPFire.org - A linux based firewall #
7885b150 4# Copyright (C) 2007-2021 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
8f7623b9
AF
27VER = 5.10.43
28ARM_PATCHES = 5.10.43-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
347db51a 37HEADERS_ARCH = $(BUILD_PLATFORM)
7f841117
AF
38KERNEL_ARCH = $(BUILD_ARCH)
39KERNEL_TARGET = bzImage
347db51a 40
dc7d6b20 41ifeq "$(BUILD_ARCH)" "i586"
ba583892 42 KERNEL_ARCH = i386
dc7d6b20
MT
43endif
44
45ifeq "$(BUILD_ARCH)" "aarch64"
46 HEADERS_ARCH = arm64
347db51a
MT
47 KERNEL_ARCH = arm64
48 KERNEL_TARGET = Image
49endif
50
aafdd71b 51ifeq "$(BUILD_ARCH)" "armv6l"
07664187 52 KERNEL_ARCH = arm
347db51a 53 KERNEL_TARGET = zImage
ba583892
MT
54endif
55
fdf0c7c1 56VERSUFIX=ipfire$(KCFG)
b0d0b681 57
991d11d7 58ifeq "$(TOOLCHAIN)" "1"
cc24c14b 59 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)-tools
6c4cc7ea 60 HEADERS_PREFIX = $(TOOLS_DIR)
3c7ae787 61 EXTRAMAKE = CROSS_COMPILE=$(CROSSTARGET)-
51f9e7ac
MT
62else
63 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
cc24c14b 64 HEADERS_PREFIX = /usr
51f9e7ac
MT
65endif
66
bc8fe5ff
AF
67ifeq "$(KCFG)" ""
68LASTKERNEL=1
69endif
bc8fe5ff 70
df5e82b3
MT
71###############################################################################
72# Top-level Rules
73###############################################################################
74objects =$(DL_FILE) \
b69338e0 75 arm-multi-patches-$(ARM_PATCHES).patch.xz
e69f1bf2 76
932a34e5 77$(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
b69338e0 78arm-multi-patches-$(ARM_PATCHES).patch.xz = $(URL_IPFIRE)/arm-multi-patches-$(ARM_PATCHES).patch.xz
e69f1bf2 79
8f7623b9 80$(DL_FILE)_MD5 = 983f71287dbaa21a77410351a1c51d06
663ab267 81arm-multi-patches-$(ARM_PATCHES).patch.xz_MD5 = 1b66be2d80c102c6c1963e9f601e5099
bdf9df74 82
df5e82b3
MT
83install : $(TARGET)
84
85check : $(patsubst %,$(DIR_CHK)/%,$(objects))
86
87download :$(patsubst %,$(DIR_DL)/%,$(objects))
88
89md5 : $(subst %,%_MD5,$(objects))
90
f418a984
AF
91dist:
92 @$(PAK)
df5e82b3
MT
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)
fdecb907 112 @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
b0d0b681 113
51f9e7ac 114 ln -svf linux-$(VER) $(DIR_SRC)/linux
3a1019f6 115
3a1019f6 116 # Layer7-patch
c062c770 117 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-5.10-layer7.patch
bb5f0bf8 118
e2b79cd1 119 # DVB Patches
e2b79cd1
AF
120 cd $(DIR_APP) && patch -Np2 < $(DIR_SRC)/src/patches/v4l-dvb_fix_tua6034_pll.patch
121
d33aa452 122 # Wlan Patches
3005eb22 123 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14_ath_user_regd.patch
91648bd1 124 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8-iwlwifi-noibss_only_on_radar_chan.patch
d33aa452 125
fead7810
AF
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
fcffac13 129 # Fix igb and e1000e crash
2e1fe3c8 130 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14.1-igb-e1000e_fix_lock_at_update_stats.patch
d52f1169 131
1e67b3c3 132 # cs5535audio spams syslog if no ac97 was present (geos router)
91648bd1 133 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8_cs5535audio_fix_logspam_on_geos.patch
1e67b3c3 134
87837787 135 # Fix uevent PHYSDEVDRIVER
91648bd1 136 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-2.6.32.27_mcs7830-fix-driver-name.patch
bd64e2a0 137
c062c770
AF
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
b923dd3d 140
aafdd71b 141ifeq "$(BUILD_ARCH)" "armv6l"
0a21d63f 142 # Apply Arm-multiarch kernel patches.
5a27051f 143 cd $(DIR_APP) && xzcat $(DIR_DL)/arm-multi-patches-$(ARM_PATCHES).patch.xz | patch -Np1
c448474f 144endif
66a29eaa
AF
145ifeq "$(BUILD_ARCH)" "aarch64"
146 # Apply Arm-multiarch kernel patches.
5a27051f 147 cd $(DIR_APP) && xzcat $(DIR_DL)/arm-multi-patches-$(ARM_PATCHES).patch.xz | patch -Np1
fdecb907 148endif
0b4976e2
AF
149 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-3.14.79-amba-fix.patch
150
cee50e12 151ifeq "$(KCFG)" "-headers"
51f9e7ac 152 # Install the header files
3c7ae787 153 cd $(DIR_APP) && make ARCH=$(HEADERS_ARCH) $(EXTRAMAKE) headers
51f9e7ac 154 -mkdir -pv $(BUILDROOT)/$(HEADERS_PREFIX)/include
c062c770
AF
155 cd $(DIR_APP) && find usr/include -name '.*' -delete
156 cd $(DIR_APP) && rm usr/include/Makefile
157 cd $(DIR_APP) && cp -rv usr/include/* $(BUILDROOT)/$(HEADERS_PREFIX)/include
51f9e7ac
MT
158else
159
aa2049e5
MT
160 # Install ipfire logo
161 cd $(DIR_APP) && cp -vf $(DIR_SRC)/config/kernel/ipfire_logo.ppm \
162 drivers/video/logo/logo_linux_clut224.ppm
163
df5e82b3 164 # Cleanup kernel source
dc7d6b20 165 cp $(DIR_SRC)/config/kernel/kernel.config.$(BUILD_ARCH)-$(VERSUFIX) $(DIR_APP)/.config
6f67c28d
MT
166 cd $(DIR_APP) && make oldconfig
167 cd $(DIR_APP) && make clean
fdecb907 168 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
3a1019f6 169
831ff05d
AF
170 # Copy Module signing key configuration
171 cp -f $(DIR_SRC)/config/kernel/x509.genkey $(DIR_APP)/certs/x509.genkey
172
2e65d316
AF
173 # Remove modules folder if exists
174 rm -rf /lib/modules/$(VER)-$(VERSUFIX)
175
347db51a
MT
176 # Build the kernel
177 cd $(DIR_APP) && make $(MAKETUNING) $(KERNEL_TARGET) modules
a158cbbb 178
347db51a
MT
179 # Install the kernel
180 cd $(DIR_APP) && cp -v arch/$(KERNEL_ARCH)/boot/$(KERNEL_TARGET) /boot/vmlinuz-$(VER)-$(VERSUFIX)
2b2e03ed
AF
181 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
182 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
6f67c28d 183 cd $(DIR_APP) && make $(MAKETUNING) modules_install
376e42ce 184
dc7d6b20 185ifeq "$(BUILD_PLATFORM)" "arm"
6f67c28d 186 cd $(DIR_APP) && make $(MAKETUNING) dtbs
5b17da41 187 mkdir -p /boot/dtb-$(VER)-$(VERSUFIX)
574a7117 188 cd $(DIR_APP)/arch/$(KERNEL_ARCH)/boot/dts && for f in $$(find -name "*.dtb"); do \
5b17da41
AF
189 cp -v --parents $$f /boot/dtb-$(VER)-$(VERSUFIX)/ ; \
190 chmod 644 /boot/dtb-$(VER)-$(VERSUFIX)/$$f ; \
7284262a
AF
191 done
192endif
193
0ad5f6a1
MT
194 # Recreate source and build links
195 rm -rf /lib/modules/$(VER)-$(VERSUFIX)/{build,source}
196 mkdir -p /lib/modules/$(VER)-$(VERSUFIX)/build
197 ln -sf build /lib/modules/$(VER)-$(VERSUFIX)/source
198
199 # Create dirs for extra modules
200 mkdir -p /lib/modules/$(VER)-$(VERSUFIX)/extra
201
202 cd $(DIR_APP) && cp --parents $$(find -type f -name "Makefile*" -o -name "Kconfig*") \
203 /lib/modules/$(VER)-$(VERSUFIX)/build
204 cd $(DIR_APP) && cp Module.symvers System.map /lib/modules/$(VER)-$(VERSUFIX)/build
205 rm -rf /lib/modules/$(VER)-$(VERSUFIX)/build/{Documentation,scripts,include}
206
207 cd $(DIR_APP) && cp .config /lib/modules/$(VER)-$(VERSUFIX)/build
208 cd $(DIR_APP) && cp -a scripts /lib/modules/$(VER)-$(VERSUFIX)/build
209 find /lib/modules/$(VER)-$(VERSUFIX)/build/scripts -name "*.o" -exec rm -vf {} \;
210
211 cd $(DIR_APP) && cp -a --parents arch/$(HEADERS_ARCH)/include /lib/modules/$(VER)-$(VERSUFIX)/build
212 cd $(DIR_APP) && cp -a include /lib/modules/$(VER)-$(VERSUFIX)/build/include
213
831ff05d
AF
214 # Copy module signing key for off tree modules
215 cd $(DIR_APP) && cp -f certs/signing_key.* /lib/modules/$(VER)-$(VERSUFIX)/build/certs/
216
0ad5f6a1 217 # Install objtool
c1e8c954
MT
218 cd $(DIR_APP) && cp -a tools/objtool/objtool \
219 /lib/modules/$(VER)-$(VERSUFIX)/build/tools/objtool/ || :
0ad5f6a1
MT
220 cd $(DIR_APP) && cp -a --parents tools/build/{Build,Build.include,fixdep.c} \
221 tools/scripts/utilities.mak /lib/modules/$(VER)-$(VERSUFIX)/build
222
223 # Make sure we can build external modules
224 touch -r /lib/modules/$(VER)-$(VERSUFIX)/build/Makefile \
3f60a1e1 225 /lib/modules/$(VER)-$(VERSUFIX)/build/include/generated/uapi/linux/version.h
0ad5f6a1
MT
226 touch -r /lib/modules/$(VER)-$(VERSUFIX)/build/.config \
227 /lib/modules/$(VER)-$(VERSUFIX)/build/autoconf.h
228 cp /lib/modules/$(VER)-$(VERSUFIX)/build/.config \
229 /lib/modules/$(VER)-$(VERSUFIX)/build/include/config/auto.conf
230
231 # Fix permissions
232 find /lib/modules/$(VER)-$(VERSUFIX) -name "modules.order" \
233 -exec chmod 644 {} \;
234
235 find /lib/modules/$(VER)-$(VERSUFIX) -name ".*.cmd" -exec rm -f {} \;
236
bc8fe5ff
AF
237ifeq "$(LASTKERNEL)" "1"
238 # Only do this once
81e974f3 239 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
d644d86f 240
050479e9
AF
241 # disable drm by install drm to /bin/false because i915 ignore blacklisting
242 echo install drm /bin/false > /etc/modprobe.d/framebuffer.conf
243
aa1dd878 244 # Blacklist old framebuffer modules
4c76d08b 245 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video/fbdev/ -name *.ko.xz); do \
ba109afd 246 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
030a57c5 247 done
aa1dd878 248 # Blacklist new drm framebuffer modules
4c76d08b 249 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm -name *.ko.xz); do \
ba109afd 250 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
e31045ee 251 done
4c76d08b 252 sed -i -e "s|.ko.xz||g" /etc/modprobe.d/framebuffer.conf
e2e106be 253
78a51aaf 254 # Disable ipv6 at runtime
ba109afd 255 echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6.conf
26c1cc71 256endif
51f9e7ac 257endif
8885467f 258
22820bf2
AF
259 #force new build of external modules and initrd if the kernel was rebuild
260 -rm -f /usr/src/log/*-kmod-$(VER)-$(VERSUFIX)
261 -rm -f /usr/src/log/linux-initrd-$(VER)-$(VERSUFIX)
262
0ad5f6a1 263 @rm -rf $(DIR_APP) $(DIR_SRC)/linux
df5e82b3 264 @$(POSTBUILD)