From Developer Community
Overview
When requesting KMPs through the Driver Process Build Service, partners should provide source rpms that have been tested to build correctly on the target platform. This document provides information on how to build a kernel module source rpm.
Partners who plan to build their own driver kits and KMPs also should employ the following steps to ensure that they build KMPs which will function correctly on SLES platforms.
Definitions
Please see Driver Process Terminology.
Rationale - "Why does Novell need a source rpm to create a KMP?"
When receiving a KMP build request from a partner, Novell needs to ensure that the source provided with the request will build successfully in Novell's build system, and that the build will create a binary rpm which functions as the partner expects. A source rpm is fully structured so that Novell Partner Engineers can be certain that they are building the correct source code and that the final binary will install in a way that the partner wishes and has tested. Although Novell has worked with KMP build requests where the source code is provided as a tarball or in another format, providing a source rpm significantly reduces problems or communication difficulties w/ regards to the request.
How to Create a Kernel Module Source RPM for Code 9 (SLES 9, OES 1, NLD 9)
Preparing the Build System
- Using YaST->"Software Management", install the kernel-source and kernel-syms packages. These packages provide the kernel build environment.
- Using YaST->"Software Management", install the build package, which contains the SUSE build tool. Note that the build package is contained in the SLES9 SDK, therefore you will need to set up an installation source to the SLES 9 SDK in order for YaST to see the build package.
Building the KMP and Source RPM
The Novell Linux University for Developers demonstrates the following steps in a visual introduction to kmp building.
- Create a staging directory on your local system.
- In your staging directory, create a driver source directory named <vendor>-<driver>-<version>. (Example: novell-sampledriver-1.0)
- In your source directory, place all your driver source code (*.c and *.h files) and a "Kbuild" file. The "Kbuild" file serves as the Makefile; information on how to create a Kbuild file is contained in the document /usr/src/linux/Documentation/kbuild/modules.txt. A sample Kbuild file is contained in the /usr/share/doc/packages/kernel-source/novell-kmp/novell-example-1.1.tar.bz2 file.
- In your staging directory, create a compressed tar file containing your driver source directory and all its contents. Name this compressed tar file "<vendor>-<driver>-<version>.tar.gz" (or "<vendor>-<driver>-<version>.tar.bz2"). A sample compressed tar file is /usr/share/doc/packages/kernel-source/novell-kmp/novell-example-1.1.tar.bz2.
- In your staging directory, create a <vendor>-<driver>.spec file as detailed in Kernel Module Packages Manual for CODE 9. A sample spec file is /usr/share/doc/packages/kernel-source/novell-kmp/novell-example.spec.
- From within your staging directory, build your source and binary rpms by using the "build" command. Use "man build" for more information on options to the "build" command. Ensure that the build completes successfully.
- The build process will place your binary rpm in the /var/rpm/build-root/usr/src/packages/RPMS directory. Install this binary on a test system and ensure that it functions as expected.
- The build process will place your source rpm in the /var/rpm/build-root/usr/src/packages/SRPMS directory.
How to Create a Kernel Module Source RPM for Code 10 (SLES 10, SLED 10, OES 2)
Preparing the Build System
- Using YaST->"Software Management", install the kernel-source and kernel-syms packages. These packages provide the kernel build environment.
- Using YaST->"Software Management", install the build package, which contains the SUSE "build" command. Note that the build package is contained on the SLES10 SDK, therefore you will need to have an installation source pointing to the SDK in order for YaST->"Software Management" to see the build package.
Building the KMP and Source RPM
The Novell Linux University for Developers demonstrates the following steps in a visual introduction to kmp building.
- Create a staging directory on your local system.
- In your staging directory, create a driver source directory named <vendor>-<driver>-<version>. (Example: novell-sampledriver-1.0)
- In your source directory, place all your driver source code (*.c and *.h files) and a "Kbuild" file. The "Kbuild" file serves as the Makefile; information on how to create a Kbuild file is contained in the document /usr/src/linux/Documentation/kbuild/modules.txt. A sample Kbuild file is contained in the /usr/share/doc/packages/kernel-source/novell-kmp/novell-example-1.1.tar.bz2 file.
- In your staging directory, create a compressed tar file containing your driver source directory and all its contents. Name this compressed tar file "<vendor>-<driver>-<version>.tar.gz" (or "<vendor>-<driver>-<version>.tar.bz2"). A sample compressed tar file is /usr/share/doc/packages/kernel-source/novell-kmp/novell-example-1.1.tar.bz2.
- In your staging directory, create a <vendor>-<driver>.spec file as detailed in Kernel Module Packages Manual for CODE 10. A sample spec file is /usr/share/doc/packages/kernel-source/novell-kmp/novell-example.spec.
- From within your staging directory, build your source and binary rpms by using the "build" command. Use "man build" for more information on options to the "build" command. Ensure that the build completes successfully.
- The build process will place your binary rpm in the /var/rpm/build-root/usr/src/packages/RPMS directory. Install this binary on a test system and ensure that it functions as expected.
- The build process will place your source rpm in the /var/rpm/build-root/usr/src/packages/SRPMS directory.