mirror of
https://abf.rosa.ru/djam/kernel-5.15.git
synced 2025-02-23 18:42:55 +00:00
1276 lines
38 KiB
RPMSpec
1276 lines
38 KiB
RPMSpec
%define kernelversion 4
|
|
%define patchlevel 20
|
|
# sublevel is now used for -stable patches
|
|
%define sublevel 12
|
|
|
|
# Release number. Increase this before a rebuild.
|
|
%define rpmrel 1
|
|
|
|
# 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
|
|
%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}
|
|
%define buildrel %{kversion}-%{buildrpmrel}
|
|
|
|
# Having different top-level names for packages means that you have to remove
|
|
# them by hand :(
|
|
%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}
|
|
############################################################################
|
|
|
|
# Build defines
|
|
%define build_doc 1
|
|
%define build_source 0
|
|
%define build_devel 1
|
|
%define build_debug 0
|
|
|
|
# Build kernel-headers package
|
|
%define build_headers 1
|
|
|
|
# Build nrj desktop kernels
|
|
%define build_nrj_desktop 1
|
|
|
|
# build perf and cpupower tools
|
|
%define build_perf 1
|
|
%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}
|
|
|
|
%{?_with_nrj_desktop: %global build_nrj_desktop 1}
|
|
|
|
%{?_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
|
|
|
|
############################################################
|
|
### Linker start1 > Check point to build for omv or rosa ###
|
|
############################################################
|
|
%if %(if [ -z "$CC" ] ; then echo 0; else echo 1; fi)
|
|
%define kmake %make CC="$CC"
|
|
%else
|
|
%define kmake %make
|
|
%endif
|
|
# there are places where parallel make don't work
|
|
%define smake make
|
|
|
|
###########################################################
|
|
### Linker end1 > Check point to build for omv or rosa ###
|
|
###########################################################
|
|
|
|
# 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
|
|
Name: %{kname}
|
|
Version: %{kversion}
|
|
Release: %{rpmrel}
|
|
License: GPLv2
|
|
Group: System/Kernel and hardware
|
|
ExclusiveArch: %{ix86} x86_64
|
|
URL: http://www.kernel.org
|
|
|
|
####################################################################
|
|
#
|
|
# Sources
|
|
#
|
|
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
|
|
|
|
# This is for disabling *config, mrproper, prepare, scripts on -devel rpms
|
|
Source2: disable-mrproper-prepare-scripts-configs-in-devel-rpms.patch
|
|
|
|
# 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
|
|
|
|
# Cpupower: the service, the config, etc.
|
|
Source50: cpupower.service
|
|
Source51: cpupower.config
|
|
Source52: cpupower-start.sh
|
|
Source53: cpupower.path
|
|
|
|
Source80: kernel.rpmlintrc
|
|
####################################################################
|
|
|
|
# Patches
|
|
|
|
# The patch to make kernel x.y.z from x.y.0.
|
|
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
|
|
|
|
# ROSA-specific patches
|
|
# 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
|
|
|
|
# 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
|
|
|
|
# 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
|
|
####################################################################
|
|
|
|
# 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 \
|
|
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
|
|
%define requires4 sysfsutils >= 2.1.0-12
|
|
%define requires5 linux-firmware >= 20160318
|
|
|
|
%define kprovides1 %{kname} = %{kverrel}
|
|
%define kprovides2 kernel = %{tar_ver}
|
|
%define kprovides3 alsa = 1.0.27
|
|
|
|
Autoreqprov: no
|
|
|
|
BuildRequires: bc
|
|
BuildRequires: binutils
|
|
BuildRequires: gcc
|
|
# For power tools
|
|
BuildRequires: pkgconfig(ncurses)
|
|
|
|
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
|
|
BuildRequires: binutils-devel
|
|
BuildRequires: elfutils-devel
|
|
BuildRequires: libunwind-devel
|
|
BuildRequires: newt-devel
|
|
BuildRequires: perl-devel
|
|
BuildRequires: python-devel
|
|
BuildRequires: xmlto
|
|
BuildRequires: zlib-devel
|
|
BuildRequires: pkgconfig(libcrypto)
|
|
%endif
|
|
|
|
# might be useful too:
|
|
Suggests: microcode
|
|
|
|
|
|
%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 \
|
|
Provides: should-restart = system \
|
|
Suggests: crda \
|
|
%if %build_devel \
|
|
Requires: %{kname}-%{1}-devel-%{buildrel} \
|
|
Requires(post): %{kname}-%{1}-devel-%{buildrel} \
|
|
%endif \
|
|
%ifarch %{ix86} \
|
|
Conflicts: arch(x86_64) \
|
|
%endif \
|
|
Summary: %{expand:%{summary_%(echo %{1} | sed -e "s/-/_/g")}} \
|
|
Group: System/Kernel and hardware \
|
|
%description -n %{kname}-%{1}-%{buildrel} \
|
|
%common_desc_kernel %{expand:%{info_%(echo %{1} | sed -e "s/-/_/g")}} \
|
|
%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} \
|
|
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... \
|
|
\
|
|
%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... \
|
|
\
|
|
%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 \
|
|
\
|
|
%if %build_devel \
|
|
%files -n %{kname}-%{1}-devel-%{buildrel} -f kernel_devel_files.%{1} \
|
|
%files -n %{kname}-%{1}-%{kernelversion}.%{patchlevel}-devel-latest \
|
|
%endif \
|
|
\
|
|
%if %build_debug \
|
|
%files -n %{kname}-%{1}-%{buildrel}-debuginfo -f kernel_debug_files.%{1} \
|
|
%endif
|
|
|
|
%if %build_nrj_desktop
|
|
%define summary_nrj_desktop A general-purpose Linux Kernel
|
|
%define info_nrj_desktop This is a general-purpose kernel.
|
|
%mkflavour nrj-desktop
|
|
%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}
|
|
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
|
|
custom kernel that is better tuned to your particular hardware.
|
|
|
|
If you only want the files needed to build third-party (dkms-*,...)
|
|
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
|
|
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
|
|
|
|
%description -n cpupower
|
|
The cpupower tools.
|
|
|
|
%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 || :
|
|
fi
|
|
|
|
%preun -n cpupower
|
|
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 || :
|
|
fi
|
|
|
|
%package -n cpupower-devel
|
|
Version: %{kversion}
|
|
Release: %{rpmrel}
|
|
Summary: Development files for cpupower
|
|
Group: Development/Kernel
|
|
Requires: cpupower = %{kversion}-%{rpmrel}
|
|
Conflicts: %{_lib}cpufreq-devel
|
|
|
|
%description -n cpupower-devel
|
|
This package contains the development files for cpupower.
|
|
%endif
|
|
|
|
%if %{build_headers}
|
|
%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
|
|
%endif
|
|
|
|
#
|
|
# End packages - here begins build stage
|
|
#
|
|
%prep
|
|
%setup -q -n %top_dir_name -c
|
|
cd %src_dir
|
|
|
|
%apply_patches
|
|
|
|
%ifarch %{ix86}
|
|
patch -p1 --fuzz=0 < %{SOURCE91}
|
|
%endif
|
|
|
|
%if %{enhanced_security}
|
|
patch -p1 --fuzz=0 < %{SOURCE701}
|
|
%endif
|
|
|
|
#
|
|
# Setup Begin
|
|
#
|
|
|
|
# Configs
|
|
cp %{SOURCE110} .
|
|
|
|
%if %build_debug
|
|
sed -i 's/# CONFIG_DEBUG_INFO is not set/CONFIG_DEBUG_INFO=y\nCONFIG_DEBUG_INFO_DWARF4=y\nCONFIG_GDB_SCRIPTS=y/' \
|
|
./kernel-%{arch_suffix}.config
|
|
%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} .
|
|
|
|
CONFIG_DIR=arch/x86/configs
|
|
mkdir -p "${CONFIG_DIR}"
|
|
|
|
for flav in ${FLAVOURS}; do
|
|
cfg_file=arch/x86/configs/%{arch_suffix}_defconfig-${flav}
|
|
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
|
|
done
|
|
|
|
# Remove the no longer needed parts of the config files
|
|
rm -f ./kernel*.config
|
|
|
|
# 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
|
|
|
|
%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"
|
|
|
|
%smake -s mrproper
|
|
|
|
if [ -z "$name" ]; then
|
|
cp ${config_dir}/%{arch_suffix}_defconfig-nrj-desktop .config
|
|
else
|
|
cp ${config_dir}/%{arch_suffix}_defconfig-$name .config
|
|
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
|
|
|
|
# modules
|
|
install -d %{temp_modules}/$KernelVer
|
|
%smake INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=$KernelVer modules_install
|
|
|
|
# headers
|
|
%if %{build_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
|
|
%endif
|
|
|
|
# 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
|
|
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/
|
|
cp -fR include $TempDevelRoot
|
|
# ln -s ../generated/uapi/linux/version.h $TempDevelRoot/include/linux/version.h
|
|
cp -fR scripts $TempDevelRoot
|
|
cp -fR kernel/bounds.c $TempDevelRoot/kernel
|
|
cp -fR kernel/time/timeconst.bc $TempDevelRoot/kernel/time
|
|
cp -fR tools $TempDevelRoot/
|
|
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/
|
|
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
|
|
|
|
# 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/
|
|
|
|
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
|
|
rm -rf $TempDevelRoot/arch/$i
|
|
done
|
|
|
|
rm -rf $TempDevelRoot/arch/arm*
|
|
rm -rf $TempDevelRoot/include/kvm/arm*
|
|
rm -rf $TempDevelRoot/include/soc
|
|
|
|
# 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
|
|
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
|
|
$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
|
|
$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
|
|
EOF
|
|
|
|
|
|
### Create -devel Post script on the fly
|
|
cat > $kernel_devel_files-post <<EOF
|
|
/usr/sbin/dkms_autoinstaller start $KernelVer
|
|
EOF
|
|
|
|
|
|
### Create -devel Preun script on the fly
|
|
cat > $kernel_devel_files-preun <<EOF
|
|
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; }')
|
|
/usr/sbin/dkms --rpm_safe_upgrade uninstall -m \$mod -v \$ver -k ${KernelVer} || true
|
|
done
|
|
|
|
# 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
|
|
# too.
|
|
if ! test -f /boot/vmlinuz-${KernelVer}; then
|
|
rm -f /boot/initrd-${KernelVer}.img
|
|
rm -f /boot/initrd-${KernelVer}_old.img
|
|
fi
|
|
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
|
|
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}
|
|
|
|
kernel_files=../kernel_files.$kernel_flavour
|
|
|
|
ker="vmlinuz"
|
|
|
|
### 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.*
|
|
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.
|
|
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
|
|
|
|
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
|
|
rm -f vmlinuz-$kernel_flavour
|
|
fi
|
|
fi
|
|
if [ -L initrd-$kernel_flavour.img ]; then
|
|
if [ "\$(readlink initrd-$kernel_flavour.img)" = "initrd-$KernelVer.img" ]; then
|
|
rm -f initrd-$kernel_flavour.img
|
|
fi
|
|
fi
|
|
|
|
# File triggers from grub packages will handle this.
|
|
#/usr/sbin/update-grub2
|
|
|
|
popd > /dev/null
|
|
exit 0
|
|
EOF
|
|
|
|
### Create kernel Postun script on the fly
|
|
cat > $kernel_files-postun <<EOF
|
|
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/.
|
|
rm -rf /lib/modules/${KernelVer}/kernel/
|
|
rm -rf /lib/modules/${KernelVer}/modules*
|
|
# Remove /lib/modules/<...>/ if it is empty (-devel uses it too).
|
|
find /lib/modules/${KernelVer} -maxdepth 0 -empty -exec rm -rf {} \; || true
|
|
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
|
|
|
|
# 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 ###
|
|
############################################################
|
|
%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} NO_GTK2=1 all
|
|
%smake -C tools/perf -s prefix=%{_prefix} NO_GTK2=1 man
|
|
%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
|
|
%endif
|
|
############################################################
|
|
### Linker end3 > Check point to build for omv or rosa ###
|
|
############################################################
|
|
|
|
|
|
# We don't make to repeat the depend code at the install phase
|
|
%if %build_source
|
|
PrepareKernel "" %{buildrpmrel}-custom
|
|
%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
|
|
rm -rf %{target_source}/arch/$i
|
|
done
|
|
rm -rf %{target_source}/include/kvm/arm*
|
|
|
|
# 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
|
|
|
|
# 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
|
|
|
|
# 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
|
|
|
|
# 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
|
|
|
|
# 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
|
|
%endif
|
|
|
|
############################################################
|
|
### Linker start4 > Check point to build for omv or rosa ###
|
|
############################################################
|
|
%if %{build_cpupower}
|
|
make -C tools/power/cpupower DESTDIR=%{buildroot} libdir=%{_libdir} mandir=%{_mandir} CPUFREQ_BENCH=false install
|
|
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
|
|
install -m644 %{SOURCE51} %{buildroot}%{_sysconfdir}/sysconfig/cpupower
|
|
install -m755 %{SOURCE52} %{buildroot}%{_bindir}/cpupower-start.sh
|
|
%endif
|
|
############################################################
|
|
### Linker start4 > Check point to build for omv or rosa ###
|
|
############################################################
|
|
|
|
###
|
|
### 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
|
|
%{_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
|
|
%{_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
|
|
%{_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
|
|
%dir %{_prefix}/libexec/perf-core
|
|
%dir %{_libdir}/traceevent
|
|
%dir %{_libdir}/traceevent/plugins
|
|
%{_libdir}/traceevent/plugins/*
|
|
%{_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
|
|
/usr/lib/perf/examples/bpf/*
|
|
/usr/lib/perf/include/bpf/*
|
|
%endif
|
|
|
|
%if %{build_cpupower}
|
|
%files -n cpupower -f cpupower.lang
|
|
%{_bindir}/cpupower
|
|
%{_bindir}/cpupower-start.sh
|
|
%{_libdir}/libcpupower.so.0
|
|
%{_libdir}/libcpupower.so.0.0.1
|
|
%{_unitdir}/cpupower.service
|
|
%{_unitdir}/cpupower.path
|
|
%{_mandir}/man[1-8]/cpupower*
|
|
%config(noreplace) %{_sysconfdir}/sysconfig/cpupower
|
|
|
|
%files -n cpupower-devel
|
|
%{_libdir}/libcpupower.so
|
|
%{_includedir}/cpufreq.h
|
|
%endif
|