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