Updated kernel to 2.6.25.17
[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 = .17
28 VER        = 2.6.25.17
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 # Normal build or SMP build.
38 #
39 ifeq "$(SMP)" "1"
40         TARGET = $(DIR_INFO)/linux-$(VER)-smp
41 else
42         TARGET = $(DIR_INFO)/linux-$(VER)
43 endif
44
45
46 ###############################################################################
47 # Top-level Rules
48 ###############################################################################
49 objects =$(DL_FILE) \
50         mISDN-1_1_8.tar.gz \
51         squashfs3.4.tar.gz \
52         netfilter-layer7-v2.20.tar.gz \
53         patch-2.6.16-nath323-1.3.bz2 \
54         reiser4-for-2.6.25.patch.bz2
55         
56 $(DL_FILE)                              = $(URL_IPFIRE)/$(DL_FILE)
57 netfilter-layer7-v2.20.tar.gz           = $(URL_IPFIRE)/netfilter-layer7-v2.20.tar.gz
58 patch-2.6.16-nath323-1.3.bz2            = $(URL_IPFIRE)/patch-2.6.16-nath323-1.3.bz2
59 squashfs3.4.tar.gz                      = $(URL_IPFIRE)/squashfs3.4.tar.gz
60 mISDN-1_1_8.tar.gz                      = $(URL_IPFIRE)/mISDN-1_1_8.tar.gz
61 reiser4-for-2.6.25.patch.bz2            = $(URL_IPFIRE)/reiser4-for-2.6.25.patch.bz2
62
63 $(DL_FILE)_MD5                          = 30618bff93fd4fd048e20a9a6aab8e5d
64 netfilter-layer7-v2.20.tar.gz_MD5       = 525a821c973b730c8feaf9eedb57d1e4
65 patch-2.6.16-nath323-1.3.bz2_MD5        = f926409ff703a307baf54b57ab75d138
66 squashfs3.4.tar.gz_MD5                  = 2a4d2995ad5aa6840c95a95ffa6b1da6
67 mISDN-1_1_8.tar.gz_MD5                  = 29c55ffe0b35668a41eaed3b1c3ddfe2
68 reiser4-for-2.6.25.patch.bz2_MD5        = 4294bbcb39e5ee859b94b09ff4fb1e0c
69
70 install : $(TARGET)
71
72 check : $(patsubst %,$(DIR_CHK)/%,$(objects))
73
74 download :$(patsubst %,$(DIR_DL)/%,$(objects))
75
76 md5 : $(subst %,%_MD5,$(objects))
77
78 ###############################################################################
79 # Downloading, checking, md5sum
80 ###############################################################################
81
82 $(patsubst %,$(DIR_CHK)/%,$(objects)) :
83         @$(CHECK)
84
85 $(patsubst %,$(DIR_DL)/%,$(objects)) :
86         @$(LOAD)
87
88 $(subst %,%_MD5,$(objects)) :
89         @$(MD5)
90
91 ###############################################################################
92 # Installation Details
93 ###############################################################################
94
95 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
96         @$(PREBUILD)
97         @rm -rf $(DIR_APP) $(DIR_SRC)/linux $(DIR_SRC)/xen-* && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
98         ln -s linux-$(VER) /usr/src/linux
99
100         # Add devolo MicroLink ADSL Fun USB ID's to ueagle-atm
101 #       cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.23-ueagle-atm-devolo_usb_id.patch
102
103         # Fix crash on Twinhead H12Y notebooks
104         cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-h12y-mmio-quirks.patch
105
106         # Openswan
107         cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/openswan-2.4.x.kernel-2.6.23-natt.patch
108
109         # Reiser4
110         cd $(DIR_APP) && bzip2 -d -c $(DIR_DL)/reiser4-for-2.6.25.patch.bz2 | patch -Np1
111         
112         # SquashFS
113         cd $(DIR_SRC) && rm -rf squashfs*
114         cd $(DIR_SRC) && tar xfz $(DIR_DL)/squashfs3.4.tar.gz
115         cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/squashfs3.4/kernel-patches/linux-2.6.26/squashfs3.4-patch
116
117         # ip_conntrack permissions from 440 to 444
118 #       cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/ip_conntrack_standalone-patch-for-ipfire.patch
119         
120         # Layer7-patch
121         cd $(DIR_SRC) && rm -rf $(DIR_SRC)/netfilter-layer7-v2.20
122         cd $(DIR_SRC) && tar xzf $(DIR_DL)/netfilter-layer7-v2.20.tar.gz
123         cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/netfilter-layer7-v2.20/kernel-2.6.25-layer7-2.20.patch
124
125         # Linux Intermediate Queueing Device
126 ifeq "$(XEN)" ""
127         cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-2.6.25-imq5.diff
128 endif
129
130         # mISDN
131         cd $(DIR_SRC) && rm -rf mISDN-*
132         cd $(DIR_SRC) && tar xfz $(DIR_DL)/mISDN-1_1_8.tar.gz
133         cd $(DIR_SRC)/mISDN-1_1_8 && yes 'yes' | ./std2kern -k /usr/src/linux
134         
135         cd $(DIR_APP)/drivers/isdn/hardware/mISDN && patch -Np0 < $(DIR_SRC)/src/patches/mISDN-avmfritz.patch
136
137         # Cleanup kernel source
138         cd $(DIR_APP) && make mrproper
139
140 ifeq "$(SMP)" "1"
141         cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE).smp $(DIR_APP)/.config
142 else
143         cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE) $(DIR_APP)/.config
144 endif
145
146         cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
147         cd $(DIR_APP) && make CC="$(KGCC)" clean
148
149 ifeq "$(SMP)" "1"
150         cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-ipfire-smp/' Makefile
151         cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
152         cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-ipfire-smp
153         cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-ipfire-smp
154         ln -sf vmlinuz-$(VER)-ipfire-smp /boot/vmlinuz-ipfire-smp
155         cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
156         cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
157 else
158         cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(PATCHLEVEL)-ipfire/' Makefile
159         cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage
160         cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-ipfire
161         cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-ipfire
162         cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-ipfire
163         ln -sf vmlinuz-$(VER)-ipfire /boot/vmlinuz-ipfire
164         ln -sf System.map-$(VER)-ipfire /boot/System.map-ipfire
165         cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules
166         cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
167 endif
168
169 ifeq "$(SMP)" ""
170         # Only do this once on the non-SMP pass 
171         cd $(DIR_APP) && install -m 755 usr/gen_init_cpio /sbin/
172 endif 
173
174         @rm -rf $(DIR_SRC)/patch-o-matic* $(DIR_SRC)/iptables* $(DIR_SRC)/squashfs* $(DIR_SRC)/mISDN-* $(DIR_SRC)/netfilter-layer7-*
175         @$(POSTBUILD)