Skip to contentSkip to conversation

enable building as SUSE KMP

PATCH New Jeff Mahoney 2 participants 4 messages Apr 16, 2007 – May 3, 2007 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 enable building as SUSE KMP

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Starting with SLE 10 and openSUSE 10.2, the "right" way of building kernel modules for SUSE Linux systems is via the kernel module package (KMP) mechanism.

This automates much of what the scripts and specfiles do now in a standard manner, building kernel modules for every installed kernel for which source can be found.

The attached patch changes the definition of "sles9" to mean "any release starting with sles9 that doesn't support building KMPs. The only difference between the sles9 and suse-kmp vendor.guess is the logic on what to do if the suse_kernel_module_package macro is found or not. SLES10 systems included the macro with the rpm package. Later versions include the macro as part of the kernel-source package.

With the KMP infrastructure, if allowed, 'make packages' should work without even running configure since it runs configure for each kernel it builds against.

This patch applies after the previous ones.

- -Jeff

diff -ruNp ocfs2-1.2.5.staging/configure.in ocfs2-1.2.5.devel/configure.in
- --- ocfs2-1.2.5.staging/configure.in 2007-04-16 13:10:02.715354028 -0400
+++ ocfs2-1.2.5.devel/configure.in 2007-04-16 12:56:51.301364243 -0400
@@ -292,4 +292,5 @@ vendor/ax2/ocfs2.spec-generic
vendor/rhel4/ocfs2.spec-generic
vendor/sles9/ocfs2.spec-generic
vendor/rhel5/ocfs2.spec-generic
+vendor/suse-kmp/ocfs2.spec-generic
])
diff -ruNp ocfs2-1.2.5.staging/vendor/Makefile ocfs2-1.2.5.devel/vendor/Makefile
- --- ocfs2-1.2.5.staging/vendor/Makefile 2007-03-27 15:54:15.000000000 -0400
+++ ocfs2-1.2.5.devel/vendor/Makefile 2007-04-15 19:20:08.000000000 -0400
@@ -2,6 +2,6 @@ TOPDIR = ..

include $(TOPDIR)/Preamble.make

- -SUBDIRS = ax2 rhel4 sles9 rhel5
+SUBDIRS = ax2 rhel4 sles9 rhel5 suse-kmp

include $(TOPDIR)/Postamble.make
diff -ruNp ocfs2-1.2.5.staging/vendor/sles9/vendor.guess ocfs2-1.2.5.devel/vendor/sles9/vendor.guess
- --- ocfs2-1.2.5.staging/vendor/sles9/vendor.guess 2007-03-27 15:54:15.000000000 -0400
+++ ocfs2-1.2.5.devel/vendor/sles9/vendor.guess 2007-04-15 19:19:35.000000000 -0400
@@ -1,13 +1,22 @@
#!/bin/sh

+# Test whether we can use kernel module packages or not +
if [ ! -f /etc/SuSE-release ]
then
exit 1
fi

- -if [ "rpm -qf /etc/SuSE-release --qf '%{VERSION}' 2>/dev/null" != "9" ] +SUSE_RELEASE="rpm -qf /etc/SuSE-release --qf "%{VERSION}" 2> /dev/null" +
+if [ "$SUSE_RELEASE" -lt 9 ]; then
+ exit 1
+fi
+
+HAS_KMP="rpm --showrc | grep suse_kernel_module_package 2> /dev/null" +if [ -n "$HAS_KMP" ]
then
- - exit 1
+ exit 1
fi

