]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blame - pkgs/core/kernel/kernel.nm
naoki: Initial checkin.
[people/ms/ipfire-3.x.git] / pkgs / core / kernel / kernel.nm
CommitLineData
166a6c21
MT
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
25include ../../Config
26
27PKG_NAME = linux
28PKG_VER = 2.6.31.1
29PKG_REL = 0
30
31PKG_MAINTAINER = Michael Tremer <michael.tremer@ipfire.org>
32PKG_GROUP = System/Kernels
33PKG_URL = http://www.kernel.org/
34PKG_LICENSE = GPLv2
35PKG_SUMMARY = The Linux kernel.
36
37define PKG_DESCRIPTION
38 The kernel package contains the Linux kernel (vmlinuz), the core of any \
39 Linux operating system. The kernel handles the basic functions \
40 of the operating system: memory allocation, process allocation, device \
41 input and output, etc.
42endef
43
44PKG_BUILD_DEPS+=
45PKG_DEPS +=
46
47CFLAGS =
48CXXFLAGS =
49
50LOCALVERSION = -ipfire1
51FULLVER= $(PKG_VER)$(LOCALVERSION)
52
53# Another Union FS
54AUFS_PATCH = aufs2-$(PKG_VER)-1.patch
55PKG_PATCHES += $(AUFS_PATCH)
56
57# Grsecurity
58GRSEC_PATCH = grsecurity-2.1.14-$(PKG_VER)-200910012153.patch
59PKG_PATCHES += $(GRSEC_PATCH)
60
61# OCF
62#OCF_PATCH = ocf-linux-26-20080917.patch
63PKG_PATCHES += $(OCF_PATCH)
64
65# Reiser4 Filesystem
66REISER4_PATCH = reiser4-for-$(PKG_VER).patch
67PKG_PATCHES += $(REISER4_PATCH)
68
69# Routing improvements taken from http://www.ssi.bg/~ja/#routes
70ROUTES_PATCH = routes-$(PKG_VER)-16.diff
71PKG_PATCHES += $(ROUTES_PATCH)
72
73PKG_OBJECTS += $(THISAPP).tar.bz2
74
75PKG_PATCHES += $(THISAPP)-disable-compat_vdso-1.patch
76
77include ../../Rules
78
79###############################################################################
80# Installation Details
81###############################################################################
82
83$(STAGE_PREPARE): $(OBJECTS)
84 @$(PRE_PREPARE)
85 rm -rf $(DIR_APP) && cd $(DIR_SRC) && $(DO_EXTRACT) $(DIR_DL)/$(firstword $(PKG_OBJECTS))
86
87 cd $(DIR_APP) && echo "$(LOCALVERSION)" > localversion-ipfire
88
89 cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(AUFS_PATCH)
90 #cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(OCF_PATCH)
91 #cd $(DIR_APP) && echo "source \"crypto/ocf/Kconfig\"" >> crypto/Kconfig
92 cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(REISER4_PATCH)
93 cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(ROUTES_PATCH)
94 cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(GRSEC_PATCH)
95 rm -f $(DIR_APP)/localversion-grsec
96
97 #cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-disable-compat_vdso-1.patch
98
99 cd $(DIR_APP) && sed -e "s/^HOSTCFLAGS.*=.*/& -fPIC/g" -i Makefile
100
101 @$(POST_PREPARE)
102
103
104$(STAGE_BUILD): $(STAGE_PREPARE)
105 @$(PRE_BUILD)
106
107 cd $(DIR_APP) && make mrproper
108
109 # Select right optimization for the linux kernel.
110 if [ "$(TARGET)" == "i486" ]; then \
111 sed -e "s/^CONFIG_M686=y/# CONFIG_686 is not set/" \
112 -e "s/^# CONFIG_M486 is not set/CONFIG_M486=y/" \
113 < $(DIR_SOURCE)/kernel/kernel.config > $(DIR_APP)/.config; \
114 elif [ "$(TARGET)" == "i586" ]; then \
115 sed -e "s/^CONFIG_M686=y/# CONFIG_686 is not set/" \
116 -e "s/^# CONFIG_M586TSC is not set/CONFIG_M586TSC=y/" \
117 < $(DIR_SOURCE)/kernel/kernel.config > $(DIR_APP)/.config; \
118 elif [ "$(TARGET)" == "via-c7" ]; then \
119 sed -e "s/^CONFIG_M686=y/# CONFIG_686 is not set/" \
120 -e "s/^# CONFIG_MVIAC7 is not set/CONFIG_MVIAC7=y/" \
121 < $(DIR_SOURCE)/kernel/kernel.config > $(DIR_APP)/.config; \
122 elif [ "$(TARGET)" == "via-c3" ]; then \
123 sed -e "s/^CONFIG_M686=y/# CONFIG_686 is not set/" \
124 -e "s/^# CONFIG_MVIAC3_2 is not set/CONFIG_MVIAC3_2=y/" \
125 < $(DIR_SOURCE)/kernel/kernel.config > $(DIR_APP)/.config; \
126 else \
127 cp -f $(DIR_SOURCE)/kernel/kernel.config $(DIR_APP)/.config; \
128 fi
129
130 cd $(DIR_APP) && yes "" | make oldconfig
131
132 cd $(DIR_APP) && cp -vf $(DIR_SOURCE)/kernel/$(SNAME)_logo.ppm \
133 drivers/video/logo/logo_linux_clut224.ppm
134
135 cd $(DIR_APP) && make CC="gcc -nopie" $(PARALLELISMFLAGS)
136
137 @$(POST_BUILD)
138
139
140$(STAGE_INSTALL): $(STAGE_BUILD)
141 @$(PRE_INSTALL)
142
143 cd $(DIR_APP) && make modules_install
144
145 cd $(DIR_APP) && cp -v arch/x86/boot/bzImage /boot/$(SNAME)kernel-$(FULLVER)
146 cd $(DIR_APP) && cp -v System.map /boot/System.map-$(FULLVER)
147
148 ln -svf $(SNAME)kernel-$(FULLVER) /boot/$(SNAME)kernel
149 ln -svf System.map-$(FULLVER) /boot/System.map
150
151 # keep the source code in $(DIR_SRC)/$(PKG_NAME)-$(FULLVER)
152 cp -fal $(DIR_APP) $(DIR_SRC)/$(PKG_NAME)-$(FULLVER)
153
154 rm -vf /lib/modules/$(KVER)/{build,source}
155 ln -svf $(DIR_SRC)/$(PKG_NAME)-$(FULLVER) /lib/modules/$(KVER)/build
156 ln -svf $(DIR_SRC)/$(PKG_NAME)-$(FULLVER) /lib/modules/$(KVER)/source
157 -mkdir -pv /lib/modules/$(KVER)/extra
158
159 @$(POST_INSTALL)