1 ###############################################################################
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2018 IPFire Team <info@ipfire.org> #
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. #
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. #
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/>. #
19 ###############################################################################
21 ###############################################################################
23 ###############################################################################
28 ARM_PATCHES = 4.14.40-ipfire0
30 THISAPP = linux-$(VER)
31 DL_FILE = linux-$(VER).tar.xz
32 DL_FROM = $(URL_IPFIRE)
33 DIR_APP = $(DIR_SRC)/$(THISAPP)
40 ifeq "$(BUILD_ARCH)" "i586"
43 KERNEL_ARCH = $(BUILD_ARCH)
46 ifeq "$(BUILD_ARCH)" "aarch64"
49 HEADERS_ARCH = $(BUILD_PLATFORM)
52 VERSUFIX=ipfire$(KCFG)
54 ifeq "$(TOOLCHAIN)" "1"
55 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)-tools
56 HEADERS_PREFIX = $(TOOLS_DIR)
58 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
65 ifeq "$(KCFG)" "-multi"
69 ###############################################################################
71 ###############################################################################
73 arm-multi-patches-$(ARM_PATCHES).patch.xz
75 $(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
76 arm-multi-patches-$(ARM_PATCHES).patch.xz = $(URL_IPFIRE)/arm-multi-patches-$(ARM_PATCHES).patch.xz
78 $(DL_FILE)_MD5 = 8376ed89777760443a359edb1d08ed9a
79 arm-multi-patches-$(ARM_PATCHES).patch.xz_MD5 = ae7091bb79bad05c8394c8bacc48dd60
83 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
85 download :$(patsubst %,$(DIR_DL)/%,$(objects))
87 md5 : $(subst %,%_MD5,$(objects))
91 ###############################################################################
92 # Downloading, checking, md5sum
93 ###############################################################################
95 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
98 $(patsubst %,$(DIR_DL)/%,$(objects)) :
101 $(subst %,%_MD5,$(objects)) :
104 ###############################################################################
105 # Installation Details
106 ###############################################################################
108 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
110 @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
112 ln -svf linux-$(VER) $(DIR_SRC)/linux
114 # Linux Intermediate Queueing Device
115 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14-imq.diff
118 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14-layer7.patch
121 cd $(DIR_APP) && patch -Np2 < $(DIR_SRC)/src/patches/v4l-dvb_fix_tua6034_pll.patch
124 # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/backports-4.2.6-1_ath10k_remove_logspam.patch
125 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8-ath_ignore_eeprom_regd.patch
126 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8-iwlwifi-noibss_only_on_radar_chan.patch
127 # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8-rt2x00usb_suppress_queue_warnings.patch
128 # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.39-add_libertas_uap.patch
131 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.16-ledtrig_netdev.patch
133 # Fix igb and e1000e crash
134 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14.1-igb-e1000e_fix_lock_at_update_stats.patch
136 # cs5535audio spams syslog if no ac97 was present (geos router)
137 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8_cs5535audio_fix_logspam_on_geos.patch
139 # Add PC Engines APU led support
140 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8-apu_leds.patch
142 # Fix uevent PHYSDEVDRIVER
143 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-2.6.32.27_mcs7830-fix-driver-name.patch
145 ifeq "$(KCFG)" "-kirkwood"
146 # cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.10-mv_cesa_disable_failing_hmac_sha1.patch
147 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14.40-kirkwood-dtb.patch
150 ifeq "$(KCFG)" "-multi"
151 # Apply Arm-multiarch kernel patches.
152 cd $(DIR_APP) && xzcat $(DIR_DL)/arm-multi-patches-$(ARM_PATCHES).patch.xz | patch -Np1
154 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-3.14.79-amba-fix.patch
156 ifeq "$(KCFG)" "-headers"
157 # Install the header files
158 cd $(DIR_APP) && make ARCH=$(HEADERS_ARCH) INSTALL_HDR_PATH=dest headers_install
159 -mkdir -pv $(BUILDROOT)/$(HEADERS_PREFIX)/include
160 cd $(DIR_APP) && find dest/include \( -name .install -o -name ..install.cmd \) -delete
161 cd $(DIR_APP) && cp -rv dest/include/* $(BUILDROOT)/$(HEADERS_PREFIX)/include
164 # Install ipfire logo
165 cd $(DIR_APP) && cp -vf $(DIR_SRC)/config/kernel/ipfire_logo.ppm \
166 drivers/video/logo/logo_linux_clut224.ppm
168 # Cleanup kernel source
169 cp $(DIR_SRC)/config/kernel/kernel.config.$(BUILD_ARCH)-$(VERSUFIX) $(DIR_APP)/.config
170 cd $(DIR_APP) && make oldconfig
171 cd $(DIR_APP) && make clean
172 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
174 ifeq "$(KCFG)" "-kirkwood"
175 cd $(DIR_APP) && make $(MAKETUNING) zImage modules
176 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
177 # cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX)
179 ifeq "$(KCFG)" "-multi"
180 cd $(DIR_APP) && make $(MAKETUNING) zImage modules
181 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
183 cd $(DIR_APP) && make $(MAKETUNING) bzImage modules
184 cd $(DIR_APP) && cp -v arch/$(KERNEL_ARCH)/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
188 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
189 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
190 cd $(DIR_APP) && make $(MAKETUNING) modules_install
192 ifeq "$(BUILD_PLATFORM)" "arm"
193 cd $(DIR_APP) && make $(MAKETUNING) dtbs
194 cd $(DIR_APP) && for f in $$(find arch/arm/boot/dts/ -name *.dtb); do \
195 mkdir -p /boot/dtb-$(VER)-$(VERSUFIX) ; \
196 install -m 644 $$f /boot/dtb-$(VER)-$(VERSUFIX)/ ; \
200 ifeq "$(LASTKERNEL)" "1"
202 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
204 # disable drm by install drm to /bin/false because i915 ignore blacklisting
205 echo install drm /bin/false > /etc/modprobe.d/framebuffer.conf
207 # Blacklist old framebuffer modules
208 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video/fbdev/ -name *.ko); do \
209 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
211 # Blacklist new drm framebuffer modules
212 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm -name *.ko); do \
213 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
215 sed -i -e "s|.ko||g" /etc/modprobe.d/framebuffer.conf
217 # Disable ipv6 at runtime
218 echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6.conf
222 #force new build of external modules and initrd if the kernel was rebuild
223 -rm -f /usr/src/log/*-kmod-$(VER)-$(VERSUFIX)
224 -rm -f /usr/src/log/linux-initrd-$(VER)-$(VERSUFIX)
226 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*