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