]>
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 | 6 | name = kernel |
f9a30277 | 7 | version = 4.12.9 |
589a99cb | 8 | release = 1 |
15a11c5b | 9 | thisapp = linux-%{version} |
166a6c21 | 10 | |
81bb0557 | 11 | maintainer = Arne Fitzenreiter <arne.fitzenreiter@ipfire.org> |
802ea3af MT |
12 | groups = System/Kernels |
13 | url = http://www.kernel.org/ | |
14 | license = GPLv2 | |
15 | summary = The Linux kernel. | |
166a6c21 | 16 | |
802ea3af | 17 | description |
4c928ab7 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 | |
166a6c21 | 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 | |
94cce289 | 28 | source_dl = http://www.kernel.org/pub/linux/kernel/v4.x/ |
fe014038 | 29 | sources = %{thisapp}.tar.xz |
802ea3af MT |
30 | |
31 | build | |
6b6a8ff6 MT |
32 | kernel_logo = /usr/share/pixmaps/kernel-logo.ppm |
33 | ||
802ea3af | 34 | requires |
662414a4 | 35 | asciidoc |
81bb0557 | 36 | audit-devel |
7f6f4de5 | 37 | bc |
849a0073 | 38 | binutils >= 2.25 |
bcf38aec | 39 | binutils-devel |
c6e2a6c8 | 40 | bison |
bcf38aec | 41 | elfutils-devel |
c6e2a6c8 | 42 | flex |
461b7e77 | 43 | gcc >= 4.9 |
fe2de317 | 44 | gcc-plugin-devel |
6e9df6a3 | 45 | gettext |
849a0073 | 46 | hostname |
81bb0557 | 47 | libunwind-devel |
802ea3af | 48 | ncurses-devel |
ebeed08a | 49 | net-tools |
7c69f2c2 MT |
50 | newt-devel |
51 | pciutils-devel | |
802ea3af | 52 | perl |
bcf38aec | 53 | python-devel |
849a0073 | 54 | openssl-devel |
7c69f2c2 | 55 | slang-devel |
662414a4 | 56 | xmlto |
bf6ee3f7 | 57 | xz |
4c928ab7 MT |
58 | |
59 | /sbin/depmod | |
6b6a8ff6 | 60 | %{kernel_logo} |
bcf38aec MT |
61 | end |
62 | ||
63 | # A list of kernels to build. | |
45088e83 | 64 | kernels = |
bcf38aec | 65 | |
55586be2 MT |
66 | # Arguments that are passed to the kernel build command |
67 | # Clearning any host CFLAGS or LDFLAGS for kernel build | |
68 | kernel_build_flags = CFLAGS= LDFLAGS= | |
572b4308 | 69 | |
34520606 | 70 | kernel_arch = %{DISTRO_PLATFORM} |
45088e83 | 71 | kernel_target = bzImage |
967da24b MT |
72 | kernel_image = arch/%{kernel_arch}/boot/%{kernel_target} |
73 | ||
c112b2e3 MT |
74 | if "%{DISTRO_ARCH}" == "x86_64" |
75 | build_kernel_default = 1 | |
c112b2e3 MT |
76 | end |
77 | ||
d5383c43 | 78 | if "%{DISTRO_ARCH}" == "aarch64" |
55586be2 | 79 | build_kernel_default = 1 |
d5383c43 MT |
80 | |
81 | kernel_arch = arm64 | |
82 | kernel_target = Image.gz | |
83 | end | |
84 | ||
13c9d848 | 85 | if "%{DISTRO_ARCH}" == "armv7hl" |
7f6f4de5 MT |
86 | # Build the default unified kernel. |
87 | build_kernel_default = 1 | |
88 | ||
7f6f4de5 | 89 | kernel_target = zImage |
967da24b MT |
90 | end |
91 | ||
92 | # mkimage is a requirement to build uImage images. | |
93 | if "%{kernel_target}" == "uImage" | |
94 | requires += u-boot-tools | |
13c9d848 MT |
95 | end |
96 | ||
45088e83 MT |
97 | # Build default kernel. |
98 | if "%{build_kernel_default}" == "1" | |
99 | kernels += default | |
100 | end | |
101 | ||
802ea3af | 102 | prepare_cmds |
5e856224 MT |
103 | # Disable the colorize plugin. |
104 | # It's generally very nice but it clutters our | |
105 | # logfiles. | |
106 | sed -e "/^COLORIZE_PLUGIN_CFLAGS/d" \ | |
107 | -i Makefile | |
108 | ||
802ea3af MT |
109 | sed -e "s/^HOSTCFLAGS.*=.*/& -fPIC/g" -i Makefile |
110 | ||
6b6a8ff6 | 111 | cp -vf %{kernel_logo} \ |
802ea3af MT |
112 | drivers/video/logo/logo_linux_clut224.ppm |
113 | ||
bcf38aec MT |
114 | # Get rid of unwanted files resulting from patch fuzz. |
115 | find . \( -name "*.orig" -o -name "*~" \) -exec rm -f {} \; >/dev/null | |
116 | ||
117 | # Remove unnecessary SCM files. | |
118 | find . -name .gitignore -exec rm -f {} \; >/dev/null | |
119 | ||
ebeed08a MT |
120 | # This prevents scripts/setlocalversion from mucking with our version numbers. |
121 | touch .scmversion | |
122 | ||
bcf38aec | 123 | mkdir -pv configs |
4c928ab7 MT |
124 | |
125 | cd %{DIR_SOURCE} | |
bcf38aec MT |
126 | configure_kernel() { |
127 | local flavour=${1} | |
128 | local suffix | |
129 | if [ "${flavour}" != "default" ]; then | |
130 | suffix="-${flavour}" | |
131 | fi | |
132 | ||
4c928ab7 MT |
133 | scripts/configure --kernel-dir=%{DIR_APP} \ |
134 | merge %{DISTRO_ARCH} ${flavour} %{DIR_APP}/configs/config.${flavour} | |
bcf38aec MT |
135 | } |
136 | ||
137 | # Generate configuration files for all kernels we are going to | |
138 | # build. | |
139 | for kernel in %{kernels}; do | |
140 | configure_kernel ${kernel} | |
141 | done | |
302e8df8 | 142 | |
802ea3af MT |
143 | end |
144 | ||
145 | build | |
bcf38aec MT |
146 | build_kernel() { |
147 | local flavour=${1} | |
148 | local suffix | |
149 | local localversion="%{localversion}" | |
150 | local fullversion="%{fullver}" | |
151 | if [ "${flavour}" != "default" ]; then | |
152 | suffix="-${flavour}" | |
153 | localversion="${localversion}.${flavour}" | |
154 | fullversion="${fullversion}.${flavour}" | |
155 | fi | |
802ea3af | 156 | |
ebeed08a MT |
157 | # Label the build. |
158 | sed -i Makefile \ | |
159 | -e "s/^EXTRAVERSION.*/EXTRAVERSION = -${localversion}/" | |
160 | ||
bcf38aec MT |
161 | # Clean up the source tree. |
162 | make mrproper | |
802ea3af | 163 | |
bcf38aec MT |
164 | # Install configuration file. |
165 | cp configs/config.${flavour} .config | |
c6e2a6c8 | 166 | cat .config |
802ea3af | 167 | |
bcf38aec | 168 | # Run the build. |
ebeed08a | 169 | make ARCH=%{kernel_arch} oldnoconfig >/dev/null |
572b4308 MT |
170 | make ARCH=%{kernel_arch} CC="gcc -fno-PIE" %{kernel_target} modules \ |
171 | %{kernel_build_flags} %{PARALLELISMFLAGS} | |
bcf38aec | 172 | |
9d4be168 MT |
173 | # Compile Flattened Device Tree database |
174 | case "${DISTRO_ARCH}" in | |
d5383c43 | 175 | aarch64|arm*) |
9d4be168 MT |
176 | make ARCH=%{kernel_arch} dtbs |
177 | ||
178 | mkdir -pv %{BUILDROOT}/boot/dtb-${fullversion} | |
179 | for file in arch/arm/boot/dts/*.dtb; do | |
180 | [ -e "${file}" ] || continue | |
181 | ||
182 | install -m 644 ${file} %{BUILDROOT}/boot/dtb-${fullversion} || exit 1 | |
183 | rm -f ${file} | |
184 | done | |
185 | ;; | |
186 | esac | |
187 | ||
bcf38aec | 188 | # Install the results. |
c4ef5c45 | 189 | mkdir -pv %{BUILDROOT}/boot %{BUILDROOT}/usr/lib/modules/${fullversion} |
bcf38aec MT |
190 | install -m 755 %{kernel_image} %{BUILDROOT}/boot/vmlinuz-${fullversion} |
191 | install -m 644 .config %{BUILDROOT}/boot/config-${fullversion} | |
192 | install -m 644 System.map %{BUILDROOT}/boot/System.map-${fullversion} | |
193 | ||
194 | # Create empty initramfs (20M). | |
195 | dd if=/dev/zero of=%{BUILDROOT}/boot/initramfs-${fullversion}.img bs=1M count=20 | |
196 | ||
197 | # Install modules. | |
81bb0557 | 198 | make ARCH=%{kernel_arch} INSTALL_MOD_PATH=%{BUILDROOT}/usr mod-fw= V=1 \ |
bcf38aec | 199 | KERNELRELEASE=${fullversion} modules_install |
c8f122e5 | 200 | |
bcf38aec | 201 | # Create an empty settings file for dracut |
7c69f2c2 | 202 | mkdir -p %{BUILDROOT}/etc/ld.so.conf.d |
bcf38aec MT |
203 | echo "# Placeholder file, no vDSO hwcap entries used in this kernel." \ |
204 | > %{BUILDROOT}/etc/ld.so.conf.d/kernel-${fullversion}.conf | |
802ea3af | 205 | |
bcf38aec MT |
206 | # And now the scary looking part. |
207 | # | |
208 | # Recreate source and build links. | |
7c69f2c2 MT |
209 | rm -f %{BUILDROOT}/usr/lib/modules/${fullversion}/{build,source} |
210 | mkdir -p %{BUILDROOT}/usr/lib/modules/${fullversion}/build | |
211 | ln -sf build %{BUILDROOT}/usr/lib/modules/${fullversion}/source | |
802ea3af | 212 | |
bcf38aec | 213 | # Create dirs for extra modules. |
7c69f2c2 | 214 | mkdir -p %{BUILDROOT}/usr/lib/modules/${fullversion}/extra |
802ea3af | 215 | |
7c69f2c2 | 216 | cp --parents $(find -type f -name "Makefile*" -o -name "Kconfig*") \ |
c4ef5c45 | 217 | %{BUILDROOT}/usr/lib/modules/${fullversion}/build |
7c69f2c2 | 218 | cp Module.symvers System.map \ |
c4ef5c45 | 219 | %{BUILDROOT}/usr/lib/modules/${fullversion}/build |
7c69f2c2 | 220 | rm -rf %{BUILDROOT}/usr/lib/modules/${fullversion}/build/{Documentation,scripts,include} |
bcf38aec | 221 | |
7c69f2c2 MT |
222 | cp .config %{BUILDROOT}/usr/lib/modules/${fullversion}/build |
223 | cp -a scripts %{BUILDROOT}/usr/lib/modules/${fullversion}/build | |
c4ef5c45 | 224 | find %{BUILDROOT}/usr/lib/modules/${fullversion}/build/scripts -name "*.o" \ |
bcf38aec MT |
225 | -exec rm -vf {} \; |
226 | ||
7c69f2c2 | 227 | cp -a --parents arch/%{kernel_arch}/include \ |
c4ef5c45 | 228 | %{BUILDROOT}/usr/lib/modules/${fullversion}/build |
7c69f2c2 | 229 | cp -a include %{BUILDROOT}/usr/lib/modules/${fullversion}/build/include |
bcf38aec MT |
230 | |
231 | # Make sure we can build external modules. | |
c4ef5c45 MT |
232 | touch -r %{BUILDROOT}/usr/lib/modules/${fullversion}/build/Makefile \ |
233 | %{BUILDROOT}/usr/lib/modules/${fullversion}/build/include/linux/version.h | |
234 | touch -r %{BUILDROOT}/usr/lib/modules/${fullversion}/build/.config \ | |
235 | %{BUILDROOT}/usr/lib/modules/${fullversion}/build/autoconf.h | |
7c69f2c2 | 236 | cp %{BUILDROOT}/usr/lib/modules/${fullversion}/build/.config \ |
c4ef5c45 MT |
237 | %{BUILDROOT}/usr/lib/modules/${fullversion}/build/include/config/auto.conf |
238 | ||
239 | find %{BUILDROOT}/usr/lib/modules/${fullversion} -name "*.ko" -type f | \ | |
bf6ee3f7 | 240 | xargs --no-run-if-empty chmod u+x |
bcf38aec | 241 | |
bcf38aec | 242 | # Move all development files to /usr/src. |
7c69f2c2 MT |
243 | mkdir -p %{BUILDROOT}/usr/src/kernels |
244 | mv %{BUILDROOT}/usr/lib/modules/${fullversion}/build \ | |
bcf38aec | 245 | %{BUILDROOT}/usr/src/kernels/${fullversion} |
7c69f2c2 | 246 | ln -sf ../../../src/kernels/${fullversion} \ |
c4ef5c45 | 247 | %{BUILDROOT}/usr/lib/modules/${fullversion}/build |
bcf38aec | 248 | |
81bb0557 MT |
249 | # Fix permissions. |
250 | find %{BUILDROOT}/usr/src/kernels -name "modules.order" \ | |
251 | -exec chmod 644 {} \; | |
252 | ||
bcf38aec | 253 | find %{BUILDROOT}/usr/src/kernels -name ".*.cmd" -exec rm -f {} \; |
d27a5bdd AF |
254 | |
255 | # remove device tree compiler because there are dead links | |
256 | rm -rf %{BUILDROOT}/usr/src/kernels/*/scripts/dtc | |
bcf38aec MT |
257 | } |
258 | ||
259 | for kernel in %{kernels}; do | |
260 | build_kernel ${kernel} | |
261 | done | |
6e9df6a3 | 262 | |
6e9df6a3 | 263 | # cpupower |
7c69f2c2 MT |
264 | chmod +x tools/power/cpupower/utils/version-gen.sh |
265 | make -C tools/power/cpupower CPUFREQ_BENCH=false %{PARALLELISMFLAGS} | |
266 | ||
302e8df8 MT |
267 | pushd tools/thermal/tmon |
268 | make | |
269 | popd | |
bcf38aec MT |
270 | end |
271 | ||
272 | install | |
4c928ab7 MT |
273 | # When no kernels are configured, we create a default config |
274 | # which enables us to install at least the header files. | |
275 | [ -n "%{kernels}" ] || make ARCH=%{kernel_arch} defconfig | |
276 | ||
802ea3af | 277 | # Install the header files |
c8f122e5 | 278 | make ARCH=%{kernel_arch} INSTALL_HDR_PATH=dest headers_install |
802ea3af MT |
279 | mkdir -pv %{BUILDROOT}/usr/include |
280 | find dest/include \( -name .install -o -name ..install.cmd \) -delete | |
281 | cp -rv dest/include/* %{BUILDROOT}/usr/include | |
282 | ||
283 | # Glibc provides these headers | |
284 | rm -rfv %{BUILDROOT}/usr/include/scsi \ | |
285 | %{BUILDROOT}/usr/include/asm*/atomic.h \ | |
286 | %{BUILDROOT}/usr/include/asm*/io.h \ | |
287 | %{BUILDROOT}/usr/include/asm*/irq.h | |
288 | ||
15a11c5b MT |
289 | # Remove all firmware files which are distributed by linux-firmware |
290 | rm -rfv %{BUILDROOT}/lib/firmware | |
bcf38aec MT |
291 | |
292 | # Install tools. | |
6e9df6a3 | 293 | # cpupower |
7c69f2c2 MT |
294 | make -C tools/power/cpupower DESTDIR=%{BUILDROOT} libdir=%{libdir} \ |
295 | mandir=%{mandir} CPUFREQ_BENCH=false install | |
296 | ||
7c69f2c2 | 297 | chmod 0755 %{BUILDROOT}%{libdir}/libcpupower.so* |
302e8df8 | 298 | |
302e8df8 MT |
299 | # tmon |
300 | pushd tools/thermal/tmon | |
301 | make INSTALL_ROOT=%{BUILDROOT} install | |
302 | popd | |
802ea3af MT |
303 | end |
304 | end | |
305 | ||
306 | packages | |
bcf38aec | 307 | template KERNEL |
aa3ab846 | 308 | kernel_name = kernel |
bcf38aec MT |
309 | kernel_release = %{fullver} |
310 | ||
311 | summary = The Linux kernel %{kernel_release}. | |
312 | ||
1c9b6c79 | 313 | prerequires |
4c928ab7 | 314 | /sbin/depmod |
1c9b6c79 MT |
315 | end |
316 | ||
317 | provides | |
318 | kernel=%{kernel_release} | |
319 | end | |
320 | ||
802ea3af | 321 | requires |
4c928ab7 MT |
322 | dracut |
323 | grubby | |
802ea3af MT |
324 | linux-firmware |
325 | end | |
ad1ea534 | 326 | |
bcf38aec MT |
327 | files |
328 | /boot/System.map-%{kernel_release} | |
9d4be168 | 329 | /boot/dtb-%{kernel_release} |
bcf38aec MT |
330 | /boot/vmlinuz-%{kernel_release} |
331 | /boot/initramfs-%{kernel_release}.img | |
332 | /etc/ld.so.conf.d/kernel-%{kernel_release}.conf | |
c4ef5c45 | 333 | /usr/lib/modules/%{kernel_release} |
bcf38aec MT |
334 | end |
335 | ||
aa3ab846 | 336 | _posttrans |
c8f9fe35 MT |
337 | /sbin/new-kernel-pkg --package %{kernel_name} --mkinitrd --dracut --depmod --update %{kernel_release} |
338 | /sbin/new-kernel-pkg --package %{kernel_name} --rpmposttrans %{kernel_release} | |
aa3ab846 MT |
339 | end |
340 | ||
ad1ea534 | 341 | script posttransin |
aa3ab846 MT |
342 | %{_posttrans} |
343 | end | |
344 | ||
345 | script posttransup | |
346 | %{_posttrans} | |
347 | end | |
348 | ||
349 | script postin | |
c8f9fe35 | 350 | /sbin/new-kernel-pkg --package %{kernel_name} --install %{kernel_release} |
aa3ab846 MT |
351 | end |
352 | ||
353 | script postup | |
354 | /sbin/new-kernel-pkg --package %{kernel_name} --install %{kernel_release} | |
355 | end | |
356 | ||
357 | script preun | |
358 | /sbin/new-kernel-pkg --rminitrd --rmmoddep --remove %{kernel_release} | |
bcf38aec MT |
359 | end |
360 | end | |
361 | ||
362 | template KERNELDEVEL | |
363 | kernel_release = %{fullver} | |
364 | ||
365 | summary = Development files of kernel-%{kernel_release}. | |
366 | description | |
367 | %{summary} | |
368 | ||
369 | Install this package in order to compile modules for | |
370 | kernel release %{kernel_release}. | |
371 | end | |
372 | ||
10756fd5 MT |
373 | provides |
374 | kernel-devel = %{thisver} | |
375 | end | |
376 | ||
bcf38aec MT |
377 | filter_requires |
378 | perl>=[0-9]\:.* | |
ad1ea534 MT |
379 | end |
380 | ||
bcf38aec | 381 | files |
c4ef5c45 MT |
382 | /usr/lib/modules/%{kernel_release}/build |
383 | /usr/lib/modules/%{kernel_release}/source | |
bcf38aec | 384 | /usr/src/kernels/%{kernel_release} |
ad1ea534 | 385 | end |
802ea3af | 386 | end |
bcf38aec | 387 | |
45088e83 | 388 | if "%{build_kernel_default}" == "1" |
7f6f4de5 MT |
389 | if "%{DISTRO_ARCH}" == "armv7hl" |
390 | package kernel | |
391 | template KERNEL | |
58dc2060 | 392 | |
7f6f4de5 MT |
393 | kernel_name = kernel |
394 | kernel_release = %{fullver} | |
bcf38aec | 395 | |
0db4b328 MT |
396 | # Replace the Exynos kernel. |
397 | obsoletes += kernel-exynos < %{kernel_release} | |
398 | conflicts += kernel-exynos < %{kernel_release} | |
399 | ||
7f6f4de5 MT |
400 | # Replace the OMAP kernel. |
401 | obsoletes += kernel-omap < %{kernel_release} | |
402 | conflicts += kernel-omap < %{kernel_release} | |
403 | end | |
404 | ||
405 | package kernel-devel | |
406 | template KERNELDEVEL | |
407 | ||
408 | kernel_name = kernel | |
409 | kernel_release = %{fullver} | |
410 | ||
0db4b328 MT |
411 | # Replace the Exynos kernel. |
412 | obsoletes += kernel-exynos-devel < %{kernel_release} | |
413 | conflicts += kernel-exynos-devel < %{kernel_release} | |
414 | ||
7f6f4de5 MT |
415 | # Replace the OMAP kernel. |
416 | obsoletes += kernel-omap-devel < %{kernel_release} | |
417 | conflicts += kernel-omap-devel < %{kernel_release} | |
418 | end | |
58dc2060 | 419 | |
7f6f4de5 MT |
420 | else |
421 | package kernel | |
422 | template KERNEL | |
423 | ||
424 | kernel_name = kernel | |
425 | kernel_release = %{fullver} | |
426 | end | |
427 | ||
428 | package kernel-devel | |
429 | template KERNELDEVEL | |
430 | ||
431 | kernel_name = kernel | |
432 | kernel_release = %{fullver} | |
433 | end | |
45088e83 | 434 | end |
bcf38aec | 435 | end |
81bb0557 | 436 | |
802ea3af | 437 | package kernel-headers |
802ea3af MT |
438 | summary = Header files of the kernel release %{fullver}. |
439 | desciption = %{summary} | |
c698e4be MT |
440 | |
441 | files | |
442 | /usr/include | |
443 | end | |
802ea3af | 444 | end |
bcf38aec | 445 | |
ebeed08a MT |
446 | package kernel-tools |
447 | summary = Assortment of tools for the Linux kernel. | |
448 | description = %{summary} | |
449 | ||
450 | filter_requires | |
451 | perl>=[0-9]\:.* | |
452 | end | |
453 | ||
454 | files | |
455 | / | |
456 | !/boot | |
ebeed08a | 457 | !/usr/include |
c4ef5c45 | 458 | !/usr/lib/modules |
ebeed08a | 459 | !/usr/src |
fe2de317 MT |
460 | !/usr/src/debug |
461 | !/usr/lib/debug | |
ebeed08a MT |
462 | end |
463 | end | |
802ea3af | 464 | end |