]> git.ipfire.org Git - ipfire-2.x.git/blame - lfs/linux
u-boot: update buildscript
[ipfire-2.x.git] / lfs / linux
CommitLineData
df5e82b3 1###############################################################################
df5e82b3 2# #
70df8302 3# IPFire.org - A linux based firewall #
a243edae 4# Copyright (C) 2007-2018 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
7f1b6ea3
AF
27VER = 4.14.35
28ARM_PATCHES = 4.14.35-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
4bdbf22e 37PAK_VER = 73
acdf0e61 38DEPS = ""
bd9921dd 39
dc7d6b20 40ifeq "$(BUILD_ARCH)" "i586"
ba583892 41 KERNEL_ARCH = i386
fdfddd64 42else
dc7d6b20
MT
43 KERNEL_ARCH = $(BUILD_ARCH)
44endif
45
46ifeq "$(BUILD_ARCH)" "aarch64"
47 HEADERS_ARCH = arm64
48else
49 HEADERS_ARCH = $(BUILD_PLATFORM)
ba583892
MT
50endif
51
fdf0c7c1 52VERSUFIX=ipfire$(KCFG)
b0d0b681 53
991d11d7 54ifeq "$(TOOLCHAIN)" "1"
cc24c14b 55 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)-tools
6c4cc7ea 56 HEADERS_PREFIX = $(TOOLS_DIR)
51f9e7ac
MT
57else
58 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
cc24c14b 59 HEADERS_PREFIX = /usr
51f9e7ac
MT
60endif
61
bc8fe5ff
AF
62ifeq "$(KCFG)" ""
63LASTKERNEL=1
64endif
0a21d63f 65ifeq "$(KCFG)" "-multi"
bc8fe5ff
AF
66LASTKERNEL=1
67endif
68
df5e82b3
MT
69###############################################################################
70# Top-level Rules
71###############################################################################
72objects =$(DL_FILE) \
0a21d63f 73 arm-multi-patches-$(ARM_PATCHES).tar.xz
e69f1bf2 74
932a34e5 75$(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
0a21d63f 76arm-multi-patches-$(ARM_PATCHES).tar.xz = $(URL_IPFIRE)/arm-multi-patches-$(ARM_PATCHES).tar.xz
e69f1bf2 77
7f1b6ea3
AF
78$(DL_FILE)_MD5 = 9f565a7edf93b58022e529f8d904a4ea
79arm-multi-patches-$(ARM_PATCHES).tar.xz_MD5 = f56e8cd4509b2ff174b5934109e3a757
27a271b2 80
df5e82b3
MT
81install : $(TARGET)
82
83check : $(patsubst %,$(DIR_CHK)/%,$(objects))
84
85download :$(patsubst %,$(DIR_DL)/%,$(objects))
86
87md5 : $(subst %,%_MD5,$(objects))
88
f418a984
AF
89dist:
90 @$(PAK)
df5e82b3
MT
91###############################################################################
92# Downloading, checking, md5sum
93###############################################################################
94
95$(patsubst %,$(DIR_CHK)/%,$(objects)) :
96 @$(CHECK)
97
98$(patsubst %,$(DIR_DL)/%,$(objects)) :
99 @$(LOAD)
100
101$(subst %,%_MD5,$(objects)) :
102 @$(MD5)
103
104###############################################################################
105# Installation Details
106###############################################################################
107
108$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
109 @$(PREBUILD)
fdecb907 110 @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
b0d0b681 111
51f9e7ac 112 ln -svf linux-$(VER) $(DIR_SRC)/linux
3a1019f6 113
3c4d4ed0 114 # Linux Intermediate Queueing Device
2e1fe3c8 115 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14-imq.diff
bd9921dd 116
3a1019f6 117 # Layer7-patch
2e1fe3c8 118 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14-layer7.patch
bb5f0bf8 119
e2b79cd1 120 # DVB Patches
e2b79cd1
AF
121 cd $(DIR_APP) && patch -Np2 < $(DIR_SRC)/src/patches/v4l-dvb_fix_tua6034_pll.patch
122
d33aa452 123 # Wlan Patches
2e1fe3c8 124# cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/backports-4.2.6-1_ath10k_remove_logspam.patch
91648bd1
AF
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
2e1fe3c8 127# cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8-rt2x00usb_suppress_queue_warnings.patch
91648bd1 128# cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.39-add_libertas_uap.patch
d33aa452 129
40c7cdd3 130 # Add LED trigger
94112e8b 131 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.16-ledtrig_netdev.patch
40c7cdd3 132
fcffac13 133 # Fix igb and e1000e crash
2e1fe3c8 134 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.14.1-igb-e1000e_fix_lock_at_update_stats.patch
d52f1169 135
1e67b3c3 136 # cs5535audio spams syslog if no ac97 was present (geos router)
91648bd1 137 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8_cs5535audio_fix_logspam_on_geos.patch
1e67b3c3 138
e583643a 139 # Add PC Engines APU led support
91648bd1 140 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-4.9.8-apu_leds.patch
9a7a6c52 141
87837787 142 # Fix uevent PHYSDEVDRIVER
91648bd1 143 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-2.6.32.27_mcs7830-fix-driver-name.patch
bd64e2a0 144
bc8fe5ff 145ifeq "$(KCFG)" "-kirkwood"
0a21d63f 146# cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.10-mv_cesa_disable_failing_hmac_sha1.patch
8e6fb99d
AF
147endif
148
7284262a 149ifeq "$(KCFG)" "-multi"
0a21d63f
AF
150 # Apply Arm-multiarch kernel patches.
151 cd $(DIR_APP) && xzcat $(DIR_DL)/arm-multi-patches-$(ARM_PATCHES).tar.xz | patch -Np1
fdecb907 152endif
0b4976e2
AF
153 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux/linux-3.14.79-amba-fix.patch
154
cee50e12 155ifeq "$(KCFG)" "-headers"
51f9e7ac
MT
156 # Install the header files
157 cd $(DIR_APP) && make ARCH=$(HEADERS_ARCH) INSTALL_HDR_PATH=dest headers_install
158 -mkdir -pv $(BUILDROOT)/$(HEADERS_PREFIX)/include
159 cd $(DIR_APP) && find dest/include \( -name .install -o -name ..install.cmd \) -delete
160 cd $(DIR_APP) && cp -rv dest/include/* $(BUILDROOT)/$(HEADERS_PREFIX)/include
161else
162
aa2049e5
MT
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
df5e82b3 167 # Cleanup kernel source
dc7d6b20 168 cp $(DIR_SRC)/config/kernel/kernel.config.$(BUILD_ARCH)-$(VERSUFIX) $(DIR_APP)/.config
6f67c28d
MT
169 cd $(DIR_APP) && make oldconfig
170 cd $(DIR_APP) && make clean
fdecb907 171 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
3a1019f6 172
bc8fe5ff 173ifeq "$(KCFG)" "-kirkwood"
0a21d63f
AF
174 cd $(DIR_APP) && make $(MAKETUNING) zImage modules
175 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
176# cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX)
bc8fe5ff 177else
7284262a 178ifeq "$(KCFG)" "-multi"
6f67c28d 179 cd $(DIR_APP) && make $(MAKETUNING) zImage modules
7284262a 180 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
92655908 181else
6f67c28d 182 cd $(DIR_APP) && make $(MAKETUNING) bzImage modules
ba583892 183 cd $(DIR_APP) && cp -v arch/$(KERNEL_ARCH)/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
92655908 184endif
a158cbbb
AF
185endif
186
2b2e03ed
AF
187 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
188 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
6f67c28d 189 cd $(DIR_APP) && make $(MAKETUNING) modules_install
376e42ce 190
dc7d6b20 191ifeq "$(BUILD_PLATFORM)" "arm"
6f67c28d 192 cd $(DIR_APP) && make $(MAKETUNING) dtbs
7284262a
AF
193 cd $(DIR_APP) && for f in $$(find arch/arm/boot/dts/ -name *.dtb); do \
194 mkdir -p /boot/dtb-$(VER)-$(VERSUFIX) ; \
195 install -m 644 $$f /boot/dtb-$(VER)-$(VERSUFIX)/ ; \
196 done
197endif
198
bc8fe5ff
AF
199ifeq "$(LASTKERNEL)" "1"
200 # Only do this once
81e974f3 201 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
d644d86f 202
050479e9
AF
203 # disable drm by install drm to /bin/false because i915 ignore blacklisting
204 echo install drm /bin/false > /etc/modprobe.d/framebuffer.conf
205
aa1dd878 206 # Blacklist old framebuffer modules
e31045ee 207 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video/fbdev/ -name *.ko); do \
ba109afd 208 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
030a57c5 209 done
aa1dd878 210 # Blacklist new drm framebuffer modules
e31045ee 211 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm -name *.ko); do \
ba109afd 212 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
e31045ee 213 done
ba109afd 214 sed -i -e "s|.ko||g" /etc/modprobe.d/framebuffer.conf
e2e106be 215
78a51aaf 216 # Disable ipv6 at runtime
ba109afd 217 echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6.conf
26c1cc71 218endif
51f9e7ac 219endif
8885467f 220
22820bf2
AF
221 #force new build of external modules and initrd if the kernel was rebuild
222 -rm -f /usr/src/log/*-kmod-$(VER)-$(VERSUFIX)
223 -rm -f /usr/src/log/linux-initrd-$(VER)-$(VERSUFIX)
224
d644d86f 225 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
df5e82b3 226 @$(POSTBUILD)