Skip to contentSkip to conversation

Adapted specfile to make kernel-module-xfs rpm build for a RHEL4 largesmp kernel

DISCUSSION Mirjam van den Hout - van Vroonhoven 2 participants 2 messages May 20, 2008

lore
Share & tools
lore
#0 lore raw

Hello XFS team,

In order to make XFS work on Redhat Enterprise Linux 4, using the stock RH largesmp kernel (our server has 16 CPU's) I had to adapt the spec file for the kernel-module-xfs source rpm you offer for download at ftp://oss.sgi.com/projects/xfs/download/testing/RHEL4/kernel-module-xfs-2.6.9-22.EL-0.1-1.src.rpm

The issue is that largesmp was not recognized as a kernel type, and with the original specfile an RPM was build with a dependency "requires kernel-smp = 2.6.9-67.0.1.ELlarge" where the dependency should have been "requires kernel-largesmp = 2.6.9-67.0.1".

The fix was to add "largesmp" to the list of defined kernel_type at the top of the .spec file. I also fixed a typo in this list (default instead of deault). The new fixed spec file (kernel-module-xfs.spec), the original spec file (kernel-module-xfs.spec.orig) and a diff between the two (kernel-module-xfs.spec.patch are attached to this email.

For other users, it might be useful to include this in the next release.

Kind regards,

Mirjam van den Hout

Signature · 6 lines
Dr. Mirjam van den Hout - van Vroonhoven
	system administrator/programmer, dept. of Bioinformatics
	Erasmus Medical Center, Rotterdam, The Netherlands
	Room Number Ee 15.32, phone +31-10-703 81 11
Web: 	http://www.erasmusmc.nl/bioinformatics/
E-mail: [email protected]

# 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 [email protected] 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

# 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 "deault$\\|smp$\\|bigsmp$\\|bigmem$\\|debug$\\|hugemem$\\|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 [email protected] 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

14c14
< %define kernel_type %(echo %{kernel_uname} | grep -o "deault$\\|smp$\\|bigsmp$\\|bigmem$\\|debug$\\|hugemem$\\|sn2$")
---

Quoted 1 line

%define kernel_type %(echo %{kernel_uname} | grep -o "default$\\|smp$\\|bigsmp$\\|bigmem$\\|debug$\\|hugemem$\\|largesmp$\\|sn2$")

#1 lore raw
Quoted 12 lines · Mirjam van den Hout - van Vroonhoven

Hello XFS team,

In order to make XFS work on Redhat Enterprise Linux 4, using the stock
RH largesmp kernel (our server has 16 CPU's) I had to adapt the spec
file for the kernel-module-xfs source rpm you offer for download at ftp://oss.sgi.com/projects/xfs/download/testing/RHEL4/kernel-module-xfs-2.6.9-22.EL-0.1-1.src.rpm

The issue is that largesmp was not recognized as a kernel type, and with the original specfile an RPM was build with a dependency "requires kernel-smp = 2.6.9-67.0.1.ELlarge" where the dependency should have been "requires kernel-largesmp = 2.6.9-67.0.1".

Quoted 7 lines

The fix was to add "largesmp" to the list of defined kernel_type at the top of the .spec file. I also fixed a typo in this list (default instead of deault). The new fixed spec file (kernel-module-xfs.spec), the original spec file (kernel-module-xfs.spec.orig) and a diff between the two (kernel-module-xfs.spec.patch are attached to this email.

For other users, it might be useful to include this in the next release.

SGI doesn't really maintain those; the xfs kernel modules in the centosplus repository
(http://mirror.centos.org/centos/4/centosplus/Readme.txt) are probably a better place to start, as they have some active users and a bit of maintenance.

(IMHO a fair amount of stuff on the xfs ftp site is so outdated it should be removed....)

-Eric

Quoted 5 lines

Kind regards,

Mirjam van den Hout