1 ###############################################################################
3 # IPFire.org - A linux based firewall #
4 # Copyright (C) 2007, 2008, 2009 Michael Tremer & Christian Schmidt #
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. #
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. #
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/>. #
19 ###############################################################################
21 ###############################################################################
23 ###############################################################################
31 PKG_MAINTAINER = Michael Tremer <michael.tremer@ipfire.org>
32 PKG_GROUP = System/Kernels
33 PKG_URL = http://www.kernel.org/
35 PKG_SUMMARY = The Linux kernel.
37 define 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.
50 LOCALVERSION = -ipfire1
51 FULLVER= $(PKG_VER)$(LOCALVERSION)
54 AUFS_PATCH = aufs2-$(PKG_VER)-1.patch
55 PKG_PATCHES += $(AUFS_PATCH)
58 GRSEC_PATCH = grsecurity-2.1.14-$(PKG_VER)-200910012153.patch
59 PKG_PATCHES += $(GRSEC_PATCH)
62 #OCF_PATCH = ocf-linux-26-20080917.patch
63 PKG_PATCHES += $(OCF_PATCH)
66 REISER4_PATCH = reiser4-for-$(PKG_VER).patch
67 PKG_PATCHES += $(REISER4_PATCH)
69 # Routing improvements taken from http://www.ssi.bg/~ja/#routes
70 ROUTES_PATCH = routes-$(PKG_VER)-16.diff
71 PKG_PATCHES += $(ROUTES_PATCH)
73 PKG_OBJECTS += $(THISAPP).tar.bz2
75 PKG_PATCHES += $(THISAPP)-disable-compat_vdso-1.patch
79 ###############################################################################
80 # Installation Details
81 ###############################################################################
83 $(STAGE_PREPARE): $(OBJECTS)
85 rm -rf $(DIR_APP) && cd $(DIR_SRC) && $(DO_EXTRACT) $(DIR_DL)/$(firstword $(PKG_OBJECTS))
87 cd $(DIR_APP) && echo "$(LOCALVERSION)" > localversion-ipfire
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
97 #cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-disable-compat_vdso-1.patch
99 cd $(DIR_APP) && sed -e "s/^HOSTCFLAGS.*=.*/& -fPIC/g" -i Makefile
104 $(STAGE_BUILD): $(STAGE_PREPARE)
107 cd $(DIR_APP) && make mrproper
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; \
127 cp -f $(DIR_SOURCE)/kernel/kernel.config $(DIR_APP)/.config; \
130 cd $(DIR_APP) && yes "" | make oldconfig
132 cd $(DIR_APP) && cp -vf $(DIR_SOURCE)/kernel/$(SNAME)_logo.ppm \
133 drivers/video/logo/logo_linux_clut224.ppm
135 cd $(DIR_APP) && make CC="gcc -nopie" $(PARALLELISMFLAGS)
140 $(STAGE_INSTALL): $(STAGE_BUILD)
143 cd $(DIR_APP) && make modules_install
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)
148 ln -svf $(SNAME)kernel-$(FULLVER) /boot/$(SNAME)kernel
149 ln -svf System.map-$(FULLVER) /boot/System.map
151 # keep the source code in $(DIR_SRC)/$(PKG_NAME)-$(FULLVER)
152 cp -fal $(DIR_APP) $(DIR_SRC)/$(PKG_NAME)-$(FULLVER)
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