kernel: bump pae kernel package version.
[people/teissler/ipfire-2.x.git] / lfs / linux
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2013 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.2.48
28
29 RPI_PATCHES = linux-3.2.27-ada8b44
30
31 THISAPP = linux-$(VER)
32 DL_FILE = linux-$(VER).tar.xz
33 DL_FROM = $(URL_IPFIRE)
34 DIR_APP = $(DIR_SRC)/$(THISAPP)
35 CFLAGS =
36 CXXFLAGS =
37
38 PAK_VER = 30
39 DEPS = ""
40
41 VERSUFIX=ipfire$(KCFG)
42
43 ifeq "$(TOOLS)" "1"
44 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)-tools
45 HEADERS_PREFIX = /tools
46 else
47 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
48 HEADERS_PREFIX = /usr
49 endif
50
51 ifeq "$(MACHINE_TYPE)" "arm"
52 HEADERS_ARCH=arm
53 else
54 HEADERS_ARCH=x86
55 endif
56
57 ifeq "$(KCFG)" ""
58 LASTKERNEL=1
59 endif
60 ifeq "$(KCFG)" "-kirkwood"
61 LASTKERNEL=1
62 endif
63
64 ###############################################################################
65 # Top-level Rules
66 ###############################################################################
67 objects =$(DL_FILE) \
68 rpi-patches-$(RPI_PATCHES).patch.xz
69
70
71 $(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
72 rpi-patches-$(RPI_PATCHES).patch.xz = $(URL_IPFIRE)/rpi-patches-$(RPI_PATCHES).patch.xz
73
74 $(DL_FILE)_MD5 = f560aa5fcf07e57ea0ca66fdfdb53ef1
75 rpi-patches-$(RPI_PATCHES).patch.xz_MD5 = 966687ff27e450e04ff50e0da829dc00
76
77
78 install : $(TARGET)
79
80 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
81
82 download :$(patsubst %,$(DIR_DL)/%,$(objects))
83
84 md5 : $(subst %,%_MD5,$(objects))
85
86 dist:
87 @$(PAK)
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)
107 @rm -rf $(DIR_APP) $(DIR_SRC)/linux && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
108
109 ln -svf linux-$(VER) $(DIR_SRC)/linux
110
111 # Linux Intermediate Queueing Device
112 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-imq.patch
113
114 # ipp2p 0.8.2-ipfire
115 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.0-ipp2p-0.8.2-ipfire.patch
116
117 # Layer7-patch
118 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/netfilter_layer7_2.22_kernel3.0.patch
119
120 # Add LED trigger
121 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2.33-ledtrig-netdev-1.patch
122
123 # Fix uevent PHYSDEVDRIVER
124 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2.33_ipg-fix-driver-name.patch
125 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.27_mcs7830-fix-driver-name.patch
126
127 ifeq "$(KCFG)" "-kirkwood"
128 # Add dreamplug,guruplug and icy 62x0 support on ARM-kirkwood
129 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2.25-arm_kirkwood_setups.patch
130 endif
131
132 ifeq "$(MACHINE_TYPE)" "arm"
133 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.45_align_ssb_modtable_32bit_boundary.patch
134
135 # Reverse some asm optimizations that are incompatible with older gcc
136 cd $(DIR_APP) && patch -p1 -R < $(DIR_SRC)/src/patches/linux-2.6-arm-asm-constraint.patch
137 endif
138
139 ifeq "$(KCFG)" "-omap"
140 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-0001-panda-wlan-fix.patch
141 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-0002-panda-i2c.patch
142 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.2-panda-reboot.patch
143 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.x-smsc95xx-add_mac_addr_param.patch
144 endif
145
146 ifeq "$(KCFG)" "-rpi"
147 # Apply Raspberry Pi kernel patches.
148 cd $(DIR_APP) && xzcat $(DIR_DL)/rpi-patches-$(RPI_PATCHES).patch.xz | patch -Np1
149 endif
150
151 ifeq "$(KCFG)" "-headers"
152 # Install the header files
153 cd $(DIR_APP) && make ARCH=$(HEADERS_ARCH) INSTALL_HDR_PATH=dest headers_install
154 -mkdir -pv $(BUILDROOT)/$(HEADERS_PREFIX)/include
155 cd $(DIR_APP) && find dest/include \( -name .install -o -name ..install.cmd \) -delete
156 cd $(DIR_APP) && cp -rv dest/include/* $(BUILDROOT)/$(HEADERS_PREFIX)/include
157 else
158
159 # Install ipfire logo
160 cd $(DIR_APP) && cp -vf $(DIR_SRC)/config/kernel/ipfire_logo.ppm \
161 drivers/video/logo/logo_linux_clut224.ppm
162
163 # Cleanup kernel source
164 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config
165 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
166 cd $(DIR_APP) && make CC="$(KGCC)" clean
167 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
168
169 ifeq "$(KCFG)" "-kirkwood"
170 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" uImage
171 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
172 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX)
173 else
174 ifeq "$(KCFG)" "-omap"
175 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" uImage
176 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
177 cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX)
178 else
179 ifeq "$(KCFG)" "-rpi"
180 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" zImage
181 cd /boot && cat first32k.bin $(DIR_APP)/arch/arm/boot/Image > kernel.img
182 cd $(DIR_APP) && cp -v /boot/kernel.img /boot/vmlinuz-$(VER)-$(VERSUFIX)
183 else
184 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
185 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
186 ln -sf vmlinuz-$(VER)-$(VERSUFIX) /boot/vmlinuz-$(VERSUFIX)
187 endif
188 endif
189 endif
190 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
191 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
192 ln -sf System.map-$(VER)-$(VERSUFIX) /boot/System.map-$(VERSUFIX)
193 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
194 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
195 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
196
197 ifeq "$(LASTKERNEL)" "1"
198 # Only do this once
199 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
200
201 # Blacklist matroxfb_base
202 echo "blacklist matroxfb_base" >> /etc/modprobe.d/framebuffer
203 # Blacklist old framebuffer modules
204 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video -name *fb.ko); do \
205 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer ; \
206 done
207 # Blacklist new drm framebuffer modules
208 for f in $$(ls -1 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm/*/*.ko); do \
209 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer ; \
210 done
211 sed -i -e "s|.ko||g" /etc/modprobe.d/framebuffer
212
213 # Blacklist isdn modules
214 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn -name *.ko); do \
215 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/isdn ; \
216 done
217 sed -i -e "s|.ko||g" /etc/modprobe.d/isdn
218
219 # Disable ipv6 at runtime
220 echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6
221 endif
222
223 ifneq "$(MACHINE_TYPE)" "arm"
224 # Disable geode_aes modul
225 mv /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/crypto/geode-aes.ko \
226 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/crypto/geode-aes.ko.off
227 endif
228 endif
229
230 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
231 @$(POSTBUILD)