kernel-source/kernel-default-base.spec

488 lines
16 KiB
RPMSpec

#
# spec file for package kernel-default subpackage builds
#
# Copyright (c) 2019 SUSE LINUX 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/
#
# needssslcertforbuild
%define srcversion 5.0
%define patchversion 5.0.0
%define variant %{nil}
%define vanilla_only 0
%define rpm_kver %(rpm -q --qf '%%{VERSION}' kernel-%build_flavor)
%define rpm_krel %(rpm -q --qf '%%{RELEASE}' kernel-%build_flavor)
%define kernel_spec_release %rpm_krel
%include %_sourcedir/kernel-spec-macros
%define build_flavor default
%define build_default ("%build_flavor" == "default")
%define build_vanilla ("%build_flavor" == "vanilla")
%define cpu_arch_flavor %cpu_arch/%build_flavor
# Force bzip2 instead of lzma compression to
# 1) allow install on older dist versions, and
# 2) decrease build times (bsc#962356)
#%define _binary_payload w9.bzdio
# Do not recompute the build-id of vmlinux in find-debuginfo.sh (bsc#964063)
%undefine _unique_build_ids
%define _no_recompute_build_ids 1
# prevent usr/lib/debug/boot/vmlinux-4.12.14-11.10-default-4.12.14-11.10.ppc64le.debug
%undefine _unique_debug_names
# define %extrasummary, %extradescription, and %modules
# %extrasummary appended to package summary
# %extradescription appended to package description
# %modules is list of modules to include in the package (if they exist)
%include %_sourcedir/kernel-subpackage.conf
Name: kernel-%build_flavor-base
BuildRequires: coreutils
BuildRequires: device-mapper
BuildRequires: dracut
BuildRequires: kmod
BuildRequires: kernel-%build_flavor-srchash-6bc64779811b7f47756325c60f0bf1d5a848fdb5
BuildRequires: kernel-%build_flavor-devel
BuildRequires: util-linux
ExclusiveArch: aarch64 %ix86 ppc64 ppc64le s390x x86_64
Summary: %(rpm -q --qf '%%{SUMMARY}' kernel-%build_flavor) %extrasummary
URL: %(rpm -q --qf '%%{URL}' kernel-%build_flavor)
Group: %(rpm -q --qf '%%{GROUP}' kernel-%build_flavor)
License: GPL-2.0
Version: %rpm_kver
Release: %rpm_krel.<RELEASE>
Provides: %name(%_target) = %version-%rpm_krel
Provides: %name = %version-%source_rel
# bnc#901925
Provides: %name-%version-%source_rel
Provides: %{name}_%_target_cpu = %version-%source_rel
Provides: kernel-base = %version-%source_rel
Provides: multiversion(kernel)
# In SLE11, kernel-$flavor complemented kernel-$flavor-base. With SLE12,
# kernel-$flavor itself contains all the needed files and kernel-$flavor-base
# is a subset that can replace kernel-$flavor in some scenarios. We need to
# obsolete the -base subpackage from SLE11, so that the base files are not
# owned by multiple packages now. The dependency is not correct wrt openSUSE
# 11.2 - 11.4, but we primarily care about the supported upgrade path.
Obsoletes: kernel-%build_flavor-base < 3.1
Recommends: kernel-firmware
# The following is copied to the -base subpackage as well
# BEGIN COMMON DEPS
Requires(pre): coreutils awk
# For /usr/lib/module-init-tools/weak-modules2
Requires(post): suse-module-tools
# For depmod (modutils is a dependency provided by both module-init-tools and
# kmod-compat)
Requires(post): modutils
# 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
%if %build_vanilla
Requires(post): mkinitrd
%else
# Require a mkinitrd that can handle usbhid/hid-generic built-in (bnc#773559)
Requires(post): mkinitrd >= 2.7.1
%endif
# 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 udev insserv
%ifarch s390 s390x
%if %build_vanilla && 0%{?suse_version} < 1130
BuildRequires: dwarfextract
%endif
%endif
%ifarch %arm
BuildRequires: u-boot-tools
%endif
Obsoletes: microcode_ctl
# Force bzip2 instead of lzma compression to
# 1) allow install on older dist versions, and
# 2) decrease build times (bsc#962356)
%define _binary_payload w9.bzdio
# Do not recompute the build-id of vmlinux in find-debuginfo.sh (bsc#964063)
%undefine _unique_build_ids
%define _no_recompute_build_ids 1
# prevent usr/lib/debug/boot/vmlinux-4.12.14-11.10-default-4.12.14-11.10.ppc64le.debug
%undefine _unique_debug_names
# dead network if installed on SLES10, otherwise it will work (mostly)
Conflicts: sysfsutils < 2.0
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 < 4
%ifarch %ix86
Conflicts: libc.so.6()(64bit)
%endif
Provides: kernel = %version-%source_rel
Provides: kernel-%build_flavor-base-srchash-6bc64779811b7f47756325c60f0bf1d5a848fdb5
Provides: kernel-srchash-6bc64779811b7f47756325c60f0bf1d5a848fdb5
# END COMMON DEPS
Provides: %name-srchash-6bc64779811b7f47756325c60f0bf1d5a848fdb5
%ifarch %ix86
Provides: kernel-trace-base = 3.13
Obsoletes: kernel-trace-base <= 3.13
%endif
%ifarch ppc64
Provides: kernel-kdump-base = 2.6.28
Obsoletes: kernel-kdump-base <= 2.6.28
%endif
%ifarch s390x
Provides: kernel-trace-base = 3.13
Obsoletes: kernel-trace-base <= 3.13
%endif
%ifarch x86_64
Provides: kernel-trace-base = 3.13
Obsoletes: kernel-trace-base <= 3.13
Provides: kernel-bigsmp-base = 3.1
Obsoletes: kernel-bigsmp-base <= 3.1
Provides: kernel-desktop-base = 4.3
Obsoletes: kernel-desktop-base <= 4.3
Provides: kernel-xen-base = 4.4
Obsoletes: kernel-xen-base <= 4.4
Provides: kernel-ec2-base = 4.4
Obsoletes: kernel-ec2-base <= 4.4
%endif
%obsolete_rebuilds %name
Source0: http://www.kernel.org/pub/linux/kernel/v5.x/linux-%srcversion.tar.xz
Source2: source-post.sh
Source3: kernel-source.rpmlintrc
Source8: devel-pre.sh
Source9: devel-post.sh
Source10: preun.sh
Source11: postun.sh
Source12: pre.sh
Source13: post.sh
Source14: series.conf
Source16: guards
Source17: apply-patches
Source21: config.conf
Source23: supported.conf
Source33: check-for-config-changes
Source35: group-source-files.pl
Source36: README.PATCH-POLICY.SUSE
Source37: README.SUSE
Source38: README.KSYMS
Source39: config-options.changes.txt
Source40: source-timestamp
Source46: split-modules
Source47: modversions
Source48: macros.kernel-source
Source49: kernel-module-subpackage
Source50: kabi.pl
Source51: mkspec
Source52: kernel-source%variant.changes
Source53: kernel-source.spec.in
Source54: kernel-binary.spec.in
Source55: kernel-syms.spec.in
Source56: kernel-docs.spec.in
Source57: kernel-cert-subpackage
Source58: constraints.in
Source60: config.sh
Source61: compute-PATCHVERSION.sh
Source62: old-flavors
Source63: arch-symbols
Source64: package-descriptions
Source65: kernel-spec-macros
Source67: log.sh
Source68: host-memcpy-hack.h
Source69: try-disable-staging-driver
Source70: kernel-obs-build.spec.in
Source71: kernel-obs-qa.spec.in
Source72: compress-vmlinux.sh
Source73: dtb.spec.in.in
Source74: mkspec-dtb
Source75: release-projects
Source76: check-module-license
Source77: klp-symbols
Source78: modules.fips
Source79: kernel-subpackage-build.spec.in
Source80: kernel-subpackage.conf
Source81: subpackage-names.conf
Source82: splitflist
Source83: mergedep
Source84: moddep
Source85: modflist
Source100: config.tar.bz2
Source101: config.addon.tar.bz2
Source102: patches.arch.tar.bz2
Source103: patches.drivers.tar.bz2
Source104: patches.fixes.tar.bz2
Source105: patches.rpmify.tar.bz2
Source106: patches.suse.tar.bz2
Source108: patches.addon.tar.bz2
Source109: patches.kernel.org.tar.bz2
Source110: patches.apparmor.tar.bz2
Source111: patches.rt.tar.bz2
Source113: patches.kabi.tar.bz2
Source120: kabi.tar.bz2
Source121: sysctl.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: aarch64 %ix86 ppc64 ppc64le s390x x86_64
%define kmp_target_cpu %_target_cpu
%ifarch %ix86
# Only i386/default supports i586, mark other flavors' packages as i686
%if ! %build_default
BuildArch: i686
# KMPs are always built as i586, because rpm does not allow to build
# subpackages for different architectures. Therefore, we change the
# /usr/src/linux-obj/<arch> symlink to i586.
%define kmp_target_cpu i586
%endif
%endif
# These files are found in the kernel-source package:
NoSource: 0
NoSource: 2
NoSource: 3
NoSource: 8
NoSource: 9
NoSource: 10
NoSource: 11
NoSource: 12
NoSource: 13
NoSource: 14
NoSource: 16
NoSource: 17
NoSource: 21
NoSource: 23
NoSource: 33
NoSource: 35
NoSource: 36
NoSource: 37
NoSource: 38
NoSource: 39
NoSource: 40
NoSource: 46
NoSource: 47
NoSource: 48
NoSource: 49
NoSource: 50
NoSource: 51
NoSource: 52
NoSource: 53
NoSource: 54
NoSource: 55
NoSource: 56
NoSource: 57
NoSource: 58
NoSource: 60
NoSource: 61
NoSource: 62
NoSource: 63
NoSource: 64
NoSource: 65
NoSource: 67
NoSource: 68
NoSource: 69
NoSource: 70
NoSource: 71
NoSource: 72
NoSource: 73
NoSource: 74
NoSource: 75
NoSource: 76
NoSource: 77
NoSource: 78
NoSource: 79
NoSource: 80
NoSource: 81
NoSource: 82
NoSource: 83
NoSource: 84
NoSource: 85
NoSource: 100
NoSource: 101
NoSource: 102
NoSource: 103
NoSource: 104
NoSource: 105
NoSource: 106
NoSource: 108
NoSource: 109
NoSource: 110
NoSource: 111
NoSource: 113
NoSource: 120
NoSource: 121
%description
%(rpm -q --qf '%%{DESCRIPTION}' kernel-%build_flavor)
%extradescription
This is a subpackage of kernel-%build_flavor. Development files are in
kernel-%build_flavor-devel and sources in kernel-source-%variant.
%prep
%build
%install
set -o pipefail
install -d -m 0755 $RPM_BUILD_ROOT/boot
chmod 755 %_sourcedir/splitflist
%_sourcedir/splitflist kernel-%build_flavor kernel.flist kernel-ghost.flist
echo Missing files:
cat kernel-ghost.flist
# The scripts need to be regenerated here. Eventually we should get rid of
# base_package and use one script.
%ifarch %ix86 x86_64
image=vmlinuz
%endif
%ifarch ppc ppc64 ppc64le
image=vmlinux
%endif
%ifarch s390 s390x
image=image
%endif
%ifarch %arm
image=zImage
%endif
%ifarch aarch64
image=Image
%endif
certs=($(rpm -ql kernel-%build_flavor | grep ^/etc/uefi/certs/ ||:))
for sub in '-base'; do
base_package=1 # should use for any package name
for script in preun postun pre post; do
if test %build_flavor = "zfcpdump"; then
: >%_builddir/$script.sh
continue
fi
sed -e "s:@KERNELRELEASE@:%kernelrelease:g" \
-e "s:@IMAGE@:$image:g" \
-e "s:@FLAVOR""@:%build_flavor:g" \
-e "s:@SUBPACKAGE""@:%name:g" \
-e "s:@BASE_PACKAGE@:$base_package:g" \
-e "s:@RPM_VERSION_RELEASE@:%version-%release:g" \
-e "s:@CPU_ARCH_FLAVOR@:%cpu_arch_flavor:g" \
-e "s:@SRCVARIANT@:%variant:g" \
%_sourcedir/$script.sh > %_builddir/$script.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 \
>>"%_builddir/$script.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" >>"%_builddir/$script.sh"
done
done
[ -z "$(rpm -q --triggers kernel-%build_flavor)" ] # not handled
KREL=$(cat kernel.flist | grep ^/lib/modules | { sort -r ||: ;} | head -n 1 | sed -e s,^/lib/modules/,, -e 's,/.*,,')
chmod 755 %_sourcedir/mergedep
%_sourcedir/mergedep $KREL > modules.dep
echo "%{?modules}" | tr ', ' '\n\n' > request-modules
chmod 755 %_sourcedir/moddep
%_sourcedir/moddep modules.dep request-modules modules
chmod 755 %_sourcedir/modflist
%_sourcedir/modflist kernel.flist modules modules.flist
cat kernel.flist | grep -v ^/lib/modules >> modules.flist
[ -d /lib/modules/$KREL/vdso ] && echo /lib/modules/$KREL/vdso >> modules.flist ||:
echo /lib/modules/$KREL/modules.* | tr ' ' '\n' >> modules.flist
tar -C / -cf- -T modules.flist | tar -C $RPM_BUILD_ROOT -xvf-
moderr="$(/usr/sbin/depmod -b $RPM_BUILD_ROOT -e -F /boot/System.map-$KREL $KREL 2>&1 > /dev/null)"
if [ "$moderr" ] ; then
echo Picked modules have errors:
echo $moderr
exit 1
fi
echo "%defattr(-,root,root)" > subpackage.flist
cat kernel.flist | grep -v ^/lib/modules >> subpackage.flist
echo /lib/modules/$KREL >> subpackage.flist
cat kernel-ghost.flist | sed -e 's/^/%ghost /' >> subpackage.flist
cat kernel-ghost.flist | while read ghost ; do
case $ghost in
/boot/image-%build_flavor | /boot/vmlinux-%build_flavor | /boot/vmlinuz-%build_flavor | \
/boot/Image-%build_flavor | /boot/initrd-%build_flavor)
ln -s $(basename $ghost -%build_flavor)-$KREL $RPM_BUILD_ROOT$ghost
;;
/boot/vmlinux | /boot/vmlinuz | /boot/Image | /boot/image | /boot/initrd)
ln -s $ghost-$KREL $RPM_BUILD_ROOT$ghost
;;
/boot/vmlinux-$KREL)
[ -f /boot/vmlinux-$KREL.gz ] && gunzip -dc < /boot/vmlinux-$KREL.gz > vmlinux-$KREL
size="$(ls -l vmlinux-$KREL | sed -e 's/^\([^ ]* \)\{4\}//' -e 's/ .*//')"
dd if=/dev/zero bs=1 count="$size" of=$RPM_BUILD_ROOT$ghost
;;
/boot/initrd-$KREL | /boot/initrd-$KREL-kdump)
# 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=$RPM_BUILD_ROOT$ghost \
bs=1024 seek=2047 count=1
chmod 0600 $RPM_BUILD_ROOT$ghost
;;
/lib/modules/$KREL/modules.*)
[ -f $RPM_BUILD_ROOT$ghost ]
;;
*)
echo Missing file "$ghost" not handled.
exit 1;
;;
esac
done
%preun -f preun.sh
%postun -f postun.sh
%pre -f pre.sh
%post -f post.sh
%files -f subpackage.flist
%changelog