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