Merge branch 'master' of ssh://git.ipfire.org/pub/git/ipfire-2.x
[people/teissler/ipfire-2.x.git] / lfs / linux
CommitLineData
df5e82b3 1###############################################################################
df5e82b3 2# #
70df8302
MT
3# IPFire.org - A linux based firewall #
4# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
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
d68506e9
AF
27PATCHLEVEL = .12
28VER = 2.6.32.12
df5e82b3
MT
29
30THISAPP = linux-$(VER)
376e42ce 31DL_FILE = $(THISAPP).tar.bz2
a2cb3a33 32DL_FROM = $(URL_IPFIRE)
df5e82b3
MT
33DIR_APP = $(DIR_SRC)/$(THISAPP)
34CFLAGS =
35CXXFLAGS =
36
acdf0e61 37PROG = linux-xen
b0d0b681 38PAK_VER = 8
acdf0e61 39DEPS = ""
bd9921dd
MT
40
41# Normal build or XEN build.
df5e82b3 42#
b0d0b681 43
3c4d4ed0
AF
44ifeq "$(XEN)" "1"
45 VERSUFIX=ipfire-xen
46else
47 VERSUFIX=ipfire
48endif
b0d0b681 49
2b2e03ed 50TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
6230f0da 51
df5e82b3
MT
52###############################################################################
53# Top-level Rules
54###############################################################################
55objects =$(DL_FILE) \
b0d0b681 56 netfilter-layer7-v2.22.tar.gz \
f418a984 57 patch-2.6.16-nath323-1.3.bz2 \
b0d0b681 58 reiser4-for-2.6.32.patch.bz2 \
6f9e582f 59 squashfs-lzma-linux-2.6.32-kernel-patches.tar.bz2 \
0e717101 60 linux-$(VER)-suse_xen_patches-1.tar.bz2
e69f1bf2 61
64cf4991 62$(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
9b16f056 63netfilter-layer7-v2.22.tar.gz = $(URL_IPFIRE)/netfilter-layer7-v2.22.tar.gz
4ce37908 64patch-2.6.16-nath323-1.3.bz2 = $(URL_IPFIRE)/patch-2.6.16-nath323-1.3.bz2
b0d0b681 65reiser4-for-2.6.32.patch.bz2 = $(URL_IPFIRE)/reiser4-for-2.6.32.patch.bz2
6f9e582f 66squashfs-lzma-linux-2.6.32-kernel-patches.tar.bz2 = $(URL_IPFIRE)/squashfs-lzma-linux-2.6.32-kernel-patches.tar.bz2
0e717101 67linux-$(VER)-suse_xen_patches-1.tar.bz2 = $(URL_IPFIRE)/linux-$(VER)-suse_xen_patches-1.tar.bz2
e69f1bf2 68
f44dda3c 69
d68506e9 70$(DL_FILE)_MD5 = bc87db696ed4be729334584493d6d98d
b0d0b681 71netfilter-layer7-v2.22.tar.gz_MD5 = 98dff8a3d5a31885b73341633f69501f
3185932e 72patch-2.6.16-nath323-1.3.bz2_MD5 = f926409ff703a307baf54b57ab75d138
b0d0b681 73reiser4-for-2.6.32.patch.bz2_MD5 = 3246397973d9271eb8e6d7c97c5d2d91
6f9e582f 74squashfs-lzma-linux-2.6.32-kernel-patches.tar.bz2_MD5 = d2a84311081023c7ffd28cdca67c45d4
d68506e9
AF
75linux-$(VER)-suse_xen_patches-1.tar.bz2_MD5 = e568ec5d8e65a4b0f2008d67f30198bb
76
df5e82b3
MT
77
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)
e69f1bf2 107 @rm -rf $(DIR_APP) $(DIR_SRC)/linux $(DIR_SRC)/linux-*-suse_xen_patches $(DIR_SRC)/xen-* && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
b0d0b681 108
8eec2184 109 ln -s linux-$(VER) /usr/src/linux
3a1019f6 110
3c4d4ed0
AF
111ifeq "$(XEN)" "1"
112 # Apply Xen patches (provided by SuSE)
f5b23e51
AF
113 cd $(DIR_SRC) && tar jxf $(DIR_DL)/linux-$(VER)-suse_xen_patches-1.tar.bz2
114 cp -f $(DIR_SRC)/src/patches/suse_xen_series.conf $(DIR_SRC)/linux-$(VER)-suse_xen_patches/series.conf
e69f1bf2
AF
115 cd $(DIR_SRC)/linux-$(VER)-suse_xen_patches && \
116 for x in $$( ./guards $$( ./arch-symbols) < ./series.conf); do \
f5b23e51 117 echo "*********** [Patch: $$x]"; \
3c4d4ed0
AF
118 patch -d $(DIR_APP) -p1 < $$x || break; \
119 done
e69f1bf2 120 rm -rf $(DIR_SRC)/linux-*-suse_xen_patches
3c4d4ed0 121
0e717101
AF
122 # Fix strange patchset errors
123 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.8-xen-patch-fixes.patch
124
3c4d4ed0 125 # Linux Intermediate Queueing Device
0e717101 126 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.8-xen-imq-test2.patch
3c4d4ed0 127else
bd9921dd 128 # Linux Intermediate Queueing Device
b0d0b681 129 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32-imq-test2.patch
3c4d4ed0 130endif
bd9921dd 131
3c4d4ed0
AF
132 # Not report deprecated syscall 1.23 (for kudzu)
133 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.25.18-not_report_sysctl_1.23.patch
b0d0b681 134
0e717101
AF
135 # Reiser4 (don't check if fail (some patches are already in xen patchset)
136 -cd $(DIR_APP) && bzcat $(DIR_DL)/reiser4-for-2.6.32.patch.bz2 | patch -Np1
a3b414d3 137
4f1b7a27 138 # ipp2p 0.8.2-pomng
b0d0b681 139 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.8-ipp2p-0.8.2-pomng.patch
4f1b7a27 140
3a1019f6 141 # Layer7-patch
b0d0b681
AF
142 cd $(DIR_SRC) && rm -rf $(DIR_SRC)/netfilter-layer7-v2.22
143 cd $(DIR_SRC) && tar xzf $(DIR_DL)/netfilter-layer7-v2.22.tar.gz
144 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/netfilter-layer7-v2.22/kernel-2.6.25-2.6.28-layer7-2.22.patch
df5e82b3 145
6f9e582f
AF
146 # Squashfs LZMA support
147 cd $(DIR_APP) && bzcat $(DIR_DL)/squashfs-lzma-linux-2.6.32-kernel-patches.tar.bz2 | patch -Np1
148
f90eb01e
AF
149 # mISDN hfcusb fixes
150 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/mISDN-hfcusb-reportl1down.patch
151 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/mISDN-hfcusb_bchannels.patch
f0ed79fb
MT
152
153 # Add some more LED triggers
154 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.11-netdev-1.patch
155
525793ac
AF
156 # Huawei (Vodafone) K3765 & K4505 Usbids
157 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.11-option_add_vodafone_usbids.patch
158
df5e82b3 159 # Cleanup kernel source
3a1019f6 160
2b2e03ed 161 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config
bd9921dd 162 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
df5e82b3 163 cd $(DIR_APP) && make CC="$(KGCC)" clean
2b2e03ed 164 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-$(VERSUFIX)/' Makefile
3a1019f6 165
3c4d4ed0
AF
166ifeq "$(XEN)" "1"
167 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" vmlinuz
168 cd $(DIR_APP) && cp -v arch/i386/boot/vmlinuz /boot/vmlinuz-$(VER)-$(VERSUFIX)
169else
872e5216 170 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
2b2e03ed 171 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
3c4d4ed0 172endif
2b2e03ed
AF
173 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
174 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
175 ln -sf vmlinuz-$(VER)-$(VERSUFIX) /boot/vmlinuz-$(VERSUFIX)
176 ln -sf System.map-$(VER)-$(VERSUFIX) /boot/System.map-$(VERSUFIX)
376e42ce
MT
177 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
178 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
a3b414d3 179 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
376e42ce 180
3c4d4ed0 181ifeq "$(XEN)" ""
bd9921dd 182 # Only do this once on the non-XEN pass
81e974f3 183 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
3c4d4ed0 184endif
ee78a5ef 185
bd9921dd 186 # Rename ide-cd module to match with old kernel
2b2e03ed
AF
187 mv /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/ide/ide-cd_mod.ko \
188 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/ide/ide-cd.ko
b0d0b681
AF
189 mv /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/ide/ide-gd_mod.ko \
190 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/ide/ide-disk.ko
bd9921dd 191
b0d0b681
AF
192# # Remove mISDN modules
193# rm -rvf /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn/mISDN
194# rm -rvf /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn/hardware/mISDN
d644d86f
AF
195
196 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
df5e82b3 197 @$(POSTBUILD)