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