]> git.ipfire.org Git - ipfire-3.x.git/blob - lfs/linux
s/TARGET/OBJECT/g
[ipfire-3.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 PKG_NAME = linux
28 VER = 2.6.27
29
30 THISAPP = $(PKG_NAME)-$(VER)
31 DL_FILE = $(THISAPP).tar.bz2
32 DIR_APP = $(DIR_SRC)/$(THISAPP)
33 CFLAGS =
34 CXXFLAGS =
35
36 OBJECT = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)
37
38 LOCALVERSION = -ipfire1
39 FULLVER = $(VER)$(LOCALVERSION)
40
41 # Patches
42 FRANDOM_PATCH = linux-2.6.25-frandom-1.patch
43 GRSEC_PATCH = grsecurity-2.1.12-$(VER)-200808171148.patch
44 OCF_PATCH = ocf-linux-26-20080917.patch
45 REISER4_PATCH = reiser4-for-$(VER).patch
46 SQUASHFS_PATCH = $(THISAPP)-squashfs3.4-1.patch
47
48 ###############################################################################
49 # Top-level Rules
50 ###############################################################################
51
52 objects = $(DL_FILE) \
53 $(OCF_PATCH) \
54 $(REISER4_PATCH) \
55 $(SQUASHFS_PATCH)
56
57 ifeq "$(PAX)" "1"
58 #objects += $(GRSEC_PATCH)
59 endif
60
61 ifeq "$(SSP)" "1"
62 #objects += $(FRANDOM_PATCH)
63 endif
64
65 install : $(OBJECT)
66
67 download : $(objects)
68
69 $(objects) :
70 @$(LOAD)
71
72 ###############################################################################
73 # Installation Details
74 ###############################################################################
75
76 $(OBJECT) :
77 @$(PREBUILD)
78 @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
79
80 cd $(DIR_APP) && echo "$(LOCALVERSION)" > localversion-ipfire
81
82 ifeq "$(SSP)" "1"
83 ### frandom
84 #
85 #cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(FRANDOM_PATCH)
86 endif
87
88 ### OCF
89 #
90 cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(OCF_PATCH)
91 cd $(DIR_APP) && echo "source \"crypto/ocf/Kconfig\"" >> crypto/Kconfig
92
93 ### Reiser4
94 #
95 cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(REISER4_PATCH)
96
97 ### Squashfs
98 #
99 cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(SQUASHFS_PATCH)
100
101 ifeq "$(PAX)" "1"
102 ### GrSecurity
103 #
104 #cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(GRSEC_PATCH)
105 #rm -f $(DIR_APP)/localversion-grsec
106 endif
107
108 ifeq "$(STAGE)" "toolchain"
109 install -dv $(TOOLS_DIR)/include
110 cd $(DIR_APP) && make mrproper
111 cd $(DIR_APP) && make ARCH=x86 headers_check
112 cd $(DIR_APP) && make ARCH=x86 INSTALL_HDR_PATH=dest headers_install
113 cd $(DIR_APP) && cp -rv dest/include/* $(TOOLS_DIR)/include
114 endif
115
116 ifeq "$(STAGE)" "base"
117 cd $(DIR_APP) && make mrproper
118 cd $(DIR_APP) && make ARCH=x86 headers_check
119 cd $(DIR_APP) && make ARCH=x86 INSTALL_HDR_PATH=dest headers_install
120 cd $(DIR_APP) && cp -rv dest/include/* /usr/include
121 endif
122
123 ifeq "$(STAGE)" "ipfire"
124 cd $(DIR_APP) && make mrproper
125
126 if [ "$(IFS_ARCH)" == "i586" ]; then \
127 sed -e "s/^CONFIG_M686=y/# CONFIG_686 is not set/" \
128 -e "s/^# CONFIG_MPENTIUMIII is not set/CONFIG_MPENTIUMII=y/" \
129 < $(DIR_CONF)/kernel/kernel.config > $(DIR_APP)/.config; \
130 elif [ "$(IFS_ARCH)" == "i486" ]; then \
131 sed -e "s/^CONFIG_M686=y/# CONFIG_686 is not set/" \
132 -e "s/^# CONFIG_M486 is not set/CONFIG_M486=y/" \
133 < $(DIR_CONF)/kernel/kernel.config > $(DIR_APP)/.config; \
134 elif [ "$(IFS_ARCH)" == "via-c7" ]; then \
135 sed -e "s/^CONFIG_M686=y/# CONFIG_686 is not set/" \
136 -e "s/^# CONFIG_MVIAC7 is not set/CONFIG_MVIAC7=y/" \
137 < $(DIR_CONF)/kernel/kernel.config > $(DIR_APP)/.config; \
138 elif [ "$(IFS_ARCH)" == "via-c3" ]; then \
139 sed -e "s/^CONFIG_M686=y/# CONFIG_686 is not set/" \
140 -e "s/^# CONFIG_MVIAC3_2 is not set/CONFIG_MVIAC3_2=y/" \
141 < $(DIR_CONF)/kernel/kernel.config > $(DIR_APP)/.config; \
142 else \
143 cp -f $(DIR_CONF)/kernel/kernel.config $(DIR_APP)/.config; \
144 fi
145
146 # Fixed CFLAGS when using distcc
147 cd $(DIR_APP) && sed -e "s/-D__KERNEL__/& -fno-PIE/" -i Makefile
148
149 cd $(DIR_APP) && yes "" | make oldconfig
150
151 cd $(DIR_APP) && make $(PARALLELISMFLAGS)
152 cd $(DIR_APP) && make modules_install
153
154 cd $(DIR_APP) && cp -v arch/x86/boot/bzImage /boot/$(SNAME)kernel-$(FULLVER)
155 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(FULLVER)
156
157 ln -svf $(SNAME)kernel-$(FULLVER) /boot/$(SNAME)kernel
158 ln -svf System.map-$(FULLVER) /boot/System.map
159
160 # keep the source code in $(DIR_SRC)/$(PKG_NAME)-$(FULLVER)
161 cp -fal $(DIR_APP) $(DIR_SRC)/$(PKG_NAME)-$(FULLVER)
162
163 rm -vf /lib/modules/$(KVER)/{build,source}
164 ln -svf $(DIR_SRC)/$(PKG_NAME)-$(FULLVER) /lib/modules/$(KVER)/build
165 ln -svf $(DIR_SRC)/$(PKG_NAME)-$(FULLVER) /lib/modules/$(KVER)/source
166 -mkdir -pv /lib/modules/$(KVER)/extra
167 endif
168
169 @rm -rf $(DIR_APP)
170 @$(POSTBUILD)