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