]>
Commit | Line | Data |
---|---|---|
166a6c21 | 1 | ############################################################################### |
802ea3af MT |
2 | # IPFire.org - An Open Source Firewall Solution # |
3 | # Copyright (C) - IPFire Development Team <info@ipfire.org> # | |
166a6c21 MT |
4 | ############################################################################### |
5 | ||
15a11c5b MT |
6 | name = kernel |
7 | version = 3.0.4 | |
ebeed08a | 8 | release = 6 |
15a11c5b | 9 | thisapp = linux-%{version} |
166a6c21 | 10 | |
802ea3af MT |
11 | maintainer = Michael Tremer <michael.tremer@ipfire.org> |
12 | groups = System/Kernels | |
13 | url = http://www.kernel.org/ | |
14 | license = GPLv2 | |
15 | summary = The Linux kernel. | |
166a6c21 | 16 | |
802ea3af | 17 | description |
166a6c21 MT |
18 | The kernel package contains the Linux kernel (vmlinuz), the core of any \ |
19 | Linux operating system. The kernel handles the basic functions \ | |
20 | of the operating system: memory allocation, process allocation, device \ | |
21 | input and output, etc. | |
802ea3af | 22 | end |
166a6c21 | 23 | |
802ea3af | 24 | # Version helper variables. |
bcf38aec MT |
25 | localversion = %{release}.%{DISTRO_DISTTAG}.%{DISTRO_ARCH} |
26 | fullver = %{version}-%{localversion} | |
802ea3af | 27 | |
15a11c5b | 28 | sources = %{thisapp}.tar.gz |
802ea3af MT |
29 | |
30 | build | |
ebeed08a MT |
31 | # icecream cannot be used to compile the kernel. |
32 | # Because the PaX patch does use GCC plugins to harden the kernel which | |
33 | # are not available on the remote compilers, we need to disable it here. | |
34 | export ICECC=no | |
35 | ||
802ea3af | 36 | requires |
bcf38aec MT |
37 | binutils-devel |
38 | elfutils-devel | |
802ea3af MT |
39 | module-init-tools |
40 | ncurses-devel | |
ebeed08a | 41 | net-tools |
bcf38aec | 42 | newt-devel |
802ea3af | 43 | perl |
bcf38aec | 44 | python-devel |
ebeed08a | 45 | slang-devel |
bcf38aec MT |
46 | xz-lzma-compat |
47 | end | |
48 | ||
49 | # A list of kernels to build. | |
50 | kernels = default | |
51 | ||
52 | if "%{DISTRO_ARCH}" == "i686" | |
53 | # Build a PAE-enabled kernel for the i686 architecture. | |
54 | kernels += PAE | |
55 | ||
56 | kernel_arch = x86 | |
57 | kernel_image = arch/%{kernel_arch}/boot/bzImage | |
58 | kernel_target = bzImage | |
802ea3af MT |
59 | end |
60 | ||
61 | prepare_cmds | |
802ea3af MT |
62 | rm -f %{DIR_APP}/localversion-grsec |
63 | ||
64 | sed -e "s/^HOSTCFLAGS.*=.*/& -fPIC/g" -i Makefile | |
65 | ||
66 | cp -vf %{DIR_SOURCE}/%{DISTRO_SNAME}_logo.ppm \ | |
67 | drivers/video/logo/logo_linux_clut224.ppm | |
68 | ||
bcf38aec MT |
69 | # Get rid of unwanted files resulting from patch fuzz. |
70 | find . \( -name "*.orig" -o -name "*~" \) -exec rm -f {} \; >/dev/null | |
71 | ||
72 | # Remove unnecessary SCM files. | |
73 | find . -name .gitignore -exec rm -f {} \; >/dev/null | |
74 | ||
ebeed08a MT |
75 | # This prevents scripts/setlocalversion from mucking with our version numbers. |
76 | touch .scmversion | |
77 | ||
bcf38aec MT |
78 | mkdir -pv configs |
79 | configure_kernel() { | |
80 | local flavour=${1} | |
81 | local suffix | |
82 | if [ "${flavour}" != "default" ]; then | |
83 | suffix="-${flavour}" | |
84 | fi | |
85 | ||
86 | # This is the place, where the configuration files | |
87 | # should be dynamically generated. | |
88 | # For now, we just copy pregenerated ones. | |
89 | cp %{DIR_SOURCE}/config.%{arch}${suffix} .config | |
802ea3af | 90 | |
bcf38aec MT |
91 | make ARCH=%{kernel_arch} oldnoconfig |
92 | mv .config configs/config.${flavour} | |
93 | } | |
94 | ||
95 | # Generate configuration files for all kernels we are going to | |
96 | # build. | |
97 | for kernel in %{kernels}; do | |
98 | configure_kernel ${kernel} | |
99 | done | |
802ea3af MT |
100 | end |
101 | ||
102 | build | |
bcf38aec MT |
103 | build_kernel() { |
104 | local flavour=${1} | |
105 | local suffix | |
106 | local localversion="%{localversion}" | |
107 | local fullversion="%{fullver}" | |
108 | if [ "${flavour}" != "default" ]; then | |
109 | suffix="-${flavour}" | |
110 | localversion="${localversion}.${flavour}" | |
111 | fullversion="${fullversion}.${flavour}" | |
112 | fi | |
802ea3af | 113 | |
ebeed08a MT |
114 | # Label the build. |
115 | sed -i Makefile \ | |
116 | -e "s/^EXTRAVERSION.*/EXTRAVERSION = -${localversion}/" | |
117 | ||
bcf38aec MT |
118 | # Clean up the source tree. |
119 | make mrproper | |
802ea3af | 120 | |
bcf38aec MT |
121 | # Install configuration file. |
122 | cp configs/config.${flavour} .config | |
802ea3af | 123 | |
bcf38aec | 124 | # Run the build. |
ebeed08a | 125 | make ARCH=%{kernel_arch} oldnoconfig >/dev/null |
bcf38aec MT |
126 | make ARCH=%{kernel_arch} CC="gcc -fno-PIE" %{kernel_target} modules %{PARALLELISMFLAGS} |
127 | ||
128 | # Install the results. | |
129 | mkdir -pv %{BUILDROOT}/boot %{BUILDROOT}/lib/modules/${fullversion} | |
130 | install -m 755 %{kernel_image} %{BUILDROOT}/boot/vmlinuz-${fullversion} | |
131 | install -m 644 .config %{BUILDROOT}/boot/config-${fullversion} | |
132 | install -m 644 System.map %{BUILDROOT}/boot/System.map-${fullversion} | |
133 | ||
134 | # Create empty initramfs (20M). | |
135 | dd if=/dev/zero of=%{BUILDROOT}/boot/initramfs-${fullversion}.img bs=1M count=20 | |
136 | ||
137 | # Install modules. | |
138 | make ARCH=%{kernel_arch} INSTALL_MOD_PATH=%{BUILDROOT} mod-fw= \ | |
139 | KERNELRELEASE=${fullversion} modules_install | |
140 | #make ARCH=%{kernel_arch} INSTALL_MOD_PATH=%{BUILDROOT} \ | |
141 | # KERNELRELEASE=${fullversion} vdso_install | |
802ea3af | 142 | |
bcf38aec MT |
143 | # Create an empty settings file for dracut |
144 | mkdir -pv %{BUILDROOT}/etc/ld.so.conf.d | |
145 | echo "# Placeholder file, no vDSO hwcap entries used in this kernel." \ | |
146 | > %{BUILDROOT}/etc/ld.so.conf.d/kernel-${fullversion}.conf | |
802ea3af | 147 | |
bcf38aec MT |
148 | # And now the scary looking part. |
149 | # | |
150 | # Recreate source and build links. | |
151 | rm -vf %{BUILDROOT}/lib/modules/${fullversion}/{build,source} | |
152 | mkdir -pv %{BUILDROOT}/lib/modules/${fullversion}/build | |
153 | ln -svf build %{BUILDROOT}/lib/modules/${fullversion}/source | |
802ea3af | 154 | |
bcf38aec MT |
155 | # Create dirs for extra modules. |
156 | mkdir -pv %{BUILDROOT}/lib/modules/${fullversion}/extra | |
802ea3af | 157 | |
bcf38aec MT |
158 | cp -v --parents $(find -type f -name "Makefile*" -o -name "Kconfig*") \ |
159 | %{BUILDROOT}/lib/modules/${fullversion}/build | |
160 | cp -v Module.symvers System.map \ | |
161 | %{BUILDROOT}/lib/modules/${fullversion}/build | |
162 | rm -vrf %{BUILDROOT}/lib/modules/${fullversion}/build/{Documentation,scripts,include} | |
163 | ||
164 | cp -v .config %{BUILDROOT}/lib/modules/${fullversion}/build | |
165 | cp -va scripts %{BUILDROOT}/lib/modules/${fullversion}/build | |
166 | find %{BUILDROOT}/lib/modules/${fullversion}/build/scripts -name "*.o" \ | |
167 | -exec rm -vf {} \; | |
168 | ||
169 | cp -va --parents arch/%{kernel_arch}/include \ | |
170 | %{BUILDROOT}/lib/modules/${fullversion}/build | |
171 | cp -va include %{BUILDROOT}/lib/modules/${fullversion}/build/include | |
172 | ||
173 | # Make sure we can build external modules. | |
174 | touch -r %{BUILDROOT}/lib/modules/${fullversion}/build/Makefile \ | |
175 | %{BUILDROOT}/lib/modules/${fullversion}/build/include/linux/version.h | |
176 | touch -r %{BUILDROOT}/lib/modules/${fullversion}/build/.config \ | |
177 | %{BUILDROOT}/lib/modules/${fullversion}/build/autoconf.h | |
178 | cp -v %{BUILDROOT}/lib/modules/${fullversion}/build/.config \ | |
179 | %{BUILDROOT}/lib/modules/${fullversion}/build/include/config/auto.conf | |
180 | ||
181 | find %{BUILDROOT}/lib/modules/${fullversion} -name "*.ko" -type f | \ | |
182 | xargs chmod u+x | |
183 | ||
184 | for i in alias alias.bin builtin.bin ccwmap dep dep.bin ieee1394map inputmap isapnpmap ofmap pcimap seriomap symbols symbols.bin usbmap; do | |
185 | rm -vf %{BUILDROOT}/lib/modules/${fullversion}/modules.${i} | |
186 | done | |
187 | ||
188 | # Move all development files to /usr/src. | |
189 | mkdir -pv %{BUILDROOT}/usr/src/kernels | |
190 | mv -v %{BUILDROOT}/lib/modules/${fullversion}/build \ | |
191 | %{BUILDROOT}/usr/src/kernels/${fullversion} | |
192 | ln -svf ../../../usr/src/kernels/${fullversion} \ | |
193 | %{BUILDROOT}/lib/modules/${fullversion}/build | |
194 | ||
195 | find %{BUILDROOT}/usr/src/kernels -name ".*.cmd" -exec rm -f {} \; | |
196 | } | |
197 | ||
198 | for kernel in %{kernels}; do | |
199 | build_kernel ${kernel} | |
200 | done | |
201 | end | |
202 | ||
203 | install | |
802ea3af MT |
204 | # Install the header files |
205 | make ARCH=x86 INSTALL_HDR_PATH=dest headers_install | |
206 | mkdir -pv %{BUILDROOT}/usr/include | |
207 | find dest/include \( -name .install -o -name ..install.cmd \) -delete | |
208 | cp -rv dest/include/* %{BUILDROOT}/usr/include | |
209 | ||
210 | # Glibc provides these headers | |
211 | rm -rfv %{BUILDROOT}/usr/include/scsi \ | |
212 | %{BUILDROOT}/usr/include/asm*/atomic.h \ | |
213 | %{BUILDROOT}/usr/include/asm*/io.h \ | |
214 | %{BUILDROOT}/usr/include/asm*/irq.h | |
215 | ||
15a11c5b MT |
216 | # Remove all firmware files which are distributed by linux-firmware |
217 | rm -rfv %{BUILDROOT}/lib/firmware | |
bcf38aec MT |
218 | |
219 | # Install tools. | |
ebeed08a MT |
220 | # XXX Man pages cannot be created because they need asciidoc. |
221 | make -C tools/perf DESTDIR=%{BUILDROOT} \ | |
222 | HAVE_CPLUS_DEMANGLE=1 prefix=/usr perfexecdir=lib/perf-core \ | |
223 | install #install-man | |
802ea3af MT |
224 | end |
225 | end | |
226 | ||
227 | packages | |
bcf38aec MT |
228 | template KERNEL |
229 | kernel_release = %{fullver} | |
230 | ||
231 | summary = The Linux kernel %{kernel_release}. | |
232 | ||
233 | prerequires = module-init-tools | |
234 | provides = kernel | |
802ea3af MT |
235 | requires |
236 | dracut | |
237 | linux-firmware | |
238 | end | |
ad1ea534 | 239 | |
bcf38aec MT |
240 | files |
241 | /boot/System.map-%{kernel_release} | |
242 | /boot/vmlinuz-%{kernel_release} | |
243 | /boot/initramfs-%{kernel_release}.img | |
244 | /etc/ld.so.conf.d/kernel-%{kernel_release}.conf | |
245 | /lib/modules/%{kernel_release} | |
246 | end | |
247 | ||
248 | script postin | |
249 | depmod -a %{kernel_release} || : | |
250 | end | |
251 | ||
ad1ea534 | 252 | script posttransin |
bcf38aec MT |
253 | dracut --force /boot/initramfs-%{kernel_release}.img %{kernel_release} |
254 | end | |
255 | end | |
256 | ||
257 | template KERNELDEVEL | |
258 | kernel_release = %{fullver} | |
259 | ||
260 | summary = Development files of kernel-%{kernel_release}. | |
261 | description | |
262 | %{summary} | |
263 | ||
264 | Install this package in order to compile modules for | |
265 | kernel release %{kernel_release}. | |
266 | end | |
267 | ||
268 | filter_requires | |
269 | perl>=[0-9]\:.* | |
ad1ea534 MT |
270 | end |
271 | ||
bcf38aec MT |
272 | files |
273 | /lib/modules/%{kernel_release}/build | |
274 | /lib/modules/%{kernel_release}/source | |
275 | /usr/src/kernels/%{kernel_release} | |
ad1ea534 | 276 | end |
802ea3af | 277 | end |
bcf38aec MT |
278 | |
279 | package kernel | |
280 | template KERNEL | |
281 | end | |
282 | ||
283 | package kernel-devel | |
284 | template KERNELDEVEL | |
285 | end | |
286 | ||
287 | package kernel-PAE | |
288 | template KERNEL | |
289 | ||
290 | kernel_release = %{fullver}.PAE | |
291 | end | |
292 | ||
293 | package kernel-PAE-devel | |
294 | template KERNELDEVEL | |
295 | ||
296 | kernel_release = %{fullver}.PAE | |
297 | end | |
ebeed08a | 298 | |
802ea3af | 299 | package kernel-headers |
802ea3af MT |
300 | summary = Header files of the kernel release %{fullver}. |
301 | desciption = %{summary} | |
c698e4be MT |
302 | |
303 | files | |
304 | /usr/include | |
305 | end | |
802ea3af | 306 | end |
bcf38aec | 307 | |
ebeed08a MT |
308 | package kernel-tools |
309 | summary = Assortment of tools for the Linux kernel. | |
310 | description = %{summary} | |
311 | ||
312 | filter_requires | |
313 | perl>=[0-9]\:.* | |
314 | end | |
315 | ||
316 | files | |
317 | / | |
318 | !/boot | |
319 | !/lib/modules | |
320 | !/usr/include | |
321 | !/usr/src | |
322 | end | |
323 | end | |
802ea3af | 324 | end |