collectd: Don't scan for sensors on ARM.
[people/teissler/ipfire-2.x.git] / lfs / linux
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007-2011 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 PATCHLEVEL = .45
28 VER = 2.6.32.45
29
30 THISAPP = linux-$(VER)
31 DL_FILE = $(THISAPP).tar.gz
32 DL_FROM = $(URL_IPFIRE)
33 DIR_APP = $(DIR_SRC)/$(THISAPP)
34 CFLAGS =
35 CXXFLAGS =
36
37 PROG = linux-xen
38 PAK_VER = 19
39 DEPS = ""
40
41 # Normal build or XEN build.
42 #
43
44 ifeq "$(PAE)" "1"
45 VERSUFIX=ipfire-pae
46 else
47 ifeq "$(XEN)" "1"
48 VERSUFIX=ipfire-xen
49 else
50 VERSUFIX=ipfire
51 endif
52 endif
53
54 ifeq "$(HEADERS)" "1"
55 ifeq "$(TOOLS)" "1"
56 TARGET = $(DIR_INFO)/linux-libc-headers-$(VER)-$(VERSUFIX)-tools
57 HEADERS_PREFIX = /tools
58 else
59 TARGET = $(DIR_INFO)/linux-libc-headers-$(VER)-$(VERSUFIX)
60 HEADERS_PREFIX = /usr
61 endif
62 else
63 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
64 endif
65
66 ifeq "$(MACHINE_TYPE)" "arm"
67 HEADERS_ARCH=arm
68 else
69 HEADERS_ARCH=x86
70 endif
71
72 ###############################################################################
73 # Top-level Rules
74 ###############################################################################
75 objects =$(DL_FILE) \
76 netfilter-layer7-v2.22.tar.gz \
77 patch-2.6.16-nath323-1.3.bz2 \
78 reiser4-for-2.6.32.patch.bz2 \
79 xen-patches-2.6.32-2f.tar.bz2
80
81 $(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
82 netfilter-layer7-v2.22.tar.gz = $(URL_IPFIRE)/netfilter-layer7-v2.22.tar.gz
83 patch-2.6.16-nath323-1.3.bz2 = $(URL_IPFIRE)/patch-2.6.16-nath323-1.3.bz2
84 reiser4-for-2.6.32.patch.bz2 = $(URL_IPFIRE)/reiser4-for-2.6.32.patch.bz2
85 xen-patches-2.6.32-2f.tar.bz2 = $(URL_IPFIRE)/xen-patches-2.6.32-2f.tar.bz2
86
87 $(DL_FILE)_MD5 = d41f1c7e704cc95fdfc3374367b6fd64
88 netfilter-layer7-v2.22.tar.gz_MD5 = 98dff8a3d5a31885b73341633f69501f
89 patch-2.6.16-nath323-1.3.bz2_MD5 = f926409ff703a307baf54b57ab75d138
90 reiser4-for-2.6.32.patch.bz2_MD5 = 3246397973d9271eb8e6d7c97c5d2d91
91 xen-patches-2.6.32-2f.tar.bz2_MD5 = b59d6f89e11accb9d40354418e13f31b
92
93 install : $(TARGET)
94
95 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
96
97 download :$(patsubst %,$(DIR_DL)/%,$(objects))
98
99 md5 : $(subst %,%_MD5,$(objects))
100
101 dist:
102 @$(PAK)
103 ###############################################################################
104 # Downloading, checking, md5sum
105 ###############################################################################
106
107 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
108 @$(CHECK)
109
110 $(patsubst %,$(DIR_DL)/%,$(objects)) :
111 @$(LOAD)
112
113 $(subst %,%_MD5,$(objects)) :
114 @$(MD5)
115
116 ###############################################################################
117 # Installation Details
118 ###############################################################################
119
120 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
121 @$(PREBUILD)
122 @rm -rf $(DIR_APP) $(DIR_SRC)/linux $(DIR_SRC)/linux-*-suse_xen_patches $(DIR_SRC)/xen-* && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
123
124 ln -svf linux-$(VER) $(DIR_SRC)/linux
125
126 ifeq "$(XEN)" "1"
127 # Apply gentoo Xen patches
128 mkdir -p $(DIR_SRC)/xen-patches
129 cd $(DIR_SRC)/xen-patches && tar jxf $(DIR_DL)/xen-patches-2.6.32-2f.tar.bz2
130
131 for x in `ls -1 $(DIR_SRC)/xen-patches/*.patch1`; do \
132 echo "*********** [Patch: $$x]"; \
133 cd $(DIR_APP) && pwd && patch -Np1 < $$x || exit 1; \
134 done
135 rm -rf $(DIR_SRC)/xen-patches
136
137 # Linux Intermediate Queueing Device
138 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.8-xen-imq-test2.patch
139 else
140 # Linux Intermediate Queueing Device
141 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32-imq-test2.patch
142 endif
143
144 # Not report deprecated syscall 1.23 (for kudzu)
145 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.25.18-not_report_sysctl_1.23.patch
146
147 # Reiser4 (don't check if fail (some patches are already in xen patchset)
148 -cd $(DIR_APP) && bzcat $(DIR_DL)/reiser4-for-2.6.32.patch.bz2 | patch -Np1
149
150 # ipp2p 0.8.2-pomng
151 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.8-ipp2p-0.8.2-pomng.patch
152
153 # Layer7-patch
154 cd $(DIR_SRC) && rm -rf $(DIR_SRC)/netfilter-layer7-v2.22
155 cd $(DIR_SRC) && tar xzf $(DIR_DL)/netfilter-layer7-v2.22.tar.gz
156 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/netfilter-layer7-v2.22/kernel-2.6.25-2.6.28-layer7-2.22.patch
157
158 # Add some more LED triggers
159 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.11-netdev-1.patch
160
161 # Huawei Android Phones (Vodafone V845, T-Mobile Pulse/mini ...)
162 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.15-option_add_huawei_android.patch
163
164 # Fix uevent PHYSDEVDRIVER
165 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.27_ipg-fix-driver-name.patch
166 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.27_mcs7830-fix-driver-name.patch
167
168 ifeq "$(HEADERS)" "1"
169 # Install the header files
170 cd $(DIR_APP) && make ARCH=$(HEADERS_ARCH) INSTALL_HDR_PATH=dest headers_install
171 -mkdir -pv $(BUILDROOT)/$(HEADERS_PREFIX)/include
172 cd $(DIR_APP) && find dest/include \( -name .install -o -name ..install.cmd \) -delete
173 cd $(DIR_APP) && cp -rv dest/include/* $(BUILDROOT)/$(HEADERS_PREFIX)/include
174 else
175
176 # Install ipfire logo
177 cd $(DIR_APP) && cp -vf $(DIR_SRC)/config/kernel/ipfire_logo.ppm \
178 drivers/video/logo/logo_linux_clut224.ppm
179
180 # Cleanup kernel source
181 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config
182 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
183 cd $(DIR_APP) && make CC="$(KGCC)" clean
184 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-$(VERSUFIX)/' Makefile
185
186 ifeq "$(XEN)" "1"
187 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" vmlinuz
188 cd $(DIR_APP) && cp -v arch/i386/boot/vmlinuz /boot/vmlinuz-$(VER)-$(VERSUFIX)
189 else
190 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
191 ifeq "$(MACHINE_TYPE)" "arm"
192 cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
193 else
194 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
195 endif
196 endif
197 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
198 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
199 ln -sf vmlinuz-$(VER)-$(VERSUFIX) /boot/vmlinuz-$(VERSUFIX)
200 ln -sf System.map-$(VER)-$(VERSUFIX) /boot/System.map-$(VERSUFIX)
201 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
202 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
203 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
204
205 ifneq "$(PAE)" "1"
206 ifneq "$(XEN)" "1"
207 # Only do this once on the standard kernel pass
208 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
209
210 # Blacklist matroxfb_base
211 echo "blacklist matroxfb_base" >> /etc/modprobe.d/framebuffer
212 # Blacklist old framebuffer modules
213 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video -name *fb.ko); do \
214 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer ; \
215 done
216 # Blacklist new drm framebuffer modules
217 for f in $$(ls -1 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm/*/*.ko); do \
218 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer ; \
219 done
220 sed -i -e "s|.ko||g" /etc/modprobe.d/framebuffer
221
222 # Blacklist isdn modules
223 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn -name *.ko); do \
224 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/isdn ; \
225 done
226 sed -i -e "s|.ko||g" /etc/modprobe.d/isdn
227
228 # Disable ipv6 at runtime
229 echo "options ipv6 disable_ipv6=1" > /etc/modprobe.d/ipv6
230
231 endif
232 endif
233
234 # Remove mISDN modules
235 rm -rvf /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn/mISDN
236 rm -rvf /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn/hardware/mISDN
237
238 ifneq "$(MACHINE_TYPE)" "arm"
239 # Disable geode_aes modul
240 mv /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/crypto/geode-aes.ko \
241 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/crypto/geode-aes.ko.off
242 endif
243 endif
244
245 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
246 @$(POSTBUILD)