浏览代码

rpm-pkg: add generation of kernel-devel

Change the spec file to generate a kernel-devel module
allowing for compilation of external kernel modules.

This patch requires a new minimum RPM level of 4.0.3.

Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Mike Marciniszyn 12 年之前
父节点
当前提交
2174d29201
共有 1 个文件被更改,包括 26 次插入2 次删除
  1. 26 2
      scripts/package/mkspec

+ 26 - 2
scripts/package/mkspec

@@ -1,7 +1,7 @@
 #!/bin/sh
 #!/bin/sh
 #
 #
-#	Output a simple RPM spec file that uses no fancy features requiring
-#	RPM v4. This is intended to work with any RPM distro.
+#	Output a simple RPM spec file.
+#	This version assumes a minimum of RPM 4.0.3.
 #
 #
 #	The only gothic bit here is redefining install_post to avoid
 #	The only gothic bit here is redefining install_post to avoid
 #	stripping the symbols from files in the kernel which we want
 #	stripping the symbols from files in the kernel which we want
@@ -59,6 +59,14 @@ echo "header files define structures and constants that are needed for"
 echo "building most standard programs and are also needed for rebuilding the"
 echo "building most standard programs and are also needed for rebuilding the"
 echo "glibc package."
 echo "glibc package."
 echo ""
 echo ""
+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 ""
 
 
 if ! $PREBUILT; then
 if ! $PREBUILT; then
 echo "%prep"
 echo "%prep"
@@ -109,6 +117,14 @@ echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2"
 echo 'mv vmlinux.orig vmlinux'
 echo 'mv vmlinux.orig vmlinux'
 echo "%endif"
 echo "%endif"
 
 
+echo 'rm -f $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/{build,source}"
+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"
+
 echo ""
 echo ""
 echo "%clean"
 echo "%clean"
 echo 'rm -rf $RPM_BUILD_ROOT'
 echo 'rm -rf $RPM_BUILD_ROOT'
@@ -126,6 +142,8 @@ echo "%files"
 echo '%defattr (-, root, root)'
 echo '%defattr (-, root, root)'
 echo "%dir /lib/modules"
 echo "%dir /lib/modules"
 echo "/lib/modules/$KERNELRELEASE"
 echo "/lib/modules/$KERNELRELEASE"
+echo "%exclude /lib/modules/$KERNELRELEASE/build"
+echo "%exclude /lib/modules/$KERNELRELEASE/source"
 echo "/lib/firmware/$KERNELRELEASE"
 echo "/lib/firmware/$KERNELRELEASE"
 echo "/boot/*"
 echo "/boot/*"
 echo ""
 echo ""
@@ -133,3 +151,9 @@ echo "%files headers"
 echo '%defattr (-, root, root)'
 echo '%defattr (-, root, root)'
 echo "/usr/include"
 echo "/usr/include"
 echo ""
 echo ""
+echo "%files devel"
+echo '%defattr (-, root, root)'
+echo "/usr/src/kernels/$KERNELRELEASE"
+echo "/lib/modules/$KERNELRELEASE/build"
+echo "/lib/modules/$KERNELRELEASE/source"
+echo ""