]> git.ipfire.org Git - ipfire-3.x.git/blob - lfs/linux
42a923bed71f147ead7909668dc30fd0a41051d7
[ipfire-3.x.git] / lfs / linux
1 ###############################################################################
2 # #
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007, 2008, 2009 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 PKG_VER = 2.6.27.10
29 PKG_REL = 0
30
31 THISAPP = $(PKG_NAME)-$(PKG_VER)
32 DL_FILE = $(THISAPP).tar.bz2
33 DIR_APP = $(DIR_SRC)/$(THISAPP)
34
35 OBJECT = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)
36
37 MAINTAINER =
38 GROUP = System/Base
39 EXTRA = no
40 DEBUG = no
41 DEPS =
42
43 URL = http://www.kernel.org/
44 LICENSE = GPLv2
45 SHORT_DESC = The Linux kernel.
46
47 define LONG_DESC
48 The kernel package contains the Linux kernel (vmlinuz), the core of any \
49 Linux operating system. The kernel handles the basic functions \
50 of the operating system: memory allocation, process allocation, device \
51 input and output, etc.
52 endef
53
54 CFLAGS =
55 CXXFLAGS =
56
57 LOCALVERSION = -ipfire1
58 FULLPKG_VER= $(PKG_VER)$(LOCALVERSION)
59
60 # Patches
61 GRSEC_PATCH = grsecurity-2.1.12-$(PKG_VER)-200812271347.patch
62 OCF_PATCH = ocf-linux-26-20080917.patch
63 REISER4_PATCH = reiser4-for-$(PKG_VER).patch
64 SQUASHFS_PATCH = $(THISAPP)-squashfs3.4-1.patch
65 H12Y_PATCH = linux-h12y-mmio-quirks.patch
66
67 ###############################################################################
68 # Top-level Rules
69 ###############################################################################
70
71 objects = $(DL_FILE) \
72 $(OCF_PATCH) \
73 $(REISER4_PATCH) \
74 $(SQUASHFS_PATCH) \
75 $(GRSEC_PATCH) \
76 $(H12Y_PATCH)
77
78 download: $(objects)
79
80 info:
81 $(DO_PKG_INFO)
82
83 install: $(OBJECT)
84
85 package:
86 @$(DO_PACKAGE)
87
88 $(objects):
89 @$(LOAD)
90
91 ###############################################################################
92 # Installation Details
93 ###############################################################################
94
95 $(OBJECT): $(objects)
96 @$(PREBUILD)
97 @rm -rf $(DIR_APP) && cd $(DIR_SRC) && $(EXTRACTOR) $(DIR_DL)/$(DL_FILE)
98
99 cd $(DIR_APP) && echo "$(LOCALVERSION)" > localversion-ipfire
100
101 ### OCF
102 #
103 cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(OCF_PATCH)
104 cd $(DIR_APP) && echo "source \"crypto/ocf/Kconfig\"" >> crypto/Kconfig
105
106 ### Reiser4
107 #
108 cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(REISER4_PATCH)
109
110 ### Squashfs
111 #
112 cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(SQUASHFS_PATCH)
113
114 ### GrSecurity
115 #
116 cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(GRSEC_PATCH)
117 rm -f $(DIR_APP)/localversion-grsec
118
119 ### H12Y mmio patch for H12Y Laptops
120 #
121 cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(H12Y_PATCH)
122
123 ifeq "$(STAGE)" "toolchain"
124 install -dv $(TOOLS_DIR)/include
125 cd $(DIR_APP) && make mrproper
126 cd $(DIR_APP) && make ARCH=x86 headers_check
127 cd $(DIR_APP) && make ARCH=x86 INSTALL_HDR_PATH=dest headers_install
128 cd $(DIR_APP) && cp -rv dest/include/* $(TOOLS_DIR)/include
129 endif
130
131 ifeq "$(STAGE)" "base"
132 cd $(DIR_APP) && make mrproper
133 cd $(DIR_APP) && make ARCH=x86 headers_check
134 cd $(DIR_APP) && make ARCH=x86 INSTALL_HDR_PATH=dest headers_install
135 cd $(DIR_APP) && cp -rv dest/include/* /usr/include
136 endif
137
138 ifeq "$(STAGE)" "ipfire"
139 cd $(DIR_APP) && make mrproper
140
141 # Select right optimization for the linux kernel.
142 if [ "$(TARGET)" == "i486" ]; then \
143 sed -e "s/^CONFIG_M686=y/# CONFIG_686 is not set/" \
144 -e "s/^# CONFIG_M486 is not set/CONFIG_M486=y/" \
145 < $(DIR_CONF)/kernel/kernel.config > $(DIR_APP)/.config; \
146 elif [ "$(TARGET)" == "i586" ]; then \
147 sed -e "s/^CONFIG_M686=y/# CONFIG_686 is not set/" \
148 -e "s/^# CONFIG_M586TSC is not set/CONFIG_M586TSC=y/" \
149 < $(DIR_CONF)/kernel/kernel.config > $(DIR_APP)/.config; \
150 elif [ "$(TARGET)" == "via-c7" ]; then \
151 sed -e "s/^CONFIG_M686=y/# CONFIG_686 is not set/" \
152 -e "s/^# CONFIG_MVIAC7 is not set/CONFIG_MVIAC7=y/" \
153 < $(DIR_CONF)/kernel/kernel.config > $(DIR_APP)/.config; \
154 elif [ "$(TARGET)" == "via-c3" ]; then \
155 sed -e "s/^CONFIG_M686=y/# CONFIG_686 is not set/" \
156 -e "s/^# CONFIG_MVIAC3_2 is not set/CONFIG_MVIAC3_2=y/" \
157 < $(DIR_CONF)/kernel/kernel.config > $(DIR_APP)/.config; \
158 else \
159 cp -f $(DIR_CONF)/kernel/kernel.config $(DIR_APP)/.config; \
160 fi
161
162 # Fixed CFLAGS when using distcc
163 cd $(DIR_APP) && sed -e "s/-D__KERNEL__/& -fno-PIE/" -i Makefile
164
165 cd $(DIR_APP) && yes "" | make oldconfig
166
167 cd $(DIR_APP) && CC="gcc -U_FORTIFY_SOURCE" make $(PARALLELISMFLAGS)
168 cd $(DIR_APP) && make modules_install
169
170 cd $(DIR_APP) && cp -v arch/x86/boot/bzImage /boot/$(SNAME)kernel-$(FULLVER)
171 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(FULLVER)
172
173 ln -svf $(SNAME)kernel-$(FULLVER) /boot/$(SNAME)kernel
174 ln -svf System.map-$(FULLVER) /boot/System.map
175
176 # keep the source code in $(DIR_SRC)/$(PKG_NAME)-$(FULLVER)
177 cp -fal $(DIR_APP) $(DIR_SRC)/$(PKG_NAME)-$(FULLVER)
178
179 rm -vf /lib/modules/$(KVER)/{build,source}
180 ln -svf $(DIR_SRC)/$(PKG_NAME)-$(FULLVER) /lib/modules/$(KVER)/build
181 ln -svf $(DIR_SRC)/$(PKG_NAME)-$(FULLVER) /lib/modules/$(KVER)/source
182 -mkdir -pv /lib/modules/$(KVER)/extra
183 endif
184
185 @rm -rf $(DIR_APP)
186 @$(POSTBUILD)