# # spec file for package kernel-@FLAVOR@ # # Copyright (c) @YEAR@ SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # # norootforbuild # This makes the OBS store the project cert as %_sourcedir/_projectcert.crt # needssslcertforbuild %define srcversion @SRCVERSION@ %define patchversion @PATCHVERSION@ %define variant @VARIANT@%{nil} %include %_sourcedir/kernel-spec-macros %define build_flavor @FLAVOR@ %define build_kdump (%build_flavor == "kdump") %define build_xen (%build_flavor == "xen" || %build_flavor == "ec2") %define build_vanilla (%build_flavor == "vanilla") %define build_ps3 (%build_flavor == "ps3") %define build_src_dir %my_builddir/linux-%srcversion %define src_install_dir /usr/src/linux-%kernelrelease%variant %define obj_install_dir %src_install_dir-obj %define rpm_install_dir %buildroot%obj_install_dir %define kernel_build_dir %my_builddir/linux-obj %(chmod +x %_sourcedir/{@SCRIPTS@}) %global cpu_arch %(%_sourcedir/arch-symbols %_target_cpu) %define cpu_arch_flavor %cpu_arch/%build_flavor # Define some CONFIG variables as rpm macros as well. (rpm cannot handle # defining them all at once.) %define config_vars CONFIG_MODULES CONFIG_MODULE_SIG CONFIG_KMSG_IDS CONFIG_SPLIT_PACKAGE CONFIG_ENTERPRISE_SUPPORT CONFIG_EFI_STUB %{expand:%(eval "$(test -n "%cpu_arch_flavor" && tar -xjf %_sourcedir/config.tar.bz2 --to-stdout config/%cpu_arch_flavor)"; for config in %config_vars; do echo "%%global $config ${!config:-n}"; done)} %define split_base (%CONFIG_SPLIT_PACKAGE == "y") %define split_extra (%CONFIG_SPLIT_PACKAGE == "y" && %CONFIG_ENTERPRISE_SUPPORT == "y") %ifarch s390 s390x %if ! %build_vanilla %define install_vdso 1 %else %define install_vdso 0 %endif # ! %build_vanilla %else %ifarch %ix86 x86_64 %define install_vdso 1 %else %define install_vdso 0 %endif # %ix86 x86_64 %endif # s390 s390x Name: kernel-@FLAVOR@ Summary: @SUMMARY@ Version: @RPMVERSION@ %if 0%{?is_kotd} Release: .g@COMMIT@ %else Release: @RELEASE@ %endif License: GPL-2.0-only Group: System/Kernel Url: http://www.kernel.org/ BuildRequires: coreutils module-init-tools sparse openssl BuildRequires: fdupes elfutils openssl # Have the buildservice sign the kernel image (on x86_64), modules # and firmware files BuildRequires: pesign-obs-integration Provides: multiversion(kernel) Provides: %{name}_%_target_cpu = %version-%release %if %split_base Requires: %name-base_%_target_cpu = %version-%release %endif Requires(pre): coreutils awk # Need a module-init-tools with /usr/lib/module-init-tools/weak-modules2 Requires(post): module-init-tools >= 3.4 # This Requires is wrong, because the post/postun scripts have a # test -x update-bootloader, having perl-Bootloader is not a hard requirement. # But, there is no way to tell rpm or yast to schedule the installation # of perl-Bootloader before kernel-binary.rpm if both are in the list of # packages to install/update. Likewise, this is true for mkinitrd. # Need a perl-Bootloader with /usr/lib/bootloader/bootloader_entry Requires(post): perl-Bootloader >= 0.4.15 Requires(post): mkinitrd # Install the package providing /etc/SuSE-release early enough, so that # the grub entry has correct title (bnc#757565) Requires(post): distribution-release # Do not install p-b and mkinitrd for the install check, the %post script is # able to handle this #!BuildIgnore: perl-Bootloader mkinitrd distribution-release # Remove some packages that are installed automatically by the build system, # but are not needed to build the kernel #!BuildIgnore: autoconf automake gettext-runtime libtool cvs gettext-tools m4 udev insserv %ifarch ia64 # arch/ia64/scripts/unwcheck.py BuildRequires: python %endif %ifarch s390 s390x %if %build_vanilla && 0%{?suse_version} < 1130 BuildRequires: dwarfextract %endif %endif %if %build_xen #!BuildIgnore: xen %endif %if %build_vanilla # force bzip2 instead of lzma compression to allow install on older dist versions %define _binary_payload w9.bzdio %endif # dead network if installed on SLES10, otherwise it will work (mostly) Conflicts: sysfsutils < 2.0 %if ! %build_vanilla Conflicts: apparmor-profiles <= 2.1 Conflicts: apparmor-parser < 2.3 # root-lvm only works with newer udevs Conflicts: udev < 118 Conflicts: lvm2 < 2.02.33 # Interface to hv_kvp_daemon changed Conflicts: hyper-v < 3 %endif %ifarch %ix86 Conflicts: libc.so.6()(64bit) %endif Provides: kernel = %version-%source_rel @PROVIDES_OBSOLETES@ @SOURCES@ BuildRoot: %{_tmppath}/%{name}-%{version}-build ExclusiveArch: @ARCHS@ # These files are found in the kernel-source package: @NOSOURCE@ # The following KMPs have been integrated into the kernel package, # grouped by the last product that contained them. # Usage: obsolete_kmp # Note that KMPs embed the version of the kernel built against, that's why # the _3 suffix for 2.6.x-based KMPs %define obsolete_kmp() Obsoletes: %1-kmp-%build_flavor <= %2 \ Provides: %1-kmp = %2 \ Provides: %1-kmp-%build_flavor = %2 # sles10 / 10.3 %obsolete_kmp iwlwifi 1.3.27_3 %obsolete_kmp ipw3945 1.2.2_3 # sled10 / 11.0 %obsolete_kmp uvcvideo r200_3 # sle11-ga %obsolete_kmp enic 0.0.1_3 %obsolete_kmp fnic 1.0.0_3 %obsolete_kmp brocade-bfa 1.1.0.2_3 %obsolete_kmp kvm 78.2.6.30.1_3 %obsolete_kmp perfmon 2_3 %obsolete_kmp iwlagn-2-6-27 1.0_3 %obsolete_kmp msi-wmi 1.0_3 # 11.1 %obsolete_kmp quickcam 0.6.7 # sle11-sp1 %obsolete_kmp wacom 0.8.1_3 %obsolete_kmp btrfs 0_3 %obsolete_kmp brocade-bna 2.1.0.0_3 %obsolete_kmp hyper-v 0_3 %obsolete_kmp intel-e1000e 2.2.14 %obsolete_kmp drm 3.7_3.1 Obsoletes: firewire <= 3.0 Provides: firewire = 3.0 %obsolete_kmp firewire 3.0 %obsolete_kmp iwlagn 3.0 Obsoletes: compat-ath9k <= 3.0 Provides: compat-ath9k = 3.0 %obsolete_kmp compat-ath9k 3.0 %obsolete_kmp realtek-r8192ce_pci 2.6.0005_3 %obsolete_kmp realtek-r8192se_pci 2.6.0019.1207.2010_3 %obsolete_kmp rt3090 2.4.0.4_3 %obsolete_kmp rt3592 2.4.1.1_3 %obsolete_kmp rt5390 2.4.0.4_3 %obsolete_kmp ath3k 1.0_3 Obsoletes: ath3k-firmware <= 1.0 Provides: ath3k-firmware = 1.0 # Provide the exported symbols as "ksym(symbol) = hash" %define __find_provides %_sourcedir/find-provides %my_builddir %name # Will modules not listed in supported.conf abort the kernel build (0/1)? %define supported_modules_check 0 %description @DESCRIPTION@ %source_timestamp %prep if ! [ -e %_sourcedir/linux-%srcversion.tar.bz2 ]; then echo "The %name-%version.nosrc.rpm package does not contain the" \ "complete sources. Please install kernel-source-%version.src.rpm." exit 1 fi SYMBOLS= if test -e %_sourcedir/extra-symbols; then SYMBOLS=$(cat %_sourcedir/extra-symbols) echo "extra symbol(s):" $SYMBOLS fi # Unpack all sources and patches %setup -q -c -T -a 0 @UNPACK_PATCHES@ mkdir -p %kernel_build_dir # Generate a list of modules with their support status marking %_sourcedir/guards --list --with-guards <%_sourcedir/supported.conf | \ awk ' /^\+(base|yes) / { print $(NF); next; } /^\+external / { print $(NF) " external"; next; } /^[-+]/ { print $(NF) " no"; next; } { print $(NF); } ' >%kernel_build_dir/Module.supported %_sourcedir/guards --default=0 base < %_sourcedir/supported.conf | \ sed 's,.*/,,; s,\.ko$,,' | sort -u >%kernel_build_dir/Module.base cd linux-%srcversion %_sourcedir/apply-patches \ %if %{build_vanilla} --vanilla \ %endif %_sourcedir/series.conf .. $SYMBOLS cd %kernel_build_dir if [ -f %_sourcedir/localversion ] ; then cat %_sourcedir/localversion > localversion fi if test -e ../config.addon/%cpu_arch_flavor; then # FIXME: config.addon doesn't affect the %CONFIG_ macros defined at # the top of the specfile %_sourcedir/configtool.pl ../config{,.addon}/%cpu_arch_flavor >.config else cp ../config/%cpu_arch_flavor .config fi %build_src_dir/scripts/config \ --set-str CONFIG_LOCALVERSION -%source_rel-%build_flavor \ --enable CONFIG_SUSE_KERNEL \ %if 0%{?__debug_package:1} --enable CONFIG_DEBUG_INFO \ --disable CONFIG_DEBUG_INFO_REDUCED %else --disable CONFIG_DEBUG_INFO %endif makeoutputsync= if make --output-sync --help >/dev/null 2>&1 ; then makeoutputsync=--output-sync else echo make does not support --output-sync flag. Build messages may be mangled. 1>&2 fi MAKE_ARGS="$MAKE_ARGS %{?_smp_mflags} $makeoutputsync" KERN_DIRS="-C %build_src_dir O=$PWD" if test -e %_sourcedir/TOLERATE-UNKNOWN-NEW-CONFIG-OPTIONS; then yes '' | make oldconfig $MAKE_ARGS $KERN_DIRS else cp .config .config.orig make silentoldconfig $MAKE_ARGS $KERN_DIRS < /dev/null %_sourcedir/check-for-config-changes .config.orig .config rm .config.orig fi make prepare $MAKE_ARGS make scripts $MAKE_ARGS krel=$(make -s kernelrelease $MAKE_ARGS) if [ "$krel" != "%kernelrelease-%build_flavor" ]; then echo "Kernel release mismatch: $krel != %kernelrelease-%build_flavor" >&2 exit 1 fi make clean $MAKE_ARGS rm -f source find . ! -type d -printf '%%P\n' > %my_builddir/obj-files # Override the timestamp 'uname -v' reports with the source timestamp and # the commit hash. date=$(head -n 1 %_sourcedir/source-timestamp) commit=$(sed -n 's/GIT Revision: //p' %_sourcedir/source-timestamp) cat > .kernel-binary.spec.buildenv < >(tee "$log") %install # sign the modules, firmware and possibly the kernel in the buildservice export BRP_PESIGN_FILES="*.ko /lib/firmware" %if %CONFIG_EFI_STUB == "y" BRP_PESIGN_FILES="$BRP_PESIGN_FILES /boot/vmlinuz-%kernelrelease-%build_flavor" %endif # Do not sign vanilla kernels released in official projects %if %build_vanilla BRP_PESIGN_FILES="" %endif # get rid of /usr/lib/rpm/brp-strip-debug # strip removes too much from the vmlinux ELF binary export NO_BRP_STRIP_DEBUG=true export STRIP_KEEP_SYMTAB='*/vmlinux-*' # /lib/modules/%kernelrelease-%build_flavor/build will be a stale symlink until the # kernel-source package is installed. Don't check for stale symlinks # in the brp-symlink check: export NO_BRP_STALE_LINK_ERROR=yes cd %kernel_build_dir mkdir -p %buildroot/boot # (Could strip out non-public symbols.) cp -p System.map %buildroot/boot/System.map-%kernelrelease-%build_flavor add_vmlinux() { local vmlinux=boot/vmlinux-%kernelrelease-%build_flavor compressed=false if test $1 == "--compressed"; then compressed=true fi cp vmlinux %buildroot/$vmlinux >%my_builddir/vmlinux.debug.files %if 0%{?__debug_package:1} if $compressed; then local vmlinux_debug=usr/lib/debug/$vmlinux.debug mkdir -p $(dirname %buildroot/$vmlinux_debug) local id=$(/usr/bin/eu-unstrip -n -e %buildroot/$vmlinux | \ sed -rn 's/.* (.*)@.*/\1/p') /usr/lib/rpm/debugedit -b "$RPM_BUILD_DIR" -d /usr/src/debug \ -l vmlinux.sourcefiles %buildroot/$vmlinux objcopy --only-keep-debug \ %buildroot/$vmlinux \ %buildroot/$vmlinux_debug || : objcopy --add-gnu-debuglink=%buildroot/$vmlinux_debug \ --strip-debug \ %buildroot/$vmlinux || : mkdir -p %buildroot/usr/src/debug LANG=C sort -z -u vmlinux.sourcefiles | grep -Ezv "<(built-in|stdin)>" \ | ( cd %_builddir && cpio -pd0m %buildroot/usr/src/debug ) find %buildroot/usr/src/debug -type d -print0 | xargs -0 -r chmod 0755 find %buildroot/usr/src/debug -type f -print0 | xargs -0 -r chmod 0644 echo -e "%%defattr(-, root, root)\\n/$vmlinux_debug" >%my_builddir/vmlinux.debug.files # create and package build-id symlinks if [ -n "$id" -a "$id" != "-" ]; then local ldir="/usr/lib/debug/.build-id/${id:0:2}" local l="$ldir/${id:2}" mkdir -p %buildroot/$ldir # /boot/vmlinux-* is compressed, so this would be a dangling link: # ln -snf /$vmlinux %buildroot/$l # echo "/$l" >>%my_builddir/vmlinux.debug.files ln -snf ../../$vmlinux.debug %buildroot/$l.debug echo "/$l.debug" >>%my_builddir/vmlinux.debug.files fi else # make vmlinux executable so that find-debuginfo.sh picks it up # (TODO: fix find-debuginfo.sh instead) chmod +x %buildroot/$vmlinux fi %endif if $compressed; then gzip -n -9 %buildroot/$vmlinux chmod a-x %buildroot/$vmlinux.gz fi } %if %build_kdump add_vmlinux image=vmlinux %else # architecture specifics %ifarch %ix86 x86_64 add_vmlinux --compressed image=bzImage %if %build_xen test -f arch/x86/boot/$image || image=vmlinuz %endif cp -p arch/x86/boot/$image %buildroot/boot/vmlinuz-%kernelrelease-%build_flavor image=vmlinuz %endif %ifarch alpha add_vmlinux --compressed cp -p arch/alpha/boot/vmlinux.gz %buildroot/boot/vmlinuz-%kernelrelease-%build_flavor image=vmlinuz %endif %ifarch ppc ppc64 add_vmlinux image=vmlinux %endif %ifarch ia64 add_vmlinux --compressed mv %buildroot/boot/vmlinux-%kernelrelease-%build_flavor.gz \ %buildroot/boot/vmlinuz-%kernelrelease-%build_flavor image=vmlinuz %endif %ifarch s390 s390x add_vmlinux --compressed cp -p arch/s390/boot/image %buildroot/boot/image-%kernelrelease-%build_flavor image=image %if %CONFIG_KMSG_IDS == "y" mkdir -p %buildroot/usr/share/man/man9 find man -name '*.9' -exec install -m 644 -D '{}' %buildroot/usr/share/man/man9/ ';' %endif %endif %ifarch sparc64 add_vmlinux --compressed image=zImage cp -p arch/sparc/boot/$image %buildroot/boot/vmlinuz-%kernelrelease-%build_flavor image=vmlinux %endif # end of build_kdump %endif echo "/boot/$image-%kernelrelease-%build_flavor.hmac" >%my_builddir/hmac.files # Package the compiled-in certificates as DER files in /etc/uefi/certs # and have mokutil enroll them when the kernel is installed certs=() if test %CONFIG_MODULE_SIG = "y"; then for f in *.x509; do if ! test -s "$f"; then continue fi h=$(openssl x509 -inform DER -fingerprint -noout -in "$f") test -n "$h" cert=/etc/uefi/certs/$(echo "$h" | \ sed -rn 's/^SHA1 Fingerprint=//; T; s/://g; s/(.{8}).*/\1/p').crt if test -e %buildroot/"$cert"; then continue fi mkdir -p %buildroot/etc/uefi/certs cp "$f" %buildroot/"$cert" certs=("${certs[@]}" "$cert") done fi # Install the frontend driver selector file for xen/ec2 %if %build_xen mkdir -p %buildroot/etc/modprobe.d cp %_sourcedir/modprobe-xen.conf %buildroot/etc/modprobe.d/50-xen.conf %endif for sub in '-base' '' '-extra'; do case "$sub" in '-base') base_package=1 ;; %if ! %split_base '') base_package=1 ;; %endif *) base_package=0 ;; esac for script in preun postun pre post devel-pre devel-post; do sed -e "s:@KERNELRELEASE@:%kernelrelease:g" \ -e "s:@IMAGE@:$image:g" \ -e "s:@FLAVOR""@:%build_flavor:g" \ -e "s:@SUBPACKAGE@:%name$sub:g" \ -e "s:@BASE_PACKAGE@:$base_package:g" \ -e "s:@RPM_VERSION_RELEASE@:%version-%release:g" \ -e "s:@RPM_TARGET_CPU@:%_target_cpu:g" \ -e "s:@CPU_ARCH_FLAVOR@:%cpu_arch_flavor:g" \ -e "s:@SRCVARIANT@:%variant:g" \ %_sourcedir/$script.sh > %my_builddir/$script$sub.sh if test "$base_package" -eq 1 -a "${#certs[@]}" -gt 0; then case "$script" in preun | postun | post) # Copy the respective scriptlet from kernel-cert-subpackage sed "1,/^%%$script / d; /^%%[^%%]/,\$ d; s:@CERTS@:${certs[*]}:g" \ %_sourcedir/kernel-cert-subpackage \ >>"%my_builddir/$script$sub.sh" esac fi # Do an exit 0 at the end of each scriptlet. If the last real command # in the scriptlet (e.g. update-bootloader call, see bnc#809617) # returns an error, we do not want to amplify the damage by leaving # the system in an inconsistent state. echo "exit 0" >>"%my_builddir/$script$sub.sh" done done %if %build_kdump || %build_xen || %build_vanilla || %build_ps3 # keep this -suffix list in sync with post.sh and postun.sh suffix=-%build_flavor %endif ln -s $image$suffix %buildroot/boot/$image$suffix ln -s initrd$suffix %buildroot/boot/initrd$suffix cp -p .config %buildroot/boot/config-%kernelrelease-%build_flavor %if %install_vdso # Install the unstripped vdso's that are linked in the kernel image make vdso_install $MAKE_ARGS INSTALL_MOD_PATH=%buildroot %endif # Create a dummy initrd with roughly the size the real one will have. # That way, YaST will know that this package requires some additional # space in /boot. dd if=/dev/zero of=%buildroot/boot/initrd-%kernelrelease-%build_flavor \ bs=1024 seek=2047 count=1 # Figure out where the symbols that vmlinux exports are defined. %_sourcedir/built-in-where %{?jobs:-j%jobs} < Module.symvers > Module.symvers.split if [ %CONFIG_MODULES = y ]; then mkdir -p %rpm_install_dir/%cpu_arch_flavor mkdir -p %buildroot/usr/src/linux-obj/%cpu_arch ln -s %build_flavor %buildroot/usr/src/linux-obj/%cpu_arch_flavor gzip -n -c9 < Module.symvers > %buildroot/boot/symvers-%kernelrelease-%build_flavor.gz make %{?_smp_mflags} modules_install $MAKE_ARGS INSTALL_MOD_PATH=%buildroot # Also put the resulting file in %rpm_install_dir/%cpu_arch/%build_flavor # so that kernel-source + kernel-%build_flavor is sufficient for building # modules that have modversions as well. mkdir -p %rpm_install_dir/%cpu_arch/%build_flavor cp Module.symvers %rpm_install_dir/%cpu_arch/%build_flavor # Table of types used in exported symbols (for modversion debugging). %_sourcedir/modversions --pack . > %buildroot/boot/symtypes-%kernelrelease-%build_flavor if [ -s %buildroot/boot/symtypes-%kernelrelease-%build_flavor ]; then gzip -n -9 %buildroot/boot/symtypes-%kernelrelease-%build_flavor else rm -f %buildroot/boot/symtypes-%kernelrelease-%build_flavor fi # Some architecture's $(uname -m) output is different from the ARCH # parameter that needs to be passed to kbuild. Create symlinks from # $(uname -m) to the ARCH directory. if [ ! -e %rpm_install_dir/%_target_cpu ]; then ln -sf %cpu_arch %rpm_install_dir/%_target_cpu ln -sf %cpu_arch %buildroot/usr/src/linux-obj/%_target_cpu fi # We were building in %my_builddir/linux-%srcversion, but the sources will # later be installed in /usr/src/linux-%srcversion-%source_rel. Fix up the # build symlink. rm -f %buildroot/lib/modules/%kernelrelease-%build_flavor/{source,build} ln -s %src_install_dir \ %buildroot/lib/modules/%kernelrelease-%build_flavor/source ln -s %obj_install_dir/%cpu_arch/%build_flavor \ %buildroot/lib/modules/%kernelrelease-%build_flavor/build # Abort if there are any undefined symbols msg="$(/sbin/depmod -F %buildroot/boot/System.map-%kernelrelease-%build_flavor \ -b %buildroot -ae %kernelrelease-%build_flavor 2>&1)" if [ $? -ne 0 ] || echo "$msg" | grep 'needs unknown symbol'; then exit 1 fi %if %split_base %_sourcedir/split-modules -d %buildroot \ -o %my_builddir \ -b %kernel_build_dir/Module.base %if ! %split_extra cat %my_builddir/unsupported-modules >>%my_builddir/main-modules %endif %else ( cd %buildroot find lib/modules/%kernelrelease-%build_flavor -type f -name '*.ko' -printf '/%%p\n' ) > %my_builddir/base-modules %endif res=0 if test -e %my_builddir/kabi/%cpu_arch/symvers-%build_flavor; then # check for kabi changes %_sourcedir/kabi.pl --rules %my_builddir/kabi/severities \ %my_builddir/kabi/%cpu_arch/symvers-%build_flavor \ Module.symvers.split || res=$? fi if [ $res -ne 0 ]; then # %ignore_kabi_badness is defined in the Kernel:* projects in the # OBS to be able to build the KOTD in spite of kabi errors if [ 0%{?ignore_kabi_badness} -eq 0 -a \ ! -e %my_builddir/kabi/%cpu_arch/ignore-%build_flavor -a \ ! -e %_sourcedir/IGNORE-KABI-BADNESS ]; then echo "Create a file IGNORE-KABI-BADNESS in the kernel-source" \ "directory to build this kernel even though its badness is" \ "higher than allowed for an official kernel." exit 1 fi fi # generate symsets mkdir -p %my_builddir/{base,main,extra}-symsets for f in %my_builddir/{base,main,unsupported}-modules; do if [ -f "$f" ]; then sed 's:^/:%buildroot/:' "$f" fi > "$f-br" done reference= if test -e %my_builddir/kabi/%cpu_arch/symsets-@FLAVOR@.tar.gz; then tar xzf %my_builddir/kabi/%cpu_arch/symsets-@FLAVOR@.tar.gz -C \ %my_builddir/kabi/%cpu_arch reference="--reference %my_builddir/kabi/%cpu_arch/symsets-*-@FLAVOR@/" if test -e %my_builddir/kabi/%cpu_arch/symvers-@FLAVOR@.fake; then reference="$reference --fake $_" fi fi %_sourcedir/symsets.pl --generate-symsets \ $reference \ --symvers=Module.symvers.split \ --modules=%my_builddir/base-modules-br \ --output-dir=%my_builddir/base-symsets %if %split_base %_sourcedir/symsets.pl --generate-symsets \ $reference \ --modules=%my_builddir/main-modules-br \ --required-modules=%my_builddir/base-modules-br \ --output-dir=%my_builddir/main-symsets %endif %if %split_extra %_sourcedir/symsets.pl --generate-symsets \ $reference \ --modules=%my_builddir/unsupported-modules-br \ --required-modules=%my_builddir/base-modules-br \ --required-modules=%my_builddir/main-modules-br \ --output-dir=%my_builddir/extra-symsets %endif # arch/powerpc/lib/crtsavres.o is required for building external # modules on powerpc if [ -f %kernel_build_dir/arch/powerpc/lib/crtsavres.o ]; then echo arch/powerpc/lib/crtsavres.o >> %my_builddir/obj-files fi tar cf - -T %my_builddir/obj-files | \ tar xf - -C %rpm_install_dir/%cpu_arch_flavor # bnc#507084 find %rpm_install_dir/%cpu_arch_flavor/scripts -type f -perm -111 | \ while read f; do case "$(file -b "$f")" in ELF\ *\ executable*) strip "$f" esac done # Replace the absolute with a relative path sed -i "s,%build_src_dir,../../../linux-%kernelrelease%variant,g" \ %rpm_install_dir/%cpu_arch_flavor/Makefile # bnc#551348 install -d -m 755 %buildroot/etc/modprobe.d/ install -m 644 %_sourcedir/generic_serial-blacklist %buildroot/etc/modprobe.d/ symsets=%my_builddir/symsets-%kernelrelease-%build_flavor mkdir -p $symsets find %my_builddir/{base,main,extra}-symsets -type f \ | xargs --replace='{}' cp '{}' $symsets/ tar c -C ${symsets%/*} ${symsets##*/} \ | gzip -9 \ > %buildroot/boot/symsets-%kernelrelease-%build_flavor.tar.gz find %buildroot -name '*.ko' -printf '/%%P.hmac\n' >>%my_builddir/hmac.files fi # CONFIG_MODULES = y add_dirs_to_filelist() { sed -rn ' # print file name p # remove filelist macros s:%%[a-z]+(\([^)]+\))? ?::g # add %%dir prefix s:^:%%dir : # print all parents :a # skip directories owned by other packages s:^%%dir (/boot|/etc|/lib/(modules|firmware)|/usr/src)/[^/]+$:: s:/[^/]+$::p ta ' "$@" | sort -u } # Collect the file lists. shopt -s nullglob > %my_builddir/kernel-devel.files for file in %buildroot/boot/sym{sets,types}* \ %buildroot/lib/modules/*/{build,source}; do f=${file##%buildroot} echo "$f" done | add_dirs_to_filelist >%my_builddir/kernel-devel.files { cd %buildroot find boot \ \( -type l -o -name 'initrd-*' \) -printf '%%%%ghost /%%p\n' -o \ -type f -name 'vmlinux-*' -printf '%%%%attr(0644, root, root) /%%p\n' -o \ -type f -printf '/%%p\n' # Add the auto-generated (by mkdumprd) kdump initrd to %ghost so that # the file gets removed when uninstalling the kernel. echo '%%ghost /boot/initrd-%kernelrelease-%build_flavor-kdump' touch $RPM_BUILD_ROOT/boot/initrd-%kernelrelease-%build_flavor-kdump if [ %CONFIG_MODULES = y ]; then find lib/modules/%kernelrelease-%build_flavor \ -type d -o \ \( -path '*/modules.*' ! -path '*/modules.order' \ ! -path '*/modules.builtin' \) -printf '%%%%ghost /%%p\n' \ -o -name '*.ko' -prune -o -printf '/%%p\n' cat %my_builddir/base-modules fi if test %CONFIG_MODULE_SIG = "y"; then find etc/uefi/certs -type f -printf '/%%p\n' fi # optional per-kernel-release module config workarounds if test -d etc/modprobe.d; then find etc/modprobe.d -type f -printf '%%%%config(noreplace) /%%p\n' fi test -d lib/firmware/%kernelrelease-%build_flavor && \ find lib/firmware/%kernelrelease-%build_flavor \ -type d -o \ -printf '/%%p\n' if [ -e .%_docdir/%name ]; then echo "%%doc %_docdir/%name" fi } | sort -u >%my_builddir/tmp cat %my_builddir/tmp %my_builddir/kernel-devel.files | sort | uniq -u | \ add_dirs_to_filelist >%my_builddir/kernel-base.files rm %my_builddir/tmp %if %split_base add_dirs_to_filelist %my_builddir/main-modules \ > %my_builddir/kernel-main.files %endif %if %split_extra add_dirs_to_filelist %my_builddir/unsupported-modules > %my_builddir/kernel-extra.files %endif %_sourcedir/gen-hmacs %my_builddir/hmac.files # Hardlink duplicate files automatically (from package fdupes): It doesn't save # much, but it keeps rpmlint from breaking the package build. Note that we skip # /usr/src/linux-obj intentionally, to not accidentally break timestamps there %fdupes $RPM_BUILD_ROOT/lib %preun -f preun.sh %postun -f postun.sh %pre -f pre.sh %post -f post.sh %if %split_base %files -f kernel-main.files %else %files -f kernel-base.files %endif %defattr(-, root, root) %package base Summary: @SUMMARY@ - base modules License: GPL v2 only Group: System/Kernel Url: http://www.kernel.org/ Provides: multiversion(kernel) Provides: %name-base_%_target_cpu = %version-%release Provides: kernel-base = %version-%source_rel Requires(pre): coreutils awk Requires(post): module-init-tools Requires(post): perl-Bootloader Requires(post): mkinitrd @PROVIDES_OBSOLETES_BASE@ %ifarch %ix86 Conflicts: libc.so.6()(64bit) %endif %description base @DESCRIPTION@ This package contains only the base modules, required in all installs. %source_timestamp %preun base -f preun-base.sh %postun base -f postun-base.sh %pre base -f pre-base.sh %post base -f post-base.sh %if %split_base %files base -f kernel-base.files %defattr(-, root, root) %endif %package extra Summary: @SUMMARY@ - Unsupported kernel modules License: GPL v2 only Group: System/Kernel Url: http://www.kernel.org/ Provides: multiversion(kernel) Provides: %name-extra_%_target_cpu = %version-%release Provides: kernel-extra = %version-%source_rel Requires: %{name}_%_target_cpu = %version-%release Requires(pre): coreutils awk Requires(post): module-init-tools Requires(post): perl-Bootloader Requires(post): mkinitrd @PROVIDES_OBSOLETES_EXTRA@ Supplements: packageand(product(SUSE_SLED):%{name}_%_target_cpu) %ifarch %ix86 Conflicts: libc.so.6()(64bit) %endif %description extra @DESCRIPTION@ This package contains additional modules not supported by SUSE. %source_timestamp %preun extra -f preun-extra.sh %postun extra -f postun-extra.sh %pre extra -f pre-extra.sh %post extra -f post-extra.sh %if %split_extra %files extra -f kernel-extra.files %defattr(-, root, root) %endif %if %CONFIG_KMSG_IDS == "y" %package man Summary: The collection of man pages generated by the kmsg script. License: GPL v2 only Group: System/Kernel %description man This package includes the man pages that have been generated from the kmsg message documentation comments. %source_timestamp %files man %defattr(-,root,root) /usr/share/man/man9/* %endif %package devel Summary: Development files necessary for building kernel modules License: GPL v2 only Group: Development/Sources Provides: multiversion(kernel) Provides: %name-devel = %version-%source_rel Requires: kernel-source%variant = %version-%source_rel %if %CONFIG_MODULE_SIG == "y" Requires: openssl %endif @PROVIDES_OBSOLETES_DEVEL@ Supplements: packageand(%name:kernel-source) %description devel This package contains files necessary for building kernel modules (and kernel module packages) against the %build_flavor flavor of the kernel. %source_timestamp %if %CONFIG_MODULES == "y" %pre devel -f devel-pre.sh %post devel -f devel-post.sh %files devel -f kernel-devel.files %defattr(-,root,root) %dir %obj_install_dir %dir %obj_install_dir/%cpu_arch %dir /usr/src/linux-obj %dir /usr/src/linux-obj/%cpu_arch %ghost /usr/src/linux-obj/%cpu_arch_flavor %obj_install_dir/%cpu_arch_flavor %if %_target_cpu != %cpu_arch %obj_install_dir/%_target_cpu /usr/src/linux-obj/%_target_cpu %endif %endif %package devel-debuginfo # rpm doesn't notice that vmlinux.debug belongs to the gzipped vmlinux.gz Summary: Debug information for package %name-devel License: GPL v2 only Group: Development/Debug %description devel-debuginfo Debug information for package %name-devel %source_timestamp %files devel-debuginfo -f vmlinux.debug.files %package hmac Summary: HMAC files for the kernel image and modules License: GPL v2 only Group: System/Kernel Provides: multiversion(kernel) Requires: %{name}_%_target_cpu = %version-%release @PROVIDES_OBSOLETES_HMAC@ %description hmac This package contains HMAC hashes for the kernel image and modules. %source_timestamp %files hmac -f hmac.files %defattr(-, root, root) %changelog