2010-06-15 20:49:11 +00:00
|
|
|
# A spec file for building xenlinux Dom0 kernel for Qubes
|
|
|
|
# Based on the Open SUSE kernel-spec & Fedora kernel-spec.
|
|
|
|
#
|
|
|
|
|
2013-03-19 17:55:54 +00:00
|
|
|
%if 0%{?qubes_builder}
|
|
|
|
%define _sourcedir %(pwd)
|
|
|
|
%endif
|
|
|
|
|
2010-06-15 20:49:11 +00:00
|
|
|
#%define _unpackaged_files_terminate_build 0
|
2015-04-30 01:43:43 +00:00
|
|
|
%define variant pvops.qubes
|
|
|
|
%define plainrel %(cat rel)
|
2012-06-14 00:52:26 +00:00
|
|
|
%define rel %{plainrel}.%{variant}
|
2015-04-30 01:43:43 +00:00
|
|
|
%define version %(cat version)
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
%define _buildshell /bin/bash
|
2014-06-10 10:46:28 +00:00
|
|
|
%define build_xen 1
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
%global cpu_arch x86_64
|
2015-04-30 01:43:43 +00:00
|
|
|
%define cpu_arch_flavor %cpu_arch
|
2010-06-15 20:49:11 +00:00
|
|
|
|
2014-03-11 02:46:21 +00:00
|
|
|
%define kernelrelease %(echo %{version} | sed 's/^3\\.[0-9]\\+$/\\0.0/')-%rel.%cpu_arch
|
2010-06-15 20:49:11 +00:00
|
|
|
%define my_builddir %_builddir/%{name}-%{version}
|
|
|
|
|
|
|
|
%define build_src_dir %my_builddir/linux-%version
|
|
|
|
%define src_install_dir /usr/src/kernels/%kernelrelease
|
|
|
|
%define kernel_build_dir %my_builddir/linux-obj
|
2012-06-14 00:52:26 +00:00
|
|
|
%define vm_install_dir /var/lib/qubes/vm-kernels/%version-%{plainrel}
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
%(chmod +x %_sourcedir/{guards,apply-patches,check-for-config-changes})
|
|
|
|
|
|
|
|
%define install_vdso 1
|
2014-01-27 13:50:57 +00:00
|
|
|
%define debuginfodir /usr/lib/debug
|
2010-06-15 20:49:11 +00:00
|
|
|
|
2014-04-23 10:49:31 +00:00
|
|
|
# If you want to build debuginfo package, enable also CONFIG_DEBUG_INFO in %%setup section
|
|
|
|
# Otherwise debuginfo build is disabled by default to save disk space (it needs 2-3GB build time)
|
|
|
|
%global debug_package %{nil}
|
|
|
|
|
2010-06-20 21:30:51 +00:00
|
|
|
Name: kernel
|
2010-06-15 20:49:11 +00:00
|
|
|
Summary: The Xen Kernel
|
|
|
|
Version: %{version}
|
2010-09-30 15:45:17 +00:00
|
|
|
Epoch: 1000
|
2010-06-15 20:49:11 +00:00
|
|
|
Release: %{rel}
|
|
|
|
License: GPL v2 only
|
|
|
|
Group: System/Kernel
|
|
|
|
Url: http://www.kernel.org/
|
|
|
|
AutoReqProv: on
|
|
|
|
BuildRequires: coreutils module-init-tools sparse
|
2015-03-20 09:30:11 +00:00
|
|
|
BuildRequires: qubes-kernel-vm-support
|
2014-06-10 10:46:28 +00:00
|
|
|
BuildRequires: dracut
|
2015-03-20 09:30:11 +00:00
|
|
|
BuildRequires: busybox
|
2015-05-06 23:26:44 +00:00
|
|
|
BuildRequires: bc
|
2010-06-15 20:49:11 +00:00
|
|
|
Provides: multiversion(kernel)
|
2014-04-27 09:59:58 +00:00
|
|
|
Provides: %name = %kernelrelease
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
Provides: kernel-xen-dom0
|
|
|
|
Provides: kernel-qubes-dom0
|
2015-04-30 01:43:43 +00:00
|
|
|
Provides: kernel-qubes-dom0-pvops
|
2013-02-05 22:34:22 +00:00
|
|
|
Provides: kernel-drm = 4.3.0
|
2010-06-16 14:10:28 +00:00
|
|
|
Provides: kernel-drm-nouveau = 16
|
2013-01-26 23:32:39 +00:00
|
|
|
Provides: kernel-modules-extra = %kernelrelease
|
2013-02-05 22:34:22 +00:00
|
|
|
Provides: kernel-modeset = 1
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
Requires(pre): coreutils gawk
|
2013-02-05 21:15:36 +00:00
|
|
|
Requires(post): dracut binutils
|
2015-07-10 16:58:49 +00:00
|
|
|
Requires: qubes-core-dom0-linux-kernel-install
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
Conflicts: sysfsutils < 2.0
|
|
|
|
# root-lvm only works with newer udevs
|
|
|
|
Conflicts: udev < 118
|
|
|
|
Conflicts: lvm2 < 2.02.33
|
2011-07-14 00:01:37 +00:00
|
|
|
Provides: kernel = %kernelrelease
|
|
|
|
Provides: kernel-uname-r = %kernelrelease
|
2010-06-15 20:49:11 +00:00
|
|
|
|
2014-02-02 02:20:06 +00:00
|
|
|
Source0: linux-%version.tar.xz
|
2015-04-30 01:43:43 +00:00
|
|
|
Source14: series.conf
|
2010-06-15 20:49:11 +00:00
|
|
|
Source16: guards
|
|
|
|
Source17: apply-patches
|
|
|
|
Source33: check-for-config-changes
|
2015-04-30 01:43:43 +00:00
|
|
|
Source100: config
|
2011-06-29 23:11:56 +00:00
|
|
|
# FIXME: Including dirs this way does NOT produce proper src.rpms
|
2014-01-27 13:50:57 +00:00
|
|
|
Source204: patches.rpmify
|
2010-07-07 11:12:45 +00:00
|
|
|
Source205: patches.xen
|
2010-09-03 13:48:27 +00:00
|
|
|
Source300: patches.qubes
|
2010-06-15 20:49:11 +00:00
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
|
ExclusiveArch: x86_64
|
|
|
|
|
|
|
|
%description
|
|
|
|
Qubes Dom0 kernel.
|
|
|
|
|
|
|
|
%prep
|
2014-02-02 02:20:06 +00:00
|
|
|
if ! [ -e %_sourcedir/linux-%version.tar.xz ]; then
|
2010-06-15 20:49:11 +00:00
|
|
|
echo "The %name-%version.nosrc.rpm package does not contain the" \
|
2014-06-10 10:46:28 +00:00
|
|
|
"complete sources. Please install kernel-source-%version.src.rpm."
|
2010-06-15 20:49:11 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-04-30 01:43:43 +00:00
|
|
|
SYMBOLS="xen-dom0 pvops"
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
# Unpack all sources and patches
|
2010-07-07 11:12:45 +00:00
|
|
|
%setup -q -c -T -a 0
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
mkdir -p %kernel_build_dir
|
|
|
|
|
|
|
|
cd linux-%version
|
|
|
|
|
2015-04-30 01:43:43 +00:00
|
|
|
if [ -r %_sourcedir/series-%{version}.conf ]; then
|
|
|
|
%_sourcedir/apply-patches %_sourcedir/series-%{version}.conf %_sourcedir $SYMBOLS
|
2012-02-12 15:58:39 +00:00
|
|
|
else
|
2015-04-30 01:43:43 +00:00
|
|
|
%_sourcedir/apply-patches %_sourcedir/series.conf %_sourcedir $SYMBOLS
|
2012-02-12 15:58:39 +00:00
|
|
|
fi
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
cd %kernel_build_dir
|
|
|
|
|
2015-04-30 01:43:43 +00:00
|
|
|
if [ -f %_sourcedir/config-%{version} ]; then
|
|
|
|
cp %_sourcedir/config-%{version} .config
|
2012-02-12 15:58:39 +00:00
|
|
|
else
|
2015-04-30 01:43:43 +00:00
|
|
|
cp %_sourcedir/config .config
|
2012-02-12 15:58:39 +00:00
|
|
|
fi
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
%build_src_dir/scripts/config \
|
2014-06-10 10:46:28 +00:00
|
|
|
--set-str CONFIG_LOCALVERSION -%release.%cpu_arch \
|
|
|
|
--disable CONFIG_DEBUG_INFO
|
|
|
|
# --enable CONFIG_DEBUG_INFO \
|
|
|
|
# --disable CONFIG_DEBUG_INFO_REDUCED
|
2010-06-15 20:49:11 +00:00
|
|
|
# Enabling CONFIG_DEBUG_INFO produces *huge* packages!
|
|
|
|
|
|
|
|
MAKE_ARGS="$MAKE_ARGS -C %build_src_dir O=$PWD"
|
|
|
|
if test -e %_sourcedir/TOLERATE-UNKNOWN-NEW-CONFIG-OPTIONS; then
|
|
|
|
yes '' | make oldconfig $MAKE_ARGS
|
|
|
|
else
|
|
|
|
cp .config .config.orig
|
|
|
|
make silentoldconfig $MAKE_ARGS < /dev/null
|
|
|
|
%_sourcedir/check-for-config-changes .config.orig .config
|
|
|
|
rm .config.orig
|
|
|
|
fi
|
|
|
|
|
|
|
|
make prepare $MAKE_ARGS
|
|
|
|
make scripts $MAKE_ARGS
|
2012-05-25 21:47:23 +00:00
|
|
|
make scripts_basic $MAKE_ARGS
|
2010-06-15 20:49:11 +00:00
|
|
|
krel=$(make -s kernelrelease $MAKE_ARGS)
|
|
|
|
|
|
|
|
if [ "$krel" != "%kernelrelease" ]; then
|
|
|
|
echo "Kernel release mismatch: $krel != %kernelrelease" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
make clean $MAKE_ARGS
|
|
|
|
|
|
|
|
rm -f source
|
|
|
|
find . ! -type d -printf '%%P\n' > %my_builddir/obj-files
|
2015-03-20 09:30:11 +00:00
|
|
|
u2mfn_ver=`dkms status u2mfn|tail -n 1|cut -f 2 -d ' '|tr -d ':,:'`
|
|
|
|
rm -rf %_builddir/u2mfn
|
|
|
|
cp -r /usr/src/u2mfn-$u2mfn_ver %_builddir/u2mfn
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
%build
|
2011-06-29 23:11:56 +00:00
|
|
|
|
2010-06-15 20:49:11 +00:00
|
|
|
cd %kernel_build_dir
|
|
|
|
|
2014-01-27 13:50:57 +00:00
|
|
|
# This override tweaks the kernel makefiles so that we run debugedit on an
|
|
|
|
# object before embedding it. When we later run find-debuginfo.sh, it will
|
|
|
|
# run debugedit again. The edits it does change the build ID bits embedded
|
|
|
|
# in the stripped object, but repeating debugedit is a no-op. We do it
|
|
|
|
# beforehand to get the proper final build ID bits into the embedded image.
|
|
|
|
# This affects the vDSO images in vmlinux, and the vmlinux image in bzImage.
|
|
|
|
export AFTER_LINK=\
|
|
|
|
'sh -xc "/usr/lib/rpm/debugedit -b $$RPM_BUILD_DIR -d /usr/src/debug \
|
|
|
|
-i $@ > $@.id"'
|
|
|
|
|
2013-03-19 15:41:05 +00:00
|
|
|
make %{?_smp_mflags} all $MAKE_ARGS CONFIG_DEBUG_SECTION_MISMATCH=y
|
2010-06-15 20:49:11 +00:00
|
|
|
|
2011-06-29 23:11:56 +00:00
|
|
|
# Build u2mfn module
|
2015-03-20 09:30:11 +00:00
|
|
|
make -C %kernel_build_dir M=%_builddir/u2mfn modules
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
%install
|
|
|
|
|
|
|
|
# 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-*'
|
|
|
|
|
2012-05-24 14:19:53 +00:00
|
|
|
# /lib/modules/%kernelrelease-%build_flavor/build will be a stale symlink until the
|
|
|
|
# kernel-devel package is installed. Don't check for stale symlinks
|
|
|
|
# in the brp-symlink check:
|
|
|
|
export NO_BRP_STALE_LINK_ERROR=yes
|
|
|
|
|
2010-06-15 20:49:11 +00:00
|
|
|
cd %kernel_build_dir
|
|
|
|
|
|
|
|
mkdir -p %buildroot/boot
|
|
|
|
cp -p System.map %buildroot/boot/System.map-%kernelrelease
|
2015-04-30 01:43:43 +00:00
|
|
|
cp -p arch/x86/boot/bzImage %buildroot/boot/vmlinuz-%kernelrelease
|
2010-06-15 20:49:11 +00:00
|
|
|
cp .config %buildroot/boot/config-%kernelrelease
|
|
|
|
|
|
|
|
%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 initramfs with roughly the size the real one will have.
|
|
|
|
# That way, rpm will know that this package requires some additional
|
|
|
|
# space in /boot.
|
|
|
|
dd if=/dev/zero of=%buildroot/boot/initramfs-%kernelrelease.img \
|
2014-06-10 10:46:28 +00:00
|
|
|
bs=1M count=20
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
gzip -c9 < Module.symvers > %buildroot/boot/symvers-%kernelrelease.gz
|
|
|
|
|
|
|
|
make modules_install $MAKE_ARGS INSTALL_MOD_PATH=%buildroot
|
2015-03-20 09:30:11 +00:00
|
|
|
make modules_install $MAKE_ARGS INSTALL_MOD_PATH=%buildroot M=%_builddir/u2mfn
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
mkdir -p %buildroot/%src_install_dir
|
|
|
|
|
|
|
|
rm -f %buildroot/lib/modules/%kernelrelease/build
|
|
|
|
rm -f %buildroot/lib/modules/%kernelrelease/source
|
|
|
|
mkdir -p %buildroot/lib/modules/%kernelrelease/build
|
|
|
|
(cd %buildroot/lib/modules/%kernelrelease ; ln -s build source)
|
|
|
|
# dirs for additional modules per module-init-tools, kbuild/modules.txt
|
|
|
|
mkdir -p %buildroot/lib/modules/%kernelrelease/extra
|
|
|
|
mkdir -p %buildroot/lib/modules/%kernelrelease/updates
|
|
|
|
mkdir -p %buildroot/lib/modules/%kernelrelease/weak-updates
|
|
|
|
|
|
|
|
pushd %build_src_dir
|
|
|
|
cp --parents `find -type f -name "Makefile*" -o -name "Kconfig*"` %buildroot/lib/modules/%kernelrelease/build
|
|
|
|
cp -a scripts %buildroot/lib/modules/%kernelrelease/build
|
2013-09-29 00:34:44 +00:00
|
|
|
cp -a --parents arch/x86/include %buildroot/lib/modules/%kernelrelease/build/
|
2010-06-15 20:49:11 +00:00
|
|
|
cp -a include %buildroot/lib/modules/%kernelrelease/build/include
|
|
|
|
popd
|
|
|
|
|
|
|
|
cp Module.symvers %buildroot/lib/modules/%kernelrelease/build
|
|
|
|
cp System.map %buildroot/lib/modules/%kernelrelease/build
|
|
|
|
if [ -s Module.markers ]; then
|
|
|
|
cp Module.markers %buildroot/lib/modules/%kernelrelease/build
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf %buildroot/lib/modules/%kernelrelease/build/Documentation
|
|
|
|
cp .config %buildroot/lib/modules/%kernelrelease/build
|
|
|
|
|
|
|
|
rm -f %buildroot/lib/modules/%kernelrelease/build/scripts/*.o
|
|
|
|
rm -f %buildroot/lib/modules/%kernelrelease/build/scripts/*/*.o
|
|
|
|
|
|
|
|
cp -a scripts/* %buildroot/lib/modules/%kernelrelease/build/scripts/
|
|
|
|
cp -a include/* %buildroot/lib/modules/%kernelrelease/build/include
|
|
|
|
|
|
|
|
# Copy .config to include/config/auto.conf so "make prepare" is unnecessary.
|
|
|
|
cp %buildroot/lib/modules/%kernelrelease/build/.config %buildroot/lib/modules/%kernelrelease/build/include/config/auto.conf
|
2013-09-29 00:34:44 +00:00
|
|
|
|
|
|
|
# Make sure the Makefile and version.h have a matching timestamp so that
|
|
|
|
# external modules can be built
|
|
|
|
touch -r %buildroot/lib/modules/%kernelrelease/build/Makefile %buildroot/lib/modules/%kernelrelease/build/include/generated/uapi/linux/version.h
|
|
|
|
touch -r %buildroot/lib/modules/%kernelrelease/build/.config %buildroot/lib/modules/%kernelrelease/build/include/config/auto.conf
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
if test -s vmlinux.id; then
|
|
|
|
cp vmlinux.id %buildroot/lib/modules/%kernelrelease/build/vmlinux.id
|
|
|
|
else
|
|
|
|
echo >&2 "*** WARNING *** no vmlinux build ID! ***"
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# save the vmlinux file for kernel debugging into the kernel-debuginfo rpm
|
|
|
|
#
|
|
|
|
mkdir -p %buildroot%{debuginfodir}/lib/modules/%kernelrelease
|
|
|
|
cp vmlinux %buildroot%{debuginfodir}/lib/modules/%kernelrelease
|
|
|
|
|
|
|
|
find %buildroot/lib/modules/%kernelrelease -name "*.ko" -type f >modnames
|
|
|
|
|
2011-03-27 15:50:51 +00:00
|
|
|
# mark modules executable so that strip-to-file can strip them
|
|
|
|
xargs --no-run-if-empty chmod u+x < modnames
|
|
|
|
|
|
|
|
# Generate a list of modules for block and networking.
|
|
|
|
|
|
|
|
fgrep /drivers/ modnames | xargs --no-run-if-empty nm -upA |
|
|
|
|
sed -n 's,^.*/\([^/]*\.ko\): *U \(.*\)$,\1 \2,p' > drivers.undef
|
|
|
|
|
|
|
|
collect_modules_list()
|
|
|
|
{
|
|
|
|
sed -r -n -e "s/^([^ ]+) \\.?($2)\$/\\1/p" drivers.undef |
|
|
|
|
LC_ALL=C sort -u > %buildroot/lib/modules/%kernelrelease/modules.$1
|
|
|
|
}
|
|
|
|
|
|
|
|
collect_modules_list networking \
|
2014-06-10 10:46:28 +00:00
|
|
|
'register_netdev|ieee80211_register_hw|usbnet_probe'
|
2011-03-27 15:50:51 +00:00
|
|
|
collect_modules_list block \
|
2014-06-10 10:46:28 +00:00
|
|
|
'ata_scsi_ioctl|scsi_add_host|scsi_add_host_with_dma|blk_init_queue|register_mtd_blktrans|scsi_esp_register|scsi_register_device_handler'
|
2011-03-27 15:50:51 +00:00
|
|
|
collect_modules_list drm \
|
2014-06-10 10:46:28 +00:00
|
|
|
'drm_open|drm_init'
|
2011-03-27 15:50:51 +00:00
|
|
|
collect_modules_list modesetting \
|
2014-06-10 10:46:28 +00:00
|
|
|
'drm_crtc_init'
|
2011-03-27 15:50:51 +00:00
|
|
|
|
|
|
|
# detect missing or incorrect license tags
|
|
|
|
rm -f modinfo
|
|
|
|
while read i
|
|
|
|
do
|
|
|
|
echo -n "${i#%buildroot/lib/modules/%kernelrelease/} " >> modinfo
|
|
|
|
/sbin/modinfo -l $i >> modinfo
|
|
|
|
done < modnames
|
|
|
|
|
|
|
|
egrep -v \
|
2014-06-10 10:46:28 +00:00
|
|
|
'GPL( v2)?$|Dual BSD/GPL$|Dual MPL/GPL$|GPL and additional rights$' \
|
|
|
|
modinfo && exit 1
|
2011-03-27 15:50:51 +00:00
|
|
|
|
|
|
|
rm -f modinfo modnames
|
|
|
|
|
2010-06-15 20:49:11 +00:00
|
|
|
# Move the devel headers out of the root file system
|
|
|
|
mkdir -p %buildroot/usr/src/kernels
|
2011-09-08 10:45:29 +00:00
|
|
|
mv %buildroot/lib/modules/%kernelrelease/build/* %buildroot/%src_install_dir/
|
2011-03-16 09:32:17 +00:00
|
|
|
mv %buildroot/lib/modules/%kernelrelease/build/.config %buildroot/%src_install_dir
|
|
|
|
rmdir %buildroot/lib/modules/%kernelrelease/build
|
2011-05-02 14:06:05 +00:00
|
|
|
ln -sf %src_install_dir %buildroot/lib/modules/%kernelrelease/build
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
# Abort if there are any undefined symbols
|
|
|
|
msg="$(/sbin/depmod -F %buildroot/boot/System.map-%kernelrelease \
|
|
|
|
-b %buildroot -ae %kernelrelease 2>&1)"
|
|
|
|
|
|
|
|
if [ $? -ne 0 ] || echo "$msg" | grep 'needs unknown symbol'; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-04-30 01:43:43 +00:00
|
|
|
# in case of no firmware built - place empty dir
|
|
|
|
mkdir -p %buildroot/lib/firmware
|
|
|
|
mv %buildroot/lib/firmware %buildroot/lib/firmware-all
|
|
|
|
mkdir -p %buildroot/lib/firmware
|
|
|
|
mv %buildroot/lib/firmware-all %buildroot/lib/firmware/%kernelrelease
|
2012-09-23 21:42:48 +00:00
|
|
|
|
2011-06-29 23:11:56 +00:00
|
|
|
# Prepare initramfs for Qubes VM
|
|
|
|
mkdir -p %buildroot/%vm_install_dir
|
|
|
|
/sbin/dracut --nomdadmconf --nolvmconf \
|
|
|
|
--kmoddir %buildroot/lib/modules/%kernelrelease \
|
2015-03-20 09:30:11 +00:00
|
|
|
--modules "kernel-modules qubes-vm-simple" \
|
|
|
|
--conf /dev/null --confdir /var/empty \
|
2011-09-08 10:45:29 +00:00
|
|
|
-d "xenblk xen-blkfront cdrom ext4 jbd2 crc16 dm_snapshot" \
|
2011-06-29 23:11:56 +00:00
|
|
|
%buildroot/%vm_install_dir/initramfs %kernelrelease
|
|
|
|
|
2015-04-30 01:43:43 +00:00
|
|
|
cp -p arch/x86/boot/bzImage %buildroot/%vm_install_dir/vmlinuz
|
2011-06-29 23:11:56 +00:00
|
|
|
|
|
|
|
# Modules for Qubes VM
|
|
|
|
mkdir -p %buildroot%vm_install_dir/modules
|
|
|
|
cp -a %buildroot/lib/modules/%kernelrelease %buildroot%vm_install_dir/modules/
|
|
|
|
mkdir -p %buildroot%vm_install_dir/modules/firmware
|
|
|
|
cp -a %buildroot/lib/firmware/%kernelrelease %buildroot%vm_install_dir/modules/firmware/
|
|
|
|
|
|
|
|
# remove files that will be auto generated by depmod at rpm -i time
|
|
|
|
for i in alias alias.bin ccwmap dep dep.bin ieee1394map inputmap isapnpmap ofmap pcimap seriomap symbols symbols.bin usbmap
|
|
|
|
do
|
|
|
|
rm -f %buildroot/lib/modules/%kernelrelease/modules.$i
|
|
|
|
done
|
|
|
|
|
2010-06-15 20:49:11 +00:00
|
|
|
%post
|
2015-07-10 16:02:37 +00:00
|
|
|
/sbin/depmod -a %{kernelrelease}
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
%posttrans
|
2015-07-10 16:02:37 +00:00
|
|
|
/bin/kernel-install add %{kernelrelease} /boot/vmlinuz-%{kernelrelease} || exit $?
|
2013-02-05 23:16:14 +00:00
|
|
|
|
2010-06-15 20:49:11 +00:00
|
|
|
%preun
|
2015-07-10 16:02:37 +00:00
|
|
|
/bin/kernel-install remove %{kernelrelease} /boot/vmlinuz-%{kernelrelease} || exit $?
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
%files
|
|
|
|
%defattr(-, root, root)
|
|
|
|
%ghost /boot/initramfs-%{kernelrelease}.img
|
|
|
|
/boot/System.map-%{kernelrelease}
|
|
|
|
/boot/config-%{kernelrelease}
|
|
|
|
/boot/symvers-%kernelrelease.gz
|
|
|
|
%attr(0644, root, root) /boot/vmlinuz-%{kernelrelease}
|
|
|
|
/lib/firmware/%{kernelrelease}
|
|
|
|
/lib/modules/%{kernelrelease}
|
|
|
|
|
|
|
|
%package devel
|
|
|
|
Summary: Development files necessary for building kernel modules
|
|
|
|
License: GPL v2 only
|
|
|
|
Group: Development/Sources
|
|
|
|
Provides: multiversion(kernel)
|
2011-07-14 00:01:37 +00:00
|
|
|
Provides: %name-devel = %kernelrelease
|
|
|
|
Provides: kernel-devel-uname-r = %kernelrelease
|
2010-06-15 20:49:11 +00:00
|
|
|
AutoReqProv: on
|
|
|
|
|
|
|
|
%description devel
|
|
|
|
This package contains files necessary for building kernel modules (and
|
2015-04-30 01:43:43 +00:00
|
|
|
kernel module packages) against the kernel.
|
2010-06-15 20:49:11 +00:00
|
|
|
|
|
|
|
%post devel
|
|
|
|
if [ -f /etc/sysconfig/kernel ]
|
|
|
|
then
|
|
|
|
. /etc/sysconfig/kernel || exit $?
|
|
|
|
fi
|
|
|
|
if [ "$HARDLINK" != "no" -a -x /usr/sbin/hardlink ]
|
|
|
|
then
|
|
|
|
(cd /usr/src/kernels/%{kernelrelease} &&
|
|
|
|
/usr/bin/find . -type f | while read f; do
|
|
|
|
hardlink -c /usr/src/kernels/*.fc*.*/$f $f
|
|
|
|
done)
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
%files devel
|
|
|
|
%defattr(-,root,root)
|
|
|
|
/usr/src/kernels/%{kernelrelease}
|
|
|
|
|
2010-09-03 13:48:27 +00:00
|
|
|
|
2011-06-29 23:11:56 +00:00
|
|
|
%package qubes-vm
|
2010-09-03 13:48:27 +00:00
|
|
|
Summary: The Xen Kernel
|
|
|
|
Version: %{version}
|
|
|
|
Release: %{rel}
|
|
|
|
License: GPL v2 only
|
|
|
|
Group: System/Kernel
|
|
|
|
Url: http://www.kernel.org/
|
|
|
|
AutoReqProv: on
|
|
|
|
BuildRequires: coreutils module-init-tools sparse
|
2011-06-29 23:11:56 +00:00
|
|
|
Provides: multiversion(kernel-qubes-vm)
|
2010-09-03 13:48:27 +00:00
|
|
|
|
|
|
|
Provides: kernel-xen-domU
|
|
|
|
Provides: kernel-qubes-domU
|
|
|
|
|
|
|
|
Requires(pre): coreutils gawk
|
|
|
|
Requires(post): dracut
|
2014-04-08 03:04:08 +00:00
|
|
|
Requires(post): qubes-core-dom0
|
2010-09-03 13:48:27 +00:00
|
|
|
|
|
|
|
Conflicts: sysfsutils < 2.0
|
|
|
|
# root-lvm only works with newer udevs
|
|
|
|
Conflicts: udev < 118
|
|
|
|
Conflicts: lvm2 < 2.02.33
|
2014-04-27 09:59:58 +00:00
|
|
|
Provides: kernel-qubes-vm = %kernelrelease
|
2010-09-03 13:48:27 +00:00
|
|
|
|
2011-06-29 23:11:56 +00:00
|
|
|
%description qubes-vm
|
2010-09-03 13:48:27 +00:00
|
|
|
Qubes domU kernel.
|
|
|
|
|
2011-06-29 23:11:56 +00:00
|
|
|
%post qubes-vm
|
2010-09-03 13:48:27 +00:00
|
|
|
|
2011-06-29 23:11:56 +00:00
|
|
|
mkdir /tmp/qubes-modules-%kernelrelease
|
2014-01-23 03:54:28 +00:00
|
|
|
truncate -s 400M /tmp/qubes-modules-%kernelrelease.img
|
2011-06-29 23:11:56 +00:00
|
|
|
mkfs -t ext3 -F /tmp/qubes-modules-%kernelrelease.img > /dev/null
|
|
|
|
mount /tmp/qubes-modules-%kernelrelease.img /tmp/qubes-modules-%kernelrelease -o loop
|
2011-07-24 23:42:42 +00:00
|
|
|
cp -a -t /tmp/qubes-modules-%kernelrelease %vm_install_dir/modules/%kernelrelease
|
|
|
|
mkdir /tmp/qubes-modules-%kernelrelease/firmware
|
2011-10-16 08:39:15 +00:00
|
|
|
cp -a -t /tmp/qubes-modules-%kernelrelease/firmware %vm_install_dir/modules/firmware/%kernelrelease
|
2011-06-29 23:11:56 +00:00
|
|
|
umount /tmp/qubes-modules-%kernelrelease
|
|
|
|
rmdir /tmp/qubes-modules-%kernelrelease
|
|
|
|
mv /tmp/qubes-modules-%kernelrelease.img %vm_install_dir/modules.img
|
2010-09-03 13:48:27 +00:00
|
|
|
|
2014-04-08 03:04:08 +00:00
|
|
|
# If qubes-prefs isn't installed yet, the default kernel will be set by %post
|
|
|
|
# of qubes-core-dom0
|
|
|
|
type qubes-prefs &>/dev/null && qubes-prefs --set default-kernel %version-%plainrel
|
2010-09-03 13:48:27 +00:00
|
|
|
|
2014-05-12 15:37:54 +00:00
|
|
|
exit 0
|
|
|
|
|
|
|
|
%preun qubes-vm
|
|
|
|
|
|
|
|
if [ "`qubes-prefs -g default-kernel`" == "%version-%plainrel" ]; then
|
|
|
|
echo "This kernel version is set as default VM kernel, cannot remove"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
if qvm-ls --kernel | grep -qw "%version-%plainrel"; then
|
|
|
|
echo "This kernel version is used by at least one VM, cannot remove"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
2011-06-29 23:11:56 +00:00
|
|
|
%files qubes-vm
|
2010-09-03 13:48:27 +00:00
|
|
|
%defattr(-, root, root)
|
2014-05-12 15:41:04 +00:00
|
|
|
%dir %vm_install_dir
|
2011-06-29 23:11:56 +00:00
|
|
|
%ghost %attr(0644, root, root) %vm_install_dir/modules.img
|
|
|
|
%attr(0644, root, root) %vm_install_dir/initramfs
|
|
|
|
%attr(0644, root, root) %vm_install_dir/vmlinuz
|
|
|
|
%vm_install_dir/modules
|
2010-09-03 13:48:27 +00:00
|
|
|
|
|
|
|
|
2010-06-15 20:49:11 +00:00
|
|
|
%changelog
|