# upstream versioning %define kernelversion 5 %define patchlevel 8 # sublevel is now used for -stable patches %define sublevel 5 # kernel Makefile extraversion is substituted by # kpatch wich are either 0 (empty), rc (kpatch) %define kpatch 0 # this is the releaseversion %define mgarelease 1 # This is only to make life easier for people that creates derivated kernels # a.k.a name it kernel-tmb :) %define kname kernel-linus %define rpmtag %{distsuffix}%{mgaver} %if %kpatch %define rpmrel %mkrel 0.%{kpatch}.%{mgarelease} %else %define rpmrel %mkrel %{mgarelease} %endif # theese two never change, they are used to fool rpm/urpmi/smart %define fakever 1 %define fakerel %mkrel 1 # When we are using a pre/rc patch, the tarball is a sublevel -1 %if %kpatch %if %sublevel %define tar_ver %{kernelversion}.%{patchlevel} %else %define tar_ver %{kernelversion}.%(expr %{patchlevel} - 1) %endif %else %define tar_ver %{kernelversion}.%{patchlevel} %endif %define kversion %{kernelversion}.%{patchlevel}.%{sublevel} %define kverrel %{kversion}-%{rpmrel} # used for not making too long names for rpms or search paths %if %kpatch %define buildrpmrel 0.%{kpatch}.%{mgarelease}%{rpmtag} %else %define buildrpmrel %{mgarelease}%{rpmtag} %endif %define buildrel %{kversion}-%{buildrpmrel} %define klinus_notice NOTE: This kernel has no Mageia patches and no third-party drivers. # having different top level names for packges means that you have to remove them by hard :( %define top_dir_name %{kname}-%{_arch} %define build_dir ${RPM_BUILD_DIR}/%{top_dir_name} %define src_dir %{build_dir}/linux-%{tar_ver} # disable useless debug rpms... %global debug_package %{nil} %global _enable_debug_packages %{nil} %global __debug_package %{nil} %global __debug_install_post %{nil} %global _build_id_links none # no bytecompiling wanted as it breaks build on selftests we dont even ship # for older buildsystems %global _python_bytecompile_build 0 # for systems with >= rpm-mageia-setup-2.29-1.mga7 %global __brp_python_bytecompile %nil # build defines %define build_doc 1 %define build_source 1 %define build_devel 1 %define build_kernel 1 %define distro_branch %(perl -pe '/(\\d+)\\.(\\d)\\.?(\\d)?/; $_="$1.$2"' /etc/mageia-release) # End of user definitions %{?_without_kernel: %global build_kernel 0} %{?_without_doc: %global build_doc 0} %{?_without_source: %global build_source 0} %{?_without_devel: %global build_devel 0} %{?_with_kernel: %global build_kernel 1} %{?_with_doc: %global build_doc 1} %{?_with_source: %global build_source 1} %{?_with_devel: %global build_devel 1} %if %(if [ -z "$CC" ] ; then echo 0; else echo 1; fi) %define kmake %make_build CC="$CC" %else %define kmake %make_build %endif # there are places where parallel make doesn't work %define smake make # 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") # Aliases for amd64 builds (better make source links?) %define target_cpu %(echo %{_target_cpu} | sed -e "s/amd64/x86_64/") %define target_arch %(echo %{_arch} | sed -e "s/amd64/x86_64/" -e 's/arm.*/arm/') # src.rpm description Summary: The Linux kernel (the core of the Linux operating system) Name: %{kname} Version: %{kversion} Release: %{rpmrel} License: GPLv2 Group: System/Kernel and hardware ExclusiveArch: %{ix86} x86_64 %{arm} ExclusiveOS: Linux URL: https://www.kernel.org/ #################################################################### # # Sources # ### This is for full SRC RPM 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 mrproper and other targets on -devel rpms Source2: disable-mrproper-in-devel-rpms.patch Source4: README.kernel-sources # Kernel defconfigs Source10: update-defconfigs.sh Source20: i386_defconfig Source21: x86_64_defconfig Source22: arm_defconfig Source23: arm64_defconfig #################################################################### # # Patches # # Patch0 to Patch100 are for core kernel upgrades. # # Pre linus patch: https://cdn.kernel.org/pub/linux/kernel/v(kernelversion).(patchlevel)/testing %if %sublevel Patch1: https://cdn.kernel.org/pub/linux/kernel/v%{kernelversion}.x/patch-%{kernelversion}.%{patchlevel}.%{sublevel}.xz %endif %if %kpatch # (tmb) Created with: # wget https://git.kernel.org/torvalds/p/v5.1-rc6/v5.0 -O patch-5.1-rc6 # xz -6e patch-5.1-rc6 Patch2: patch-%{kernelversion}.%{patchlevel}-%{kpatch}.xz %endif # python3 Patch50: linux-5.5-python3.patch # revert as it breaks mageia kernel build process, no real functional change Patch55: revert-objtool-silence-build-output.patch # critical fixes #END #################################################################### # global defines Autoreqprov: no BuildRequires: gcc BuildRequires: kmod >= 12-2 BuildRequires: bc BuildRequires: binutils >= 1:2.25.1 # for orc unwinder BuildRequires: elfutils-devel # for crypto stuff BuildRequires: pkgconfig(openssl) # since 4.16 BuildRequires: bison BuildRequires: flex %description Source package to build the Linux kernel. %{klinus_notice} # # kernel: Symmetric MultiProcessing kernel # %if %build_kernel %package -n %{kname}-%{buildrel} Version: %{fakever} Release: %{fakerel} %ifarch %{ix86} Summary: Linux Kernel for desktop use with i586 & 4GB RAM %else %ifarch %{arm} Summary: Linux Kernel for Arm machines based on Kirkwood %else Summary: Linux Kernel for desktop use with %{_arch} %endif %endif Group: System/Kernel and hardware Provides: should-restart = system Provides: installonlypkg(kernel) Provides: kernel = %{tar_ver} Provides: alsa Requires: bootloader-utils >= 1.16-1 Requires: dracut >= 046-2 Requires: kmod >= 12-2 Requires: sysfsutils >= 2.1.0-16 Requires: kernel-firmware >= 20170101-1 # conflict dkms packages that dont support kernel-5.6 Conflicts: dkms-broadcom-wl < 20200316-1 Conflicts: dkms-nvidia-current < 430.64-8 Conflicts: dkms-nvidia390 < 390.132-6 Conflicts: dkms-nvidia340 < 340.108-6 Conflicts: dkms-nvidia304 < 304.137-3 Conflicts: dkms-virtualbox < 6.0.14-2 %if %mgaversion >= 8 Conflicts: dkms-virtualbox < 6.1.6-1 %else Conflicts: dkms-virtualbox < 6.0.20-1 %endif Conflicts: dkms-xtables-addons < 3.9-1 # (tmb) conflict older btrfs-progs to get the new in same transaction and in initrd Conflicts: btrfs-progs < 5.1.1-1 # (tmb) conflict too old radeon-firmware to get the uvd firmwares in initrd Conflicts: radeon-firmware < 20200316-1 # (tmb) conflict old firmware to get the firmwares in initrd Conflicts: kernel-firmware-nonfree < 20200316-1 # (tmb) conflict old microcode to get updated ones in initrd for early loading Conflicts: microcode < 0.20190514-1 # (tmb) conflict old theme to get mga5 theme in initrd Conflicts: mageia-gfxboot-theme < 4.5.14.10-1 # (tmb) conflict too old grub2(-efi) Conflicts: grub2 < 2.02.0-15 Conflicts: grub2-efi < 2.02.0-15 # (tmb) conflict too old efibootmgr Conflicts: efibootmgr < 16-3 # (tmb) conflict for vmmouse breakage (for mga5, mga#16954) Conflicts: x11-driver-input-vmmouse < 13.1.0-1 %ifarch %{ix86} Conflicts: arch(x86_64) %endif %description -n %{kname}-%{buildrel} %ifarch %{ix86} This kernel is compiled for desktop use, single or multiple i586 processor(s)/core(s) and less than 4GB RAM, using HZ_1000, voluntary preempt, CFS cpu scheduler and cfq i/o scheduler. 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. %else %ifarch %{arm} This kernel is compiled for Arm Kirkwood boxes. It will run on openrd boards. It's configured using HZ_100, preempt, CFS cpu scheduler and cfq i/o scheduler. 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. %else This kernel is compiled for desktop use, single or multiple %{_arch} processor(s)/core(s), using HZ_1000, voluntary preempt, CFS cpu scheduler and cfq i/o scheduler. 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. %endif %endif %{klinus_notice} %endif # build_kernel # # kernel-source: kernel sources # %if %build_source %package -n %{kname}-source-%{buildrel} Version: %{fakever} Release: %{fakerel} Provides: %{kname}-source, kernel-source = %{kverrel} Provides: %{kname}-source-%{kernelversion}.%{patchlevel} Requires: glibc-devel, ncurses-devel, make, gcc, perl, diffutils Summary: The source code for the Linux kernel Group: Development/Kernel Autoreqprov: no Buildarch: noarch %description -n %{kname}-source-%{buildrel} The %{kname}-source package contains the source code files for the Linux kernel. Theese 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 3rdparty (nVidia, Ati, dkms-*,...) drivers against, install the *-devel-* rpm that is matching your kernel. %{klinus_notice} %endif #build_source # # kernel-devel: stripped kernel sources # %if %build_devel %package -n %{kname}-devel-%{buildrel} Version: %{fakever} Release: %{fakerel} Provides: kernel-devel = %{kverrel} Summary: The %{kname} devel files for 3rdparty modules build Group: Development/Kernel Autoreqprov: no Requires: glibc-devel, ncurses-devel, make, gcc, perl Requires: pkgconfig(libelf) %ifarch %{ix86} Conflicts: arch(x86_64) %endif %description -n %{kname}-devel-%{buildrel} This package contains the kernel-devel files that should be enough to build 3rdparty drivers against for use with the %{kname}-%{buildrel}. If you want to build your own kernel, you need to install the full %{kname}-source-%{buildrel} rpm. %{klinus_notice} %endif #build_devel # # 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 kernel source Group: Documentation Buildarch: noarch %description -n %{kname}-doc This package contains documentation files form the kernel 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. %{klinus_notice} %endif #build_doc # # kernel-latest: virtual rpm # %if %build_kernel %package -n %{kname}-latest Version: %{kversion} Release: %{rpmrel} Summary: Virtual rpm for latest %{kname} Group: System/Kernel and hardware Requires: %{kname}-%{buildrel} %ifarch %{ix86} Conflicts: arch(x86_64) %endif %description -n %{kname}-latest This package is a virtual rpm that aims to make sure you always have the latest %{kname} installed... %{klinus_notice} %endif #build_kernel # # kernel-source-latest: virtual rpm # %if %build_source %package -n %{kname}-source-latest Version: %{kversion} Release: %{rpmrel} Summary: Virtual rpm for latest %{kname}-source Group: System/Kernel and hardware 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... %{klinus_notice} %endif #build_source # # kernel-devel-latest: virtual rpm # %if %build_devel %package -n %{kname}-devel-latest Version: %{kversion} Release: %{rpmrel} Summary: Virtual rpm for latest %{kname}-devel Group: System/Kernel and hardware Requires: %{kname}-devel-%{buildrel} %ifarch %{ix86} Conflicts: arch(x86_64) %endif %description -n %{kname}-devel-latest This package is a virtual rpm that aims to make sure you always have the latest %{kname}-devel installed... %{klinus_notice} %endif #build_devel # # End packages - here begins build stage # %prep %setup -q -n %top_dir_name -c pushd %src_dir %if %sublevel %patch1 -p1 %endif %if %kpatch %patch2 -p1 %endif # python 3 %patch50 -p1 # revert build breakage %patch55 -p1 # critical fixes popd # PATCH END # # Setup Begin # # Install defconfigs... install %{SOURCE20} %{build_dir}/linux-%{tar_ver}/arch/x86/configs/ install %{SOURCE21} %{build_dir}/linux-%{tar_ver}/arch/x86/configs/ install %{SOURCE22} %{build_dir}/linux-%{tar_ver}/arch/arm/configs/ install %{SOURCE23} %{build_dir}/linux-%{tar_ver}/arch/arm64/configs/ # make sure the kernel has the sublevel we know it has... LC_ALL=C perl -p -i -e "s/^SUBLEVEL.*/SUBLEVEL = %{sublevel}/" linux-%{tar_ver}/Makefile %build # Common target directories %define _bootdir /boot %define _modulesdir /lib/modules %define _kerneldir /usr/src/%{kname}-%{buildrel} %define _develdir /usr/src/%{kname}-devel-%{buildrel} # Directories definition needed for building %define temp_root %{build_dir}/temp-root %define temp_boot %{temp_root}%{_bootdir} %define temp_modules %{temp_root}%{_modulesdir} %define temp_source %{temp_root}%{_kerneldir} %define temp_devel %{temp_root}%{_develdir} # Create a simulacro of buildroot rm -rf %{temp_root} install -d %{temp_root} # make sure we are in the directory cd %{src_dir} # fix missing exec flag on file introduced in 4.14.10-rc1 chmod 755 tools/objtool/sync-check.sh # make sure EXTRAVERSION says what we want it to say LC_ALL=C perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{buildrpmrel}/" Makefile # Prepare the kernel %smake -s mrproper %ifarch %{ix86} x86_64 cp arch/x86/configs/%{target_arch}_defconfig .config %else cp arch/%{target_arch}/configs/%{target_arch}_defconfig .config %endif %smake ARCH=%{_arch} oldconfig # Build the kernel %kmake ARCH=%{_arch} -s all # Install kernel install -d %{temp_boot} install -m 644 System.map %{temp_boot}/System.map-%{buildrel} install -m 644 .config %{temp_boot}/config-%{buildrel} %ifarch %{arm} cp -f arch/arm/boot/zImage %{temp_boot}/vmlinuz-%{buildrel} install -d %{temp_root}/usr/lib/linux-%{buildrel}/ for d in arch/arm/boot/dts/*.dtb; do \ install -D -m644 $d %{temp_root}/usr/lib/linux-%{buildrel}/$(basename $d); \ done %else cp -f arch/%{target_arch}/boot/bzImage %{temp_boot}/vmlinuz-%{buildrel} %endif # Install modules install -d %{temp_modules}/%{buildrel} %smake ARCH=%{_arch} INSTALL_MOD_PATH=%{temp_root} KERNELRELEASE=%{buildrel} modules_install # Save devel tree %if %build_devel mkdir -p %{temp_devel} for i in $(find . -name 'Makefile*'); do cp -R --parents $i %{temp_devel};done for i in $(find . -name 'Kconfig*' -o -name 'Kbuild*' -o -name config.mk); do cp -R --parents $i %{temp_devel};done cp -fR include %{temp_devel} cp -fR scripts %{temp_devel} cp -fR tools/include %{temp_devel}/tools/ # needed for selinux cp -R --parents security/selinux/include/*.h %{temp_devel} %ifarch %{arm} cp -fR arch/%{target_arch}/tools %{temp_devel}/arch/%{target_arch}/ cp -fR arch/%{target_arch}/kernel/signal.h %{temp_devel}/arch/%{target_arch}/kernel/ %endif %ifarch %{ix86} x86_64 cp -fR arch/x86/boot/{ctype.h,string.{c,h}} %{temp_devel}/arch/x86/boot/ cp -fR arch/x86/kernel/asm-offsets.{c,s} %{temp_devel}/arch/x86/kernel/ cp -fR arch/x86/kernel/asm-offsets_{32,64}.c %{temp_devel}/arch/x86/kernel/ cp -fR arch/x86/purgatory/* %{temp_devel}/arch/x86/purgatory/ cp -fR arch/x86/entry/syscalls/syscall* %{temp_devel}/arch/x86/entry/syscalls/ cp -fR arch/x86/include %{temp_devel}/arch/x86/ cp -fR arch/x86/tools %{temp_devel}/arch/x86/ %else cp -fR arch/%{target_arch}/kernel/asm-offsets.{c,s} %{temp_devel}/arch/%{target_arch}/kernel/ for f in $(find arch/%{target_arch} -name include); do cp -fR --parents $f %{temp_devel}; done %endif %ifarch x86_64 # orc unwinder needs theese cp -fR tools/build/Build{,.include} %{temp_devel}/tools/build cp -fR tools/build/fixdep.c %{temp_devel}/tools/build cp -fR tools/lib/{rbtree.c,ctype.c,str_error_r.c,string.c} %{temp_devel}/tools/lib cp -fR tools/lib/subcmd/* %{temp_devel}/tools/lib/subcmd cp -fR tools/objtool/* %{temp_devel}/tools/objtool cp -fR tools/scripts/utilities.mak %{temp_devel}/tools/scripts mkdir -p %{temp_devel}/tools/arch/x86/tools cp -fR tools/arch/x86/tools/gen-insn-attr-x86.awk %{temp_devel}/tools/arch/x86/tools/ mkdir -p %{temp_devel}/tools/arch/x86/lib cp -fR tools/arch/x86/lib/{inat.c,insn.c,x86-opcode-map.txt} %{temp_devel}/tools/arch/x86/lib/ mkdir -p %{temp_devel}/tools/arch/x86/include/asm cp -fR tools/arch/x86/include/asm/{emulate_prefix.h,inat.h,inat_types.h,insn.h,orc_types.h} %{temp_devel}/tools/arch/x86/include/asm/ %endif # Needed for generation of kernel/bounds.s cp -fR kernel/bounds.c %{temp_devel}/kernel/ # needed by include/generated/timeconst.h cp -fR kernel/time/timeconst.bc %{temp_devel}/kernel/time/ # ship config and symvers cp -fR .config Module.symvers %{temp_devel} # Needed for truecrypt build (Danny) cp -fR drivers/md/dm.h %{temp_devel}/drivers/md/ # Check and clean the -devel tree pushd %{temp_devel} >/dev/null %smake ARCH=%{_arch} -s prepare scripts clean rm -f .config.old popd >/dev/null # Disable mrproper and other targets patch -p1 -d %{temp_devel} -i %{SOURCE2} # Fix permissions chmod -R a+rX %{temp_devel} %endif # build_devel #make sure we are in the directory cd %src_dir # kernel-source is shipped as an unprepared tree %smake ARCH=%{_arch} -s mrproper ### ### Install ### %install install -m 644 %{SOURCE4} . cd %src_dir # Directories definition needed for installing %define target_source %{buildroot}/%{_kerneldir} %define target_boot %{buildroot}%{_bootdir} %define target_modules %{buildroot}%{_modulesdir} %define target_devel %{buildroot}%{_develdir} # 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 csky frv hexagon h8300 ia64 m32r mips \ microblaze m68k m68knommu metag mn10300 nds32 nios2 openrisc parisc powerpc ppc \ riscv s390 score sh sh64 sparc tile unicore32 v850 xtensa; do rm -rf %{target_source}/arch/$i %if %build_devel rm -rf %{target_devel}/arch/$i %endif done %ifnarch %{arm} rm -rf %{target_source}/arch/arm* rm -rf %{target_source}/include/kvm/arm* rm -rf %{target_source}/include/soc rm -rf %{target_source}/tools/arch/arm* %endif # remove arch files based on target arch in -devel rpms %if %build_devel %ifnarch %{ix86} x86_64 rm -rf %{target_devel}/arch/x86 %endif %ifnarch %{arm} rm -rf %{target_devel}/arch/arm rm -rf %{target_devel}/arch/arm64 rm -rf %{target_devel}/include/kvm/arm* rm -rf %{target_devel}/include/soc %endif %endif # other misc files rm -f %{target_source}/{.clang-format,.config.old,.config.cmd,.tmp_gas_check,.mailmap,.missing-syscalls.d,arch/.gitignore,.gitattributes,.get_maintainer.ignore,.cocciconfig} rm -rf %{target_source}/.tmp_depmod/ # clean tools tree pushd %{target_source} %smake -C tools clean %smake -C tools/build clean %smake -C tools/build/feature clean popd # nuke last as it gets re-created rm -f %{target_source}/.cache.mk #endif %build_source %endif # compressing modules find %{target_modules} -name "*.ko" | %kxargs xz -6 # 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 for i in %{target_modules}/*; do rm -f $i/build $i/source done # sniff, if we gzipped all the modules, we change the stamp :( # we really need the depmod -ae here pushd %{target_modules} 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 module.description for $i" modules=`find . -name "*.ko.xz"` echo $modules | xargs /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 ### ### 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} ### ### Scripts ### ### kernel %if %build_kernel %post -n %{kname}-%{buildrel} /sbin/installkernel -L %{buildrel} if [ -d /usr/src/%{kname}-devel-%{buildrel} ]; then ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source fi pushd /boot > /dev/null ln -sf vmlinuz-%{buildrel} vmlinuz-linus ln -sf initrd-%{buildrel}.img initrd-linus.img popd > /dev/null %posttrans -n %{kname}-%{buildrel} if [ -x /usr/sbin/dkms_autoinstaller -a -d /usr/src/%{kname}-devel-%{buildrel} ]; then /usr/sbin/dkms_autoinstaller start %{buildrel} fi %postun -n %{kname}-%{buildrel} pushd /boot > /dev/null if [ -L vmlinuz-linus ]; then if [ "$(readlink vmlinuz-linus)" = "vmlinuz-%{buildrel}" ]; then rm -f vmlinuz-linus fi fi if [ -L initrd-linus.img ]; then if [ "$(readlink initrd-linus.img)" = "initrd-%{buildrel}.img" ]; then rm -f initrd-linus.img fi fi popd > /dev/null /sbin/kernel_remove_initrd %{buildrel} /sbin/installkernel -R %{buildrel} rm -rf /lib/modules/%{buildrel} > /dev/null if [ -d /var/lib/dkms ]; then rm -f /var/lib/dkms/*/kernel-%{buildrel}-%{_target_cpu} >/dev/null rm -rf /var/lib/dkms/*/*/%{buildrel} >/dev/null fi %endif # build_kernel ### kernel-devel %if %build_devel %post -n %{kname}-devel-%{buildrel} # place /build and /source symlinks in place. if [ -d /lib/modules/%{buildrel} ]; then ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/build ln -sf /usr/src/%{kname}-devel-%{buildrel} /lib/modules/%{buildrel}/source fi %preun -n %{kname}-devel-%{buildrel} # we need to delete /{build,source} at uninstall if [ -L /lib/modules/%{buildrel}/build ]; then rm -f /lib/modules/%{buildrel}/build fi if [ -L /lib/modules/%{buildrel}/source ]; then rm -f /lib/modules/%{buildrel}/source fi exit 0 %endif #build_devel ### ### file lists ### # kernel %if %build_kernel %files -n %{kname}-%{buildrel} %{_bootdir}/config-%{buildrel} %{_bootdir}/vmlinuz-%{buildrel} %{_bootdir}/System.map-%{buildrel} %dir %{_modulesdir}/%{buildrel}/ %{_modulesdir}/%{buildrel}/kernel %{_modulesdir}/%{buildrel}/modules.* %doc README.kernel-sources %ifarch %arm %dir /usr/lib/linux-%{buildrel} /usr/lib/linux-%{buildrel}/*.dtb %endif %endif # build_kernel # kernel-source %if %build_source %files -n %{kname}-source-%{buildrel} %doc %{_kerneldir}/LICENSES %dir %{_kerneldir} %dir %{_kerneldir}/arch %dir %{_kerneldir}/include %{_kerneldir}/.gitignore %{_kerneldir}/COPYING %{_kerneldir}/CREDITS %{_kerneldir}/Documentation %{_kerneldir}/Kbuild %{_kerneldir}/Kconfig %{_kerneldir}/MAINTAINERS %{_kerneldir}/Makefile %{_kerneldir}/README %{_kerneldir}/arch/Kconfig %ifarch %arm %{_kerneldir}/arch/arm %{_kerneldir}/arch/arm64 %endif %{_kerneldir}/arch/x86 %{_kerneldir}/arch/um %{_kerneldir}/block %{_kerneldir}/certs %{_kerneldir}/crypto %{_kerneldir}/drivers %{_kerneldir}/fs %{_kerneldir}/include/acpi %{_kerneldir}/include/asm-generic %{_kerneldir}/include/clocksource %{_kerneldir}/include/crypto %{_kerneldir}/include/drm %{_kerneldir}/include/dt-bindings %{_kerneldir}/include/kunit %{_kerneldir}/include/kvm %{_kerneldir}/include/linux %{_kerneldir}/include/math-emu %{_kerneldir}/include/net %{_kerneldir}/include/pcmcia %{_kerneldir}/include/ras %{_kerneldir}/include/scsi %ifarch %arm %{_kerneldir}/include/soc %endif %{_kerneldir}/include/sound %{_kerneldir}/include/target %{_kerneldir}/include/trace %{_kerneldir}/include/uapi %{_kerneldir}/include/vdso/*.h %{_kerneldir}/include/video %{_kerneldir}/include/media %{_kerneldir}/include/misc %{_kerneldir}/include/keys %{_kerneldir}/include/rdma %{_kerneldir}/include/xen %{_kerneldir}/init %{_kerneldir}/ipc %{_kerneldir}/kernel %{_kerneldir}/lib %{_kerneldir}/mm %{_kerneldir}/net %{_kerneldir}/samples %{_kerneldir}/scripts %{_kerneldir}/security %{_kerneldir}/sound %{_kerneldir}/tools %{_kerneldir}/usr %{_kerneldir}/virt %doc README.kernel-sources %endif # build_source # kernel-devel %if %build_devel %files -n %{kname}-devel-%{buildrel} %dir %{_develdir} %dir %{_develdir}/arch %dir %{_develdir}/include %{_develdir}/.config %{_develdir}/Documentation %{_develdir}/Kbuild %{_develdir}/Kconfig %{_develdir}/Makefile %{_develdir}/Module.symvers %{_develdir}/arch/Kconfig %ifarch %{arm} %{_develdir}/arch/arm %{_develdir}/arch/arm64 %endif %ifarch %{ix86} x86_64 %{_develdir}/arch/x86 %endif %{_develdir}/arch/um %{_develdir}/block %{_develdir}/certs %{_develdir}/crypto %{_develdir}/drivers %{_develdir}/fs %{_develdir}/include/acpi %{_develdir}/include/asm-generic %{_develdir}/include/clocksource %{_develdir}/include/config %{_develdir}/include/crypto %{_develdir}/include/drm %{_develdir}/include/dt-bindings %{_develdir}/include/generated %{_develdir}/include/keys %{_develdir}/include/kunit %{_develdir}/include/kvm %{_develdir}/include/linux %{_develdir}/include/math-emu %{_develdir}/include/misc %{_develdir}/include/net %{_develdir}/include/pcmcia %{_develdir}/include/ras %{_develdir}/include/rdma %{_develdir}/include/scsi %ifarch %arm %{_develdir}/include/soc %endif %{_develdir}/include/sound %{_develdir}/include/target %{_develdir}/include/trace %{_develdir}/include/uapi %{_develdir}/include/vdso/*.h %{_develdir}/include/video %{_develdir}/include/media %{_develdir}/include/xen %{_develdir}/init %{_develdir}/ipc %{_develdir}/kernel %{_develdir}/lib %{_develdir}/mm %{_develdir}/net %{_develdir}/samples %{_develdir}/scripts %{_develdir}/security %{_develdir}/sound %{_develdir}/tools %{_develdir}/usr %{_develdir}/virt %doc README.kernel-sources %endif # build_devel %if %build_doc %files -n %{kname}-doc %doc linux-%{tar_ver}/Documentation/* %endif # build_doc %if %build_kernel %files -n %{kname}-latest %endif # build_kernel %if %build_source %files -n %{kname}-source-latest %endif # build_source %if %build_devel %files -n %{kname}-devel-latest %endif # build_devel