2005-04-17 05:20:36 +07:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2013-07-09 00:14:06 +07:00
|
|
|
# Output a simple RPM spec file.
|
|
|
|
# This version assumes a minimum of RPM 4.0.3.
|
2005-04-17 05:20:36 +07:00
|
|
|
#
|
|
|
|
# The only gothic bit here is redefining install_post to avoid
|
|
|
|
# stripping the symbols from files in the kernel which we want
|
|
|
|
#
|
|
|
|
# Patched for non-x86 by Opencon (L) 2002 <opencon@rio.skydome.net>
|
|
|
|
#
|
|
|
|
|
|
|
|
# how we were called determines which rpms we build and how we build them
|
|
|
|
if [ "$1" = "prebuilt" ]; then
|
|
|
|
PREBUILT=true
|
|
|
|
else
|
|
|
|
PREBUILT=false
|
|
|
|
fi
|
|
|
|
|
|
|
|
# starting to output the spec
|
|
|
|
if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then
|
|
|
|
PROVIDES=kernel-drm
|
|
|
|
fi
|
|
|
|
|
|
|
|
PROVIDES="$PROVIDES kernel-$KERNELRELEASE"
|
2011-05-05 03:48:11 +07:00
|
|
|
__KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-/_/g"`
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
echo "Name: kernel"
|
|
|
|
echo "Summary: The Linux Kernel"
|
|
|
|
echo "Version: $__KERNELRELEASE"
|
|
|
|
# we need to determine the NEXT version number so that uname and
|
|
|
|
# rpm -q will agree
|
|
|
|
echo "Release: `. $srctree/scripts/mkversion`"
|
|
|
|
echo "License: GPL"
|
|
|
|
echo "Group: System Environment/Kernel"
|
|
|
|
echo "Vendor: The Linux Community"
|
|
|
|
echo "URL: http://www.kernel.org"
|
|
|
|
|
|
|
|
if ! $PREBUILT; then
|
|
|
|
echo "Source: kernel-$__KERNELRELEASE.tar.gz"
|
|
|
|
fi
|
|
|
|
|
2010-02-01 07:18:58 +07:00
|
|
|
echo "BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root"
|
2005-04-17 05:20:36 +07:00
|
|
|
echo "Provides: $PROVIDES"
|
|
|
|
echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :"
|
|
|
|
echo "%define debug_package %{nil}"
|
|
|
|
echo ""
|
|
|
|
echo "%description"
|
|
|
|
echo "The Linux Kernel, the operating system core itself"
|
|
|
|
echo ""
|
2011-05-18 00:36:16 +07:00
|
|
|
echo "%package headers"
|
|
|
|
echo "Summary: Header files for the Linux kernel for use by glibc"
|
|
|
|
echo "Group: Development/System"
|
|
|
|
echo "Obsoletes: kernel-headers"
|
|
|
|
echo "Provides: kernel-headers = %{version}"
|
|
|
|
echo "%description headers"
|
|
|
|
echo "Kernel-headers includes the C header files that specify the interface"
|
|
|
|
echo "between the Linux kernel and userspace libraries and programs. The"
|
|
|
|
echo "header files define structures and constants that are needed for"
|
|
|
|
echo "building most standard programs and are also needed for rebuilding the"
|
|
|
|
echo "glibc package."
|
|
|
|
echo ""
|
2013-07-09 00:14:06 +07:00
|
|
|
echo "%package devel"
|
|
|
|
echo "Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel"
|
|
|
|
echo "Group: System Environment/Kernel"
|
|
|
|
echo "AutoReqProv: no"
|
|
|
|
echo "%description -n kernel-devel"
|
|
|
|
echo "This package provides kernel headers and makefiles sufficient to build modules"
|
|
|
|
echo "against the $__KERNELRELEASE kernel package."
|
|
|
|
echo ""
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
if ! $PREBUILT; then
|
|
|
|
echo "%prep"
|
|
|
|
echo "%setup -q"
|
|
|
|
echo ""
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "%build"
|
|
|
|
|
|
|
|
if ! $PREBUILT; then
|
2008-10-26 05:02:47 +07:00
|
|
|
echo "make clean && make %{?_smp_mflags}"
|
2005-04-17 05:20:36 +07:00
|
|
|
echo ""
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "%install"
|
2013-06-24 19:48:37 +07:00
|
|
|
echo 'KBUILD_IMAGE=$(make image_name)'
|
2004-07-30 01:07:32 +07:00
|
|
|
echo "%ifarch ia64"
|
2006-08-14 13:16:47 +07:00
|
|
|
echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
|
2004-07-30 01:07:32 +07:00
|
|
|
echo "%else"
|
2006-08-14 13:16:47 +07:00
|
|
|
echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib/modules'
|
2004-07-30 01:07:32 +07:00
|
|
|
echo "%endif"
|
2013-06-24 21:38:28 +07:00
|
|
|
echo 'mkdir -p $RPM_BUILD_ROOT'"/lib/firmware/$KERNELRELEASE"
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2013-06-24 21:38:28 +07:00
|
|
|
echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= mod-fw= modules_install'
|
|
|
|
echo 'INSTALL_FW_PATH=$RPM_BUILD_ROOT'"/lib/firmware/$KERNELRELEASE"
|
|
|
|
echo 'make INSTALL_FW_PATH=$INSTALL_FW_PATH' firmware_install
|
2004-07-30 01:07:32 +07:00
|
|
|
echo "%ifarch ia64"
|
|
|
|
echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE"
|
|
|
|
echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/"
|
|
|
|
echo "%else"
|
2006-06-02 21:53:42 +07:00
|
|
|
echo "%ifarch ppc64"
|
|
|
|
echo "cp vmlinux arch/powerpc/boot"
|
|
|
|
echo "cp arch/powerpc/boot/"'$KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
|
|
|
|
echo "%else"
|
2005-04-17 05:20:36 +07:00
|
|
|
echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
|
2004-07-30 01:07:32 +07:00
|
|
|
echo "%endif"
|
2006-06-02 21:53:42 +07:00
|
|
|
echo "%endif"
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2013-01-12 22:19:19 +07:00
|
|
|
echo 'make %{?_smp_mflags} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr KBUILD_SRC= headers_install'
|
2005-04-17 05:20:36 +07:00
|
|
|
echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE"
|
|
|
|
|
|
|
|
echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE"
|
2009-02-12 12:10:57 +07:00
|
|
|
|
|
|
|
echo "%ifnarch ppc64"
|
2015-04-19 05:05:14 +07:00
|
|
|
echo 'bzip2 -9 --keep vmlinux'
|
2009-02-12 12:10:57 +07:00
|
|
|
echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2"
|
|
|
|
echo "%endif"
|
|
|
|
|
2014-12-04 22:53:13 +07:00
|
|
|
if ! $PREBUILT; then
|
2016-10-25 16:00:44 +07:00
|
|
|
echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/build"
|
|
|
|
echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/source"
|
2013-07-09 00:14:06 +07:00
|
|
|
echo "mkdir -p "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE"
|
|
|
|
echo "EXCLUDES=\"$RCS_TAR_IGNORE --exclude .tmp_versions --exclude=*vmlinux* --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation --exclude=firmware --exclude .config.old --exclude .missing-syscalls.d\""
|
|
|
|
echo "tar "'$EXCLUDES'" -cf- . | (cd "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE;tar xvf -)"
|
|
|
|
echo 'cd $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE"
|
|
|
|
echo "ln -sf /usr/src/kernels/$KERNELRELEASE build"
|
|
|
|
echo "ln -sf /usr/src/kernels/$KERNELRELEASE source"
|
2014-12-04 22:53:13 +07:00
|
|
|
fi
|
2013-07-09 00:14:06 +07:00
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
echo ""
|
|
|
|
echo "%clean"
|
2009-02-23 01:54:55 +07:00
|
|
|
echo 'rm -rf $RPM_BUILD_ROOT'
|
2005-04-17 05:20:36 +07:00
|
|
|
echo ""
|
2013-06-24 21:38:22 +07:00
|
|
|
echo "%post"
|
|
|
|
echo "if [ -x /sbin/installkernel -a -r /boot/vmlinuz-$KERNELRELEASE -a -r /boot/System.map-$KERNELRELEASE ]; then"
|
2016-02-26 22:15:17 +07:00
|
|
|
echo "cp /boot/vmlinuz-$KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm"
|
|
|
|
echo "cp /boot/System.map-$KERNELRELEASE /boot/.System.map-$KERNELRELEASE-rpm"
|
2013-06-24 21:38:22 +07:00
|
|
|
echo "rm -f /boot/vmlinuz-$KERNELRELEASE /boot/System.map-$KERNELRELEASE"
|
2016-02-26 22:15:17 +07:00
|
|
|
echo "/sbin/installkernel $KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm"
|
|
|
|
echo "rm -f /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm"
|
2013-06-24 21:38:22 +07:00
|
|
|
echo "fi"
|
|
|
|
echo ""
|
2016-03-02 21:28:00 +07:00
|
|
|
echo "%preun"
|
|
|
|
echo "if [ -x /sbin/new-kernel-pkg ]; then"
|
|
|
|
echo "new-kernel-pkg --remove $KERNELRELEASE --rminitrd --initrdfile=/boot/initramfs-$KERNELRELEASE.img"
|
|
|
|
echo "fi"
|
|
|
|
echo ""
|
2016-04-07 20:00:54 +07:00
|
|
|
echo "%postun"
|
|
|
|
echo "if [ -x /sbin/update-bootloader ]; then"
|
|
|
|
echo "/sbin/update-bootloader --remove $KERNELRELEASE"
|
|
|
|
echo "fi"
|
|
|
|
echo ""
|
2005-04-17 05:20:36 +07:00
|
|
|
echo "%files"
|
|
|
|
echo '%defattr (-, root, root)'
|
|
|
|
echo "/lib/modules/$KERNELRELEASE"
|
2013-07-09 00:14:06 +07:00
|
|
|
echo "%exclude /lib/modules/$KERNELRELEASE/build"
|
|
|
|
echo "%exclude /lib/modules/$KERNELRELEASE/source"
|
2013-06-24 21:38:28 +07:00
|
|
|
echo "/lib/firmware/$KERNELRELEASE"
|
2005-04-17 05:20:36 +07:00
|
|
|
echo "/boot/*"
|
|
|
|
echo ""
|
2011-05-18 00:36:16 +07:00
|
|
|
echo "%files headers"
|
|
|
|
echo '%defattr (-, root, root)'
|
|
|
|
echo "/usr/include"
|
|
|
|
echo ""
|
2014-12-04 22:53:13 +07:00
|
|
|
if ! $PREBUILT; then
|
2013-07-09 00:14:06 +07:00
|
|
|
echo "%files devel"
|
|
|
|
echo '%defattr (-, root, root)'
|
|
|
|
echo "/usr/src/kernels/$KERNELRELEASE"
|
|
|
|
echo "/lib/modules/$KERNELRELEASE/build"
|
|
|
|
echo "/lib/modules/$KERNELRELEASE/source"
|
|
|
|
echo ""
|
2014-12-04 22:53:13 +07:00
|
|
|
fi
|