2014-01-23 08:04:33 +01:00
|
|
|
#
|
|
|
|
# spec file for package kernel-obs-build
|
|
|
|
#
|
2023-01-02 08:40:54 +01:00
|
|
|
# Copyright (c) 2023 SUSE LLC
|
2014-01-23 08:04:33 +01:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2022-03-17 07:01:51 +01:00
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
2014-01-23 08:04:33 +01:00
|
|
|
#
|
|
|
|
# needsrootforbuild
|
|
|
|
|
2014-02-02 08:01:46 +01:00
|
|
|
|
2014-01-23 08:04:33 +01:00
|
|
|
#!BuildIgnore: post-build-checks
|
|
|
|
|
2023-06-26 10:32:55 +02:00
|
|
|
%define patchversion 6.4.0
|
2014-04-15 08:02:51 +02:00
|
|
|
%define variant %{nil}
|
|
|
|
|
|
|
|
%include %_sourcedir/kernel-spec-macros
|
|
|
|
|
2014-02-02 08:01:46 +01:00
|
|
|
Name: kernel-obs-build
|
|
|
|
BuildRequires: coreutils
|
|
|
|
BuildRequires: device-mapper
|
|
|
|
BuildRequires: util-linux
|
2014-01-23 08:04:33 +01:00
|
|
|
|
2016-01-12 08:05:55 +01:00
|
|
|
%if 0%{?suse_version}
|
2023-04-12 10:09:57 +02:00
|
|
|
%if "%{nil}"
|
|
|
|
%define kernel_flavor %{nil}
|
2017-02-21 08:08:23 +01:00
|
|
|
%else
|
2018-01-31 19:59:10 +01:00
|
|
|
%ifarch %ix86
|
|
|
|
%define kernel_flavor -pae
|
|
|
|
%else
|
|
|
|
%ifarch armv7l armv7hl
|
|
|
|
%define kernel_flavor -lpae
|
|
|
|
%else
|
2016-01-12 08:05:55 +01:00
|
|
|
%define kernel_flavor -default
|
|
|
|
%endif
|
2017-02-21 08:08:23 +01:00
|
|
|
%endif
|
2018-01-31 19:59:10 +01:00
|
|
|
%endif
|
|
|
|
%endif
|
2023-06-26 10:32:55 +02:00
|
|
|
BuildRequires: kernel%kernel_flavor-srchash-d68cda5621aa7524f47fa0a6cc845dc8c0f72294
|
2016-01-12 08:05:55 +01:00
|
|
|
|
|
|
|
%if 0%{?rhel_version}
|
|
|
|
BuildRequires: kernel
|
|
|
|
%define kernel_flavor ""
|
|
|
|
%endif
|
|
|
|
|
2023-04-28 07:34:07 +02:00
|
|
|
ExclusiveArch: aarch64 armv6hl armv7hl ppc64 ppc64le riscv64 s390x x86_64
|
2014-04-15 08:02:51 +02:00
|
|
|
BuildRequires: dracut
|
2014-02-02 08:01:46 +01:00
|
|
|
Summary: package kernel and initrd for OBS VM builds
|
2021-08-03 10:04:33 +02:00
|
|
|
License: GPL-2.0-only
|
2014-02-02 08:01:46 +01:00
|
|
|
Group: SLES
|
2023-06-26 10:32:55 +02:00
|
|
|
Version: 6.4.0
|
2014-04-15 08:02:51 +02:00
|
|
|
%if 0%{?is_kotd}
|
2023-06-26 10:32:55 +02:00
|
|
|
Release: <RELEASE>.gd68cda5
|
2014-04-15 08:02:51 +02:00
|
|
|
%else
|
2014-11-01 08:04:35 +01:00
|
|
|
Release: 0
|
2014-04-15 08:02:51 +02:00
|
|
|
%endif
|
2021-12-15 10:02:26 +01:00
|
|
|
%if 0%{?suse_version} > 1550 || 0%{?sle_version} > 150200
|
|
|
|
BuildRequires: zstd
|
|
|
|
%endif
|
2014-01-23 08:04:33 +01:00
|
|
|
|
|
|
|
%description
|
|
|
|
This package is repackaging already compiled kernels to make them usable
|
|
|
|
inside of Open Build Service (OBS) VM builds. An initrd with some basic
|
2019-09-16 11:20:56 +02:00
|
|
|
kernel modules is generated as well, but further kernel modules can be
|
2014-01-23 08:04:33 +01:00
|
|
|
loaded during build when installing the kernel package.
|
|
|
|
|
|
|
|
%prep
|
|
|
|
|
|
|
|
%build
|
2021-08-13 10:03:21 +02:00
|
|
|
# set 'date of last password change' to a static value (bsc#1189305)
|
|
|
|
sed -i 's/^\(root:\*:\)[1-9][0-9]*\(::::::\)/\142\2/' /etc/shadow
|
2014-04-15 08:02:51 +02:00
|
|
|
mkdir -p /usr/lib/dracut/modules.d/80obs
|
|
|
|
cat > /usr/lib/dracut/modules.d/80obs/module-setup.sh <<EOF
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# called by dracut
|
|
|
|
check() {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
# called by dracut
|
|
|
|
installkernel() {
|
|
|
|
hostonly='' instmods obs
|
|
|
|
}
|
|
|
|
|
|
|
|
# called by dracut
|
|
|
|
install() {
|
|
|
|
inst_hook pre-udev 10 "\$moddir"/setup_obs.sh
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
chmod a+rx /usr/lib/dracut/modules.d/80obs/module-setup.sh
|
|
|
|
cat > /usr/lib/dracut/modules.d/80obs/setup_obs.sh <<EOF
|
|
|
|
#!/bin/sh
|
|
|
|
info "Loading kernel modules for OBS"
|
|
|
|
info " Loop..."
|
2022-01-10 09:25:17 +01:00
|
|
|
modprobe -q loop max_loop=64
|
2014-04-15 08:02:51 +02:00
|
|
|
info " binfmt misc..."
|
2020-11-20 09:06:59 +01:00
|
|
|
modprobe -q binfmt_misc
|
2014-04-15 08:02:51 +02:00
|
|
|
EOF
|
|
|
|
chmod a+rx /usr/lib/dracut/modules.d/80obs/setup_obs.sh
|
2016-06-26 16:47:43 +02:00
|
|
|
# Configure systemd in kernel-obs-build's initrd not to limit TasksMax,
|
|
|
|
# we run with build as PID 1 (boo#965564)
|
|
|
|
echo "DefaultTasksMax=infinity" >> /etc/systemd/system.conf
|
|
|
|
echo "DefaultTasksAccounting=no" >> /etc/systemd/system.conf
|
2014-04-15 08:02:51 +02:00
|
|
|
|
2014-01-23 08:04:33 +01:00
|
|
|
# a longer list to have them also available for qemu cross builds where x86_64 kernel runs in eg. arm env.
|
|
|
|
# this list of modules where available on build workers of build.opensuse.org, so we stay compatible.
|
2022-07-22 10:15:10 +02:00
|
|
|
export KERNEL_MODULES="loop dm-crypt essiv dm-mod dm-snapshot binfmt-misc fuse kqemu squashfs ext2 ext3 ext4 reiserfs btrfs xfs nf_conntrack_ipv6 binfmt_misc virtio_pci virtio_mmio virtio_blk virtio_rng fat vfat nls_cp437 nls_iso8859-1 ibmvscsi sd_mod e1000 ibmveth overlay 9p 9pnet_virtio qemu_fw_cfg"
|
2014-10-09 08:03:01 +02:00
|
|
|
|
|
|
|
# manually load all modules to make sure they're available
|
|
|
|
for i in $KERNEL_MODULES; do
|
|
|
|
(
|
|
|
|
echo "info ' $i'"
|
2020-11-20 09:06:59 +01:00
|
|
|
echo "modprobe -q $i"
|
2014-10-09 08:03:01 +02:00
|
|
|
) >> /usr/lib/dracut/modules.d/80obs/setup_obs.sh
|
|
|
|
done
|
|
|
|
|
2014-01-23 08:04:33 +01:00
|
|
|
ROOT=""
|
|
|
|
[ -e "/dev/vda" ] && ROOT="-d /dev/vda"
|
|
|
|
[ -e /dev/hda1 ] && ROOT="-d /dev/hda1" # for xen builds
|
2014-02-02 08:01:46 +01:00
|
|
|
%define kernel_name vmlinu?
|
|
|
|
%ifarch s390 s390x
|
|
|
|
%define kernel_name image
|
|
|
|
%endif
|
2014-10-09 08:03:01 +02:00
|
|
|
%ifarch %arm
|
|
|
|
%define kernel_name zImage
|
|
|
|
%endif
|
2019-09-11 08:08:09 +02:00
|
|
|
%ifarch aarch64 riscv64
|
2014-08-18 08:02:31 +02:00
|
|
|
%define kernel_name Image
|
|
|
|
%endif
|
2014-04-15 08:02:51 +02:00
|
|
|
|
2022-05-04 10:17:15 +02:00
|
|
|
# --host-only mode is needed for unlimited TasksMax workaround (boo#965564)
|
2021-08-13 10:03:21 +02:00
|
|
|
dracut --reproducible --host-only --no-hostonly-cmdline \
|
2021-10-21 07:03:06 +02:00
|
|
|
--no-early-microcode --nofscks --strip --hardlink \
|
2021-08-13 10:03:21 +02:00
|
|
|
--drivers="$KERNEL_MODULES" --force /tmp/initrd.kvm \
|
2021-12-15 10:02:26 +01:00
|
|
|
%if 0%{?suse_version} > 1550 || 0%{?sle_version} > 150200
|
|
|
|
--compress "zstd -19 -T0" \
|
|
|
|
%endif
|
2022-03-23 09:14:44 +01:00
|
|
|
$(echo /boot/%{kernel_name}-*%{kernel_flavor} | sed -n -e 's,[^-]*-\(.*'%{kernel_flavor}'\),\1,p')
|
2014-04-15 08:02:51 +02:00
|
|
|
|
|
|
|
#cleanup
|
|
|
|
rm -rf /usr/lib/dracut/modules.d/80obs
|
2014-01-23 08:04:33 +01:00
|
|
|
|
|
|
|
%install
|
2021-12-14 12:24:51 +01:00
|
|
|
install -d -m 0755 %{buildroot}
|
|
|
|
cp -v /boot/%{kernel_name}-*%{kernel_flavor} %{buildroot}/.build.kernel.kvm
|
|
|
|
cp -v /tmp/initrd.kvm %{buildroot}/.build.initrd.kvm
|
|
|
|
|
2021-12-15 10:02:26 +01:00
|
|
|
# inform worker kernel parameters to invoke
|
2022-01-10 09:25:17 +01:00
|
|
|
CMDLINE="elevator=noop nmi_watchdog=0 rw"
|
2021-12-15 10:02:26 +01:00
|
|
|
%if 0%{?suse_version} && 0%{?suse_version} < 1315
|
|
|
|
# kvmclock has always been disabled for old kernels, keep it for historic compatibility
|
|
|
|
CMDLINE+=" no-kvmclock"
|
|
|
|
%endif
|
|
|
|
echo "$CMDLINE" > %{buildroot}/.build.cmdline.kvm
|
|
|
|
|
2021-12-14 12:24:51 +01:00
|
|
|
# inform worker about availability of virtio-serial
|
|
|
|
touch %{buildroot}/.build.console.kvm
|
|
|
|
if grep -qx CONFIG_VIRTIO_CONSOLE=y /boot/config-*%{kernel_flavor} ; then
|
|
|
|
echo "virtio" > %{buildroot}/.build.console.kvm
|
|
|
|
fi
|
2014-01-23 08:04:33 +01:00
|
|
|
|
2015-04-22 08:05:37 +02:00
|
|
|
#inform worker about arch
|
|
|
|
#see obs-build commit e47399d738e51
|
2021-12-14 12:24:51 +01:00
|
|
|
uname -m > %{buildroot}/.build.hostarch.kvm
|
2015-04-22 08:05:37 +02:00
|
|
|
|
2014-01-23 08:04:33 +01:00
|
|
|
%files
|
2021-12-15 10:02:26 +01:00
|
|
|
/.build.cmdline.*
|
2021-12-14 12:24:51 +01:00
|
|
|
/.build.console.*
|
2021-12-15 10:02:26 +01:00
|
|
|
/.build.hostarch.*
|
|
|
|
/.build.initrd.*
|
|
|
|
/.build.kernel.*
|
2014-01-23 08:04:33 +01:00
|
|
|
|
2014-02-02 08:01:46 +01:00
|
|
|
%changelog
|