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