grub: disable pax mprotect for grub.
[people/teissler/ipfire-2.x.git] / lfs / linux
CommitLineData
df5e82b3 1###############################################################################
df5e82b3 2# #
70df8302 3# IPFire.org - A linux based firewall #
eed187d6 4# Copyright (C) 2007-2013 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
bb5f0bf8 27VER = 3.10.9
fdecb907 28
2e732994 29RPI_PATCHES = linux-3.2.27-ada8b44
df5e82b3
MT
30
31THISAPP = linux-$(VER)
79f94395 32DL_FILE = linux-$(VER).tar.xz
a2cb3a33 33DL_FROM = $(URL_IPFIRE)
df5e82b3
MT
34DIR_APP = $(DIR_SRC)/$(THISAPP)
35CFLAGS =
36CXXFLAGS =
37
bb5f0bf8 38PAK_VER = 31
acdf0e61 39DEPS = ""
bd9921dd 40
fdf0c7c1 41VERSUFIX=ipfire$(KCFG)
b0d0b681 42
51f9e7ac 43ifeq "$(TOOLS)" "1"
cc24c14b 44 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)-tools
51f9e7ac 45 HEADERS_PREFIX = /tools
51f9e7ac
MT
46else
47 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
cc24c14b 48 HEADERS_PREFIX = /usr
51f9e7ac
MT
49endif
50
cc72d5cb 51ifeq "$(MACHINE_TYPE)" "arm"
51f9e7ac
MT
52 HEADERS_ARCH=arm
53else
54 HEADERS_ARCH=x86
55endif
6230f0da 56
bc8fe5ff
AF
57ifeq "$(KCFG)" ""
58LASTKERNEL=1
59endif
60ifeq "$(KCFG)" "-kirkwood"
61LASTKERNEL=1
62endif
63
df5e82b3
MT
64###############################################################################
65# Top-level Rules
66###############################################################################
67objects =$(DL_FILE) \
fdecb907
AF
68 rpi-patches-$(RPI_PATCHES).patch.xz
69
e69f1bf2 70
64cf4991 71$(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
fdecb907 72rpi-patches-$(RPI_PATCHES).patch.xz = $(URL_IPFIRE)/rpi-patches-$(RPI_PATCHES).patch.xz
e69f1bf2 73
bb5f0bf8 74$(DL_FILE)_MD5 = 28d1e1117c30fdd861f70ac0f9b677aa
2e732994 75rpi-patches-$(RPI_PATCHES).patch.xz_MD5 = 966687ff27e450e04ff50e0da829dc00
df5e82b3 76
3e5f2ee9 77
df5e82b3
MT
78install : $(TARGET)
79
80check : $(patsubst %,$(DIR_CHK)/%,$(objects))
81
82download :$(patsubst %,$(DIR_DL)/%,$(objects))
83
84md5 : $(subst %,%_MD5,$(objects))
85
f418a984
AF
86dist:
87 @$(PAK)
df5e82b3
MT
88###############################################################################
89# Downloading, checking, md5sum
90###############################################################################
91
92$(patsubst %,$(DIR_CHK)/%,$(objects)) :
93 @$(CHECK)
94
95$(patsubst %,$(DIR_DL)/%,$(objects)) :
96 @$(LOAD)
97
98$(subst %,%_MD5,$(objects)) :
99 @$(MD5)
100
101###############################################################################
102# Installation Details
103###############################################################################
104
105$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
106 @$(PREBUILD)
fdecb907 107 @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
b0d0b681 108
51f9e7ac 109 ln -svf linux-$(VER) $(DIR_SRC)/linux
3a1019f6 110
3c4d4ed0 111 # Linux Intermediate Queueing Device
bb5f0bf8 112 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/imq_kernel3.10.patch
bd9921dd 113
fdecb907 114 # ipp2p 0.8.2-ipfire
bb5f0bf8 115 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.10-ipp2p-0.8.2-ipfire.patch
4f1b7a27 116
3a1019f6 117 # Layer7-patch
bb5f0bf8
AF
118 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/netfilter_layer7_2.22_kernel3.10-no_proc_interface.patch
119
120 # Grsecurity-patches
121ifneq "$(KCFG)" "-headers"
122 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/grsecurity-2.9.1-3.10.9-201308202015.patch
123 cd $(DIR_APP) && rm localversion-grsec
124 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.7-disable-compat_vdso.patch
125endif
126
127 # Disable pcspeaker autoload
128 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.30-no-pcspkr-modalias.patch
129
130 # Remove ACPI Blacklist message
131 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6-silence-acpi-blacklist.patch
df5e82b3 132
40c7cdd3 133 # Add LED trigger
bb5f0bf8 134# cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2.33-ledtrig-netdev-1.patch
40c7cdd3 135
87837787 136 # Fix uevent PHYSDEVDRIVER
4de2df1e 137 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2.33_ipg-fix-driver-name.patch
87837787 138 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.27_mcs7830-fix-driver-name.patch
9256a1df 139
bc8fe5ff 140ifeq "$(KCFG)" "-kirkwood"
c05f6df0 141 # Add dreamplug,guruplug and icy 62x0 support on ARM-kirkwood
cc7e3a98 142 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2.25-arm_kirkwood_setups.patch
8e6fb99d
AF
143endif
144
7fbc483a
AF
145ifeq "$(MACHINE_TYPE)" "arm"
146 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.45_align_ssb_modtable_32bit_boundary.patch
fdecb907
AF
147
148 # Reverse some asm optimizations that are incompatible with older gcc
149 cd $(DIR_APP) && patch -p1 -R < $(DIR_SRC)/src/patches/linux-2.6-arm-asm-constraint.patch
150endif
151
152ifeq "$(KCFG)" "-omap"
153 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-0001-panda-wlan-fix.patch
154 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-0002-panda-i2c.patch
155 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-panda-reboot.patch
156 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.x-smsc95xx-add_mac_addr_param.patch
157endif
158
159ifeq "$(KCFG)" "-rpi"
160 # Apply Raspberry Pi kernel patches.
161 cd $(DIR_APP) && xzcat $(DIR_DL)/rpi-patches-$(RPI_PATCHES).patch.xz | patch -Np1
7fbc483a 162endif
8e6fb99d 163
cc24c14b 164ifeq "$(KCFG)" "-headers"
51f9e7ac
MT
165 # Install the header files
166 cd $(DIR_APP) && make ARCH=$(HEADERS_ARCH) INSTALL_HDR_PATH=dest headers_install
167 -mkdir -pv $(BUILDROOT)/$(HEADERS_PREFIX)/include
168 cd $(DIR_APP) && find dest/include \( -name .install -o -name ..install.cmd \) -delete
169 cd $(DIR_APP) && cp -rv dest/include/* $(BUILDROOT)/$(HEADERS_PREFIX)/include
170else
171
aa2049e5
MT
172 # Install ipfire logo
173 cd $(DIR_APP) && cp -vf $(DIR_SRC)/config/kernel/ipfire_logo.ppm \
174 drivers/video/logo/logo_linux_clut224.ppm
175
df5e82b3 176 # Cleanup kernel source
2b2e03ed 177 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config
bd9921dd 178 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
df5e82b3 179 cd $(DIR_APP) && make CC="$(KGCC)" clean
fdecb907 180 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
3a1019f6 181
bc8fe5ff 182ifeq "$(KCFG)" "-kirkwood"
8e6fb99d
AF
183 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" uImage
184 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
bc8fe5ff
AF
185 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX)
186else
fdecb907
AF
187ifeq "$(KCFG)" "-omap"
188 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" uImage
189 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
190 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX)
191else
192ifeq "$(KCFG)" "-rpi"
193 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" zImage
194 cd /boot && cat first32k.bin $(DIR_APP)/arch/arm/boot/Image > kernel.img
195 cd $(DIR_APP) && cp -v /boot/kernel.img /boot/vmlinuz-$(VER)-$(VERSUFIX)
92655908 196else
8e6fb99d 197 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
2b2e03ed 198 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
1e1cdd58 199 ln -sf vmlinuz-$(VER)-$(VERSUFIX) /boot/vmlinuz-$(VERSUFIX)
92655908 200endif
bc8fe5ff 201endif
3c4d4ed0 202endif
2b2e03ed
AF
203 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
204 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
2b2e03ed 205 ln -sf System.map-$(VER)-$(VERSUFIX) /boot/System.map-$(VERSUFIX)
376e42ce
MT
206 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
207 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
a3b414d3 208 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
376e42ce 209
bc8fe5ff
AF
210ifeq "$(LASTKERNEL)" "1"
211 # Only do this once
81e974f3 212 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
d644d86f 213
efa8b615 214 # Blacklist matroxfb_base
e2e106be 215 echo "blacklist matroxfb_base" >> /etc/modprobe.d/framebuffer
aa1dd878 216 # Blacklist old framebuffer modules
030a57c5
AF
217 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video -name *fb.ko); do \
218 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer ; \
219 done
aa1dd878
AF
220 # Blacklist new drm framebuffer modules
221 for f in $$(ls -1 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm/*/*.ko); do \
222 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer ; \
223 done
6886b70c 224 sed -i -e "s|.ko||g" /etc/modprobe.d/framebuffer
e2e106be
AF
225
226 # Blacklist isdn modules
227 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn -name *.ko); do \
228 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/isdn ; \
229 done
b29c22a4 230 sed -i -e "s|.ko||g" /etc/modprobe.d/isdn
78a51aaf
AF
231
232 # Disable ipv6 at runtime
233 echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6
26c1cc71
AF
234endif
235
bb5f0bf8
AF
236 # Disable geode_aes modul if exist
237 -mv /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/crypto/geode-aes.ko \
8885467f 238 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/crypto/geode-aes.ko.off
51f9e7ac 239endif
8885467f 240
d644d86f 241 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
df5e82b3 242 @$(POSTBUILD)