exit 0
diff -ruNp ocfs2-1.2.5.staging/vendor/suse-kmp/Makefile ocfs2-1.2.5.devel/vendor/suse-kmp/Makefile
- --- ocfs2-1.2.5.staging/vendor/suse-kmp/Makefile 1969-12-31 19:00:00.000000000 -0500
+++ ocfs2-1.2.5.devel/vendor/suse-kmp/Makefile 2007-04-15 18:26:44.000000000 -0400
@@ -0,0 +1,11 @@
+TOPDIR = ../..
+
+include $(TOPDIR)/Preamble.make
+
+DIST_FILES = \
+ ocfs2.spec-generic.in \
+ rpmarch.guess \
+ Vendor.make \
+ vendor.guess
+
+include $(TOPDIR)/Postamble.make
diff -ruNp ocfs2-1.2.5.staging/vendor/suse-kmp/ocfs2.spec-generic.in ocfs2-1.2.5.devel/vendor/suse-kmp/ocfs2.spec-generic.in
- --- ocfs2-1.2.5.staging/vendor/suse-kmp/ocfs2.spec-generic.in 1969-12-31 19:00:00.000000000 -0500
+++ ocfs2-1.2.5.devel/vendor/suse-kmp/ocfs2.spec-generic.in 2007-04-15 18:31:07.000000000 -0400
@@ -0,0 +1,57 @@
+Summary: The Oracle Cluster Filesystem 2 (ocfs2)
+Name: ocfs2
+Version: @DIST_VERSION@
+Release: @@PKG_VERSION@@
+License: GPL
+Group: System/Kernel
+Source: ocfs2-%{version}.tar.gz
+URL: http://oss.oracle.com/projects/ocfs2/
+Distribution: Oracle
+Vendor: Oracle
+Packager: Joel Becker <[email protected]>
+Provides: ocfs2 = %{version}
+AutoReqProv: no
+Requires: ocfs2-tools >= %{tools_ver}
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+%suse_kernel_module_package -n ocfs2
+
+%description
+The Oracle Cluster Filesystem 2 (ocfs2) kernel modules.
+
+%package KMP
+Summary: The Oracle Cluster Filesystem 2 (ocfs2)
+Group: System/Kernel
+
+%description KMP
+The Oracle Cluster Filesystem 2 (ocfs2) kernel modules.
+
+%prep
+%setup
+set -- *
+mkdir source
+mv "$@" source/
+mkdir obj
+
+%build
+for flavor in %flavors_to_build; do
+ rm -rf obj/$flavor
+ cp -r source obj/$flavor
+ cd obj/$flavor
+ ./configure --with-kernel-source=/usr/src/linux --with-kernel=/usr/src/linux-obj/%_target_cpu/$flavor
+ make
+ cd ../..
+done
+
+%install
+export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
+export INSTALL_MOD_DIR=updates
+for flavor in %flavors_to_build; do
+ (cd obj/$flavor ; make install)
+done
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%changelog
+* Fri Apr 13 2007 - [email protected]
+- Initial version to use SUSE KMP infrastructure
diff -ruNp ocfs2-1.2.5.staging/vendor/suse-kmp/rpmarch.guess ocfs2-1.2.5.devel/vendor/suse-kmp/rpmarch.guess
- --- ocfs2-1.2.5.staging/vendor/suse-kmp/rpmarch.guess 1969-12-31 19:00:00.000000000 -0500
+++ ocfs2-1.2.5.devel/vendor/suse-kmp/rpmarch.guess 2007-04-13 13:05:42.000000000 -0400
@@ -0,0 +1,70 @@
+#! /bin/sh
+
+mode="$1"
+srcdir="$2"
+
+host_cpu=
+
+QUERYFILE=/etc/SuSE-release
+
+if test -n "$QUERYFILE"; then
+ host_cpu="rpm -qf $QUERYFILE --queryformat \"%{ARCH}\""
+fi
+
+if test -z "$host_cpu" -o "$host_cpu" = "noarch" ; then

