]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame_incremental - lfs/linux
kernel: remove RPi DMA allignment revert
[people/pmueller/ipfire-2.x.git] / lfs / linux
... / ...
CommitLineData
1###############################################################################
2# #
3# IPFire.org - A linux based firewall #
4# Copyright (C) 2007-2019 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 = 4.14.128
28ARM_PATCHES = 4.14.128-ipfire0
29
30THISAPP = linux-$(VER)
31DL_FILE = linux-$(VER).tar.xz
32DL_FROM = $(URL_IPFIRE)
33DIR_APP = $(DIR_SRC)/$(THISAPP)
34CFLAGS =
35CXXFLAGS =
36
37PAK_VER = 84
38DEPS = ""
39
40HEADERS_ARCH = $(BUILD_PLATFORM)
41KERNEL_ARCH = $(BUILD_ARCH)
42KERNEL_TARGET = bzImage
43
44ifeq "$(BUILD_ARCH)" "i586"
45 KERNEL_ARCH = i386
46endif
47
48ifeq "$(BUILD_ARCH)" "aarch64"
49 HEADERS_ARCH = arm64
50 KERNEL_ARCH = arm64
51 KERNEL_TARGET = Image
52endif
53
54ifeq "$(BUILD_ARCH)" "armv5tel"
55 KERNEL_ARCH = arm
56 KERNEL_TARGET = zImage
57endif
58
59VERSUFIX=ipfire$(KCFG)
60
61ifeq "$(TOOLCHAIN)" "1"
62 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)-tools
63 HEADERS_PREFIX = $(TOOLS_DIR)
64else
65 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
66 HEADERS_PREFIX = /usr
67endif
68
69ifeq "$(KCFG)" ""
70LASTKERNEL=1
71endif
72ifeq "$(KCFG)" "-multi"
73LASTKERNEL=1
74endif
75
76###############################################################################
77# Top-level Rules
78###############################################################################
79objects =$(DL_FILE) \
80 arm-multi-patches-$(ARM_PATCHES).patch.xz
81
82$(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
83arm-multi-patches-$(ARM_PATCHES).patch.xz = $(URL_IPFIRE)/arm-multi-patches-$(ARM_PATCHES).patch.xz
84
85$(DL_FILE)_MD5 = 6c51d852170552a503b497766cfb632f
86arm-multi-patches-$(ARM_PATCHES).patch.xz_MD5 = 5c5f6da89606e63701cdcd84a500aca1
87
88install : $(TARGET)
89
90check : $(patsubst %,$(DIR_CHK)/%,$(objects))
91
92download :$(patsubst %,$(DIR_DL)/%,$(objects))
93
94md5 : $(subst %,%_MD5,$(objects))
95
96dist:
97 @$(PAK)
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)
117 @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
118
119 ln -svf linux-$(VER) $(DIR_SRC)/linux
120
121 # Linux Intermediate Queueing Device
122 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14-imq.diff
123
124 # Layer7-patch
125 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14-layer7.patch
126
127 # DVB Patches
128 cd $(DIR_APP) && patch -Np2 < $(DIR_SRC)/src/patches/v4l-dvb_fix_tua6034_pll.patch
129
130 # Wlan Patches
131 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14_ath_user_regd.patch
132 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8-iwlwifi-noibss_only_on_radar_chan.patch
133
134 # Add LED trigger
135 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.16-ledtrig_netdev.patch
136
137 # Fix igb and e1000e crash
138 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14.1-igb-e1000e_fix_lock_at_update_stats.patch
139
140 # cs5535audio spams syslog if no ac97 was present (geos router)
141 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8_cs5535audio_fix_logspam_on_geos.patch
142
143 # Add PC Engines APU led support
144 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14-apu_leds.patch
145
146 # Fix uevent PHYSDEVDRIVER
147 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-2.6.32.27_mcs7830-fix-driver-name.patch
148
149ifeq "$(KCFG)" "-kirkwood"
150 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14.40-kirkwood-dtb.patch
151endif
152
153ifeq "$(KCFG)" "-multi"
154 # Apply Arm-multiarch kernel patches.
155 cd $(DIR_APP) && xzcat $(DIR_DL)/arm-multi-patches-$(ARM_PATCHES).patch.xz | patch -Np1
156endif
157ifeq "$(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
160endif
161 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-3.14.79-amba-fix.patch
162
163ifeq "$(KCFG)" "-headers"
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
169else
170
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
175 # Cleanup kernel source
176 cp $(DIR_SRC)/config/kernel/kernel.config.$(BUILD_ARCH)-$(VERSUFIX) $(DIR_APP)/.config
177 cd $(DIR_APP) && make oldconfig
178 cd $(DIR_APP) && make clean
179 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
180
181 # Build the kernel
182 cd $(DIR_APP) && make $(MAKETUNING) $(KERNEL_TARGET) modules
183
184 # Install the kernel
185 cd $(DIR_APP) && cp -v arch/$(KERNEL_ARCH)/boot/$(KERNEL_TARGET) /boot/vmlinuz-$(VER)-$(VERSUFIX)
186 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
187 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
188 cd $(DIR_APP) && make $(MAKETUNING) modules_install
189
190ifeq "$(BUILD_PLATFORM)" "arm"
191 cd $(DIR_APP) && make $(MAKETUNING) dtbs
192 mkdir -p /boot/dtb-$(VER)-$(VERSUFIX)
193 cd $(DIR_APP)/arch/$(KERNEL_ARCH)/boot/dts && for f in $$(find -name "*.dtb"); do \
194 cp -v --parents $$f /boot/dtb-$(VER)-$(VERSUFIX)/ ; \
195 chmod 644 /boot/dtb-$(VER)-$(VERSUFIX)/$$f ; \
196 done
197endif
198
199 # Recreate source and build links
200 rm -rf /lib/modules/$(VER)-$(VERSUFIX)/{build,source}
201 mkdir -p /lib/modules/$(VER)-$(VERSUFIX)/build
202 ln -sf build /lib/modules/$(VER)-$(VERSUFIX)/source
203
204 # Create dirs for extra modules
205 mkdir -p /lib/modules/$(VER)-$(VERSUFIX)/extra
206
207 cd $(DIR_APP) && cp --parents $$(find -type f -name "Makefile*" -o -name "Kconfig*") \
208 /lib/modules/$(VER)-$(VERSUFIX)/build
209 cd $(DIR_APP) && cp Module.symvers System.map /lib/modules/$(VER)-$(VERSUFIX)/build
210 rm -rf /lib/modules/$(VER)-$(VERSUFIX)/build/{Documentation,scripts,include}
211
212 cd $(DIR_APP) && cp .config /lib/modules/$(VER)-$(VERSUFIX)/build
213 cd $(DIR_APP) && cp -a scripts /lib/modules/$(VER)-$(VERSUFIX)/build
214 find /lib/modules/$(VER)-$(VERSUFIX)/build/scripts -name "*.o" -exec rm -vf {} \;
215
216 cd $(DIR_APP) && cp -a --parents arch/$(HEADERS_ARCH)/include /lib/modules/$(VER)-$(VERSUFIX)/build
217 cd $(DIR_APP) && cp -a include /lib/modules/$(VER)-$(VERSUFIX)/build/include
218
219 # Install objtool
220 cd $(DIR_APP) && cp -a tools/objtool/objtool \
221 /lib/modules/$(VER)-$(VERSUFIX)/build/tools/objtool/ || :
222 cd $(DIR_APP) && cp -a --parents tools/build/{Build,Build.include,fixdep.c} \
223 tools/scripts/utilities.mak /lib/modules/$(VER)-$(VERSUFIX)/build
224
225 # Make sure we can build external modules
226 touch -r /lib/modules/$(VER)-$(VERSUFIX)/build/Makefile \
227 /lib/modules/$(VER)-$(VERSUFIX)/build/include/generated/uapi/linux/version.h
228 touch -r /lib/modules/$(VER)-$(VERSUFIX)/build/.config \
229 /lib/modules/$(VER)-$(VERSUFIX)/build/autoconf.h
230 cp /lib/modules/$(VER)-$(VERSUFIX)/build/.config \
231 /lib/modules/$(VER)-$(VERSUFIX)/build/include/config/auto.conf
232
233 # Fix permissions
234 find /lib/modules/$(VER)-$(VERSUFIX) -name "modules.order" \
235 -exec chmod 644 {} \;
236
237 find /lib/modules/$(VER)-$(VERSUFIX) -name ".*.cmd" -exec rm -f {} \;
238
239ifeq "$(LASTKERNEL)" "1"
240 # Only do this once
241 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
242
243 # disable drm by install drm to /bin/false because i915 ignore blacklisting
244 echo install drm /bin/false > /etc/modprobe.d/framebuffer.conf
245
246 # Blacklist old framebuffer modules
247 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video/fbdev/ -name *.ko.xz); do \
248 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
249 done
250 # Blacklist new drm framebuffer modules
251 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm -name *.ko.xz); do \
252 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
253 done
254 sed -i -e "s|.ko.xz||g" /etc/modprobe.d/framebuffer.conf
255
256 # Disable ipv6 at runtime
257 echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6.conf
258endif
259endif
260
261 #force new build of external modules and initrd if the kernel was rebuild
262 -rm -f /usr/src/log/*-kmod-$(VER)-$(VERSUFIX)
263 -rm -f /usr/src/log/linux-initrd-$(VER)-$(VERSUFIX)
264
265 @rm -rf $(DIR_APP) $(DIR_SRC)/linux
266 @$(POSTBUILD)