kernel-5.15/kernel.spec

1298 lines
39 KiB
RPMSpec
Raw Normal View History

%define kernelversion 4
2018-07-05 21:40:11 +03:00
%define patchlevel 17
2013-11-16 00:27:01 +04:00
# sublevel is now used for -stable patches
2018-09-03 13:03:37 +03:00
%define sublevel 19
2013-11-16 00:27:01 +04:00
# Release number. Increase this before a rebuild.
2018-04-22 12:50:55 +03:00
%define rpmrel 1
2013-11-16 00:27:01 +04:00
# kernel base name (also name of srpm)
%define kname kernel
%define rpmtag %{disttag}
# fakerel and fakever never change, they are used to fool
# rpm/urpmi/smart and ensure the kernels are installed,
# not upgraded so old kernel is not overwritten or removed
2013-11-16 00:27:01 +04:00
%define fakever 1
%define fakerel %mkrel 1
# version defines
%define kversion %{kernelversion}.%{patchlevel}.%{sublevel}
%define kverrel %{kversion}-%{rpmrel}
%define tar_ver %{kernelversion}.%{patchlevel}
%ifarch %{ix86}
# Use a standard suffix for 32-bit x86
%define arch_suffix i586
%else
%define arch_suffix %{_arch}
%endif
%define buildrpmrel %{rpmrel}%{rpmtag}-%{arch_suffix}
2013-11-16 00:27:01 +04:00
%define buildrel %{kversion}-%{buildrpmrel}
# Having different top-level names for packages means that you have to remove
# them by hand :(
2013-11-16 00:27:01 +04:00
%define top_dir_name %{kname}-%{_arch}
%define build_dir ${RPM_BUILD_DIR}/%{top_dir_name}
%define src_dir %{build_dir}/linux-%{tar_ver}
############################################################################
# SELinux is now built in by default but some other hardening features
# are not.
%{?build_selinux}%{?!build_selinux:%bcond_with selinux}
%if %{with selinux}
%global enhanced_security 1
%else
%global enhanced_security 0
%endif
# Allow "rpmbuild --with enhanced_security <...>"
%{?_with_enhanced_security:%global enhanced_security 1}
############################################################################
2013-11-16 00:27:01 +04:00
# Build defines
%define build_doc 1
%define build_source 0
2013-11-16 00:27:01 +04:00
%define build_devel 1
%define build_debug 0
2013-11-16 00:27:01 +04:00
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
# Build nrj desktop kernels
2013-11-16 00:27:01 +04:00
%define build_nrj_desktop 1
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
# Build nrj laptop kernels
2014-01-13 15:57:59 +04:00
%define build_nrj_laptop 1
2013-11-16 00:27:01 +04:00
# build perf and cpupower tools
2016-01-06 17:46:38 +03:00
%define build_perf 1
2013-11-16 00:27:01 +04:00
%define build_cpupower 1
# compress modules with xz
%define build_modxz 1
# End of user definitions
# buildtime flags
%{?_without_nrj_desktop: %global build_nrj_desktop 0}
%{?_without_nrj_laptop: %global build_nrj_laptop 0}
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
%{?_with_nrj_desktop: %global build_nrj_desktop 1}
%{?_with_nrj_laptop: %global build_nrj_laptop 1}
2013-11-16 00:27:01 +04:00
%{?_without_doc: %global build_doc 0}
%{?_without_source: %global build_source 0}
%{?_without_devel: %global build_devel 0}
%{?_without_debug: %global build_debug 0}
%{?_without_perf: %global build_perf 0}
%{?_without_cpupower: %global build_cpupower 0}
%{?_without_modxz: %global build_modxz 0}
%{?_with_doc: %global build_doc 1}
%{?_with_source: %global build_source 1}
%{?_with_devel: %global build_devel 1}
%{?_with_debug: %global build_debug 1}
%{?_with_perf: %global build_perf 1}
%{?_with_cpupower: %global build_cpupower 1}
%{?_with_modxz: %global build_modxz 1}
%if !%{build_debug}
# Disable debug rpms.
%define _enable_debug_packages %{nil}
%define debug_package %{nil}
%endif
2013-11-16 00:27:01 +04:00
############################################################
### Linker start1 > Check point to build for omv or rosa ###
2013-11-16 00:27:01 +04:00
############################################################
%if %(if [ -z "$CC" ] ; then echo 0; else echo 1; fi)
%define kmake %make CC="$CC"
2013-11-16 00:27:01 +04:00
%else
%define kmake %make
2013-11-16 00:27:01 +04:00
%endif
# there are places where parallel make don't work
%define smake make
2014-01-22 18:31:57 +04:00
2013-11-16 00:27:01 +04:00
###########################################################
### Linker end1 > Check point to build for omv or rosa ###
2013-11-16 00:27:01 +04:00
###########################################################
# Parallelize xargs invocations on smp machines
%define kxargs xargs %([ -z "$RPM_BUILD_NCPUS" ] \\\
&& RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
[ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-P $RPM_BUILD_NCPUS")
#
# SRC RPM description
#
Summary: The Linux kernel
2013-11-16 00:27:01 +04:00
Name: %{kname}
Version: %{kversion}
Release: %{rpmrel}
License: GPLv2
Group: System/Kernel and hardware
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
ExclusiveArch: %{ix86} x86_64
2013-11-16 00:27:01 +04:00
URL: http://www.kernel.org
####################################################################
#
# Sources
#
2018-01-10 22:20:13 +03:00
Source0: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/linux-%{tar_ver}.tar.xz
#Source1: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/linux-%{tar_ver}.tar.sign
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
2013-11-16 00:27:01 +04:00
# This is for disabling *config, mrproper, prepare, scripts on -devel rpms
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
# TODO: is it needed?
2013-11-16 00:27:01 +04:00
Source2: disable-mrproper-prepare-scripts-configs-in-devel-rpms.patch
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
# Kernel configuration files.
# kernel-<arch>.config is the common part. kernel-<flavour>-<arch>.config is
# what should be added to it to get the initial configuration file for
# the particular kernel flavour.
Source110: kernel-%{arch_suffix}.config
Source111: kernel-nrj-desktop-%{arch_suffix}.config
Source112: kernel-nrj-laptop-%{arch_suffix}.config
2013-11-16 00:27:01 +04:00
# Cpupower: the service, the config, etc.
2013-11-16 00:27:01 +04:00
Source50: cpupower.service
Source51: cpupower.config
Source52: cpupower-start.sh
Source53: cpupower.path
2013-11-16 00:27:01 +04:00
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
Source80: kernel.rpmlintrc
####################################################################
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
2013-11-16 00:27:01 +04:00
# Patches
# The patch to make kernel x.y.z from x.y.0.
2018-01-10 22:20:13 +03:00
Patch1: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/patch-%{kversion}.xz
#Source10: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/patch-%{kversion}.sign
2013-11-16 00:27:01 +04:00
# ROSA-specific patches
2017-03-12 17:43:09 +03:00
# We need to apply this one only when building 32-bit kernels but RPM
# does not care if the patch is in an if-block, unfortunately...
Source91: revert-mm-meminit-only-set-page-reserved-in-the-memblock-re.patch
# Adds explicit linking of the Perf Python extension with libdl, thus fixing
# the build.
Patch100: perf-python-ext-link-with-dl.patch
# Perf docs are built after all the kernels. To validate the xml files
# generated during that process, xmlto tries to get DTD files from the Net.
# If it fails, the whole build fails, which is unfortunate. Let us avoid
# this.
Patch101: perf-xmlto-skip-validation.patch
# http://bugs.rosalinux.ru/show_bug.cgi?id=6235
# http://bugs.rosalinux.ru/show_bug.cgi?id=6459
Patch104: audit-make-it-less-verbose.patch
# http://bugs.rosalinux.ru/show_bug.cgi?id=5649#c6
Patch105: drm-cirrus-Use-16bpp-as-default.patch
# Increase vmalloc area, https://bugs.mageia.org/show_bug.cgi?id=904
Patch106: x86-increase-default-minimum-vmalloc-area-by-64MB-to-192MB.patch
# disable floppy autoloading (mga #4696)
Patch107: block-floppy-disable-pnp-modalias.patch
# prefer ata over ide drivers
Patch108: ata-prefer-ata-drivers-over-ide-drivers-when-both-are-built.patch
# AUFS from http://aufs.sourceforge.net/
Patch109: fs-aufs4.patch
# Sanitizing kernel memory
# We do not use "Patch:" here because apply_patches would always apply it
# then, it seems, even if we place "Patch: <..>" under a conditional.
Source701: sanitize-memory.patch
2013-11-16 00:27:01 +04:00
####################################################################
# Defines for the things that are needed for all the kernels
#
%define common_desc_kernel The kernel package contains the Linux kernel (vmlinuz), the core of your \
operating system. The kernel handles the basic functions \
2013-11-16 00:27:01 +04:00
of the operating system: memory allocation, process allocation, device \
input and output, etc.
%define common_desc_kernel_smp This kernel relies on in-kernel smp alternatives to switch between up & smp \
mode depending on detected hardware. To force the kernel to boot in single \
processor mode, use the "nosmp" boot parameter.
### Global Requires/Provides
%define requires1 grub2
%define requires2 dracut >= 041-11
%define requires3 kmod >= 20-1
2013-11-16 00:27:01 +04:00
%define requires4 sysfsutils >= 2.1.0-12
2016-07-26 13:23:48 +03:00
%define requires5 linux-firmware >= 20160318
2013-11-16 00:27:01 +04:00
%define kprovides1 %{kname} = %{kverrel}
%define kprovides2 kernel = %{tar_ver}
%define kprovides3 alsa = 1.0.27
Autoreqprov: no
2013-11-16 00:27:01 +04:00
BuildRequires: bc
BuildRequires: binutils
BuildRequires: gcc
# For power tools
BuildRequires: pkgconfig(ncurses)
2013-11-16 00:27:01 +04:00
BuildRequires: kmod-devel kmod-compat
BuildRequires: bison
BuildRequires: flex
%ifarch x86_64
BuildRequires: numa-devel
%endif
# for perf, cpufreq and all other tools
# for cpupower
%if %{build_cpupower}
BuildRequires: pciutils-devel
%endif
# for perf
%if %{build_perf}
BuildRequires: asciidoc
BuildRequires: audit-devel
2013-11-16 00:27:01 +04:00
BuildRequires: binutils-devel
BuildRequires: elfutils-devel
BuildRequires: libunwind-devel
2013-11-16 00:27:01 +04:00
BuildRequires: newt-devel
BuildRequires: perl-devel
BuildRequires: pkgconfig(gtk+-2.0)
2013-11-16 00:27:01 +04:00
BuildRequires: python-devel
BuildRequires: xmlto
BuildRequires: zlib-devel
BuildRequires: pkgconfig(libcrypto)
%endif
2013-11-16 00:27:01 +04:00
# might be useful too:
Suggests: microcode
2013-11-16 00:27:01 +04:00
%description
%common_desc_kernel
%common_desc_kernel_smp
# Define obsolete/provides to help automatic upgrades of old kernel-xen-pvops
%define latest_obsoletes_server kernel-xen-pvops-latest < 3.2.1-1
%define latest_provides_server kernel-xen-pvops-latest = %{kverrel}
%define latest_obsoletes_devel_server kernel-xen-pvops-devel-latest < 3.2.1-1
%define latest_provides_devel_server kernel-xen-pvops-devel-latest = %{kverrel}
# mkflavour() name flavour processor
# name: the flavour name in the package name
# flavour: first parameter of CreateKernel()
%define mkflavour() \
%package -n %{kname}-%{1}-%{buildrel} \
Version: %{fakever} \
Release: %{fakerel} \
Provides: %kprovides1 %kprovides2 %kprovides3 \
%{expand:%%{?kprovides_%{1}:Provides: %{kprovides_%{1}}}} \
Provides: %{kname}-%{1} \
%if %{build_nrj_desktop} \
Provides: kernel-desktop \
%endif \
Requires(pre): %requires1 %requires2 %requires3 %requires4 \
Requires: %requires2 %requires5 \
Requires: wireless-regdb \
2013-11-16 00:27:01 +04:00
Provides: should-restart = system \
Suggests: crda \
%if %build_devel \
Requires: %{kname}-%{1}-devel-%{buildrel} \
Requires(post): %{kname}-%{1}-devel-%{buildrel} \
%endif \
2013-11-16 00:27:01 +04:00
%ifarch %{ix86} \
Conflicts: arch(x86_64) \
%endif \
Summary: %{expand:%{summary_%(echo %{1} | sed -e "s/-/_/g")}} \
2013-11-16 00:27:01 +04:00
Group: System/Kernel and hardware \
%description -n %{kname}-%{1}-%{buildrel} \
%common_desc_kernel %{expand:%{info_%(echo %{1} | sed -e "s/-/_/g")}} \
2013-11-16 00:27:01 +04:00
%common_desc_kernel_smp \
\
%if %build_devel \
%package -n %{kname}-%{1}-devel-%{buildrel} \
Version: %{fakever} \
Release: %{fakerel} \
Requires: glibc-devel ncurses-devel make gcc perl \
Requires(post): dkms \
Requires(preun): dkms \
Summary: Development files for %{kname}-%{1}-%{buildrel} \
2013-11-16 00:27:01 +04:00
Group: Development/Kernel \
Provides: %{kname}-devel = %{kverrel} \
Provides: %{kname}-%{1}-devel \
%ifarch %{ix86} \
Conflicts: arch(x86_64) \
%endif \
%description -n %{kname}-%{1}-devel-%{buildrel} \
This package contains the kernel files (headers and build tools) \
that should be enough to build additional drivers for \
use with %{kname}-%{1}-%{buildrel}. \
\
If you want to build your own kernel, you need to install the full \
%{kname}-source-%{buildrel} rpm. \
\
%endif \
\
%if %build_debug \
%package -n %{kname}-%{1}-%{buildrel}-debuginfo \
Version: %{fakever} \
Release: %{fakerel} \
Summary: Files with debuginfo for %{kname}-%{1}-%{buildrel} \
Group: Development/Debug \
Provides: kernel-debug = %{kverrel} \
%ifarch %{ix86} \
Conflicts: arch(x86_64) \
%endif \
%description -n %{kname}-%{1}-%{buildrel}-debuginfo \
This package contains the files with debuginfo to aid in debug tasks \
when using %{kname}-%{1}-%{buildrel}. \
\
If you need to look at debug information or use some application that \
needs debugging info from the kernel, this package may help. \
\
%endif \
\
%package -n %{kname}-%{1}-%{kernelversion}.%{patchlevel}-latest \
Version: %{kversion} \
Release: %{rpmrel} \
Summary: Meta package for the latest %{kname}-%{1} in %{kernelversion}.%{patchlevel} series \
Group: System/Kernel and hardware \
Requires: %{kname}-%{1}-%{buildrel} \
%ifarch %{ix86} \
Conflicts: arch(x86_64) \
Obsoletes: %{kname}-%{1}-pae-%{kernelversion}.%{patchlevel}-latest < %{kversion}-%{release} \
Provides: %{kname}-%{1}-pae-%{kernelversion}.%{patchlevel}-latest = %{kversion}-%{release} \
%endif \
%description -n %{kname}-%{1}-%{kernelversion}.%{patchlevel}-latest \
This meta package aims to make sure you always have the \
latest %{kname}-%{1} %{kernelversion}.%{patchlevel}.x installed... \
\
2013-11-16 00:27:01 +04:00
%if %build_devel \
\
%package -n %{kname}-%{1}-%{kernelversion}.%{patchlevel}-devel-latest \
Version: %{kversion} \
Release: %{rpmrel} \
Summary: Meta package for the latest %{kname}-%{1}-devel in %{kernelversion}.%{patchlevel} series \
Group: Development/Kernel \
Requires: %{kname}-%{1}-devel-%{buildrel} \
%ifarch %{ix86} \
Conflicts: arch(x86_64) \
Obsoletes: %{kname}-%{1}-pae-%{kernelversion}.%{patchlevel}-devel-latest < %{kversion}-%{release} \
Provides: %{kname}-%{1}-pae-%{kernelversion}.%{patchlevel}-devel-latest = %{kversion}-%{release} \
%endif \
Provides: %{kname}-devel-latest \
%description -n %{kname}-%{1}-%{kernelversion}.%{patchlevel}-devel-latest \
This meta package aims to make sure you always have the \
latest %{kname}-%{1}-devel %{kernelversion}.%{patchlevel}.x installed... \
\
2013-11-16 00:27:01 +04:00
%endif \
\
%post -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1}-post \
%preun -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1}-preun \
%postun -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1}-postun \
\
%if %build_devel \
%post -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1}-post \
%preun -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1}-preun \
%postun -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1}-postun \
%endif \
\
%files -n %{kname}-%{1}-%{buildrel} -f kernel_files.%{1} \
%files -n %{kname}-%{1}-%{kernelversion}.%{patchlevel}-latest \
2013-11-16 00:27:01 +04:00
\
%if %build_devel \
%files -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1} \
%files -n %{kname}-%{1}-%{kernelversion}.%{patchlevel}-devel-latest \
2013-11-16 00:27:01 +04:00
%endif \
\
%if %build_debug \
%files -n %{kname}-%{1}-%{buildrel}-debuginfo -f kernel_debug_files.%{1} \
%endif
%if %build_nrj_desktop
2016-07-21 15:58:13 +03:00
%define summary_nrj_desktop A general-purpose Linux Kernel
%define info_nrj_desktop This is a general-purpose kernel.
2013-11-16 00:27:01 +04:00
%mkflavour nrj-desktop
%endif
2016-07-21 15:58:13 +03:00
2013-11-16 00:27:01 +04:00
%if %build_nrj_laptop
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
%define summary_nrj_laptop Linux Kernel for laptops
2016-07-21 15:58:13 +03:00
%define info_nrj_laptop This kernel is mostly intended for laptops.
2013-11-16 00:27:01 +04:00
%mkflavour nrj-laptop
%endif
#
# kernel-source
#
%if %build_source
%package -n %{kname}-source-%{buildrel}
Version: %{fakever}
Release: %{fakerel}
Requires: glibc-devel, ncurses-devel, make, gcc, perl, diffutils
Summary: The source code of %{kname}-%{buildrel}
2013-11-16 00:27:01 +04:00
Group: Development/Kernel
Autoreqprov: no
Provides: kernel-source = %{kverrel}
Buildarch: noarch
%description -n %{kname}-source-%{buildrel}
The %{kname}-source package contains the source code for the kernel.
These source files are only needed if you want to build your own
2013-11-16 00:27:01 +04:00
custom kernel that is better tuned to your particular hardware.
If you only want the files needed to build third-party (dkms-*,...)
2013-11-16 00:27:01 +04:00
drivers against, install the *-devel-* rpm that is matching your kernel.
#
# kernel-source-latest: virtual rpm
#
%package -n %{kname}-source-latest
Version: %{kversion}
Release: %{rpmrel}
Summary: Virtual rpm for latest %{kname}-source
Group: Development/Kernel
Requires: %{kname}-source-%{buildrel}
Buildarch: noarch
%description -n %{kname}-source-latest
This package is a virtual rpm that aims to make sure you always have the
latest %{kname}-source installed...
%endif
#
# kernel-doc: documentation for the Linux kernel
#
%if %build_doc
%package -n %{kname}-doc
Version: %{kversion}
Release: %{rpmrel}
Summary: Various documentation bits found in the %{kname} source
Group: Documentation
Buildarch: noarch
%description -n %{kname}-doc
This package contains documentation files from the %{kname} source.
Various bits of information about the Linux kernel and the device drivers
shipped with it are documented in these files. You also might want install
this package if you need a reference to the options that can be passed to
Linux kernel modules at load time.
%endif
#
# kernel/tools
#
%if %{build_perf}
%package -n perf
Version: %{kversion}
Release: %{rpmrel}
Summary: perf tool and the supporting documentation
Group: System/Kernel and hardware
%description -n perf
the perf tool and the supporting documentation.
%endif
%if %{build_cpupower}
%package -n cpupower
Version: %{kversion}
Release: %{rpmrel}
Summary: The cpupower tools
2013-11-16 00:27:01 +04:00
Group: System/Kernel and hardware
Requires(post): rpm-helper >= 0.24.0-3
Requires(preun): rpm-helper >= 0.24.0-3
Obsoletes: cpufreq < 3.0
Obsoletes: cpufrequtils < 10.0
2013-11-16 00:27:01 +04:00
%description -n cpupower
The cpupower tools.
2013-11-16 00:27:01 +04:00
%post -n cpupower
if [ $1 -ge 0 ]; then
# Do not enable/disable cpupower.service directly, because it should start
# when cpupower.path triggers it.
/bin/systemctl enable cpupower.path >/dev/null 2>&1 || :
/bin/systemctl start cpupower.path >/dev/null 2>&1 || :
2014-04-01 15:25:39 +04:00
fi
2013-11-16 00:27:01 +04:00
%preun -n cpupower
2014-04-01 15:25:39 +04:00
if [ $1 -eq 0 ]; then
/bin/systemctl --no-reload disable cpupower.path > /dev/null 2>&1 || :
/bin/systemctl stop cpupower.path > /dev/null 2>&1 || :
2014-04-01 15:25:39 +04:00
fi
2013-11-16 00:27:01 +04:00
%package -n cpupower-devel
Version: %{kversion}
Release: %{rpmrel}
Summary: Development files for cpupower
2013-11-16 00:27:01 +04:00
Group: Development/Kernel
Requires: cpupower = %{kversion}-%{rpmrel}
Conflicts: %{_lib}cpufreq-devel
%description -n cpupower-devel
This package contains the development files for cpupower.
%endif
%package headers
Version: %kversion
Release: %rpmrel
Summary: Linux kernel header files mostly used by your C library
Group: System/Kernel and hardware
Epoch: 1
%rename linux-userspace-headers
%description headers
C header files from the Linux kernel. The header files define
structures and constants that are needed for building most
standard programs, notably the C library.
This package is not suitable for building kernel modules, you
should use the 'kernel-devel' package instead.
%files headers
%_includedir/*
# Don't conflict with cpupower-devel
%if %{build_cpupower}
%exclude %_includedir/cpufreq.h
%endif
#
# End packages - here begins build stage
#
%prep
%setup -q -n %top_dir_name -c
cd %src_dir
%apply_patches
2013-11-16 00:27:01 +04:00
2017-03-12 17:43:09 +03:00
%ifarch %{ix86}
patch -p1 --fuzz=0 < %{SOURCE91}
%endif
%if %{enhanced_security}
patch -p1 --fuzz=0 < %{SOURCE701}
%endif
2013-11-16 00:27:01 +04:00
#
# Setup Begin
#
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
# Configs
cp %{SOURCE110} .
2013-11-16 00:27:01 +04:00
%if %build_debug
2017-03-12 17:43:09 +03:00
sed -i 's/# CONFIG_DEBUG_INFO is not set/CONFIG_DEBUG_INFO=y\nCONFIG_DEBUG_INFO_DWARF4=y\nCONFIG_GDB_SCRIPTS=y/' \
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
./kernel-%{arch_suffix}.config
2013-11-16 00:27:01 +04:00
%endif
# Hardening features
%if %{enhanced_security}
sed -i 's/# CONFIG_PAX_MEMORY_SANITIZE is not set/CONFIG_PAX_MEMORY_SANITIZE=y/' \
./kernel-%{arch_suffix}.config
sed -i 's/# CONFIG_PAGE_POISONING is not set/CONFIG_PAGE_POISONING=y\nCONFIG_PAGE_POISONING_NO_SANITY=y/' \
./kernel-%{arch_suffix}.config
%endif
# We may not want to build nrj-desktop flavour in some cases but its config
# is nice to have. It is used when preparing the RPM with the sources,
# for example.
FLAVOURS="nrj-desktop"
cp %{SOURCE111} .
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
%if %{build_nrj_laptop}
cp %{SOURCE112} .
FLAVOURS="${FLAVOURS} nrj-laptop"
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
%endif
CONFIG_DIR=arch/x86/configs
mkdir -p "${CONFIG_DIR}"
for flav in ${FLAVOURS}; do
cfg_file=arch/x86/configs/%{arch_suffix}_defconfig-${flav}
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
echo "Creating configuration file for \"$flav\" kernel."
cp ./kernel-%{arch_suffix}.config .config
# Make sure a newline is at the end of the basic part of the config.
echo >> .config
cat ./kernel-${flav}-%{arch_suffix}.config >> .config
make ARCH=%{_arch} oldconfig && \
mv .config ${cfg_file} && \
echo "Created ${cfg_file}."
# Do not try to build 64-bit kernels for 32-bit systems, for now.
# Looks like something might have removed '# CONFIG_64BIT is not set' from
# the config, let us restore it.
%ifarch %{ix86}
sed -i 's/CONFIG_64BIT=y//' ${cfg_file}
echo '# CONFIG_64BIT is not set' >> ${cfg_file}
%endif
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
done
2013-11-16 00:27:01 +04:00
# Remove the no longer needed parts of the config files
rm -f ./kernel*.config
2013-11-16 00:27:01 +04:00
# make sure the kernel has the sublevel we know it has...
LC_ALL=C perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{sublevel}/" Makefile
# get rid of unwanted files
find . -name '*~' -o -name '*.orig' -o -name '*.append' | %kxargs rm -f
find . -name '.get_maintainer.ignore' | %kxargs rm -f
2013-11-16 00:27:01 +04:00
%build
# Common target directories
%define _kerneldir /usr/src/linux-%{kversion}-%{buildrpmrel}
%define _bootdir /boot
%define _modulesdir /lib/modules
# Directories definition needed for building
%define temp_root %{build_dir}/temp-root
%define temp_source %{temp_root}%{_kerneldir}
%define temp_boot %{temp_root}%{_bootdir}
%define temp_modules %{temp_root}%{_modulesdir}
PrepareKernel() {
name=$1
extension=$2
config_dir=arch/x86/configs
echo "Make config for kernel $extension"
2013-11-16 00:27:01 +04:00
%smake -s mrproper
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
if [ -z "$name" ]; then
cp ${config_dir}/%{arch_suffix}_defconfig-nrj-desktop .config
2013-11-16 00:27:01 +04:00
else
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
cp ${config_dir}/%{arch_suffix}_defconfig-$name .config
2013-11-16 00:27:01 +04:00
fi
# make sure EXTRAVERSION says what we want it to say
LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -$extension/" Makefile
}
BuildKernel() {
KernelVer=$1
echo "Building kernel $KernelVer"
%kmake -s all
# Start installing stuff
install -d %{temp_boot}
install -m 644 System.map %{temp_boot}/System.map-$KernelVer
install -m 644 .config %{temp_boot}/config-$KernelVer
xz -c Module.symvers > %{temp_boot}/symvers-$KernelVer.xz
cp -f arch/x86/boot/bzImage %{temp_boot}/vmlinuz-$KernelVer
2013-11-16 00:27:01 +04:00
# modules
install -d %{temp_modules}/$KernelVer
%smake INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=$KernelVer modules_install
# headers
%make INSTALL_HDR_PATH=%{temp_root}%{_prefix} KERNELRELEASE=$KernelVer headers_install
find %{temp_root}%{_prefix} -name .install -or -name ..install.cmd | %kxargs rm -f
2013-11-16 00:27:01 +04:00
# remove /lib/firmware, we use a separate kernel-firmware
rm -rf %{temp_root}/lib/firmware
}
SaveDevel() {
devel_flavour=$1
KernelVer=%{kversion}-$devel_flavour-%{buildrpmrel}
DevelRoot=/usr/src/linux-$KernelVer
2013-11-16 00:27:01 +04:00
TempDevelRoot=%{temp_root}$DevelRoot
mkdir -p $TempDevelRoot
for i in $(find . -name 'Makefile*'); do cp -R --parents $i $TempDevelRoot;done
for i in $(find . -name 'Kconfig*' -o -name 'Kbuild*'); do cp -R --parents $i $TempDevelRoot;done
# cp -fR Documentation/DocBook/media/*.b64 $TempDevelRoot/Documentation/DocBook/media/
2013-11-16 00:27:01 +04:00
cp -fR include $TempDevelRoot
# ln -s ../generated/uapi/linux/version.h $TempDevelRoot/include/linux/version.h
2013-11-16 00:27:01 +04:00
cp -fR scripts $TempDevelRoot
cp -fR kernel/bounds.c $TempDevelRoot/kernel
cp -fR kernel/time/timeconst.bc $TempDevelRoot/kernel/time
cp -fR tools $TempDevelRoot/
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
cp -fR arch/x86/kernel/asm-offsets.{c,s} $TempDevelRoot/arch/x86/kernel/
cp -fR arch/x86/kernel/asm-offsets_{32,64}.c $TempDevelRoot/arch/x86/kernel/
cp -fR arch/x86/purgatory/* $TempDevelRoot/arch/x86/purgatory/
cp -fR arch/x86/entry/syscalls/syscall* $TempDevelRoot/arch/x86/entry/syscalls/
cp -fR arch/x86/include $TempDevelRoot/arch/x86/
cp -fR arch/x86/tools $TempDevelRoot/arch/x86/
2013-11-16 00:27:01 +04:00
cp -fR .config Module.symvers $TempDevelRoot
# Needed for truecrypt build (Danny)
cp -fR drivers/md/dm.h $TempDevelRoot/drivers/md/
# Needed for lirc_gpio (#39004)
cp -fR drivers/media/pci/bt8xx/bttv{,p}.h $TempDevelRoot/drivers/media/pci/bt8xx/
cp -fR drivers/media/pci/bt8xx/bt848.h $TempDevelRoot/drivers/media/pci/bt8xx/
cp -fR drivers/media/common/btcx-risc.h $TempDevelRoot/drivers/media/common/
# add acpica header files, needed for fglrx build
cp -fR drivers/acpi/acpica/*.h $TempDevelRoot/drivers/acpi/acpica/
# aufs2 has a special file needed
cp -fR fs/aufs/magic.mk $TempDevelRoot/fs/aufs
Unify the specs for 2014.1 and the future cert. systems; revisit configs The source code of the kernel and the patchset are the same for both 2014.1 and the "current" platform, so are the scripts used during the build. 1. I updated create_configs-withBFQ so that it creates different kernel configuration files depending on its --with-enhanced-security parameter. If --with-enhanced-security is set, * SELinux is used instead of TOMOYO; * Memory sanitization facilities are compiled in (but are disabled by default - should be enabled at boot time with boot options pax_sanitize_slab=1 paxsanitize_pages=1). Similar to other packages, I added a conditional in the spec that enables enhanced security features when building for 'current' (i.e. for the future cert. systems) and leaves everithing as is. Besides, I fixed create_configs-withBFQ: even if --user-cpu=... was given, it still generated the configs for all architectures, a waste of time. Now it creates the config only for the architecture corresponding to --user-cpu=... if it is set and for all otherwise. ---------------- The changes in the configs listed below are for i586 and x86_64 only. 2. Added the following to make lxc-checkconfig happy: * CONFIG_MEMCG=y * CONFIG_MEMCG_SWAP=y * CONFIG_MEMCG_KMEM=y 3. Added the following options that 'make oldconfig' adds anyway during the build: * CONFIG_MM_OWNER=y * CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y * CONFIG_IOSF_MBI=m * CONFIG_LRU_CACHE=m * (x86_64 only) CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION=y 4. Removed the following options (they are no longer available in 3.14): * CONFIG_CPU_FREQ_TABLE * CONFIG_IP_NF_MATCH_PSD * CONFIG_IP_NF_TARGET_IFWLOG 5. Increased CONFIG_SERIAL_8250_NR_UARTS from 4 to 8: some of our users have unusual boards with more than 4 serial ports. Also added CONFIG_SERIAL_8250_MANY_PORTS=y: needed for these users too. 6. Unset CONFIG_DRM_RADEON_UMS: it has been deprecated for quite some time and was seemingly ignored. 'radeon' driver the kernel provides works via KMS rather than UMS now and its UMS support is obsolete and buggy. 7. Finally dropped support for Mach64 GPUs. If there are enough users with such hardware, we could enable it is some kernel flavour in contrib (project: https://abf.io/import/kernel-other/). 8. Changed CONFIG_FB_TILEBLITTING to "y": 'make oldconfig' already does this during the kernel build because it is needed for Matrox GPUs (CONFIG_FB_MATROX). BTW, some of our users do seem to have Matrox GPUs. Consequently, I had to disable CONFIG_FB_CON_DECOR: it needs CONFIG_FB_TILEBLITTING unset. 9. Changed CONFIG_X86_VERBOSE_BOOTUP=n to # CONFIG_X86_VERBOSE_BOOTUP is not set 10. (x86_64 only) Changed CONFIG_X86_ESPFIX32=y to CONFIG_X86_ESPFIX64=y This is what 'make oldconfig' does with that option anyway.
2015-01-13 19:32:41 +03:00
# SELinux needs security/selinux/include
cp -fR security/selinux/include $TempDevelRoot/security/selinux
# needed for kexec
cp -fR arch/x86/boot/*.h $TempDevelRoot/arch/x86/boot/
cp -fR arch/x86/boot/*.c $TempDevelRoot/arch/x86/boot/
# needed for arch/x86/purgatory
cp -fR lib/*.h lib/*.c $TempDevelRoot/lib/
2013-11-16 00:27:01 +04:00
for i in alpha arc avr32 blackfin c6x cris frv h8300 hexagon ia64 m32r m68k m68knommu metag microblaze \
mips mn10300 nds32 nios2 openrisc parisc powerpc riscv s390 score sh sparc tile unicore32 xtensa; do
2013-11-16 00:27:01 +04:00
rm -rf $TempDevelRoot/arch/$i
done
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
rm -rf $TempDevelRoot/arch/arm*
rm -rf $TempDevelRoot/include/kvm/arm*
rm -rf $TempDevelRoot/include/soc
2013-11-16 00:27:01 +04:00
# Clean the scripts tree, and make sure everything is ok (sanity check)
# running prepare+scripts (tree was already "prepared" in build)
pushd $TempDevelRoot >/dev/null
%smake -s prepare scripts
%smake -s clean
popd >/dev/null
rm -f $TempDevelRoot/.config.old
# fix permissions
chmod -R a+rX $TempDevelRoot
# disable mrproper in -devel rpms
patch -p1 --fuzz=0 -d $TempDevelRoot -i %{SOURCE2}
# Create the symlinks needed by DKMS
ModulesRoot=%{temp_modules}/$KernelVer
mkdir -p $ModulesRoot
2013-11-16 00:27:01 +04:00
kernel_devel_files=../kernel_devel_files.$devel_flavour
### Create the kernel_devel_files.*
cat > $kernel_devel_files <<EOF
%dir $DevelRoot
%dir $DevelRoot/arch
%dir $DevelRoot/include
$DevelRoot/Documentation
$DevelRoot/arch/um
$DevelRoot/arch/x86
$DevelRoot/block
$DevelRoot/certs
2013-11-16 00:27:01 +04:00
$DevelRoot/crypto
$DevelRoot/drivers
$DevelRoot/firmware
$DevelRoot/fs
$DevelRoot/include/acpi
$DevelRoot/include/asm-generic
$DevelRoot/include/clocksource
$DevelRoot/include/config
$DevelRoot/include/crypto
$DevelRoot/include/drm
$DevelRoot/include/dt-bindings
$DevelRoot/include/generated
$DevelRoot/include/keys
$DevelRoot/include/kvm
2013-11-16 00:27:01 +04:00
$DevelRoot/include/linux
$DevelRoot/include/math-emu
$DevelRoot/include/media
$DevelRoot/include/memory
$DevelRoot/include/misc
$DevelRoot/include/net
$DevelRoot/include/pcmcia
$DevelRoot/include/ras
$DevelRoot/include/rdma
$DevelRoot/include/scsi
$DevelRoot/include/sound
$DevelRoot/include/target
$DevelRoot/include/trace
$DevelRoot/include/uapi
$DevelRoot/include/video
$DevelRoot/include/xen
$DevelRoot/init
$DevelRoot/ipc
$DevelRoot/kernel
$DevelRoot/lib
$DevelRoot/mm
$DevelRoot/net
$DevelRoot/samples
$DevelRoot/scripts
$DevelRoot/security
$DevelRoot/sound
$DevelRoot/tools
$DevelRoot/usr
$DevelRoot/virt
$DevelRoot/.config
$DevelRoot/Kbuild
$DevelRoot/Kconfig
$DevelRoot/Makefile
$DevelRoot/Module.symvers
$DevelRoot/arch/Kconfig
%{_modulesdir}/$KernelVer/build
%{_modulesdir}/$KernelVer/source
2013-11-16 00:27:01 +04:00
EOF
### Create -devel Post script on the fly
cat > $kernel_devel_files-post <<EOF
/usr/sbin/dkms_autoinstaller start $KernelVer
2013-11-16 00:27:01 +04:00
EOF
### Create -devel Preun script on the fly
cat > $kernel_devel_files-preun <<EOF
2015-04-23 15:41:41 +03:00
for ii in \$(/usr/sbin/dkms status -k ${KernelVer} | awk '{ print \$1 \$2; }'); do
mod=\$(echo \$ii | awk -v FS=',' '{ print \$1; }')
ver=\$(echo \$ii | awk -v FS=',' '{ print \$2; }')
2015-04-23 15:41:41 +03:00
/usr/sbin/dkms --rpm_safe_upgrade uninstall -m \$mod -v \$ver -k ${KernelVer} || true
done
2015-04-23 12:11:47 +03:00
# If any DKMS modules with REMAKE_INITRD=yes in their configs have been
# uninstalled, initrd has been regenerated for the given kernel. However,
# the kernel itself might have been uninstalled before, so that (defunct)
# initrd image files would be left behind. Remove them if the kernel itself
# is no longer installed. Should work if they are uninstalled in parallel
2015-04-23 12:11:47 +03:00
# too.
2015-04-23 15:41:41 +03:00
if ! test -f /boot/vmlinuz-${KernelVer}; then
rm -f /boot/initrd-${KernelVer}.img
rm -f /boot/initrd-${KernelVer}_old.img
2015-04-23 12:11:47 +03:00
fi
2013-11-16 00:27:01 +04:00
EOF
### Create -devel Postun script on the fly
cat > $kernel_devel_files-postun <<EOF
rm -rf /usr/src/linux-$KernelVer >/dev/null
# depmod (called when removing DKMS modules) might have created files in
# /lib/modules/.../. Remove these first.
rm -rf /lib/modules/$KernelVer/modules*
# Remove the dir if it is already empty.
find /lib/modules/$KernelVer -maxdepth 0 -empty -exec rm -rf {} \; || true
2013-11-16 00:27:01 +04:00
EOF
}
SaveDebug() {
debug_flavour=$1
install -m 644 vmlinux \
%{temp_boot}/vmlinux-%{kversion}-$debug_flavour-%{buildrpmrel}
kernel_debug_files=../kernel_debug_files.$debug_flavour
echo "%{_bootdir}/vmlinux-%{kversion}-$debug_flavour-%{buildrpmrel}" \
>> $kernel_debug_files
find %{temp_modules}/%{kversion}-$debug_flavour-%{buildrpmrel}/kernel \
-name "*.ko" | \
%kxargs -I '{}' objcopy --only-keep-debug '{}' '{}'.debug
find %{temp_modules}/%{kversion}-$debug_flavour-%{buildrpmrel}/kernel \
-name "*.ko" | %kxargs -I '{}' \
sh -c 'cd `dirname {}`; \
objcopy --add-gnu-debuglink=`basename {}`.debug \
--strip-debug `basename {}`'
pushd %{temp_modules}
find %{kversion}-$debug_flavour-%{buildrpmrel}/kernel \
-name "*.ko.debug" > debug_module_list
popd
cat %{temp_modules}/debug_module_list | \
sed 's|\(.*\)|%{_modulesdir}/\1|' >> $kernel_debug_files
cat %{temp_modules}/debug_module_list | \
sed 's|\(.*\)|%exclude %{_modulesdir}/\1|' \
>> ../kernel_exclude_debug_files.$debug_flavour
rm -f %{temp_modules}/debug_module_list
}
CreateFiles() {
kernel_flavour=$1
KernelVer=%{kversion}-$kernel_flavour-%{buildrpmrel}
2013-11-16 00:27:01 +04:00
kernel_files=../kernel_files.$kernel_flavour
ker="vmlinuz"
2016-07-22 15:04:54 +03:00
2013-11-16 00:27:01 +04:00
### Create the kernel_files.*
cat > $kernel_files <<EOF
%{_bootdir}/System.map-$KernelVer
%{_bootdir}/symvers-$KernelVer.xz
%{_bootdir}/config-$KernelVer
%{_bootdir}/$ker-$KernelVer
%{_modulesdir}/$KernelVer/kernel
%{_modulesdir}/$KernelVer/modules.*
2013-11-16 00:27:01 +04:00
EOF
%if %build_debug
cat ../kernel_exclude_debug_files.$kernel_flavour >> $kernel_files
%endif
### Create kernel Post script
# We always regenerate initrd here, even if it already exists. This may
# happen if kernel-<...>-devel is installed first, triggers rebuild of
# DKMS modules and some of these request remaking of initrd. The initrd
# that is created then will be non-functional. But when the user installs
# kernel-<...> package, that defunct initrd will be replaced with a working
# one here.
#
# depmod is also needed, because some DKMS-modules might have been installed
# when the devel package was installed but that was before the main modules
# were installed.
# This is also the reason the devel package is in Requires(post) for this
# package now: it must be installed completely before we call depmod here.
2013-11-16 00:27:01 +04:00
cat > $kernel_files-post <<EOF
/sbin/depmod -a $KernelVer
INITRD=/boot/initrd-$KernelVer.img
/sbin/dracut -f \${INITRD} $KernelVer
# File triggers from grub packages will handle this.
#/usr/sbin/update-grub2
2013-11-16 00:27:01 +04:00
pushd /boot > /dev/null
if [ -L vmlinuz-$kernel_flavour ]; then
rm -f vmlinuz-$kernel_flavour
fi
if [ -L initrd-$kernel_flavour.img ]; then
rm -f initrd-$kernel_flavour.img
fi
popd > /dev/null
EOF
### Create kernel Preun script on the fly
cat > $kernel_files-preun <<EOF
pushd /boot > /dev/null
if [ -L vmlinuz-$kernel_flavour ]; then
if [ "\$(readlink vmlinuz-$kernel_flavour)" = "vmlinuz-$KernelVer" ]; then
2013-11-16 00:27:01 +04:00
rm -f vmlinuz-$kernel_flavour
fi
fi
if [ -L initrd-$kernel_flavour.img ]; then
if [ "\$(readlink initrd-$kernel_flavour.img)" = "initrd-$KernelVer.img" ]; then
2013-11-16 00:27:01 +04:00
rm -f initrd-$kernel_flavour.img
fi
fi
# File triggers from grub packages will handle this.
#/usr/sbin/update-grub2
2013-11-16 00:27:01 +04:00
popd > /dev/null
exit 0
EOF
### Create kernel Postun script on the fly
cat > $kernel_files-postun <<EOF
2015-04-23 15:41:41 +03:00
rm -f /boot/initrd-${KernelVer}.img
rm -f /boot/initrd-${KernelVer}_old.img
rm -f /boot/initrd-${KernelVer}kdump.img
rm -f /boot/initramfs-${KernelVer}kdump.img
# Third-party modules might have left something in /lib/modules/.../kernel/.
2015-04-23 15:41:41 +03:00
rm -rf /lib/modules/${KernelVer}/kernel/
rm -rf /lib/modules/${KernelVer}/modules*
# Remove /lib/modules/<...>/ if it is empty (-devel uses it too).
2015-04-23 15:41:41 +03:00
find /lib/modules/${KernelVer} -maxdepth 0 -empty -exec rm -rf {} \; || true
2013-11-16 00:27:01 +04:00
EOF
}
CreateKernel() {
flavour=$1
PrepareKernel $flavour $flavour-%{buildrpmrel}
BuildKernel %{kversion}-$flavour-%{buildrpmrel}
%if %build_devel
SaveDevel $flavour
%endif
%if %build_debug
SaveDebug $flavour
%endif
CreateFiles $flavour
}
###
# DO it...
###
# Create a simulacro of buildroot
rm -rf %{temp_root}
install -d %{temp_root}
# make sure we are in the directory
cd %src_dir
%if %build_nrj_desktop
CreateKernel nrj-desktop
%endif
%if %build_nrj_laptop
CreateKernel nrj-laptop
%endif
# set extraversion to match srpm to get nice version reported by the tools
LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{rpmrel}/" Makefile
############################################################
### Linker start3 > Check point to build for omv or rosa ###
2013-11-16 00:27:01 +04:00
############################################################
%if %{build_perf}
%ifarch x86_64
%define perf_is_x64 1
%else
%define perf_is_x64 0
%endif
%smake -C tools/perf -s IS_X86_64=%{perf_is_x64} HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} all
%smake -C tools/perf -s prefix=%{_prefix} man
2013-11-16 00:27:01 +04:00
%endif
%if %{build_cpupower}
# make sure version-gen.sh is executable.
chmod +x tools/power/cpupower/utils/version-gen.sh
%make -C tools/power/cpupower CPUFREQ_BENCH=false
2013-11-16 00:27:01 +04:00
%endif
############################################################
### Linker end3 > Check point to build for omv or rosa ###
2013-11-16 00:27:01 +04:00
############################################################
# We don't make to repeat the depend code at the install phase
%if %build_source
PrepareKernel "" %{buildrpmrel}-custom
2013-11-16 00:27:01 +04:00
%smake -s mrproper
%endif
###
### install
###
%install
cd %src_dir
# Directories definition needed for installing
%define target_source %{buildroot}%{_kerneldir}
%define target_boot %{buildroot}%{_bootdir}
%define target_modules %{buildroot}%{_modulesdir}
# We want to be able to test several times the install part
rm -rf %{buildroot}
cp -a %{temp_root} %{buildroot}
# Create directories infastructure
%if %build_source
install -d %{target_source}
tar cf - . | tar xf - -C %{target_source}
chmod -R a+rX %{target_source}
# we remove all the source files that we don't ship
# first architecture files
for i in alpha arc avr32 blackfin c6x cris frv h8300 hexagon ia64 m32r m68k m68knommu metag microblaze \
mips nios2 openrisc parisc powerpc s390 score sh sh64 sparc tile unicore32 v850 xtensa mn10300; do
2013-11-16 00:27:01 +04:00
rm -rf %{target_source}/arch/$i
done
Revisited the set of kernel flavours and the generation of config files Until now, the build system for the kernel supported a number of flavours: nrj and non-nrj ones, desktop-, laptop-, server- and netbook-oriented, etc. It turned out over the years, however, that our users mostly need the following: * a kernel to use on the desktops (home and office use) with reasonable default settings for performance and responsiveness; * a kernel for laptops, with a bit more emphasis on power consumption. Other variants were rarely used. We also did not have enough time to properly support all these. Besides, the kernels for ARM and other architectures need a somewhat different build process than for x86. So, they are better off to be in separate ABF projects, even if they are needed. No signs of ROSA on ARM yet, btw. So, I kept only nrj-desktop and nrj-laptop flavours and only x86. Non-PAE systems also seem to be rare now, so I enabled PAE by default for the 32-bit kernels. Non-PAE kernels are no longer built. If they are needed, we may use a separate git branch or an ABF project for that. To simplify debugging, maintenance and experimentation with the kernel builds further, I revisited the process of preparing the kernel configuration files. The goal is to get rid of a separate git repo with the default configs (kernel-patches-and-configs) and keep everything in this project. The default config files are now kept here. For x86_64: * kernel-x86_64.config contains the options for both nrj-desktop and nrn-laptop flavours; * kernel-{nrj_desktop|nrj_laptop}-x86_64.config files contain the flavour-specific options. This way, it is easier to track which config options changed when, easier to experiment with the custom configs and so on. The kernel will be built with debug info if rpmbuild is called with "--with debug".
2016-07-21 13:56:25 +03:00
rm -rf %{target_source}/include/kvm/arm*
2013-11-16 00:27:01 +04:00
# other misc files
rm -f %{target_source}/{.config.old,.config.cmd,.gitignore,.lst,.mailmap}
rm -f %{target_source}/{.missing-syscalls.d,arch/.gitignore,firmware/.gitignore}
rm -rf %{target_source}/.tmp_depmod/
rm -f %{target_source}/certs/.gitignore
2013-11-16 00:27:01 +04:00
# Remove .install and ..install.cmd files from this directory tree too.
find %{target_source}/include -name .install -or -name ..install.cmd | %kxargs rm -f
#endif %build_source
%endif
2013-11-16 00:27:01 +04:00
# compressing modules
%if %{build_modxz}
find %{target_modules} -name "*.ko" | %kxargs xz -6e
%else
find %{target_modules} -name "*.ko" | %kxargs gzip -9
%endif
# We used to have a copy of PrepareKernel here
# Now, we make sure that the thing in the linux dir is what we want it to be
pushd %{target_modules}
for i in *; do
rm -f $i/build $i/source
ln -sf /usr/src/linux-$i $i/build
ln -sf /usr/src/linux-$i $i/source
done
2013-11-16 00:27:01 +04:00
# sniff, if we compressed all the modules, we change the stamp :(
# we really need the depmod -ae here
for i in *; do
/sbin/depmod -ae -b %{buildroot} -F %{target_boot}/System.map-$i $i
echo $?
done
for i in *; do
pushd $i
echo "Creating modules.description for $i"
modules=`find . -name "*.ko.[g,x]z"`
echo $modules | %kxargs /sbin/modinfo \
| perl -lne 'print "$name\t$1" if $name && /^description:\s*(.*)/; $name = $1 if m!^filename:\s*(.*)\.k?o!; $name =~ s!.*/!!' > modules.description
popd
done
popd
# need to set extraversion to match srpm again to avoid rebuild
LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{rpmrel}/" Makefile
%if %{build_perf}
# perf tool binary and supporting scripts/binaries
make -C tools/perf -s V=1 DESTDIR=%{buildroot} IS_X86_64=%{perf_is_x64} HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} install
2013-11-16 00:27:01 +04:00
# perf man pages (note: implicit rpm magic compresses them later)
make -C tools/perf -s V=1 DESTDIR=%{buildroot} IS_X86_64=%{perf_is_x64} HAVE_CPLUS_DEMANGLE=1 prefix=%{_prefix} install-man
2013-11-16 00:27:01 +04:00
%endif
############################################################
### Linker start4 > Check point to build for omv or rosa ###
2013-11-16 00:27:01 +04:00
############################################################
%if %{build_cpupower}
make -C tools/power/cpupower DESTDIR=%{buildroot} libdir=%{_libdir} mandir=%{_mandir} CPUFREQ_BENCH=false install
2013-11-16 00:27:01 +04:00
rm -f %{buildroot}%{_libdir}/*.{a,la}
%find_lang cpupower
mv cpupower.lang ../
chmod 0755 %{buildroot}%{_libdir}/libcpupower.so*
mkdir -p %{buildroot}%{_unitdir} %{buildroot}%{_sysconfdir}/sysconfig
install -m644 %{SOURCE50} %{buildroot}%{_unitdir}/cpupower.service
install -m644 %{SOURCE53} %{buildroot}%{_unitdir}/cpupower.path
2013-11-16 00:27:01 +04:00
install -m644 %{SOURCE51} %{buildroot}%{_sysconfdir}/sysconfig/cpupower
install -m755 %{SOURCE52} %{buildroot}%{_bindir}/cpupower-start.sh
2013-11-16 00:27:01 +04:00
%endif
############################################################
### Linker start4 > Check point to build for omv or rosa ###
2013-11-16 00:27:01 +04:00
############################################################
###
### clean
###
%clean
rm -rf %{buildroot}
# We don't want to remove this, the whole reason of its existence is to be
# able to do several rpm --short-circuit -bi for testing install
# phase without repeating compilation phase
#rm -rf %{temp_root}
###
### source and doc file lists
###
%if %build_source
%files -n %{kname}-source-%{buildrel}
%dir %{_kerneldir}
%dir %{_kerneldir}/arch
%dir %{_kerneldir}/include
%{_kerneldir}/Documentation
%{_kerneldir}/arch/Kconfig
%{_kerneldir}/arch/arm
%{_kerneldir}/arch/arm64
%{_kerneldir}/arch/um
%{_kerneldir}/arch/x86
%{_kerneldir}/block
%{_kerneldir}/certs
2013-11-16 00:27:01 +04:00
%{_kerneldir}/crypto
%{_kerneldir}/drivers
%{_kerneldir}/firmware
%{_kerneldir}/fs
%{_kerneldir}/include/acpi
%{_kerneldir}/include/asm-generic
%{_kerneldir}/include/clocksource
%{_kerneldir}/include/crypto
%{_kerneldir}/include/drm
%{_kerneldir}/include/dt-bindings
%{_kerneldir}/include/keys
%{_kerneldir}/include/kvm
2013-11-16 00:27:01 +04:00
%{_kerneldir}/include/linux
%{_kerneldir}/include/math-emu
%{_kerneldir}/include/media
%{_kerneldir}/include/memory
%{_kerneldir}/include/misc
%{_kerneldir}/include/net
%{_kerneldir}/include/pcmcia
%{_kerneldir}/include/ras
%{_kerneldir}/include/rdma
%{_kerneldir}/include/scsi
%{_kerneldir}/include/soc
2013-11-16 00:27:01 +04:00
%{_kerneldir}/include/sound
%{_kerneldir}/include/target
%{_kerneldir}/include/trace
%{_kerneldir}/include/uapi
%{_kerneldir}/include/video
%{_kerneldir}/include/xen
%{_kerneldir}/init
%{_kerneldir}/ipc
%{_kerneldir}/kernel
%{_kerneldir}/lib
%{_kerneldir}/mm
%{_kerneldir}/net
%{_kerneldir}/virt
%{_kerneldir}/samples
%{_kerneldir}/scripts
%{_kerneldir}/security
%{_kerneldir}/sound
%{_kerneldir}/tools
%{_kerneldir}/usr
%{_kerneldir}/COPYING
%{_kerneldir}/CREDITS
%{_kerneldir}/Kbuild
%{_kerneldir}/Kconfig
%{_kerneldir}/MAINTAINERS
%{_kerneldir}/Makefile
%{_kerneldir}/README
%{_kerneldir}/REPORTING-BUGS
%files -n %{kname}-source-latest
%endif
%if %build_doc
%files -n %{kname}-doc
%doc linux-%{tar_ver}/Documentation/*
%endif
%if %{build_perf}
%files -n perf
%{_bindir}/perf
%ifarch x86_64
%{_bindir}/perf-read-vdso32
%endif
%{_bindir}/trace
2013-11-16 00:27:01 +04:00
%dir %{_prefix}/libexec/perf-core
%dir %{_libdir}/traceevent
%dir %{_libdir}/traceevent/plugins
2016-01-06 17:21:52 +03:00
%{_libdir}/libperf-gtk.so
%{_libdir}/traceevent/plugins/*
2013-11-16 00:27:01 +04:00
%{_prefix}/libexec/perf-core/*
%{_mandir}/man[1-8]/perf*
%{_sysconfdir}/bash_completion.d/perf
%{_datadir}/perf-core/strace/groups/file
%{_datadir}/doc/perf-tip/*.txt
2013-11-16 00:27:01 +04:00
%endif
%if %{build_cpupower}
%files -n cpupower -f cpupower.lang
%{_bindir}/cpupower
%{_bindir}/cpupower-start.sh
2013-11-16 00:27:01 +04:00
%{_libdir}/libcpupower.so.0
%{_libdir}/libcpupower.so.0.0.1
2013-11-16 00:27:01 +04:00
%{_unitdir}/cpupower.service
%{_unitdir}/cpupower.path
2013-11-16 00:27:01 +04:00
%{_mandir}/man[1-8]/cpupower*
%config(noreplace) %{_sysconfdir}/sysconfig/cpupower
%files -n cpupower-devel
%{_libdir}/libcpupower.so
%{_includedir}/cpufreq.h
%endif