Rootfile Update: initscripts, liboogg, ligvorbis, net-snmp.
[people/pmueller/ipfire-2.x.git] / lfs / linux
1 ###############################################################################
2 # #
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 #
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 = .25
28 VER = 2.6.27.25
29
30 THISAPP = linux-$(VER)
31 DL_FILE = $(THISAPP).tar.bz2
32 DL_FROM = $(URL_IPFIRE)
33 DIR_APP = $(DIR_SRC)/$(THISAPP)
34 CFLAGS =
35 CXXFLAGS =
36
37 PROG = linux-xen
38 PAK_VER = 4
39 DEPS = ""
40
41 # Normal build or XEN build.
42 #
43 ifeq "$(XEN)" "1"
44 VERSUFIX=ipfire-xen
45 else
46 VERSUFIX=ipfire
47 endif
48 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
49
50 ###############################################################################
51 # Top-level Rules
52 ###############################################################################
53 objects =$(DL_FILE) \
54 squashfs3.4.tar.gz \
55 netfilter-layer7-v2.21.tar.gz \
56 patch-2.6.16-nath323-1.3.bz2 \
57 reiser4-for-2.6.27.19.patch.bz2
58
59 $(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
60 netfilter-layer7-v2.21.tar.gz = $(URL_IPFIRE)/netfilter-layer7-v2.21.tar.gz
61 patch-2.6.16-nath323-1.3.bz2 = $(URL_IPFIRE)/patch-2.6.16-nath323-1.3.bz2
62 squashfs3.4.tar.gz = $(URL_IPFIRE)/squashfs3.4.tar.gz
63 reiser4-for-2.6.27.19.patch.bz2 = $(URL_IPFIRE)/reiser4-for-2.6.27.19.patch.bz2
64
65 $(DL_FILE)_MD5 = 5d6dcff157f30d742c9ee28ad4589779
66 netfilter-layer7-v2.21.tar.gz_MD5 = 838422e7d9a06b42e682e9064e5210b5
67 patch-2.6.16-nath323-1.3.bz2_MD5 = f926409ff703a307baf54b57ab75d138
68 squashfs3.4.tar.gz_MD5 = 2a4d2995ad5aa6840c95a95ffa6b1da6
69 reiser4-for-2.6.27.19.patch.bz2_MD5 = 22988387f64f299489b90b484b2642cc
70
71 install : $(TARGET)
72
73 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
74
75 download :$(patsubst %,$(DIR_DL)/%,$(objects))
76
77 md5 : $(subst %,%_MD5,$(objects))
78
79 dist:
80 @$(PAK)
81 ###############################################################################
82 # Downloading, checking, md5sum
83 ###############################################################################
84
85 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
86 @$(CHECK)
87
88 $(patsubst %,$(DIR_DL)/%,$(objects)) :
89 @$(LOAD)
90
91 $(subst %,%_MD5,$(objects)) :
92 @$(MD5)
93
94 ###############################################################################
95 # Installation Details
96 ###############################################################################
97
98 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
99 @$(PREBUILD)
100 @rm -rf $(DIR_APP) $(DIR_SRC)/linux $(DIR_SRC)/xen-* && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
101 ln -s linux-$(VER) /usr/src/linux
102
103 ifeq "$(XEN)" "1"
104 # Apply Xen patches (provided by SuSE)
105 cd $(DIR_SRC)/src/patches/suse-$(VER) && \
106 for x in $$( $(DIR_SRC)/src/patches/suse-$(VER)/guards $$( $(DIR_SRC)/src/patches/suse-$(VER)/arch-symbols) < $(DIR_SRC)/src/patches/suse-$(VER)/series.conf); do \
107 patch -d $(DIR_APP) -p1 < $$x || break; \
108 done
109
110 # Linux Intermediate Queueing Device
111 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/imq-skbuff.patch
112 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.27.21-imq-test3-xen.patch
113 else
114 # Linux Intermediate Queueing Device
115 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.27.21-imq-test3.patch
116 endif
117
118 # Add Vodafone K3565-Z USB ID's to option driver
119 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.27.25-option_add_vf-k3565-z_usbids.patch
120
121 # Not report deprecated syscall 1.23 (for kudzu)
122 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.25.18-not_report_sysctl_1.23.patch
123 ifeq "$(XEN)" ""
124 # Reiser4
125 -cd $(DIR_APP) && bzip2 -d -c $(DIR_DL)/reiser4-for-2.6.27.19.patch.bz2 | patch -Np1
126
127 # SquashFS (already in Suse Patchset)
128 cd $(DIR_SRC) && rm -rf squashfs*
129 cd $(DIR_SRC) && tar xfz $(DIR_DL)/squashfs3.4.tar.gz
130 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/squashfs3.4/kernel-patches/linux-2.6.27-rc4/squashfs3.4-patch
131 endif
132
133 # ipp2p 0.8.2-pomng
134 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.27.19-ipp2p-0.8.2-pomng.patch
135
136 # Layer7-patch
137 cd $(DIR_SRC) && rm -rf $(DIR_SRC)/netfilter-layer7-v2.21
138 cd $(DIR_SRC) && tar xzf $(DIR_DL)/netfilter-layer7-v2.21.tar.gz
139 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/netfilter-layer7-v2.21/kernel-2.6.25-2.6.28-layer7-2.21.patch
140
141 # Cleanup kernel source
142 cd $(DIR_APP) && make mrproper
143
144 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config
145 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
146 cd $(DIR_APP) && make CC="$(KGCC)" clean
147 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-$(VERSUFIX)/' Makefile
148
149 ifeq "$(XEN)" "1"
150 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" vmlinuz
151 cd $(DIR_APP) && cp -v arch/i386/boot/vmlinuz /boot/vmlinuz-$(VER)-$(VERSUFIX)
152 else
153 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
154 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
155 endif
156 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
157 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
158 ln -sf vmlinuz-$(VER)-$(VERSUFIX) /boot/vmlinuz-$(VERSUFIX)
159 ln -sf System.map-$(VER)-$(VERSUFIX) /boot/System.map-$(VERSUFIX)
160 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
161 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
162 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
163
164 ifeq "$(XEN)" ""
165 # Only do this once on the non-XEN pass
166 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
167 endif
168
169 # Rename ide-cd module to match with old kernel
170 mv /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/ide/ide-cd_mod.ko \
171 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/ide/ide-cd.ko
172
173 # Remove mISDN modules
174 rm -rvf /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn/mISDN
175 rm -rvf /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn/hardware/mISDN
176
177 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
178 @$(POSTBUILD)