+  host_alias=`$srcdir/config.guess`
+  host=`$srcdir/config.sub $host_alias`
+  host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`

+fi
+
+case "$host_cpu" in
+ x86_64|ia64|s390x)
+ TOOLSARCH="$host_cpu"
+ ;;
+ i386|i486|i586|i686|i786|k6|k7)
+ TOOLSARCH="i386"
+ ;;
+ ppc|ppc64|ppciseries|ppcpseries|ppc64iseries|ppc64pseries|powerpc|powerpc64)
+ TOOLSARCH="ppc64"
+ ;;
+ *)

+    echo "rpmarch.guess: Warning: unknown RPM CPU architecture: $host_cpu" >&2
+    TOOLSARCH=""
+    ;;

+esac
+
+# Only a few of these need to be overwritten from RPM's default +case "$host_cpu" in
+ i586)
+ MODULEARCH="$host_cpu"
+ ;;
+ i386|i686)
+ MODULEARCH="i586"
+ ;;
+ ppc|ppc64|ppciseries|ppcpseries|ppc64iseries|ppc64pseries|powerpc|powerpc64)
+ MODULEARCH="ppc64"
+ ;;
+ *)
+ MODULEARCH=""
+ ;;
+esac
+
+case "$mode" in
+ module)
+ if [ -n "$MODULEARCH" ] ; then
+ echo "--target $MODULEARCH"
+ fi
+ ;;
+ tools)
+ if [ -n "$TOOLSARCH" ] ; then
+ echo "--target $TOOLSARCH"
+ fi
+ ;;
+ *)

+    echo "rpmarch.guess: Invalid mode: $mode" >&2
+    echo "error"
+    exit 1
+    ;;

+esac
+
+exit 0
diff -ruNp ocfs2-1.2.5.staging/vendor/suse-kmp/vendor.guess ocfs2-1.2.5.devel/vendor/suse-kmp/vendor.guess
- --- ocfs2-1.2.5.staging/vendor/suse-kmp/vendor.guess 1969-12-31 19:00:00.000000000 -0500
+++ ocfs2-1.2.5.devel/vendor/suse-kmp/vendor.guess 2007-04-15 19:19:46.000000000 -0400
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# Test whether we can use kernel module packages or not
+
+if [ ! -f /etc/SuSE-release ]
+then
+ exit 1
+fi
+
+SUSE_RELEASE="rpm -qf /etc/SuSE-release --qf "%{VERSION}" 2> /dev/null"
+
+if [ "$SUSE_RELEASE" -lt 9 ]; then
+ exit 1
+fi
+
+HAS_KMP="rpm --showrc | grep suse_kernel_module_package 2> /dev/null"
+if [ -z "$HAS_KMP" ]
+then
+ exit 1
+fi
+
+exit 0
diff -ruNp ocfs2-1.2.5.staging/vendor/suse-kmp/Vendor.make ocfs2-1.2.5.devel/vendor/suse-kmp/Vendor.make
- --- ocfs2-1.2.5.staging/vendor/suse-kmp/Vendor.make 1969-12-31 19:00:00.000000000 -0500
+++ ocfs2-1.2.5.devel/vendor/suse-kmp/Vendor.make 2007-04-15 18:32:06.000000000 -0400
@@ -0,0 +1,21 @@
+#
+# SUSE KMPs (SLE10+, 10.2+)
+#
+
+TOOLSARCH = $(shell $(TOPDIR)/vendor/suse-kmp/rpmarch.guess tools $(TOPDIR))
+MODULEARCH = $(shell $(TOPDIR)/vendor/suse-kmp/rpmarch.guess module $(TOPDIR))
+
+
+$(TOPDIR)/vendor/suse-kmp/ocfs2.spec: $(TOPDIR)/vendor/suse-kmp/ocfs2.spec-generic
+ SPECVER="$@"; \
+ SPECVER="$${SPECVER#*ocfs2-}"; \
+ SPECVER="$${SPECVER%.spec}"; \
+ sed -e 's/@DIST_VERSION@/'$(DIST_VERSION)'/' -e 's/@@PKG_VERSION@@/'$(PKG_VERSION)'/' < $< > $@
+
+srpm: dist $(TOPDIR)/vendor/suse-kmp/ocfs2.spec
+ rpmbuild -bs --define "_sourcedir $(TOPDIR)" --define "_srcrpmdir $(TOPDIR)" $(TOPDIR)/vendor/suse-kmp/ocfs2.spec
+
+rpms: srpm
+ rpmbuild --rebuild $(MODULEARCH) ocfs2-$(DIST_VERSION)-$(PKG_VERSION).src.rpm
+
+packages: rpms

- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFGI7sbLPWxlyuTD7IRAhkpAKCThFUYdddY/14hK0pOeWJmQ1xA8QCfYJUC WMfXXc/bzpIEK+t2jvPVX/k=
=zT06
-----END PGP SIGNATURE-----

#1 lore raw

PATCH 1/1 enable building as SUSE KMP

Quoted 6 lines · Jeff Mahoney

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Starting with SLE 10 and openSUSE 10.2, the "right" way of building kernel modules for SUSE Linux systems is via the kernel module package (KMP) mechanism.

Slickness. Do all SLES10 versions, including GA, support this?
I hope so, it means we never have to create vendor/sles10.

Quoted 2 lines

With the KMP infrastructure, if allowed, 'make packages' should work without even running configure since it runs configure for each kernel it builds against.

You still need to run configure in the outer tree, because that
is what substitutes @VERSION@ etc. That's all it does, however. The vendor trees, as you probably have noted, are designed to run "make packages" on any system, regardless of where configure was run.

Joel

Signature · 8 lines
"Here's a nickle -- get yourself a better X server."
	- Keith Packard

Joel Becker
Principal Software Developer
Oracle
E-mail: [email protected]
Phone: (650) 506-8127
#2 lore raw

PATCH 1/1 enable building as SUSE KMP

In reply to Jeff Mahoney
Quoted 3 lines · Jeff Mahoney

With the KMP infrastructure, if allowed, 'make packages' should work without even running configure since it runs configure for each kernel it builds against.

Jeff,
I get this when running on a vanilla SLES10 system:

# make packages
<snipped tar output>
rpmbuild -bs --define "_sourcedir ." --define "_srcrpmdir ."
./vendor/suse-kmp/ocfs2.spec
ln: creating symbolic link `arch/um/Kconfig.arch' to
`/usr/src/linux-2.6.16.21-0.8/arch/um/Kconfig.i386': Permission denied
error: Unable to open temp file.
*** glibc detected *** rpmbuild: free(): invalid pointer: 0xb7efa630 ***
======= Backtrace: =========
/lib/libc.so.6[0xb7b50911]
/lib/libc.so.6(__libc_free+0x84)[0xb7b51f84]
/usr/lib/librpmbuild-4.4.so(writeRPM+0x34a)[0xb7eb707a]
/usr/lib/librpmbuild-4.4.so(packageSources+0x1c1)[0xb7eb8091]
/usr/lib/librpmbuild-4.4.so(buildSpec+0x379)[0xb7eaf139]
rpmbuild[0x804a81e]
rpmbuild[0x804ab3b]
rpmbuild[0x804b923]
/lib/libc.so.6(__libc_start_main+0xdc)[0xb7b0287c]
rpmbuild[0x8049db1]
======= Memory map: ========
08048000-0804d000 r-xp 00000000 08:06 851112     /usr/lib/rpm/rpmb
0804d000-0804e000 rw-p 00004000 08:06 851112     /usr/lib/rpm/rpmb
0804e000-0809e000 rw-p 0804e000 00:00 0          [heap]
b78f5000-b78ff000 r-xp 00000000 08:06 277497     /lib/libgcc_s.so.1
b78ff000-b7900000 rw-p 00009000 08:06 277497     /lib/libgcc_s.so.1
b7900000-b7921000 rw-p b7900000 00:00 0 
b7921000-b7a00000 ---p b7921000 00:00 0 
b7a13000-b7a48000 r--s 00000000 08:06 786650     /var/run/nscd/db4iXNfB
(deleted)
b7a48000-b7a7d000 r--s 00000000 08:06 786649     /var/run/nscd/group
b7a7d000-b7ab2000 r--s 00000000 08:06 786648     /var/run/nscd/passwd
b7ab4000-b7ae7000 r--p 00000000 08:06 685680
/usr/lib/locale/en_US.utf8/LC_CTYPE
b7ae7000-b7ae8000 r--p 00000000 08:06 685673
/usr/lib/locale/en_US.utf8/LC_NUMERIC
b7ae8000-b7ae9000 r--p 00000000 08:06 656068
/usr/lib/locale/en_US.utf8/LC_TIME
b7ae9000-b7aea000 r--p 00000000 08:06 656067
/usr/lib/locale/en_US.utf8/LC_MONETARY
b7aea000-b7aeb000 r--p 00000000 08:06 669744
/usr/lib/locale/en_US.utf8/LC_MESSAGES/SYS_LC_MESSAGES
b7aeb000-b7aec000 r--p 00000000 08:06 685654
/usr/lib/locale/en_US.utf8/LC_PAPER
b7aec000-b7aed000 rw-p b7aec000 00:00 0 
b7aed000-b7c06000 r-xp 00000000 08:06 277459     /lib/libc-2.4.so
b7c06000-b7c08000 r--p 00118000 08:06 277459     /lib/libc-2.4.so
b7c08000-b7c0a000 rw-p 0011a000 08:06 277459     /lib/libc-2.4.so
b7c0a000-b7c0d000 rw-p b7c0a000 00:00 0 
b7c0d000-b7c1d000 r-xp 00000000 08:06 277528     /lib/libbz2.so.1.0.0
b7c1d000-b7c1e000 rw-p 0000f000 08:06 277528     /lib/libbz2.so.1.0.0
b7c1e000-b7c1f000 rw-p b7c1e000 00:00 0 
b7c1f000-b7c30000 r-xp 00000000 08:06 277513     /lib/libz.so.1.2.3
b7c30000-b7c31000 rw-p 00010000 08:06 277513     /lib/libz.so.1.2.3
b7c31000-b7c41000 r-xp 00000000 08:06 277485     /lib/libpthread-2.4.so
b7c41000-b7c43000 rw-p 0000f000 08:06 277485     /lib/libpthread-2.4.so
b7c43000-b7c45000 rw-p b7c43000 00:00 0 
b7c45000-b7c4c000 r-xp 00000000 08:06 277489     /lib/librt-2.4.so
b7c4c000-b7c4e000 rw-p 00006000 08:06 277489     /lib/librt-2.4.so
b7c4e000-b7c50000 r-xp 00000000 08:06 277465     /lib/libdl-2.4.so
b7c50000-b7c52000 rw-p 00001000 08:06 277465     /lib/libdl-2.4.so
b7c52000-b7c75000 r-xp 00000000 08:06 277467     /lib/libm-2.4.so
b7c75000-b7c77000 rw-p 00022000 08:06 277467     /lib/libm-2.4.so
b7c77000-b7c7e000 r-xp 00000000 08:06 626032
/usr/lib/libpopt.so.0.0.0
b7c7e000-b7c7f000 rw-p 00006000 08:06 626032
/usr/lib/libpopt.so.0.0.0
b7c7f000-b7c80000 rw-p b7c7f000 00:00 0 
b7c80000-b7d06000 r-xp 00000000 08:06 440757
/usr/lib/librpmio-4.4.so
b7d06000-b7d0b000 rw-p 00085000 08:06 440757
/usr/lib/librpmio-4.4.so
b7d0b000-b7d2e000 rw-p b7d0b000 00:00 0 
b7d2e000-b7e19000 r-xp 00000000 08:06 440756
/usr/lib/librpmdb-4.4.so
b7e19000-b7e1d000 rw-p 000ea000 08:06 440756
/usr/lib/librpmdb-4.4.so
b7e1d000-b7e73000 r-xp 00000000 08:06 440754     /usr/lib/librpm-4.4.so
b7e73000-b7e76000 rw-p 00055000 08:06 440754     /usr/lib/librpm-4.4.so
b7e76000-b7ea9000 rw-p b7e76000 00:00 0 
b7ea9000-b7ecd000 r-xp 00000000 08:06 440755
/usr/lib/librpmbuild-4.4.so
b7ecd000-b7ecf000 rw-p 00024000 08:06 440755
/usr/lib/librpmbuild-4.4.so
b7ecf000-b7edb000 rw-p b7ecf000 00:00 0 
b7edb000-b7edc000 r--p 00000000 08:06 685647
/usr/lib/locale/en_US.utf8/LC_NAME
b7edc000-b7edd000 r--p 00000000 08:06 656064
/usr/lib/locale/en_US.utf8/LC_ADDRESS
b7edd000-b7ede000 r--p 00000000 08:06 685646
/usr/lib/locale/en_US.utf8/LC_TELEPHONE
b7ede000-b7edf000 r--p 00000000 08:06 685648
/usr/lib/locale/en_US.utf8/LC_MEASUREMENT
b7edf000-b7ee6000 r--s 00000000 08:06 655372
/usr/lib/gconv/gconv-modules.cache
b7ee6000-b7ee7000 r--p 00000000 08:06 656065
/usr/lib/locale/en_US.utf8/LC_IDENTIFICATION
b7ee7000-b7ee8000 rw-p b7ee7000 00:00 0 
b7ee8000-b7f02000 r-xp 00000000 08:06 277452     /lib/ld-2.4.so
b7f02000-b7f04000 rw-p 00019000 08:06 277452     /lib/ld-2.4.so
bfe41000-bfe92000 rw-p bfe41000 00:00 0          [stack]
ffffe000-fffff000 ---p 00000000 00:00 0          [vdso]
make: *** [srpm] Aborted (core dumped)

I have a hunch the "Permission denied" is because I ran as
myself. Do KMP packages have to be built as root?

Joel

Signature · 9 lines
Life's Little Instruction Book #198

	"Feed a stranger's expired parking meter."

Joel Becker
Principal Software Developer
Oracle
E-mail: [email protected]
Phone: (650) 506-8127
#3 lore raw

PATCH 1/1 enable building as SUSE KMP

Quoted 8 lines · Joel Becker
Quoted 3 lines · Jeff Mahoney

With the KMP infrastructure, if allowed, 'make packages' should work without even running configure since it runs configure for each kernel it builds against.

Jeff,
I get this when running on a vanilla SLES10 system:

Quoted 9 lines
# make packages
<snipped tar output>
rpmbuild -bs --define "_sourcedir ." --define "_srcrpmdir ."
./vendor/suse-kmp/ocfs2.spec
ln: creating symbolic link `arch/um/Kconfig.arch' to
`/usr/src/linux-2.6.16.21-0.8/arch/um/Kconfig.i386': Permission denied
error: Unable to open temp file.
*** glibc detected *** rpmbuild: free(): invalid pointer: 0xb7efa630 ***
======= Backtrace: =========

<snip>

Ok, running as root I don't get that problem. However, I do see
this in the um build:

arch/um/include/sysdep/checksum.h: In function ?csum_and_copy_to_user?:
arch/um/include/sysdep/checksum.h:198: error: implicit declaration of function ?access_ok_tt?

Joel

Signature · 8 lines
"Copy from one, it's plagiarism; copy from two, it's research."
        - Wilson Mizner

Joel Becker
Principal Software Developer
Oracle
E-mail: [email protected]
Phone: (650) 506-8127