2014-01-23 08:04:33 +01:00
|
|
|
#
|
|
|
|
# spec file for package kernel-obs-build
|
|
|
|
#
|
2014-02-02 08:01:46 +01:00
|
|
|
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
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.
|
|
|
|
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
|
|
#
|
|
|
|
# needsrootforbuild
|
|
|
|
|
2014-02-02 08:01:46 +01:00
|
|
|
|
2014-01-23 08:04:33 +01:00
|
|
|
#!BuildIgnore: post-build-checks
|
|
|
|
|
2014-08-18 08:02:31 +02:00
|
|
|
%define patchversion 3.16.1
|
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
|
|
|
|
2014-02-02 08:01:46 +01:00
|
|
|
BuildRequires: kernel-default
|
2014-01-23 08:04:33 +01:00
|
|
|
%ifarch %ix86 x86_64
|
2014-02-02 08:01:46 +01:00
|
|
|
BuildRequires: kernel-xen
|
2014-01-23 08:04:33 +01:00
|
|
|
%endif
|
2014-04-28 08:02:09 +02:00
|
|
|
ExclusiveArch: aarch64 armv6hl armv7hl %ix86 ppc ppc64 ppc64le s390x x86_64
|
2014-08-19 08:03:29 +02:00
|
|
|
%if 0%{?suse_version} < 1315
|
2014-04-15 08:02:51 +02:00
|
|
|
# For SLE 11
|
|
|
|
BuildRequires: mkinitrd
|
2014-06-05 08:02:39 +02:00
|
|
|
BuildRequires: perl-Bootloader
|
2014-01-23 08:04:33 +01:00
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
2014-04-15 08:02:51 +02:00
|
|
|
%else
|
|
|
|
BuildRequires: dracut
|
2014-01-23 08:04:33 +01:00
|
|
|
%endif
|
2014-02-02 08:01:46 +01:00
|
|
|
Summary: package kernel and initrd for OBS VM builds
|
|
|
|
License: GPL-2.0
|
|
|
|
Group: SLES
|
2014-08-18 08:02:31 +02:00
|
|
|
Version: 3.16.1
|
2014-04-15 08:02:51 +02:00
|
|
|
%if 0%{?is_kotd}
|
2014-09-04 08:03:33 +02:00
|
|
|
Release: <RELEASE>.g2ab6585
|
2014-04-15 08:02:51 +02:00
|
|
|
%else
|
2014-09-04 08:03:33 +02:00
|
|
|
Release: <RELEASE>.g2ab6585
|
2014-04-15 08:02:51 +02:00
|
|
|
%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
|
|
|
|
kernel modules is generated as well, but further kernel modules can be
|
|
|
|
loaded during build when installing the kernel package.
|
|
|
|
|
|
|
|
%prep
|
|
|
|
|
|
|
|
%build
|
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..."
|
|
|
|
modprobe loop max_loop=64 lbs=0 || modprobe loop max_loop=64
|
|
|
|
info " binfmt misc..."
|
|
|
|
modprobe binfmt_misc
|
|
|
|
EOF
|
|
|
|
chmod a+rx /usr/lib/dracut/modules.d/80obs/setup_obs.sh
|
|
|
|
|
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.
|
2014-08-18 08:02:31 +02:00
|
|
|
export KERNEL_MODULES="loop dm-mod dm-snapshot binfmt-misc fuse kqemu squashfs ext2 ext3 ext4 reiserfs nf_conntrack_ipv6 binfmt_misc virtio_pci virtio_mmio virtio_blk fat vfat nls_cp437 nls_iso8859-1 ibmvscsi ibmvscsic"
|
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-08-18 08:02:31 +02:00
|
|
|
%ifarch aarch64
|
|
|
|
%define kernel_name Image
|
|
|
|
%endif
|
2014-04-15 08:02:51 +02:00
|
|
|
|
2014-08-19 08:03:29 +02:00
|
|
|
%if 0%{?suse_version} < 1315
|
2014-04-15 08:02:51 +02:00
|
|
|
# For SLE 11
|
2014-01-23 08:04:33 +01:00
|
|
|
/sbin/mkinitrd $ROOT \
|
|
|
|
-m "$KERNEL_MODULES" \
|
2014-04-01 08:03:05 +02:00
|
|
|
-k /boot/%{kernel_name}-*-default -M /boot/System.map-*-default -i /tmp/initrd.kvm -B
|
2014-01-23 08:04:33 +01:00
|
|
|
%ifarch %ix86 x86_64
|
|
|
|
/sbin/mkinitrd $ROOT \
|
|
|
|
-m "$KERNEL_MODULES" \
|
|
|
|
-k /boot/vmlinuz-xen -M /boot/System.map-*-xen -i /tmp/initrd.xen
|
|
|
|
%endif
|
2014-04-15 08:02:51 +02:00
|
|
|
%else
|
|
|
|
dracut --host-only --drivers="$KERNEL_MODULES" --force /tmp/initrd.kvm `echo /boot/%{kernel_name}-*-default | sed -n -e 's,[^-]*-\(.*-default\),\1,p'`
|
|
|
|
%ifarch %ix86 x86_64
|
2014-04-28 08:02:09 +02:00
|
|
|
dracut --host-only --drivers="$KERNEL_MODULES xenblk" --force /tmp/initrd.xen `echo /boot/%{kernel_name}-*-xen | sed -n -e 's,[^-]*-\(.*-xen\),\1,p'`
|
2014-04-15 08:02:51 +02:00
|
|
|
%endif
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
#cleanup
|
|
|
|
rm -rf /usr/lib/dracut/modules.d/80obs
|
2014-01-23 08:04:33 +01:00
|
|
|
|
|
|
|
%install
|
|
|
|
install -d -m 0755 $RPM_BUILD_ROOT
|
2014-02-02 08:01:46 +01:00
|
|
|
cp -v /boot/%{kernel_name}-*-default $RPM_BUILD_ROOT/.build.kernel.kvm
|
2014-01-23 08:04:33 +01:00
|
|
|
cp -v /tmp/initrd.kvm $RPM_BUILD_ROOT/.build.initrd.kvm
|
|
|
|
%ifarch %ix86 x86_64
|
2014-04-15 08:02:51 +02:00
|
|
|
cp -v /boot/%{kernel_name}-*-xen $RPM_BUILD_ROOT/.build.kernel.xen
|
2014-01-23 08:04:33 +01:00
|
|
|
cp -v /tmp/initrd.xen $RPM_BUILD_ROOT/.build.initrd.xen
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%files
|
|
|
|
%defattr(-,root,root)
|
|
|
|
/.build.kernel.*
|
|
|
|
/.build.initrd.*
|
|
|
|
|
2014-02-02 08:01:46 +01:00
|
|
|
%changelog
|