# Spec file for xfs linux-2.6 kernel modules %define module_name xfs # Make a kernel-modules-xfs-source package to go with kernel-source? # XXX ERS maybe a -devel package makes more sense for RH %define build_source_pkg 0 # Work out kernel uname, version, release, type, etc for provides/requires %define kernel_uname %(grep -s UTS_RELEASE %{kernel_topdir}/include/linux/version.h | awk '{print $3}' | sed s/\\"//g) # kernel_type is everything else at the end of the uname %define kernel_type %(echo %{kernel_uname} | grep -o "default$\\|smp$\\|bigsmp$\\|bigmem$\\|debug$\\|hugemem$\\|largesmp$\\|sn2$") # kernel_type, IF it exists, has leading "-" in the kernel rpm name %define rpm_kernel_type %(test ! -z "%{kernel_type}" && echo -%{kernel_type}) %define kernel_ver %(echo %{kernel_uname} | awk -F - '{print $1}') %define kernel_rel %(echo %{kernel_uname} | awk -F - '{print $2}' | sed -e "s/%{kernel_type}$//") Summary : XFS filesystem kernel modules Name : kernel-module-%{module_name}-%{kernel_uname} Version : 0.1 Release : 1 Vendor : Silicon Graphics, Inc. Packager : Silicon Graphics, Inc. License : GPL Group : System Environment/Kernel URL : http://oss.sgi.com/projects/xfs BuildRoot : %{_tmppath}/%{name}-%{version}-%{release}-buildroot Provides : kernel-module Provides : kernel-module-%{module_name} = %{version}-%{release} Requires : kernel%{rpm_kernel_type} = %{kernel_ver}-%{kernel_rel} Requires : /sbin/depmod # different name here Source0 : %{module_name}-kern.tar.gz Source1 : config.xfs # Allow the code to build as an out-of-tree module Patch0 : %{module_name}_ootbuild.patch # This patchset is for making the xfs codebase in sles9 work # with an RHEL4 kernel. Patch1 : xfs_qsort.patch Patch2 : xfs_proc_args.patch Patch3 : xfs_export_ops.patch Patch4 : xfs_write_inode_return.patch Patch5 : xfs_dmapi_address_space.patch Patch6 : xfs_direct_io_locking.patch # suppress debuginfo packages for now %define debug_package %{nil} %description The XFS(tm) Filesystem from Silicon Graphics, Inc. XFS is a highly scalable, high-performance journaling filesystem that provides rapid recovery from system crashes. %if %{build_source_pkg} %package -n kernel-module-%{module_name}-%{kernel_ver}-%{kernel_rel}-source Summary : The source code for the XFS filesystem kernel module. Group : Development/System Requires : kernel-source = %{kernel_ver}-%{kernel_rel} %description -n kernel-module-%{module_name}-%{kernel_ver}-%{kernel_rel}-source The %{module_name}-modules-source package contains the source code files for the XFS filesystem. When installed, this will populate the fs/%{module_name} subdirectory of the matching kernel-source RPM. %endif %prep %setup -n %{module_name} %patch0 -p1 %patch1 -p1 %patch2 -p1 %patch3 -p1 %patch4 -p1 %patch5 -p1 %patch6 -p1 cp %{SOURCE1} . %build make TOPDIR=%{kernel_topdir} modules %install make TOPDIR=%{kernel_topdir} DMAPI_TOPDIR=%{dmapi_topdir} INSTALL_MOD_PATH=$RPM_BUILD_ROOT modules_install # Make clean & copy files over for source package %if %{build_source_pkg} make TOPDIR=%{kernel_topdir} clean mkdir -p $RPM_BUILD_ROOT/usr/src/linux-%{kernel_ver}-%{kernel_rel}/fs/%{module_name} cp -aR * $RPM_BUILD_ROOT/usr/src/linux-%{kernel_ver}-%{kernel_rel}/fs/%{module_name} %endif %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT ] %files %defattr(644,root,root,755) /lib/modules/%{kernel_uname}/extra %if %{build_source_pkg} %ifarch i386 ia64 x86_64 %files -n kernel-module-%{module_name}-%{kernel_ver}-%{kernel_rel}-source %defattr(644,root,root,755) /usr/src/linux-%{kernel_ver}-%{kernel_rel}/fs/%{module_name} %endif %endif # Note, this mkinitrd command is unique to RH I believe %post if [ -e /boot/System.map-%{kernel_uname} ]; then /sbin/depmod -ae -F /boot/System.map-%{kernel_uname} %{kernel_uname} fi if (stat -f / | grep -q 0x58465342) || (stat -f / | grep -q XFS); then echo "It appears that your root filesytem is on XFS." echo "Creating a new initrd /boot/initrd-%{kernel_uname}.img" echo "for kernel %{kernel_uname} with command:" echo " /sbin/mkinitrd -f /boot/initrd-%{kernel_uname}.img %{kernel_uname}" echo "If you use lilo, you should re-run the lilo command." /sbin/mkinitrd -f /boot/initrd-%{kernel_uname}.img %{kernel_uname} fi echo "#################################################################" echo "# #" echo "# NOTICE #" echo "# This xfs module rpm has been provided for testing purposes #" echo "# only. It is believed to be functional, but it has not been #" echo "# heavily tested. In particular, you may have issues with the #" echo "# 4KSTACKS option on RHEL4 ia32 kernels, depending on your IO #" echo "# hardware, layering, nfs usage, etc. #" echo "# #" echo "# Please do NOT report any problems with this module, or with #" echo "# the kernel when this module is loaded, to Red Hat. #" echo "# You may report issues to the linux-xfs@oss.sgi.com list. #" echo "# (Please also report successes!) #" echo "# #" echo "#################################################################" # Could do an "are you sure? y/n" thing but that might get annoying. %preun if (stat -f / | grep -q 0x58465342) || (stat -f / | grep -q XFS); then echo "It appears that your root filesystem is on XFS." echo "Note that kernel %{kernel_uname} might not" echo "boot without this package." fi %postun if [ -e /boot/System.map-%{kernel_uname} ]; then /sbin/depmod -ae -F /boot/System.map-%{kernel_uname} %{kernel_uname} fi