Remove unneeded squashfs patches.
[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 = .21
28 VER = 2.6.32.21
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 = 12
39 DEPS = ""
40
41 # Normal build or XEN build.
42 #
43
44 ifeq "$(XEN)" "1"
45 VERSUFIX=ipfire-xen
46 else
47 VERSUFIX=ipfire
48 endif
49
50 TARGET = $(DIR_INFO)/linux-$(VER)-$(VERSUFIX)
51
52 ###############################################################################
53 # Top-level Rules
54 ###############################################################################
55 objects =$(DL_FILE) \
56 netfilter-layer7-v2.22.tar.gz \
57 patch-2.6.16-nath323-1.3.bz2 \
58 reiser4-for-2.6.32.patch.bz2 \
59 xen-patches-2.6.32-2c.tar.bz2
60
61 $(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
62 netfilter-layer7-v2.22.tar.gz = $(URL_IPFIRE)/netfilter-layer7-v2.22.tar.gz
63 patch-2.6.16-nath323-1.3.bz2 = $(URL_IPFIRE)/patch-2.6.16-nath323-1.3.bz2
64 reiser4-for-2.6.32.patch.bz2 = $(URL_IPFIRE)/reiser4-for-2.6.32.patch.bz2
65 xen-patches-2.6.32-2c.tar.bz2 = $(URL_IPFIRE)/xen-patches-2.6.32-2c.tar.bz2
66
67 $(DL_FILE)_MD5 = e4acefa00c5b8fcc539d9cbf34d88cdb
68 netfilter-layer7-v2.22.tar.gz_MD5 = 98dff8a3d5a31885b73341633f69501f
69 patch-2.6.16-nath323-1.3.bz2_MD5 = f926409ff703a307baf54b57ab75d138
70 reiser4-for-2.6.32.patch.bz2_MD5 = 3246397973d9271eb8e6d7c97c5d2d91
71 xen-patches-2.6.32-2c.tar.bz2_MD5 = 62a75ddcba43894b20f754a94b299ce6
72
73 install : $(TARGET)
74
75 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
76
77 download :$(patsubst %,$(DIR_DL)/%,$(objects))
78
79 md5 : $(subst %,%_MD5,$(objects))
80
81 dist:
82 @$(PAK)
83 ###############################################################################
84 # Downloading, checking, md5sum
85 ###############################################################################
86
87 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
88 @$(CHECK)
89
90 $(patsubst %,$(DIR_DL)/%,$(objects)) :
91 @$(LOAD)
92
93 $(subst %,%_MD5,$(objects)) :
94 @$(MD5)
95
96 ###############################################################################
97 # Installation Details
98 ###############################################################################
99
100 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
101 @$(PREBUILD)
102 @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)
103
104 ln -s linux-$(VER) /usr/src/linux
105
106 ifeq "$(XEN)" "1"
107 # Apply gentoo Xen patches
108 mkdir -p $(DIR_SRC)/xen-patches
109 cd $(DIR_SRC)/xen-patches && tar jxf $(DIR_DL)/xen-patches-2.6.32-2c.tar.bz2
110
111 for x in `ls -1 $(DIR_SRC)/xen-patches/*.patch1`; do \
112 echo "*********** [Patch: $$x]"; \
113 cd $(DIR_APP) && pwd && patch -Np1 < $$x || exit 1; \
114 done
115 rm -rf $(DIR_SRC)/xen-patches
116
117 # Linux Intermediate Queueing Device
118 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.8-xen-imq-test2.patch
119 else
120 # Linux Intermediate Queueing Device
121 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32-imq-test2.patch
122 endif
123
124 # Not report deprecated syscall 1.23 (for kudzu)
125 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.25.18-not_report_sysctl_1.23.patch
126
127 # Reiser4 (don't check if fail (some patches are already in xen patchset)
128 -cd $(DIR_APP) && bzcat $(DIR_DL)/reiser4-for-2.6.32.patch.bz2 | patch -Np1
129
130 # ipp2p 0.8.2-pomng
131 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.8-ipp2p-0.8.2-pomng.patch
132
133 # Layer7-patch
134 cd $(DIR_SRC) && rm -rf $(DIR_SRC)/netfilter-layer7-v2.22
135 cd $(DIR_SRC) && tar xzf $(DIR_DL)/netfilter-layer7-v2.22.tar.gz
136 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/netfilter-layer7-v2.22/kernel-2.6.25-2.6.28-layer7-2.22.patch
137
138 # Add some more LED triggers
139 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.11-netdev-1.patch
140
141 # Huawei Android Phones (Vodafone V845, T-Mobile Pulse/mini ...)
142 cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.32.15-option_add_huawei_android.patch
143
144 # Cleanup kernel source
145
146 cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config
147 cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
148 cd $(DIR_APP) && make CC="$(KGCC)" clean
149 cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-$(VERSUFIX)/' Makefile
150
151 ifeq "$(XEN)" "1"
152 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" vmlinuz
153 cd $(DIR_APP) && cp -v arch/i386/boot/vmlinuz /boot/vmlinuz-$(VER)-$(VERSUFIX)
154 else
155 cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
156 cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
157 endif
158 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
159 cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
160 ln -sf vmlinuz-$(VER)-$(VERSUFIX) /boot/vmlinuz-$(VERSUFIX)
161 ln -sf System.map-$(VER)-$(VERSUFIX) /boot/System.map-$(VERSUFIX)
162 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
163 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
164 cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
165
166 ifeq "$(XEN)" ""
167 # Only do this once on the non-XEN pass
168 cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
169 endif
170
171 # Remove mISDN modules
172 rm -rvf /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn/mISDN
173 rm -rvf /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn/hardware/mISDN
174
175 ifneq "$(XEN)" "1"
176 # Blacklist matroxfb_base
177 echo "blacklist matroxfb_base" >> /etc/modprobe.d/framebuffer
178 # Blacklist old framebuffer modules
179 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/video -name *fb.ko); do \
180 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer ; \
181 done
182 # Blacklist new drm framebuffer modules
183 for f in $$(ls -1 /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/gpu/drm/*/*.ko); do \
184 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/framebuffer ; \
185 done
186 sed -i -e "s|.ko||g" /etc/modprobe.d/framebuffer
187
188 # Blacklist isdn modules
189 for f in $$(find /lib/modules/$(VER)-$(VERSUFIX)/kernel/drivers/isdn -name *.ko); do \
190 echo "blacklist $$(basename $$f)" >> /etc/modprobe.d/isdn ; \
191 done
192 sed -i -e "s|.ko||g" /etc/modprobe.d/isdn
193 endif
194
195 @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/netfilter-layer7-*
196 @$(POSTBUILD)