]> git.ipfire.org Git - people/dweismueller/ipfire-2.x.git/blob - lfs/linux
kernel: update banana pi, lamobo-r1 and add banana pro dtb.
[people/dweismueller/ipfire-2.x.git] / lfs / linux
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2015 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
25 include Config
26
27 VER = 3.14.30
28
29 RPI_PATCHES = 3.14.30-grsec-ipfire1
30 A7M_PATCHES = 3.14.30-grsec-ipfire1
31 GRS_PATCHES = grsecurity-3.0-3.14.30-201501272307.patch.xz
32
33 THISAPP = linux-$(VER)
34 DL_FILE = linux-$(VER).tar.xz
35 DL_FROM = $(URL_IPFIRE)
36 DIR_APP = $(DIR_SRC)/$(THISAPP)
37 CFLAGS =
38 CXXFLAGS =
39
40 PAK_VER = 57
41 DEPS = ""
42
43 VERSUFIX=ipfire$(KCFG)
44
45 ifeq "$(TOOLS)" "1"
46 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)-tools
47 HEADERS_PREFIX = /tools
48 else
49 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
50 HEADERS_PREFIX = /usr
51 endif
52
53 ifeq "$(MACHINE_TYPE)" "arm"
54 HEADERS_ARCH=arm
55 else
56 HEADERS_ARCH=x86
57 endif
58
59 ifeq "$(KCFG)" ""
60 LASTKERNEL=1
61 endif
62 ifeq "$(KCFG)" "-kirkwood"
63 LASTKERNEL=1
64 endif
65
66 ###############################################################################
67 # Top-level Rules
68 ###############################################################################
69 objects =$(DL_FILE) \
70 rpi-patches-$(RPI_PATCHES).patch.xz \
71 arm7-multi-patches-$(A7M_PATCHES).patch.xz \
72 $(GRS_PATCHES)
73
74
75 $(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
76 rpi-patches-$(RPI_PATCHES).patch.xz = $(URL_IPFIRE)/rpi-patches-$(RPI_PATCHES).patch.xz
77 arm7-multi-patches-$(A7M_PATCHES).patch.xz = $(URL_IPFIRE)/arm7-multi-patches-$(A7M_PATCHES).patch.xz
78 $(GRS_PATCHES) = $(URL_IPFIRE)/$(GRS_PATCHES)
79
80 $(DL_FILE)_MD5 = 5926982f20bbef0988fca03b92fe43a5
81 rpi-patches-$(RPI_PATCHES).patch.xz_MD5 = 983293824ca8e68ced3a097bc9bdefb5
82 arm7-multi-patches-$(A7M_PATCHES).patch.xz_MD5 = efcfe5889f120d879387dd4ebe881587
83 $(GRS_PATCHES)_MD5 = d3c9518ca3d5f5225cd624f94116397a
84
85 install : $(TARGET)
86
87 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
88
89 download :$(patsubst %,$(DIR_DL)/%,$(objects))
90
91 md5 : $(subst %,%_MD5,$(objects))
92
93 dist:
94 @$(PAK)
95 ###############################################################################
96 # Downloading, checking, md5sum
97 ###############################################################################
98
99 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
100 @$(CHECK)
101
102 $(patsubst %,$(DIR_DL)/%,$(objects)) :
103 @$(LOAD)
104
105 $(subst %,%_MD5,$(objects)) :
106 @$(MD5)
107
108 ###############################################################################
109 # Installation Details
110 ###############################################################################
111
112 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
113 @$(PREBUILD)
114 @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
115
116 ln -svf linux-$(VER) $(DIR_SRC)/linux
117
118 # Linux Intermediate Queueing Device
119 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.22-imq.patch
120
121 # ipp2p 0.8.2-ipfire
122 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10-ipp2p-0.8.2-ipfire.patch
123
124 # Layer7-patch
125 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14-layer7-filter.patch
126
127 ifneq "$(KCFG)" "-headers"
128 # Grsecurity-patches
129 cd $(DIR_APP) && xz -c -d $(DIR_DL)/$(GRS_PATCHES) | patch -Np1
130 cd $(DIR_APP) && rm localversion-grsec
131 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.7-disable-compat_vdso.patch
132 endif
133
134 # DVB Patches
135 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.22-dvbsky.patch
136 cd $(DIR_APP) && patch -Np2 < $(DIR_SRC)/src/patches/v4l-dvb_fix_tua6034_pll.patch
137
138 # Wlan Patches
139 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/compat-drivers-3.8.3-ath_ignore_eeprom_regdomain.patch
140 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.22-iwlwifi-noibss_only_on_radar_chan.patch
141 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.37-rt2800usb_add_dlink_dwa137_usbid.patch
142 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.55-rt2800usb-change_queue_warn_to_debug.patch
143 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.25_rt2x00_fix_bss_bcn_num.patch
144 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.25-rt5592_no_special_txop_init.patch
145 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.39-add_libertas_uap.patch
146
147 # mISDN Patches
148 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/mISDN_hfc-s_add_id.patch
149 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/mISDN-hfcusb-reportl1down.patch
150
151 # Add LED trigger
152 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.22-ledtrig_netdev.patch
153
154 # cs5535audio spams syslog if no ac97 was present (geos router)
155 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.30_cs5535audio_fix_logspam_on_geos.patch
156
157 # Add PC Engines APU led support
158 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10-apu_leds.patch
159
160 # Fix uevent PHYSDEVDRIVER
161 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2.33_ipg-fix-driver-name.patch
162 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.27_mcs7830-fix-driver-name.patch
163
164 ifeq "$(KCFG)" "-kirkwood"
165 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10.10-mv_cesa_disable_failing_hmac_sha1.patch
166 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.22-kirkwood_legacy_boot.patch
167 endif
168
169 ifeq "$(KCFG)" "-multi"
170 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10-smsc95xx-add_mac_addr_param.patch
171
172 # Apply Arm7-multiarch kernel patches.
173 cd $(DIR_APP) && xzcat $(DIR_DL)/arm7-multi-patches-$(A7M_PATCHES).patch.xz | patch -Np1
174
175 # Update Banana Pi, Lamobo-R1 and add Banana Pro dtb
176 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.x-update_banana_dts.patch
177
178 # Install switch api userspace header
179 cd $(DIR_APP) && install -v -m644 include/uapi/linux/switch.h /usr/include/linux/
180 endif
181
182 ifeq "$(KCFG)" "-rpi"
183 # Apply Raspberry Pi kernel patches.
184 cd $(DIR_APP) && xzcat $(DIR_DL)/rpi-patches-$(RPI_PATCHES).patch.xz | patch -Np1
185 endif
186
187 ifeq "$(KCFG)" "-headers"
188 # Install the header files
189 cd $(DIR_APP) && make ARCH=$(HEADERS_ARCH) INSTALL_HDR_PATH=dest headers_install
190 -mkdir -pv $(BUILDROOT)/$(HEADERS_PREFIX)/include
191 cd $(DIR_APP) && find dest/include \( -name .install -o -name ..install.cmd \) -delete
192 cd $(DIR_APP) && cp -rv dest/include/* $(BUILDROOT)/$(HEADERS_PREFIX)/include
193 else
194
195 # Install ipfire logo
196 cd $(DIR_APP) && cp -vf $(DIR_SRC)/config/kernel/ipfire_logo.ppm \
197 drivers/video/logo/logo_linux_clut224.ppm
198
199 # Cleanup kernel source
200 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config
201 cd $(DIR_APP) && make oldconfig
202 cd $(DIR_APP) && make clean
203 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
204
205 ifeq "$(KCFG)" "-kirkwood"
206 cd $(DIR_APP) && make $(MAKETUNING) uImage modules
207 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
208 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX)
209 else
210 ifeq "$(KCFG)" "-multi"
211 cd $(DIR_APP) && make $(MAKETUNING) zImage modules
212 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
213 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/zImage-$(VERSUFIX)
214 else
215 ifeq "$(KCFG)" "-rpi"
216 cd $(DIR_APP) && make $(MAKETUNING) zImage modules
217 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
218 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/kernel.img
219 else
220 cd $(DIR_APP) && make $(MAKETUNING) bzImage modules
221 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
222 endif
223 endif
224 endif
225
226 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
227 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
228 cd $(DIR_APP) && make $(MAKETUNING) modules_install
229 cd $(DIR_APP) && make $(MAKETUNING) firmware_install
230
231 ifeq "$(MACHINE_TYPE)" "arm"
232 cd $(DIR_APP) && make $(MAKETUNING) dtbs
233 cd $(DIR_APP) && for f in $$(find arch/arm/boot/dts/ -name *.dtb); do \
234 mkdir -p /boot/dtb-$(VER)-$(VERSUFIX) ; \
235 install -m 644 $$f /boot/dtb-$(VER)-$(VERSUFIX)/ ; \
236 done
237 endif
238
239 ifeq "$(LASTKERNEL)" "1"
240 # Only do this once
241 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
242
243 # Blacklist matroxfb_base
244 echo "blacklist matroxfb_base" >> /etc/modprobe.d/framebuffer.conf
245 # Blacklist old framebuffer modules
246 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video -name *fb.ko); do \
247 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
248 done
249 # Blacklist new drm framebuffer modules
250 for f in $$(ls -1 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm/*/*.ko); do \
251 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer.conf ; \
252 done
253 sed -i -e "s|.ko||g" /etc/modprobe.d/framebuffer.conf
254
255 # Blacklist isdn modules
256 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn -name *.ko); do \
257 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/isdn.conf ; \
258 done
259 sed -i -e "s|.ko||g" /etc/modprobe.d/isdn.conf
260
261 # Disable ipv6 at runtime
262 echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6.conf
263 endif
264 endif
265
266 #force new build of external modules and initrd if the kernel was rebuild
267 -rm -f /usr/src/log/*-kmod-$(VER)-$(VERSUFIX)
268 -rm -f /usr/src/log/linux-initrd-$(VER)-$(VERSUFIX)
269
270 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
271 @$(POSTBUILD)